<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKKeyframeSequence",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKKeyframeSequence"
  },
  "title" : "SKKeyframeSequence"
}
-->

# SKKeyframeSequence

An object that performs interpolation between values specified at different times (keyframes).

```
class SKKeyframeSequence
```

## Overview

The primary use for an [`SKKeyframeSequence`](/documentation/SpriteKit/SKKeyframeSequence) object is to animate properties on particles emitted by an [`SKEmitterNode`](/documentation/SpriteKit/SKEmitterNode) object, but it can also be used for your general interpolation needs across a discrete set of inputs.

When a keyframe sequence is used with an emitter node, particles determine their values by sampling the keyframe sequence. The sequence replaces the normal simulation performed by the emitter node.

## Topics

### First Steps

[Using Keyframe Sequence to effect Custom Interpolation](/documentation/SpriteKit/using-keyframe-sequence-to-effect-custom-interpolation)

See a few examples of what keyframe sequence can do.

[`init(keyframeValues:times:)`](/documentation/SpriteKit/SKKeyframeSequence/init(keyframeValues:times:))

Initializes a keyframe sequence with an initial set of values and times.

[`init(capacity:)`](/documentation/SpriteKit/SKKeyframeSequence/init(capacity:))

Initializes a new keyframe sequence.

[`init(coder:)`](/documentation/SpriteKit/SKKeyframeSequence/init(coder:))

### Sequence Building

Define the composition of the keyframe sequence.

[`addKeyframeValue(_:time:)`](/documentation/SpriteKit/SKKeyframeSequence/addKeyframeValue(_:time:))

Adds a keyframe to the sequence.

[`removeKeyframe(at:)`](/documentation/SpriteKit/SKKeyframeSequence/removeKeyframe(at:))

Removes a keyframe from the sequence.

[`removeLastKeyframe()`](/documentation/SpriteKit/SKKeyframeSequence/removeLastKeyframe())

Removes the last value in the sequence.

[`setKeyframeTime(_:for:)`](/documentation/SpriteKit/SKKeyframeSequence/setKeyframeTime(_:for:))

Changes the time for a specific keyframe.

[`setKeyframeValue(_:for:)`](/documentation/SpriteKit/SKKeyframeSequence/setKeyframeValue(_:for:))

Changes the value for a specific keyframe.

[`setKeyframeValue(_:time:for:)`](/documentation/SpriteKit/SKKeyframeSequence/setKeyframeValue(_:time:for:))

Replaces a keyframe in the sequence with a new keyframe.

### Sequence Running

You run the sequence by sampling its output at a given time.

[`sample(atTime:)`](/documentation/SpriteKit/SKKeyframeSequence/sample(atTime:))

Calculates the sample at a particular time.

### Sequence Information

[`count()`](/documentation/SpriteKit/SKKeyframeSequence/count())

The number of keyframes in the sequence.

[`getKeyframeTime(for:)`](/documentation/SpriteKit/SKKeyframeSequence/getKeyframeTime(for:))

Gets the time for a keyframe in the sequence.

[`getKeyframeValue(for:)`](/documentation/SpriteKit/SKKeyframeSequence/getKeyframeValue(for:))

Gets the value for a keyframe in the sequence.

### Interpolation Modifiers

Modify sample output by defining a mode or repeat options.

[`interpolationMode`](/documentation/SpriteKit/SKKeyframeSequence/interpolationMode)

The mode used to determine how values for times between the keyframes are calculated.

[`repeatMode`](/documentation/SpriteKit/SKKeyframeSequence/repeatMode)

The mode used to determine how the keyframe sequence repeats.

### Constants

[`SKInterpolationMode`](/documentation/SpriteKit/SKInterpolationMode)

The modes used to interpolate between keyframes in the sequence.

[`SKRepeatMode`](/documentation/SpriteKit/SKRepeatMode)

The modes used to determine how the sequence repeats.



---

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)