beautypg.com

Example: animate scale at each layer-time marker, Example: start or stop wiggle at specific time – Adobe After Effects CS3 User Manual

Page 590

background image

AFTER EFFECTS CS3

User Guide

585

Example: Animate scale at each layer-time marker

Apply the following expression to a Scale property to make a layer wobble at each marker:

n = 0;

t = 0;

if (marker.numKeys > 0){

n = marker.nearestKey(time).index;

if (marker.key(n).time > time) n--;

}

if (n > 0) t = time - marker.key(n).time;

amp = 15;

freq = 5;

decay = 3.0;

angle = freq * 2 * Math.PI * t;

scaleFact = (100 + amp * Math.sin(angle) / Math.exp(decay * t)) / 100;

[value[0] * scaleFact, value[1] / scaleFact];

See also

“Add, edit, and remove expressions” on page 549

Example: Start or stop wiggle at specific time

You can use any expression in place of the

wiggle

expression used here, to begin and end any expression’s influence

at a specific time.

Apply the following expression to a property to wiggle it beginning at time 2 seconds:

timeToStart = 2;

if (time > timeToStart){

wiggle(3,25);

}else{

value;

}

Apply the following expression to a property to stop wiggling it at time 4 seconds:

timeToStop = 4;

if (time > timeToStop){

value;

}else{

wiggle(3,25);

}

Apply the following expression to a property to start wiggling it at time 2 seconds and stop wiggling it at time 4
seconds:

timeToStart = 2;

timeToStop = 4;

if ((time > timeToStart) && (time < timeToStop)){

wiggle(3,25);

}else{

value;

}