]>
Commit | Line | Data |
---|---|---|
00406c26 SW |
1 | <html> |
2 | <head> | |
3 | <title>Medusa</title> | |
4 | <script type="text/javascript" src="nt3d.js"></script> | |
5 | <script type="text/javascript"> | |
3bafa9bd SW |
6 | function medusa(params) { |
7 | var finger_crosssection = nt3d.circle(params.finger_radius, params.finger_faces); | |
00406c26 | 8 | var fingers = []; |
3bafa9bd SW |
9 | for (var ring_num = 0; ring_num < params.num_rings; ring_num++) { |
10 | var ring_radius = params.first_ring_radius + ring_num * params.ring_spacing; | |
11 | for (var finger_num = 0; finger_num < params.num_fingers; finger_num++) { | |
12 | var finger_angle = finger_num / params.num_fingers; | |
88dc31f4 | 13 | var path = []; |
3bafa9bd SW |
14 | for (var finger_point = 0; finger_point <= params.finger_points; finger_point++) { |
15 | var angle = (finger_angle + params.finger_twirl * finger_point / params.finger_points) * 2 * Math.PI; | |
88dc31f4 SW |
16 | var x = ring_radius * Math.cos(angle); |
17 | var y = ring_radius * Math.sin(angle); | |
3bafa9bd | 18 | path.push([x, y, params.finger_height * finger_point / params.finger_points]); |
88dc31f4 SW |
19 | } |
20 | var finger = nt3d.extrude(path, finger_crosssection, [0, 0, 1], nt3d.pathnormals_from_point(path, [0, 0, 0])); | |
21 | fingers = fingers.concat(finger); | |
911d073b | 22 | } |
00406c26 SW |
23 | } |
24 | ||
25 | return fingers; | |
26 | } | |
3bafa9bd SW |
27 | var params = [["first_ring_radius", 20], |
28 | ["num_rings", 10], | |
29 | ["ring_spacing", 10, "Space Between Rings"], | |
30 | ["num_fingers", 5], | |
31 | ["finger_radius", 3], | |
32 | ["finger_faces", 5], | |
33 | ["finger_points", 20], | |
34 | ["finger_twirl", .1, "Finger Twirl (in turns)"], | |
35 | ["finger_height", 100]]; | |
00406c26 SW |
36 | </script> |
37 | </head> | |
38 | <body onload="nt3d.framework(medusa, params)"> | |
39 | <h1>Medusa</h1> | |
40 | <p>An artsy thing.</p> | |
41 | </body> | |
42 | </html> |