Graphics Programs Reference
In-Depth Information
Let's take a moment to discuss what we want to have happen by holding a sheet of
paper in your right hand facing you. This will serve as our object.
Rotate the paper counterclockwise 90 degrees about a vertical axis as shown in the
right side of Figure 6.39 so that only the left edge can be seen (in theory). This is
an angle of 0 degrees in terms of Flash angles, while the front is at an angle of 90
degrees. At 0 degrees the horizontal scale factor is 0, while at 90 degrees the horizon-
tal scale factor is 100.
FRONT
FRONT
270°
90°
90°
180°
Figure 6.39 Relationship between scale factor and angle
Now hold the paper facing you in your left hand. We are at 90 degrees and a scale fac-
tor of 100. Rotate the paper clockwise so that only the right edge can be seen as shown
in the left side of Figure 6.39. We are now at 180 degrees, and again the scale factor is
0. Rotate the paper 90 degrees clockwise again and you will see the back of the paper
(or the front reversed with transparent paper). Now we are at an angle of 270 degrees
and the scale factor is -100. This is exactly the behavior we get from a sine function.
The bottom line, then, is that as we rotate the paper, the scale factor is equal to 100
times the sine of the angle. In our 3D program, we can calculate the horizontal scale
factor as a percentage of the distance ratio the way we normally do and then multiply
by the sine of the angle that we are at. A similar analysis leads to the conclusion that
we can multiply the vertical scale factor by the sine of the angle to create an object
spinning vertically.
The file objectSpinning1.fla is an example that lets you use the arrow keys to spin
the object about its own x- or y-axis. The script is basically the same as the script in
6_5_xzRotation3_DONE.fla with the radius set to 1 and provision made for arrow keys.
Let's wrap up by looking at multiple objects spinning as they are going through a circular
Search WWH ::




Custom Search