Cocos2d and iOS: Can't understand use of control points using ccBezierConfig

前端 未结 1 1446
借酒劲吻你
借酒劲吻你 2021-01-25 23:29

EDIT: If the question is badly written have a look at the video (3), same link as in the bottom of this page.

I am trying to draw a very simple bezier curve using

相关标签:
1条回答
  • 2021-01-26 00:00

    OK, the answer is rather simple...

    The quadratic Bézier curve is not the one drawn by cocos2d. Instead, check the same wiki page for cubic Bézier curve. That's what you should be looking at.

    1. Initial position is the position of the sprite (P0)
    2. Control points 1 & 2 are P1 & P2, respectively.
    3. End point is the end point.

    Nice video, btw, I enjoyed it xD.


    Evidence from the CCActionInterval.h file in the cocos2d library:

    /** An action that moves the target with a cubic Bezier curve by a certain distance.
     */
    @interface CCBezierBy : CCActionInterval <NSCopying>
    {
        ccBezierConfig config;
        CGPoint startPosition;
    }
    

    This link should help you construct your cubic Bézier curves visually, instead of tweaking the values and running the app.

    0 讨论(0)
提交回复
热议问题