The expression language, About the expression language, Accessing attributes and methods – Adobe After Effects CS3 User Manual
Page 561: Arrays and multidimensional properties
AFTER EFFECTS CS3
User Guide
556
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. 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.
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, except within a string.
In JavaScript, a value stored in an object is called a property. However, After Effects uses the term property 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.
The value of an expression is the value of the last statement evaluated.
Accessing attributes and methods
You use the expression language to access attributes and methods of layer 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), you can also 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
Rotation property would look like this:
thisComp.layer("Layer A").rotation
To see more examples of how this works, use the pick whip to link one layer property to another, and look at the
expressions it creates.
Arrays and multidimensional properties
An Array is a type of object that stores an ordered set of numbers. An Array is represented as a list of numbers
separated by commas and surrounded by brackets, as in this example:
[10, 23]