SKAction按顺时针方向跟随Circle CGPathRef

use*_*855 1 ios sprite-kit

我的SKSpriteNode沿逆时针方向跟随此路径,我如何使它沿顺时针方向跟随路径?

提前致谢!

    CGPathRef circle = CGPathCreateWithEllipseInRect(CGRectMake(0,0,50,50), NULL);

    SKAction *followTrack = [SKAction followPath:circle asOffset:YES orientToPath:YES duration:5.0];

    SKAction *forever = [SKAction repeatActionForever:followTrack];

    [player2 runAction:forever];
Run Code Online (Sandbox Code Playgroud)

Mar*_*n R 7

而不是CGPathCreateWithEllipseInRect(),使用CGPathCreateMutable()CGPathAddArc()创建圆路径并使用clockwise参数来控制方向.

未经测试的代码:

CGMutablePathRef circle = CGPathCreateMutable();
CGPathAddArc(circle, NULL, 25, 25, 25, 0, 2*M_PI, true);
CGPathCloseSubpath(circle);
Run Code Online (Sandbox Code Playgroud)