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

# scaleX(by:y:duration:)

Creates an action that adds relative values to the x and y scale values of a node.

```
class func scaleX(by xScale: CGFloat, y yScale: CGFloat, duration: TimeInterval) -> SKAction
```

## Parameters

`xScale`

The amount to add to the node’s x scale value.

`yScale`

The amount to add to the node’s y scale value.

`duration`

The duration of the animation.

## Return Value

A new action object.

## Discussion

When the action executes, the node’s [`xScale`](/documentation/SpriteKit/SKNode/xScale) and [`yScale`](/documentation/SpriteKit/SKNode/yScale) properties are animated to the new value.

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

**Swift:**

```swift
let action = SKAction.scaleX(by: -scaleX, y: -scaleY, duration: sec)
```

**Obj-C:**

```objc
[SKAction scaleXBy: -xScale y: -yScale 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)