Created
April 5, 2013 05:39
This file contains 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 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