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

# sample(atTime:)

Calculates the sample at a particular time.

```
func sample(atTime time: CGFloat) -> Any?
```

## Parameters

`time`

The time value to sample.

## Return Value

An object that contains the interpolated sample. The class of this object matches the class of the values stored in the keyframe sequence — either an <doc://com.apple.documentation/documentation/Foundation/NSNumber> or an `SKColor`.

---

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)