Last active
August 29, 2015 14:22
-
-
Save sikanrong/9dc87359af16b3c2d2d0 to your computer and use it in GitHub Desktop.
javascript animate loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var animate = function(){ | |
| var frameDuration = 1000; //milliseconds | |
| var my = this; | |
| setTimeout(function(){ | |
| //do animate stuff here. Use "my" in place of "this" to access the outer object scope within the setTimeout function, if needed. | |
| animate(); //re-calls itself. | |
| }, frameDuration); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment