Timing Functions

The acceleration of the animation is controlled by its timing function. By default, animations use an ease-in/ease-out timing function. To use a driving analogy, this would mean the driver accelerates smoothly from rest to a constant speed and then gradually slows down at the end, coming to rest.

Other timing functions include linear (a constant speed from beginning to end), ease-in (accelerating to a constant speed and then ending abruptly), and ease-out (beginning at full speed and then slowing down at the end).

In ViewController.swift, update the animation in animateLabelTransitions() to use a linear timing function.

UIView.animateWithDuration(0.5,
    delay: 0,
    options: [.CurveLinear], animations: { self.currentQuestionLabel.alpha ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.