Created
June 9, 2013 14:14
-
-
Save jswhisperer/5743694 to your computer and use it in GitHub Desktop.
requestAnimationFrame usage
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 globalID; | |
function repeatOften() { | |
$("<div />").appendTo("body"); | |
globalID = requestAnimationFrame(repeatOften); | |
} | |
$("#start").on("click", function() { | |
globalID = requestAnimationFrame(repeatOften); | |
}); | |
$("#stop").on("click", function() { | |
cancelAnimationFrame(globalID); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment