]> git.scottworley.com Git - nt3d/blobdiff - medusa.html
Widening
[nt3d] / medusa.html
index d13369236c3f4c19f79fa1798aa0044de0941b4a..d96ec35d47d28a3f1b62295bb88b9e4a5e4a1927 100644 (file)
@@ -7,11 +7,13 @@
         var path = [];
         var twirl_amplitute = Math.cos((ring_num * 2 * Math.PI) / params.finger_twirl_period);
         var twirl_angle = twirl_amplitute * params.finger_twirl_distance / (ring_radius * 2 * Math.PI);
         var path = [];
         var twirl_amplitute = Math.cos((ring_num * 2 * Math.PI) / params.finger_twirl_period);
         var twirl_angle = twirl_amplitute * params.finger_twirl_distance / (ring_radius * 2 * Math.PI);
+        var widen_scale = params.widen_amount / (Math.exp(params.widen_sharpness) - 1);
         for (var finger_point = 0; finger_point <= params.finger_points; finger_point++) {
           var finger_progress = finger_point / params.finger_points;
           var angle = (finger_angle + twirl_angle * finger_progress) * 2 * Math.PI;
         for (var finger_point = 0; finger_point <= params.finger_points; finger_point++) {
           var finger_progress = finger_point / params.finger_points;
           var angle = (finger_angle + twirl_angle * finger_progress) * 2 * Math.PI;
-          var x = ring_radius * Math.cos(angle);
-          var y = ring_radius * Math.sin(angle);
+          var r = ring_radius + widen_scale * Math.exp(finger_progress * params.widen_sharpness);
+          var x = r * Math.cos(angle);
+          var y = r * Math.sin(angle);
           var z = params.finger_height * finger_progress;
           path.push([x, y, z]);
         }
           var z = params.finger_height * finger_progress;
           path.push([x, y, z]);
         }
@@ -40,7 +42,9 @@
                     ["finger_points", 20],
                     ["finger_twirl_distance", 50],
                     ["finger_twirl_period", 2, "Finger Twirl Period (1=same, 2=alternating)"],
                     ["finger_points", 20],
                     ["finger_twirl_distance", 50],
                     ["finger_twirl_period", 2, "Finger Twirl Period (1=same, 2=alternating)"],
-                    ["finger_height", 100]];
+                    ["finger_height", 100],
+                    ["widen_sharpness", 2, "Widen Sharpness (0=disable widening)"],
+                    ["widen_amount", 30]];
     </script>
   </head>
   <body onload="nt3d.framework(medusa, params)">
     </script>
   </head>
   <body onload="nt3d.framework(medusa, params)">