Graphics Programs Reference
In-Depth Information
starts another implicit animation. Therefore, if a layer is in the middle of traveling from
point A to point B, and you tell it to go to point C, it will never reach B; and that little
change of direction coupled with the timer restarting makes the animation seem choppy.
(
Figure 22.7
)
Figure 22.7 Animation missing waypoints
To disable an implicit animation, you can use an
animation transaction
. Animation trans-
actions allow you to batch animations and set their parameters, like the duration and anim-
ation curve. To begin a transaction, you send the message
begin
to the class
CATrans-
action
. To end a transaction, you send
commit
to
CATransaction
. Within the
be-
gin
and
commit
block, you can set properties of a layer and also set values for the trans-
action as a whole.
Animation transactions can be used for lots of things, but here we'll use it to disable the
animation of the layer's change in position. In
HypnosisView.m
, edit
touchesMoved:withEvent:
.