Graphics Reference
In-Depth Information
Figure 8.3 A grouped keyframe path and basic color property animation
Transitions
Sometimes with iOS applications it is necessary to make layout changes that are very
difficult to animate using property animations. You might need to swap some text or an
image, for example, or replace a whole grid or table of views at once. Property animations
only work on animatable properties of a layer, so if you need to change a nonanimatable
property (such as an image) or actually add and remove layers from the hierarchy, property
animations won't work.
This is where transitions come in. A transition animation does not try to smoothly
interpolate between two values like a property animation; instead it is designed as a sort of
distraction tactic —to cover up content changes with an animation. Transitions affect an
entire layer instead of just a specific property. The transition takes a snapshot of the old
layer appearance and then animates in the new appearance in a single sweep.
To create a transition, we use CATransition , another subclass of CAAnimation . In addition
to all the timing functions and so on that it inherits from CAAnimation , CATransition has a
type and a subtype that are used to specify the transition effect. The type property is an
NSString and can be set to one of the following constant values:
kCATransitionFade
kCATransitionMoveIn
kCATransitionPush
kCATransitionReveal
 
Search WWH ::




Custom Search