Graphics Reference
In-Depth Information
{
//create the keyframe animation
CAKeyframeAnimation
*animation = [
CAKeyframeAnimation
animation
];
animation.
keyPath
=
@"position"
;
animation.
timeOffset
=
self
.timeOffsetSlider.
value
;
animation.
speed
=
self
.speedSlider.
value
;
animation.
duration
=
1.0
;
animation.
path
=
self
.bezierPath.
CGPath
;
animation.
rotationMode
=
kCAAnimationRotateAuto
;
animation.
removedOnCompletion
=
NO
;
[
self
.shipLayer
addAnimation
:animation
forKey
:
@"slide"
];
}
@end
Figure 9.3
A simple app to test the effect of time offset and speed
fillMode
An animation that has a
beginTime
greater than zero can be in a state where it is attached to
a layer but has not yet started animating. Similarly, an animation whose
removeOnCompletion
property is set to
NO
will remain attached to a layer after it has
finished. This raises the question of what the value of the animated properties will be before
the animation has started and after it has ended.