Let's look at an example covering a simple animation technique:
- Open ch05_01_simple-animation.html in your browser:
- Move the camera around (left mouse-click + drag) and see how the objects (sphere and cone) move independently of one another (local transformations) and the camera (global transformation).
- You can also dolly the camera (left mouse-click + Alt + drag).
- Change the camera type to Tracking. If for any reason you lose your bearings, click on Go Home.
- Let's examine the source code to see how we’ve implemented this example. Open ch05_01_simple-animation.html in a code editor.
- Take a look at the render, onFrame, and animate functions. Which timing strategy are we using here?
- The spherePosition and conePosition global variables contain the position of the sphere and the cone, respectively. Scroll up to the draw function...