Hi, I’m trying to make an animation for a sprite, which will go on path and it will loop forever. But CardinalSpline doesn’t close up as I thought.
Here are example points (it’s a square):
pointsRed->addControlPoint(Vec2(350, 350));
pointsRed->addControlPoint(Vec2(350, 150));
pointsRed->addControlPoint(Vec2(150, 150));
pointsRed->addControlPoint(Vec2(150, 350));
pointsRed->addControlPoint(Vec2(350, 350));
Animation creation:
auto redSpline = CardinalSplineTo::create(20, pointsRed, 0);
Now it looks like that:
So of course animation doesn’t look too good. I want to make a perfect loop (with constant speed), where cannot be seen where’s an end or start.
If I will continue adding the same points it will loop nice until it reaches the end where’s an breakdown, which you can see on top right corner.
How can I achieve this?