UIViewPropertyAnimator
-
The user actions interactively drive the progress of the animation.
-
Create an animator
- On the touches handler
- pauseAnimation
- set fractionComplete based on the scrubber position
- continueAnimation on .ended
- On the touches handler
-
Interruptible
- Scroll in safari, where you can stop the acceleration by tapping again.
- Catch the animator mid-flight.
-
.scrubsLinearly
-
.pauseOnCompletion
- Used in drag n drop
-
You can start an animation before providing animation blocks.
-
When interrupting sprint animations
- Stop and create a new property animator
- Consider critically damped spring without velocity
-
Blur effect is animatable.
-
View morphing
- Scaling, translation and opacity blending of two views.
- Compute .scale and .transform when animating
- Dimentional ratio
- 3 animators
- Animating corner radius
- .cornerRadius is now animatable
- Access to the layer's .cornerRadius within an animation block and it works.
- CALayer .maskedCorners
- Can provide the corners to mask.
- .cornerRadius is now animatable
- Delays in interactive animations (like UINavigationBar)
- Keyframe animations
- relativeStartTime, relativeDuration
- Can use
UIView.addKeyFrame
withinUIViewPropertyAnimator
block.
- Keyframe animations
- Additive Animations
- Rotate a square
- Decompose into several smaller additive rotation animations
- Have a for inside
UIViewPropertyAnimator
block. - Each change to an animatable property will be chained.
- Rotate a square