Bezier Implementation


  • Posts: 325
reading OpelFL documents I've found an implementation of Bezier using path.
This feature permit to move an object from point A to point C pass through point B using a smooth curve.

I've trying an implementation in Actor using tween features and tested it without collision and seems has no issue.
It's pretty and can be implemented in a future Stencyl version.

My implementation:
Code: [Select]
public function bezierTo(x:Float, y:Float, checkPointX:Float,checkPointY:Float,strength:Float,duration:Float = 1, easing:Dynamic = null) {
tweenLoc.x = getX(false);
tweenLoc.y = getY(false);

if(easing == null)
easing = Linear.easeNone;

var path = new MotionPath().bezier(x, y, checkPointX, checkPointY ,strength);
Actuate.motionPath(tweenLoc, duration, { x:path.x, y:path.y }, false ).ease(easing).onComplete(onTweenPositionComplete);
Actuate.motionPath use tween inside. This make me confidend about Actor features used in this implementation, like in Actor.moveTo method.

Let me know if you import this feature in Stencyl, so I didn't modify Actor class code to any Stencyl update.
Thanks, David.
Launching RedemptionTCG Android Alpha. If you are interested contact us at


  • *
  • Posts: 1611
Cool ! I'll try this one of these days.


  • *
  • Posts: 1285
great! it got to be implemented