Skip to content

Instantly share code, notes, and snippets.

@petercossey
Last active June 1, 2021 08:09
Show Gist options
  • Save petercossey/a3a07baa10c584e54a5e7956958febd3 to your computer and use it in GitHub Desktop.
Save petercossey/a3a07baa10c584e54a5e7956958febd3 to your computer and use it in GitHub Desktop.
Game loop for web browsers using requestAnimationFrame
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