next up previous contents index
Next: Affects Up: Animation Previous: Animation

Rotating an object: Satellite

    The satellite in section 9 is constructed at the origin. To view the satellite from all sides the satellite is rotated in two directions.

  // Add an object to look at.
  the_object = the_satellite();
  LINK(the_scene, PLUS, rotate(Z, X, 720*worldtime,
       rotate(X, Y, 360*worldtime, bind(the_object))));

The satellite rotations demonstrate an animation technique called looping  . Looping is when a number of frames can be played repeatedly without the animation breaking between the last frame and the first frame. To achieve this with n frames the nth frame must be the same as frame 0.

The satellite code is a 1 sec or 25 frame loop. A rotation of 360 degrees places the object back at the starting position. Both the satellite rotations are 0 degrees when worldtime = 0 and a multiple of 360 degrees when worldtime = 1.0. This makes frame 25 and frame 0 the same. (Only frames 0 to 24 should be included in the animation).

Figure 18 shows six frames from the one second animation.

  figure458
Figure 18: Satellite Animation



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998