User Guide

CHAPTER 10
316
Creating Expressions
Write expressions directly in the expression field, or in any text editor, and then copy and
paste them to the expression field. For a quick reference to expression elements and their
proper syntax, use the language element menus. See “Using the expression language
menu on page 321. For information on After Effects–specific language requirements, see
“Understanding the expression language” on page 317.
Important: In JavaScript, a value stored in an object is called a property. However, After
Effects uses the term “property” to refer to layer attributes as defined in the Timeline window.
Consequently, for clarity, After Effects documentation refers to a JavaScript property as a
“method” when the property takes arguments, or an “attribute” when it does not.
When writing expressions, keep the following guidelines in mind:
JavaScript is case-sensitive.
Semicolons are required to separate statements or lines.
Spaces between words are ignored.
Saving an expression
Once you have written an expression, you can save it for future use by copying and pasting
it into a text-editing application, such as Notepad, Simple Text, or even Stickies. However,
because expressions are written in relation to other layers in a project and may use specific
layer names, it doesn’t always work to simply save and load expressions into a project. If
you want to save an expression for use in another project, you may want to add comments
to the expression or save the entire project file so that you can use it as a reference when
you reuse the expression.
Note: You can save a favorite effect that includes an expression and use it in other projects, as
long as the expression does not refer to properties that don’t exist in the other projects. See
“Saving favorite effects for instant reuse” on page 272.
To add comments to an expression:
Do either of the following:
Type // at the beginning of the comment. Any text between // and the end of a line is
ignored. For example:
// This is a comment.
UG.book Page 316 Wednesday, February 21, 2001 12:05 PM