May
30
2008
Interpolation of a Point on Quadratic Curve
Posted by: Keith H in ActionScript 3, tags: Curves, Drawing API, Interpolation, QuadraticYou ever wanted an Object to move along the path of a curve?...a curve drawn with the ActionScript drawing API.
The curves drawn using the API are quadratic. Using the following expressions, you can plot an "x" or "y" value on a curve at a time between 0 - 1. You could even plot a "z" value for 3D if you wanted.
var x:Number=Math.pow(1-time,2)*startvalueX+2*(1-time)*time*controlX+Math.pow(time,2)*endvalueX; var y:Number=Math.pow(1-time,2)*startvalueY+2*(1-time)*time*controlY+Math.pow(time,2)*endvalueY;


Entries (RSS)