8.7 · Animations, PhaseAnimator, Canvas and TimelineView

In SwiftUI you do not animate views, you change state inside an animation context and the framework interpolates the difference. Drawing is a separate escape hatch for when views are too heavy.

Mental model. An animation is a change of state plus a curve. If SwiftUI can interpolate the value, it animates; if the identity changes, it uses a transition instead.

Animating changes

Implicit, explicit, transitions and keyframes.

  1. What is the difference between implicit and explicit animation, and how do transitions fit in? 8.7.1 · L2
    An implicit animation is attached to a view: .animation(.spring, value: flag) animates changes to that value in everything above the modifier. Always pass a…

Drawing and time

<code>PhaseAnimator</code>, <code>Canvas</code> and <code>TimelineView</code>.

  1. When do you use PhaseAnimator, Canvas and TimelineView? 8.7.2 · L5
    PhaseAnimator cycles a view through a list of phases (any Sequence of values), applying a content closure per phase and an animation closure for each…

More in SwiftUI