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

# speed(by:duration:)

Creates an action that changes how fast the node executes actions by a relative value.

```
class func speed(by speed: CGFloat, duration: TimeInterval) -> SKAction
```

## Parameters

`speed`

The amount to add to the node’s speed.

`duration`

The duration of the animation.

## Return Value

A new action object.

## Discussion

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

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

```swift
let action = SKAction.speed(by: -speed, 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)