When you want to create and link complex animations, but would like to avoid creating tens or hundreds of keyframes by hand, try using expressions. With expressions, you can create relationships between layer properties and use one property’s keyframes to dynamically animate other layers. For example, if you set Rotation keyframes for a layer and then apply the Drop Shadow effect, you can use an expression to link the Rotation property’s values with the Drop Shadow effect’s Direction values; that way, the drop shadow changes accordingly as the layer rotates. You can even use the pick whip to link path properties, so a mask can take its path from a brush stroke or a shape layer object.
Expressions are based on the standard JavaScript language, but you do not need to know JavaScript to use expressions. You can create expressions by using the pick whip or by copying simple examples and modifying them to suit your needs.
You can do all of your work with expressions in the Timeline panel, though it is sometimes more convenient to drag the pick whip to a property in the Effect Controls panel. You can use the pick whip to create expressions, or you can enter and edit expressions manually in the expression field, a resizable text field in the time graph. The expression field appears alongside the property in layer bar mode; the expression field appears at the bottom of the Graph Editor in Graph Editor mode. You can write an expression in a text editor and then copy it into the expression field. When you add an expression to a layer property, a default expression appears in the expression field. The default expression essentially does nothing—it sets the property value to itself.

While you are editing an expression, previews of all sorts are suspended; a red bar appears at the bottom of panels that are waiting for you to exit text-editing mode.
The values for a property that contains an expression appear in red or pink type.
Animation presets can include expressions, or even consist entirely of an expression. Animation presets that use expressions instead of keyframes are sometimes called behaviors.
After you add an expression to a property, you can continue to add or edit keyframes for the property. An expression can take the value of a property as determined by its keyframes and use that as input to generate new, modified values. For example, the following expression on a layer’s Position property preserves the layer’s keyframed motion and causes it to wiggle a little:
transform.position.wiggle(10, 10)
If an expression cannot
be processed, After Effects displays a message explaining the error
and automatically disables the expression. A yellow warning icon
appears
next to the expression; click the warning icon to view the error
message again.
To show expressions that have errors, select
one or more layers, right-click (Windows) or Control-click (Mac
OS) a selected layer in the Timeline panel, and choose Reveal Expression
Errors from the context menu.Precomposing multiple layers will also cause expressions that refer to one of the layers’ properties to produce an error, requiring you to update these expressions to refer to the layer within the new composition. (See About nesting and precomposing.)
When you are animating text, you can use the Expression selector to dynamically specify how much you want characters to be affected by an animator property through the use of expressions. You can add one or more Expression selectors to an animator group, and that animator group can contain one or more properties.
Jeff Almasol provides a script with which you can determine how to refer to any property in expressions:
http://www.redefinery.com/ae/view.php?item=rd_GimmePropPath
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS3878526689cb91655866c1103906c6dea-7a37.html
Comments
Comments are no longer accepted for After Effects CS3. After Effects CS4 is the current version. To discuss After Effects CS3, please use the Adobe forum.