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

# resize(toWidth:duration:)

Creates an action that changes the width of a sprite to a new absolute value.

```
class func resize(toWidth width: CGFloat, duration: TimeInterval) -> SKAction
```

## Parameters

`width`

The new width of the sprite.

`duration`

The duration of the animation.

## Return Value

A new action object.

## Discussion

This action can only be executed by an [`SKSpriteNode`](/documentation/SpriteKit/SKSpriteNode) object. When the action executes, the sprite’s [`size`](/documentation/SpriteKit/SKSpriteNode/size) property animates to its new value.

This action is not reversible; the reverse of this action has the same duration but does not change anything.

---

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)