ADOBE AFTER EFFECTS 7.0
User Guide
564
The expression language
About the expression language
The After Effects expression language is based on JavaScript 1.2, with an extended set of built-in objects. After Effects
uses only the core standard JavaScript 1.2 language, not the web browser–specific extensions. Instead of browser
extensions, After Effects contains its own set of extension objects such as Layer, Comp, Footage, and Camera that
you can use to access most of the values in an After Effects project.
For more information about JavaScript, see a JavaScript reference manual, such as JavaScript: The Definitive Guide,
by David Flanagan.
When creating expressions, keep the following in mind:
• JavaScript is case-sensitive.
• Semicolons are required to separate statements or lines.
• Spaces between words are ignored.
In JavaScript, a value stored in an object is called a property.However,AfterEffectsusesthetermproperty to refer to
layer attributes as defined in the Timeline panel. Consequently, for clarity, After Effects documentation refers to a
JavaScript property as a method when the property takes arguments, or an attribute when it does not.
Accessing values
You use the expression language to access values of properties. To access a value, use a chain of object references
separated by the period (
.) operator. To chain object references past the layer level (for example, to chain effect
properties, masks, or text animators), use parentheses. For example, to link the Opacity property in Layer A to the
Gaussian Blur effect’s Blurriness property in Layer B, type the following expression in the expression field for Layer
A’s Opacity property:
thisComp.layer("Layer B").effect("Gaussian Blur")("Blurriness")
The default object for an expression is the property on which the expression is written, followed by the layer
containing the expression; therefore, you do not need to specify the property. For example, a wiggle expression
written on a layer’s Position property can be either of the following:
wiggle(5, 10)
position.wiggle(5, 10)
You do need to include the layer and property when retrieving them from outside the layer and property on which
the expression is written. For example, an expression written on Layer B’s Opacity property, linking it to Layer A’s
Position property would read:
thisComp.layer("Layer A").position[0].wiggle(5, 10)
To visualize how this works, use the pick whip to link one property to another.
See also
“About animation and layer properties” on page 188
Global objects
All expressions start with a global object. Only an attribute or method of the global object can appear in an expression
with nothing to the left of it.