Make your own free website on Tripod.com

Make a spin wheel
ericlin@ms1.hinet.net


It is easy to make a 3d spin wheel with object on spots. We just create an array of (x,y,z);

A circle is 360 degree; If we want to make 3 biset points, then each point k will at the angle arc of k*360/(countOfSpots) to a startAngle; For example:

angle0=0;

angle=Angle0+k*Math.PI/countOfSpots;

x=100;//arbituray number

y=Math.cos(angle);

z=Math.sin(angle);

When we need update the x,y,z on rotation, we just add an arc to startAngle. For example:Angle0+=(Math.PI/30);

However, I need to extend the point (x,y,z) into 4 corners point in 3d format (x,y,z);

I add a small arc to angle to get point2, and up some height tp get anothte corner points; The height can be calculate by the distance between point1 and point 2; Use 3d equation to get _x,_y for 3D. Then skew the movieClip to 3 corner points.

Now:

var pt1 = new Object();
pt1.x = radius*Math.sin(angle);
pt1.z = radius*Math.cos(angle);
pt1.y = 0;

var ptW = new Object();
ptW.x = radius*Math.sin(angle2);
ptW.z = radius*Math.cos(angle2);
ptW.y = 0;

var ptH = new Object();
ptH.x = pt1.x;
ptH.z = pt1.z;
ptH.y =50;

_root.skewObj(obj, 100, 100, _root.f3dPoint(pt1), _root.f3dPoint(ptH), _root.f3dPoint(ptW));
var depths = int(1000-pt1.z);
obj.swapDepths(depths);