Reputation: 727
The following code will animate a rotation when start() is called and stop the motion when stop() is called.
func start(){
let rotate = SKAction.rotateToAngle(CGFloat(M_PI), duration: 10.0)
something.runAction(SKAction.sequence([rotate]))
}
func stop(){
something.paused = true
// or
// something.removeAllActions()
}
Now, when stop() is called within the animation period (e.g. 5sec into the action in this case), can I get how much the object has rotated at the particular moment, in radian?
I want to know the rotated angle for a given spriteNode between user taps. Is there any other ways to achieve that?
Upvotes: 0
Views: 109
Reputation: 904
All SpriteKit nodes (SKNode) have a zRotation property which tells you this (rotation around the z axis, which is the axis which points into/out of the screen)
Upvotes: 0