AfterEffects

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.