User Guide

Using Help | Contents | Index Back 253
Adobe After Effects Help Creating Expressions
Using Help | Contents | Index Back 253
this_comp.layer(
Insert the specific layer information you want, such as:
this_comp.layer(1)
Next, choose an attribute or method from the Layer, Light, or Camera menu. For example,
if layer 1 has Position keyframes, choose “position,” and so on.
this_comp.layer(1).position
To insert expression language elements:
1 Select language elements from the Expression language menu. The element appears in
the expression field at the location of the cursor.
2 Edit and add to the inserted elements, as needed.
Sample expressions
Use the following expressions in your own projects by setting up similar layer properties
as those described and then adding the expression.
Averaging one layer between two others
This expression positions and maintains one layer at a balanced distance between two
other layers. To achieve this effect, you need three layers in your composition.
To average one layer between two others:
1 Start with three layers.
2 Create motion paths for the first two layers in the Timeline.
3 Select the Position property for the third layer and choose Animation > Add Expression.
4 Select the default expression text and type the following:
mul(.5, add(this_comp.layer(1).position,
this_comp.layer(2).position))
5 Click outside the expression to activate it.
Creating a trail of images
This expression instructs a layer to be at the same position as the next higher layer in the
Timeline window, but delayed by a specified amount of time (in this case, .5 seconds). You
can set similar expressions for the other geometric properties. This expression requires
two or more layers.
To create a trail of images:
1 Start with two solids that are scaled to about 30%.
2 Create a motion path for the first layer.
3 Select the Position property for the second layer and choose Animation > Add
Expression.
4 Select the default expression text and type:
this_comp.layer(this_layer, -1).position.value_at_time(time - .5)
5 Duplicate the last layer five times.