Monday 28 January 2013

Looping Keyframes


Looping Keyframes

The expression language provides two convenient ways to
loop a sequence of keyframes: loopOut() and loopIn().
Suppose you keyframed a short animation and you want
that sequence to repeat continuously. Simply add this
expression to the keyframed property
loopOut("cycle")
and your animation will loop for the duration of the comp.

There are three other variations of loopOut(), as well:
. loopOut("pingpong") Runs your animation alternately
forward then backward.
. loopOut("continue") Extrapolates the animation
beyond the last keyframe, so the value of the property
keeps moving at the same rate (and in the same
direction, if you’re animating a spatial property such as
Position) as the last keyframe. This can be useful, for
example, if you’re tracking an object that has moved off
screen and you want After Effects to extrapolate where
it would be if it kept moving at the same speed and in
the same direction.
. loopOut("offset") Works similarly to "cycle", except
that instead of returning to the value of the fi rst
keyframe, each loop of the animation is offset by an
amount equal to the value at the end of the previous
loop. This produces a cumulative or stair-step effect.
loopIn() operates the same way as loopOut(), except that
the looping occurs before the fi rst keyframe instead of
after the last keyframe. Both loopIn() and loopOut() will
accept a second, optional parameter that specifi es how
many keyframes to loop. Actually, it’s easier to think of it
as how many keyframed segments to loop. For loopOut()
the segments are counted from the last keyframe toward
the layer’s In point. For loopIn() the segments are counted
from the fi rst keyframe toward the layer’s Out point. If you
leave this parameter out (or specify it as 0), all keyframes
are looped. For example, this variation loops the segment
bounded by the last and next-to-last keyframes:
loopOut("cycle",1).

Two variations on the expressions—loopOutDuration()
and loopInDuration()—enable you to specify the time (in
seconds) as the second parameter instead of number of
keyframed segments to be looped. For loopOutDuration(),
the time is measured from the last keyframe toward the
layer’s In point. For loopInDuration(), the time is measured
from the fi rst keyframe toward the layer’s Out point.
For example, this expression loops the two-second interval
prior to the last keyframe:
loopOutDuration("cycle",2)
If you leave out the second parameter (or specify it as 0),
the entire interval between the layer’s In point and the
last keyframe will be looped for loopOutDuration(). For
loopInDuration(), the interval from the fi rst keyframe to
the Out point will be looped.


No comments:

Post a Comment