Graphics Reference
In-Depth Information
.
BeginTime
This property is useful in an animation group. It specifies a time for the animation
to begin playing in relation to the time of the parent group animation's duration.
The default is 0.0 . Animation grouping is discussed in the next section, “Animation
Grouping.”
.
TimeOffset
If a time offset is set, the animation won't actually become visible until this amount
of time has elapsed in relation to the time of the parent group animation's duration.
.
RepeatCount
The default is zero, which means that the animation will only play back once. To
specify an infinite repeat count, use 1e100f . This property should not be used with
repeatDuration .
.
RepeatDuration
This property specifies how long the animation should repeat. The animation
repeats until this amount of time has elapsed. It should not be used with
repeatCount .
Animation Grouping
In the previous section, “Useful Animation Properties,” we defined two particular proper-
ties that are only pertinent to animation grouping: beginTime and timeOffset . Before
discussing those, however, let's consider why you might want to use an animation group
rather than just adding a list of animations to the layer.
In Listing 3-12, you can see that we build up a list of basic animations and simply add
them to the layer. If you want all your animations to begin at the same time and each of
them have the same duration, this method is perfectly adequate.
LISTING 3-12
Adding a List of Animations to the Layer
- ( IBAction )animate:( id )sender;
{
NSRect oldRect = NSMakeRect(0.0, 0.0, 100.0, 100.0);
NSRect newRect = NSMakeRect(0.0, 0.0, 300.0, 300.0);
CABasicAnimation *boundsAnimation =
[ CABasicAnimation animationWithKeyPath : @”bounds” ];
[boundsAnimation setFromValue :[ NSValue valueWithRect:oldRect]];
[boundsAnimation setToValue:[ NSValue valueWithRect:newRect]];
[boundsAnimation setDuration :5.0f];
CABasicAnimation *positionAnimation =
[ CABasicAnimation animationWithKeyPath : @”position” ];
 
Search WWH ::




Custom Search