Enumerations
The following enumerations are available globally.
-
The mode that determines whether a block should be animated or not.
The default mode is
animated
, but thenonAnimated
mode should be used when you want to interrupt an existing animation and “snap” to some new values instead.For example, the example below animates a circle from left to right:
Wave.animate(spring: spring, mode: .animated) { circle.animator.center = CGPoint(x: 500, y: 100) }
Suppose while the animation is running, you decide that the circle should snap to its final position. Simply calling:
circle.center = CGPoint(x: 500, y: 100)
will set the
center
value, butcenter
will be overridden in the next frame because the animator is still running.For this to snap to its final
center
value correctly, we need to use anonAnimated
mode:
See moreWave.animate(spring: spring, mode: .nonAnimated) { circle.animator.center = CGPoint(x: 500, y: 100) }
Declaration
Swift
public enum AnimationMode
-
The current state of an
See moreAnimation
.Declaration
Swift
public enum AnimatorState