Creates an action that rotates the node by a relative value.
SDKs
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
Framework
- Sprite
Kit
Declaration
class func rotate(byAngle radians: CGFloat, duration: Time Interval) -> SKAction
Parameters
radians
The amount to rotate the node, in radians.
sec
The duration of the animation.
Return Value
A new action object.
Discussion
When the action executes, the node’s z
property animates to the new angle.
This action is reversible; the reverse is created as if the following code is executed:
let action = SKAction.rotate(byAngle: -radians, duration: sec)