Common math+physics formulas in Actionscript
Will be adding more as time goes on
Linear Acceleration
Distance Between Two Points
Solving Quadratic Equations
Working With Circle Formulas
var acceleration = 1.05; var velocityX = 2; function loop(e:Event):void{ e.target.x += velocityX = velocityX * acceleration ; } your-movie-clip.addEventListener( Event.ENTER_FRAME , loop );
var point1:Point = new Point( 10, 10 ); var point2:Point = new Point( 30, 200 ); var distance:Number = Math.sqrt( Math.pow((point2.x-point1.x),2) + Math.pow((point2.y-point1.y),2) ); // distance formula: // distance = SquareRoot( (x2-x1)² + (y2-y1)² ); trace(distance); // 191.049731745428
import fl.motion.* var results:Array = BezierSegment.getQuadraticRoots(a, b, c);
// Get Degrees var degrees = angle *180/Math.PI; // Get Radians var radians = degrees * (Math.PI/180); // Get Arc of Circle var arc = radius * degrees * (Math.PI/180); // Get circumference var circ = Math.PI * diameter; // Get area var area = Math.PI * Math.exp( radius, 2 );




