beautypg.com

Adobe After Effects CS4 User Manual

Page 684

background image

678

USING AFTER EFFECTS CS4

Expressions

Last updated 12/21/2009

Example:

position.wiggle(5, 20, 3, .5)

produces about 5 wiggles per second with an average size of about 20

pixels. In addition to the main wiggle, two more levels of detailed wiggles occur with a frequency of 10 and 20 wiggles
per second, and sizes of 10 and 5 pixels, respectively.

This example, on a two-dimensional property such as Scale, wiggles both dimensions by the same amount:

v = wiggle(5, 10);
[v[0], v[0]]

This example, on a two-dimensional property, wiggles only along the y axis:

freq = 3;
amp = 50;
w = wiggle(freq,amp);
[value[0],w[1]];

Paul Tuersley provides a script on the

AE Enhancers forum

that automatically adds

wiggle

,

smooth

, and

loop

expressions to selected properties.

Dan Ebberts provides an example expression and a detailed explanation on his

MotionScript website

that shows how

to use the time parameter of the

wiggle

method to create a looping animation.

temporalWiggle(freq, amp, octaves=1, amp_mult=.5, t=time)

Return type: Number or Array.

Argument type: freq, amp, octaves, amp_mult, and t are Numbers.

Samples the property at a wiggled time. The freq value is the frequency in wiggles per second, amp is the amplitude in
units of the property to which it is applied, octaves is the number of octaves of noise to add together, amp_mult is the
amount that amp is multiplied by for each octave, and t is the base start time. For this function to be meaningful, the
property it samples must be animated, because the function alters only the time of sampling, not the value. Example:

scale.temporalWiggle(5, .2)

smooth(width=.2, samples=5, t=time)

Return type: Number or Array.

Argument type: width, samples, and t are Numbers.

Smooths the property values over time, converting large, brief deviations in the value to smaller, more evenly
distributed deviations. This smoothing is accomplished by applying a box filter to the value of the property at the
specified time. The width value is the range of time (in seconds) over which the filter is averaged. The samples value is
the number of discrete samples evenly spaced over time; use a larger value for greater smoothness (but decreased
performance). Generally, you’ll want samples to be an odd number so that the value at the current time is included in
the average. Example:

position.smooth(.1, 5)

loopIn(type="cycle", numKeyframes=0)

Return type: Number or Array.

Loops a segment of time that is measured from the first keyframe on the layer forward toward the Out point of the
layer. The loop plays from the In point of the layer. The numKeyframes value determines what segment is looped: The
segment looped is the portion of the layer from the first keyframe to the numKeyframes+1 keyframe. For example,

loopIn("cycle", 3)

loops the segment bounded by the first and fourth keyframes. The default value of 0 means

that all keyframes will loop.

You can use keyframe-looping methods to repeat a series of keyframes. You can use these methods on most properties.
Exceptions include properties that can’t be expressed by simple numeric values in the Timeline panel, such as the
Source Text property, path shape properties, and the Histogram property for the Levels effect. Keyframes or duration
values that are too large are clipped to the maximum allowable value. Values that are too small result in a constant loop.

This manual is related to the following products: