<!--
{
  "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.

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

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

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

Initializes a new keyframe sequence.

[`-  initWithCoder:`](/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.

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

Removes a keyframe from the sequence.

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

Removes the last value in the sequence.

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

Changes the time for a specific keyframe.

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

Changes the value for a specific keyframe.

[`-  setKeyframeValue:time:forIndex:`](/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.

[`-  sampleAtTime:`](/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.

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

Gets the time for a keyframe in the sequence.

[`-  getKeyframeValueForIndex:`](/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.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)