Skip to content

Instantly share code, notes, and snippets.

@gbatha
Created April 5, 2013 05:39
var playing = true;
//call this function to start the loop
function startRaf(){
rafGo();
}
function rafGo() {
//loop stops when playing is set to false
if(playing){
//be sure to include Paul Irish's rAF shim!
requestAnimationFrame(rafGo);
pjs.draw();
}
}
startRaf();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment