discrete
Each keyframe value is used in turn, no interpolated values are calculated.
Declaration
static let discrete: CAAnimationCalculationModeDiscussion
Keyframe animations based on discrete calculation interpolation require one less element in the values array than the keyTimes array. Each value / keyTime pair represents the value from the specified time until the next keyframe.
For example, given the 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.
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.
[Image]