Created
June 14, 2016 19:57
-
-
Save aapis/170dc5cbbc7fd0612e2745b3a6f7cddd to your computer and use it in GitHub Desktop.
Cross browser vanilla JS animation
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
| function animate(callback, timeout){ | |
| var default_timeout = timeout || 50; // ms | |
| if(window['requestAnimationFrame']){ | |
| window.requestAnimationFrame.call(null, callback); | |
| }else { | |
| window.setTimeout.call(null, callback, default_timeout); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment