Team:UCLA/Template/Javascript
From 2014.igem.org
(Difference between revisions)
Samichaels (Talk | contribs) |
Samichaels (Talk | contribs) |
||
Line 148: | Line 148: | ||
var loop = setInterval(function(){ | var loop = setInterval(function(){ | ||
// change 12 to alter damping higher is slower | // change 12 to alter damping higher is slower | ||
+ | yp += (mouseY - yp) / 12; | ||
+ | follower.css({top:yp}); | ||
+ | |||
+ | }, 30); | ||
+ | </script> | ||
+ | |||
+ | <!--SPIDER--> | ||
+ | <script> | ||
+ | var mouseY = 0; | ||
+ | $(document).mousemove(function(e){ | ||
+ | mouseY = e.pageY; | ||
+ | }); | ||
+ | |||
+ | var follower = $("#follower"); | ||
+ | var yp = 0; | ||
+ | var loop = setInterval(function(){ | ||
+ | |||
yp += (mouseY - yp) / 12; | yp += (mouseY - yp) / 12; | ||
follower.css({top:yp}); | follower.css({top:yp}); |
Revision as of 21:29, 13 August 2014