Graphics Programs Reference
In-Depth Information
Tilted Rotation
Figure 6.27 shows that one way of obtaining tilted rotating objects is by moving the
horizontal center of the path away from the horizontal center of vision. Another simple
method is to make a quick modification to the script of
6_5_xzRotation3_DONE.fla
.
Figure 6.29 shows the result, which is saved as
xzRotation3a.fla
. To create the tilt,
a one-line change in the
placeObj()
function is needed and shown below. We simply
make the y
-
component of the object vary in the same way as the x
-
component.
36
37
38
39
40
// put it on the circle
thisObj.x = xc + r * Math.cos(a);
thisObj.y = yc + r * Math.cos(a);
thisObj.z = zc + r * Math.sin(a);
The only other changes made were cosmetic ones to position the path of motion on
the screen. The horizontal center
xc
was increased from 0 to 50 to move the path
to the right. The vertical center
yc
was moved up 30 pixels to raise the path. Finally,
the radius was reduced from 160 to 120 pixels.
Figure 6.29
Tilted circular rotation
Search WWH ::
Custom Search