Graphics Programs Reference
In-Depth Information
Tip 3: If you prefer a more free-form rotation of objects about the y-axis, here is a
simple change you can make to 6_5_xzRotation3_DONE.fla . First, comment out line
38, which puts all of the objects on one plane.
36
37
38
39
40
// put it on the circle
thisObj.x = xc + r * Math.cos(a);
// thisObj.y = yc;
thisObj.z = zc + r * Math.sin(a);
Next, set the y-coordinate of the objects to be chosen at random within some range
of values when being created. In the example below, the range of vertical values lies
between -350 and -100. Since the vertical origin yo is set to 0, this range places
the objects conveniently on the screen. Open xzFreeRotation.swf to see the effect
(Figure 6.34).
22
23
24
25
26
27
28
// create the objects for the circular motion
for (var i:Number = 0; i < numberOfObjects; i++)
{
object_mc.duplicateMovieClip("object"+i, i);
this["object"+i].gotoAndStop(i+2);
this["object"+i].y = 250*Math.random() - 350;
}
Figure 6.34 Tip 3 output
 
Search WWH ::




Custom Search