decorative banner

Writing your own expressions


    After Effects uses JavaScript 1.2 for expressions. JavaScript provides all the necessary statements, functions, and operators for constructing expressions. To write your own expressions, it may help to have some basic knowledge of JavaScript syntax and mathematics. However, once you learn the basic logic behind creating an expression, you can write fairly sophisticated expressions without ever looking at a JavaScript reference guide.

    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. For information on After Effects-specific language requirements, see Understanding the expression language. For more information about JavaScript, see a JavaScript reference manual, such as JavaScript: The Definitive Guide, by David Flanagan.

    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.

Related Subtopics: