Spring Animations
Vibrancy and Blur
- Continue using
-[UIView drawViewHierarchyInRect:afterScreenUpdates:]
for static blurs.
UIVisualEffectView
is a new API for creating live blurs and vibrancy effects.
- Vibrancy is used to make content visible when the background is blurred.
- Blurs can be tinted by setting the
backgroundColor
of the contentView
- Changing the
alpha
will result in the blur being dropped.
- Can not be placed in a view hierarchy that contains masks.
UIBlurEffect
- Has 3 styles: dark, light, extra light
- Not just a simple Gaussian blur. Three steps:
- Downsample
- Modify colors
- Compute the blur
- Rendered offscreen.
UIVibrancyEffect
- Used as a subview of or layered on top of a
UIVisualEffectView
that uses a UIBlurEffect
to make content (e.g. text) more vivid and legible.
- Also rendered offscreen, takes even more time than blur.
Shape Layers
CAShapeLayer
is used to create animatable bezier paths.
- Rasterizes shape layer on CPU and sends the rasterized layer to the render server
- Expensive in CPU time, be cautious about frequent changes.
Dynamic Core Animation Behaviours
- Actions can be used to implement dynamic animation behaviour based on the context.
-actionForLayer:forKey:
is called on the CALayerDelegate
when an animatable property is set.
- Return an object that conforms to the
CAAction
protocol to run custom animations.