Graphics Reference
In-Depth Information
//reset pan gesture
[pan
setTranslation
:
CGPointZero
inView
:
self
.
view
];
}
@end
That's a neat trick, but you might be thinking that it would be easier to just set the door's
transform
directly using our pan gesture, rather than setting up an animation and then only
displaying a single frame at a time.
That is true in this simple case, but for a more complex case such as a keyframe animation,
or an animation group with several moving layers, this is actually a very simple way to
scrub through the animation without having to manually calculate each property of every
layer at a given point in time.
In this chapter, you learned about the
CAMediaTiming
protocol and the mechanisms that
Core Animation uses to manipulate time for the purposes of controlling animations. In the
next chapter, we cover
easing
, another time-manipulation technique used to make
animations appear more natural.