如何绘制渐变虚线圆圈(IOS Game Peak Brain Score Screen)

How to draw a gradient dashed circle like (IOS Game Peak Brain Score Screen)

如何绘制渐变虚线圆圈,例如(IOS Game Peak, Peak Brain Score Screen),从红色到绿色的虚线圆圈。

谢谢。

How to draw a circle of lines 这将对您有所帮助,因为它没有使用 cocos2d 但绘制圆圈的概念是相同的。你可以在 cocos2d.

中使用 ccBezierConfig
    CCProgressNode *rogressNode = [CCProgressNode progressWithSprite:[CCSprite spriteWithImageNamed:@"Sprites/circle.png"]];
    progressNode.type = CCProgressNodeTypeRadial;
    progressNode.position = ccp(160, 220);
    progressNode.percentage = 75;
    progressNode.color = [CCColor colorWithUIColor:[UIColor redColor]];
    [self addChild:progressNode];