<!--
{
  "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/CAKeyframeAnimation/keyTimes",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CAKeyframeAnimation(py)keyTimes"
  },
  "title" : "keyTimes"
}
-->

# keyTimes

An optional array of `NSNumber` objects that define the time at which to apply a given keyframe segment.

```
var keyTimes: [NSNumber]? { get set }
```

## Discussion

Each value in the array is a floating point number between `0.0` and `1.0` that defines the time point (specified as a fraction of the animation’s total duration) at which to apply the corresponding keyframe value. Each successive value in the array must be greater than, or equal to, the previous value. Usually, the number of elements in the array should match the number of elements in the [`values`](/documentation/QuartzCore/CAKeyframeAnimation/values) property or the number of control points in the [`path`](/documentation/QuartzCore/CAKeyframeAnimation/path) property. If they do not, the timing of your animation might not be what you expect.

The appropriate values to include in the array are dependent on the [`calculationMode`](/documentation/QuartzCore/CAKeyframeAnimation/calculationMode) property.

- If the [`calculationMode`](/documentation/QuartzCore/CAKeyframeAnimation/calculationMode) is set to [`linear`](/documentation/QuartzCore/CAAnimationCalculationMode/linear) or [`cubic`](/documentation/QuartzCore/CAAnimationCalculationMode/cubic), the first value in the array must be `0.0` and the last value must be `1.0`. All intermediate values represent time points between the start and end times.
- If the [`calculationMode`](/documentation/QuartzCore/CAKeyframeAnimation/calculationMode) is set to [`discrete`](/documentation/QuartzCore/CAAnimationCalculationMode/discrete), the first value in the array must be `0.0` and the last value must be `1.0`. The array should have one more entry than appears in the values array. For example, if there are two values, there should be three key times.
- If the [`calculationMode`](/documentation/QuartzCore/CAKeyframeAnimation/calculationMode) is set to [`paced`](/documentation/QuartzCore/CAAnimationCalculationMode/paced) or [`cubicPaced`](/documentation/QuartzCore/CAAnimationCalculationMode/cubicPaced), the values in this property are ignored.

If the values in this array are invalid or inappropriate for the current calculation mode, they are ignored.

---

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)