You can enter entire expressions yourself, by manually typing them or by using the Expression Language menu; or you can create an expression with the pick whip or paste it from an example or other property.
A good way to begin working with expressions is to create a simple expression with the pick whip and then adjust the expression’s behavior using simple math operations, such as those listed in the following table:
|
Symbol |
Function |
|---|---|
|
+ |
add |
|
- |
subtract |
|
/ |
divide |
|
* |
multiply |
|
*-1 |
perform opposite of original, such as counterclockwise instead of clockwise |
For example, you can double the result by typing *2 at the end of the expression; or you can halve the result by typing /2 at the end of the expression.
As you develop comfort editing expressions, you can combine these simple operations—and more. For example, you can add /360*100 to the end of an expression to change its range from 0-360 to 0-100. This would be useful if you wanted to convert the values of a 360-degree dial to a slider that is measured in percentages.
The Expression Language menu in the Timeline panel contains language elements specific to After Effects that you can use in an expression. This menu is helpful for determining valid elements and their correct syntax; use it as a reference for available elements. When you choose any object, attribute, or method from the menu, After Effects automatically inserts it in the expression field at the insertion point. If text is selected in the expression field, that text is replaced by the new expression text. If the insertion point is not in the expression field, all text in the field is replaced by the new expression text.
Add, disable, or remove an expression
next
to the property name in the Timeline panel or Effect Controls panel.
. When
an expression is disabled, a slash appears through the switch
.
Edit an expression with the pick whip
If you are not familiar
with JavaScript or the After Effects expression language, you can
still take advantage of the power of expressions by using the pick
whip. You simply drag the pick whip
from
one property to another to link the properties with an expression,
and the expression text is entered in the expression field at the
insertion point. If text is selected in the expression field, that
text is replaced by the new expression text. If the insertion point
is not in the expression field, all text in the field is replaced
by the new expression text.

You can drag the pick whip to a property’s name or to its values. If you drag to the property’s name, the resulting expression displays all the values as one. For example, if you drag the pick whip to the Position property’s name, an expression like the following appears:
thisComp.layer("Layer 1").transform.position
If you drag the pick whip to one of the Position property’s values (such as the y value), an expression like the following appears, in which both the x and y coordinates of the property are linked to the Position property’s y value:
temp = thisComp.layer("Layer 1").transform.position[1];
[temp, temp]
If the layer, mask, or effect that you drag the pick whip to does not have a unique name in its local context, After Effects renames it. For example, if you have two or more masks named “Mask” on the same layer, and you drag the pick whip to one of them, After Effects renames it “Mask 2”.
The format of expressions created by the pick whip is determined by the Expression Pick Whip Writes Compact English preference (Edit > Preferences > General (Windows) or After Effects > Preferences > General (Mac OS)). By default, the pick whip creates compact English expressions, which use the Timeline panel’s name for the properties within an expression. Because these names are coded into the application and never change, these expressions can work when After Effects is running in another language. Any property names that you can change are enclosed in double quotation marks and remain the same in any language. If you don’t plan on sharing your projects across languages, you can deselect this preference. This preference does not affect effect names or effect properties.
Here is an example in compact English:
thisComp.layer("Layer 1").transform.position
Here is the same expression, not in compact English:
thisComp.layer("Layer 1")("Transform")("Position")
Edit an expression manuallyJeff Almasol provides a script that automatically processes expressions, making specified changes. For example, the script can be used to automatically remove or enable disabled expressions.Todd_Kopriva said on Jul 1, 2008 at 11:58 AM :
http://www.redefinery.com/ae/view.php?item=rd_ExprTweaker
Paul Tuersley provides a script that automatically adds wiggle, smooth and loop expressions to selected properties. This is a good way for the expression-phobic to experiment with what these expressions can do.
http://www.aenhancers.com/viewtopic.php?f=9&t=139
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS3878526689cb91655866c1103906c6dea-7a2c.html
Comments
Comments are no longer accepted for After Effects CS3. After Effects CS4 is the current version. To discuss After Effects CS3, please use the Adobe forum.