/ Published in: ActionScript 3
Have a quadratic bezier curve, need to figure out a point along the way. This should work quite well, easy to convert to JavaScript.
Expand |
Embed | Plain Text
public static function quadraticBezierPoint(value:Number, anchor1:Point, anchor2:Point, control:Point):Point { var uc:Number = 1 - value; var posx:Number = Math.pow(uc, 2) * anchor1.x + 2 * uc * value * control.x + Math.pow(value, 2) * anchor2.x; var posy:Number = Math.pow(uc, 2) * anchor1.y + 2 * uc * value * control.y + Math.pow(value, 2) * anchor2.y; return new Point(posx, posy); }
You need to login to post a comment.
