<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CAAnimationCalculationMode/discrete",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Core Animation",
      "QuartzCore"
    ],
    "preciseIdentifier" : "c:@kCAAnimationDiscrete"
  },
  "title" : "discrete"
}
-->

# discrete

Each keyframe value is used in turn, no interpolated values are calculated.

```
static let discrete: CAAnimationCalculationMode
```

## Discussion

Keyframe animations based on discrete calculation interpolation require one less element in the [`values`](/documentation/QuartzCore/CAKeyframeAnimation/values) array than the [`keyTimes`](/documentation/QuartzCore/CAKeyframeAnimation/keyTimes) array. Each `value / keyTime` pair represents the value from the specified time until the next keyframe.

For example, given the [`CAKeyframeAnimation`](/documentation/QuartzCore/CAKeyframeAnimation) created in the following code, the penultimate keyTime, `0.75`, has a related value of `60`. The value of `position.y` will remain at `60` until the animation completes.

```swift
let keyframeAnimation = CAKeyframeAnimation(keyPath: "position.y")
keyframeAnimation.calculationMode = kCAAnimationDiscrete
  
// keyframe 0: (0, 310), keyframe 1: (0.25, 60), keyframe 2: (0.5, 120), keyframe 3: (0.75, 60)
keyframeAnimation.keyTimes = [0, 0.25, 0.5, 0.75, 1]
keyframeAnimation.values = [310, 60, 120, 60]
```

A layer animated with the keyframe animation created by the code above and with linearly interpolated horizontal movement would describe a path similar to the following figure.

![Tracing the path of an animation using discrete keyframes](images/com.apple.quartzcore/media-2776786@2x.png)

---

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)