jona jürgen
jona jürgen

Reputation: 1839

Draw Quad and Cubic Bezier in Cocos2d v3 on IOS

I want to draw a Cubic/Quad Bezier with Cocos2d v3. I looked at CCDrawNode but no change. Does anyone know a way around? Thanks!!

Upvotes: 0

Views: 382

Answers (2)

mityaika07
mityaika07

Reputation: 653

finally, I found the solution: https://github.com/njt1982/CCDrawNode-Bezier

Upvotes: 2

user3457079
user3457079

Reputation: 29

This is how I did it in Cocos2d 3.3:

// blue test
auto bluN = DrawNode::create();
//Draw a blue quadratic bezier curve
Color4F blue(0, 0, 1, 1);
bluN->drawCubicBezier(Vec2(0.0, 0.0), Vec2(_visibleSize.height, 0.0), Vec2(_visibleSize.height, _visibleSize.height), Vec2(0.0,_visibleSize.height), 18, blue);
_hudLayer->addChild(bluN);

This creates a perfect semi-circle (half-circle).

Chris

Upvotes: 0

Related Questions