Graphics Reference
In-Depth Information
[shipLayer addAnimation :animation forKey : nil ];
}
Figure 8.2 The spaceship layer rotating to match the tangent of the curve
Virtual Properties
We mentioned earlier that the fact that property animations work on key paths instead of
keys means that we can animate subproperties and even virtual properties . But what is a
virtual property?
Consider a rotation animation: If we wanted to animate a rotating object, we'd have to
animate the transform because there is no explicit angle/orientation property on a
CALayer . We might do that as shown in Listing 8.8.
Listing 8.8 Rotating a Layer by Animating the transform Property
@interface ViewController ()
@property ( nonatomic , weak ) IBOutlet UIView *containerView;
@end
@implementation ViewController
Search WWH ::




Custom Search