How to rotate an SKSpriteNode around the node's Y-axis?

后端 未结 4 2045
执笔经年
执笔经年 2020-12-28 20:37

I\'m trying to rotate an SKSpriteNode node around it\'s Y-axis. I know there\'s the zRotation property and that will rotate the node clockwise or counter-clockwise; however,

4条回答
  •  无人及你
    2020-12-28 21:36

    SpriteNode *spriteNode = [SKSpriteNode spriteNodeWithImageNamed@"Sprite"];
    spriteNode.position = position;
    
    SKAction *action = [SKAction repeatActionForever:[SKAction customActionWithDuration:duration actionBlock:^(SKNode *node, CGFloat elapsedTime) {
        node.xScale = sin(2 * M_PI * elapsedTime / duration);
    }]];
    
    [self addChild:spriteNode];
    

    However, the sprite looks like having no thickness.

提交回复
热议问题