Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Core Animation
Declaration
static let easeInEaseOut: CAMedia Timing Function Name
Discussion
This is a Bézier timing function with the control points (0.42,0.0) and (0.58,1.0).
Listing 1 shows how to create a basic animation object using ease-in-ease-out interpolation.
Creating a basic animation with an ease-in-ease-out timing function
let verticalAnimation = CABasicAnimation(keyPath: "position.y")
verticalAnimation.fromValue = 310
verticalAnimation.toValue = 10
verticalAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
A layer animated with the animation created by the code above and with linearly interpolated horizontal movement would describe a path similar to Figure 1.
Path taken using ease-in-ease-out timing function
