Graphics Programs Reference
In-Depth Information
4
5
6
7
// define the origin xo, yo of the screen coordinates
var xo:Number = Stage.width/2;
var yo:Number = 160 //0;
Save your movie as 6_8_zSineMotion2.fla and test it. You should get results similar
to Figure 6.37.
Figure 6.37 Sinusoidal motion in y and z
Tip: Try using thisObj.y = yc - r * Math.sin(a)/2 in line 38 and yo = 160 in line
6 for a different effect. Save the results as 6_8_zSineMotion3.fla .
Step 5: Create even more motion
Since changing the y - coordinates of the objects to include a sine function produced
such nice results in the previous step, it might seem reasonable to change the sine to
a cosine and see what happens. Modify line 38 to the following. Just to be on the safe
36
37
38
39
40
// put it on the circle
//thisObj.x = xc + r * Math.cos(a);
thisObj.y = yc + r * Math.cos(a)/2;
thisObj.z = zc + r * Math.sin(a);
 
Search WWH ::




Custom Search