<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKAction/rotate(byAngle:duration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKAction(cm)rotateByAngle:duration:"
  },
  "title" : "rotate(byAngle:duration:)"
}
-->

# rotate(byAngle:duration:)

Creates an action that rotates the node by a relative value.

```
class func rotate(byAngle radians: CGFloat, duration: TimeInterval) -> SKAction
```

## Parameters

`radians`

The amount to rotate the node, in radians.

`duration`

The duration of the animation.

## Return Value

A new action object.

## Discussion

When the action executes, the node’s [`zRotation`](/documentation/SpriteKit/SKNode/zRotation) property animates to the new angle.

This action is reversible; the reverse is created as if the following code is executed:

**Swift:**

```swift
let action = SKAction.rotate(byAngle: -radians, duration: sec)
```

**Obj-C:**

```objc
[SKAction rotateByAngle: -radians duration: sec];
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)