I'm trying to flip a sprite in SpriteKit. it can be done in cocos2d with CCOribitCamera like this:
id firstAction = [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:0 angleZ:0 deltaAngleZ:90 angleX:0 deltaAngleX:0];
id secondAction = [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:0 angleZ:270 deltaAngleZ:90 angleX:0 deltaAngleX:0];
[self runAction: [CCSequence actions:firstAction,
[ImageSwapAction actionWithCard: self],
secondAction, nil]];
Any ideas?
--Added--
Thanks for nickfalk's answer, I figured it out.
[sprite runAction:[SKAction sequence:@[
[SKAction scaleXTo:0 duration:0.2],
[SKAction runBlock:^{
[sprite swapImage];
}],
[SKAction scaleXTo:1 duration:0.2]
]]];
您可以使用节点的xScale属性:
spriteInstance.xScale = -1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.