Before we look at the examples, let's do a quick recap of what was shown in Chapter 1, Creating Your First 3D Scene with Three.js on the render loop. To support animations, we need to tell Three.js to render the scene every so often. For this, we use the standard HTML5 requestAnimationFrame functionality, as follows:
render(); function render() { // render the scene renderer.render(scene, camera); // schedule the next rendering using requestAnimationFrame requestAnimationFrame(render); }
With this code, we only need to call the render() function once when we're done initializing the scene. In the  render() function itself, we use requestAnimationFrame to schedule the next rendering. This way, the browser will make sure the render() function is called at the correct interval...