Graphics Programs Reference
In-Depth Information
The next thing needed is the sine function multiplier in the horizontal scale factor to
produce horizontal spinning.
59
60
61
62
63
// set the size based as a percent of distance ratio
thisObj._xscale = thisObj._yscale = 100 * dr;
// addition for horizontal spinning
thisObj._xscale *= Math.sin(a);
The final addition is the inclusion of a little bit of aerial perspective for each object.
Note that a factor of 150 is used instead of the normal 100 to keep the objects that are
farther away from becoming too pale.
64
65
66
// apply aerial perspective to each object
thisObj._alpha = 150 * dr;
One important note is that the objects are included in the file rather than loaded in. The
reason for this is that the registration points for the objects can be placed in the center
of their shapes, which makes changing the scale for spinning a straightforward pro-
cess. When the registration point is in the upper-left corner the expressions for scaling
become more complicated. The reader can refer to the file objectSpinning3.fla to
see what's involved with spinning a single object loaded into an empty movie clip.
Summary
We've covered a fair amount of ground moving and rotating objects in 3D space. The
value of experimenting with the 3D variables is hard to overstate, not to mention a lot
of fun. In the next chapter we'll look at making the viewer or camera an integral part
of a 3D scene.
Key concepts to remember from this chapter include the following:
• Points in 3D space are defined by x-, y-, and z-coordinates measured from
an origin that is the point of intersection of the center of vision with the
picture plane.
• We can convert from 3D coordinates to 2D screen coordinates
 
Search WWH ::




Custom Search