SKAction.rotate not working?

Viewed 402

I'm trying to create a node and animate it's zRotation property with an action, however, when attempting to run the action, the zRotation property of my node is not changed. I'm unsure why this isn't working.

import UIKit
import SpriteKit

let aim = SKSpriteNode()

print(aim.zRotation)
aim.zRotation = CGFloat(Double.pi/2)
print(aim.zRotation)

let myAction = SKAction.rotate(toAngle: CGFloat(3.14), duration: 0)
aim.run(myAction)
print(aim.zRotation)

image of code with output

image of code with output

2 Answers
Related