Skip to content

Instantly share code, notes, and snippets.

@graphoarty
Created February 21, 2019 19:25
Show Gist options
  • Save graphoarty/8e4b268f490c522ea1a1f9efad1dfc81 to your computer and use it in GitHub Desktop.
Save graphoarty/8e4b268f490c522ea1a1f9efad1dfc81 to your computer and use it in GitHub Desktop.
// Call the animate function
animate();
// The animated function updates the scene
// and updates the controls
function animate() {
// The window.requestAnimationFrame() method tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation before the next repaint. (docs)
requestAnimationFrame(animate);
// Update the controls
controls.update();
// Render the scene
renderer.render(scene, camera);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment