Animating Objects
A single render() call draws one still frame. To animate, you call render() over and over using requestAnimationFrame — a browser function that calls your function again right before the next screen repaint, as fast as the screen can handle (usually 60 times a second).
Each time your animate() function runs, change something small — like mesh.rotation.y += 0.01 — before rendering again. Tiny changes, many times a second, look like smooth motion.
Your turn
Open the starter and make the shape rotate on a different axis, or make it spin faster or slower.
- The shape animates continuously
- Changed which axis it rotates on, or its speed
Output shows up here when you Run.
Ask JARVIS for a hint