User Guide

CHAPTER 10
322
Creating Expressions
To continue the expression, add a period (.) to the end and then choose an attribute from
the Comp menu, such as “layer”:
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.
UG.book Page 322 Wednesday, February 21, 2001 12:05 PM