Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Basic Orbit With Trig Values  

Download .fla

Actionscript
var radius = 100;
var degrees = 0;
var angle_rate = 1;

onEnterFrame = function(){
angle = degrees * (Math.PI/180);
degrees += angle_rate;

xposition = radius * Math.cos(angle);
yposition = radius * Math.sin(angle);

ball_mc._x = xposition + Stage.width/2;
ball_mc._y = yposition + Stage.height/2;

_root.clear();
_root.lineStyle(1, 0x9966FF, 100);
_root.moveTo(Stage.width/2,Stage.height/2);
_root.lineTo(ball_mc._x, ball_mc._y);

ball_mc.coords = "("+Math.round(xposition)+","+
Math.round(yposition)+") Coordinates";
ball_mc.angle = Math.round(degrees)+" Angle";
rcoords = "Absolute Coordinates (" +Math.round(ball_mc._x)+","+
Math.round(ball_mc._y)+")";
rad = "Radius = "+ radius;
ang = "Angle Rate = "+angle_rate+"dpf";
updateAfterEvent();
}


© 2007 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us