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

# animate(with:timePerFrame:)

Creates an action that animates changes to a sprite’s texture.

```
class func animate(with textures: [SKTexture], timePerFrame sec: TimeInterval) -> SKAction
```

## Parameters

`textures`

An array of textures to use when animating a sprite.

`sec`

The duration, in seconds, that each texture is displayed.

## 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 [`texture`](/documentation/SpriteKit/SKSpriteNode/texture) property animates through the array of textures. The sprite’s [`texture`](/documentation/SpriteKit/SKSpriteNode/texture) property is changed to the next texture in the array. The action then pauses for the specified time before continuing. The action continues until it has finished animating through all of the textures in the array. The total duration of the action is the number of textures multiplied by the frame interval.

This action is reversible; the resulting action animates through the same textures from last to first.

---

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)