I am animating some HTML objects to look like snowflakes falling, but I have some problems in the loop.
Here is my code:
//animation function function snowflakeAnimate(index) { //random numbers //time var nTime = randomRange(9000,35000); var randTime = Math.round(nTime); //delay var nDelay = randomRange(200,35000); var randDelay = Math.round(nDelay); $(this).delay(randDelay).animate({ marginTop: "+600px" }, randTime); }; $(".tweet").each(snowflakeAnimate);
Thus, all he does now is revitalize the snowflakes, increasing the top edge to 600. The delay and animation speed is set by creating a random number. My question is: how do I reset the snowflake on top and then run the animation again so that it never stops falling.
Forxs source share