Graphics Programs Reference
In-Depth Information
placeObj and displayObj as before, the only difference being that the equations of a
circle in the placeObj function are as shown below.
29
30
31
32
33
34
35
36
27
38
39
40
41
// place the object on the path of motion
function placeObj(thisObj,i)
{
// calculate the angle of the object
var myAngle:Number = i * circleAngle + startAngle;
var a:Number = myAngle * Math.PI/180; // in radians
// put it on the circle
thisObj.x = xc;
thisObj.y = yc + r * Math.sin(a);
thisObj.z = zc + r * Math.cos(a);
}
Some minor modifications to the origin and path characteristics are necessary, but they
are basically switching around x- and y-values. To see an example of Exercise 6.4 in
which the rotation is about the x-axis, open yzRotation1.swf in the Chapter 6 folder.
Figure 6.28 shows a sample screen from the movie.
Figure 6.28 Circular rotation in the y-z plane
 
Search WWH ::




Custom Search