beautypg.com

Arrays and multidimensional properties – Adobe After Effects CS4 User Manual

Page 662

background image

656

USING AFTER EFFECTS CS4

Expressions

Last updated 12/21/2009

Reading this expression from left to right, you progress from the higher-level, containing object down to the specific
property:

The global object used refers to the current composition:

thisComp

.

A specific layer object within that composition is referred to by its name:

layer("Layer B")

.

A specific effect object within that layer is referred to by its name:

effect("Gaussian Blur")

.

A specific effect property within that effect is referred to by its name:

("Blurriness")

.

For the nth component of a multidimensional property, like the y component of an effect control point, append

[n]

at the end, like this:

thisComp.layer("Layer B").effect("Advanced Lightning")("Origin")[1]

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 the
Position property of a layer 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 the Opacity property of Layer B, linking it to the Rotation
property of Layer A would look like this expression:

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.

Jeff Almasol provides a script on his

redefinery website

with which you can determine how to refer to any property in

expressions.

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]

You can assign an Array object to a variable, making it easy to refer to array values in other areas of the expression. For
example:

myArray = [10, 23]

The dimension of an Array object is the number of elements in the array. The dimension of

myArray

is 2. Different

properties in After Effects have different dimensions depending on the number of value arguments they have. In the
expression language, the values of properties are either single values (Number objects) or arrays (Array objects).

The following table provides examples of some properties and their dimensions:

This manual is related to the following products: