---
title: linear
framework: quartzcore
role: symbol
role_heading: Type Property
path: quartzcore/caanimationcalculationmode/linear
---

# linear

Simple linear calculation between keyframe values.

## Declaration

```swift
static let linear: CAAnimationCalculationMode
```

## Discussion

Discussion The following code shows how to create a keyframe animation object using linear interpolation. Listing 1. Creating linearly interpolated keyframes let keyframeAnimation = CAKeyframeAnimation(keyPath: "position.y") keyframeAnimation.calculationMode = kCAAnimationLinear keyframeAnimation.keyTimes = [0, 0.25, 0.5, 0.75, 1] keyframeAnimation.values = [310, 60, 120, 60, 310] 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.

## See Also

### Constants

- [discrete](quartzcore/caanimationcalculationmode/discrete.md)
- [paced](quartzcore/caanimationcalculationmode/paced.md)
- [cubic](quartzcore/caanimationcalculationmode/cubic.md)
- [cubicPaced](quartzcore/caanimationcalculationmode/cubicpaced.md)
