Layer Animation
While Layer Kit proved useful in the previous section to glue a Core Surface buffer to the user interface, its capabilities extend far beyond a mere sticky layer. Layer Kit can be used to transform a 2-D object into a stunning 3-D texture that can be used to create beautiful transitions between views.
Chapter 3 introduced the UITransitionView class as a means of transitioning between different UIView objects. This class offered some basic animation, but was largely two-dimensional. The Layer Kit framework provides a more advanced set of tools for performing layer animation, allowing more spectacular transitions.
Creating a Layer Transition
Layer transitions augment the existing UITransitionView class by providing a way to override its transitions with new ones using Layer Kit's animation engine. This allows the developer to take advantage of the more advanced 3-D capabilities offered by Layer Kit without making significant changes to their code. When a layer transition, represented by an LKTransition object, is attached to a UITransitionView, the transition invokes Layer Kit to spawn a new thread that takes over all of the graphics processing for the transition. The developer needs only to add the desired transition to enhance an existing application. One such animation is added by the following code:
LKAnimation *animation = [ LKTransition animation ]; [ animation setType: @"pageCurl" ]; [ animation setSubtype: @"fromRight" ]; [ animation setTimingFunction: [ LKTimingFunction ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access