Last active
June 1, 2021 08:09
-
-
Save petercossey/a3a07baa10c584e54a5e7956958febd3 to your computer and use it in GitHub Desktop.
Game loop for web browsers using requestAnimationFrame
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
tick(); // start the game loop. | |
function tick() { | |
requestAnimationFrame(tick); // this will create the loop | |
// add functions/expressions which need to be in the game loop here. | |
} | |
// add game objects + code here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment