To the top
Indices and labels
Indexing for Layer, Effect, and Mask elements in After Effects starts from 1. For example, the first layer in the Timeline panel is layer(1).
Generally, it is best to use the name of a layer, effect, or a mask instead of a number to avoid confusion and errors if the layer, effect, or mask is
moved, or if the arguments are changed during product updates and upgrades. When you use a name, always enclose it in straight quotes. For
example, the first of these expressions is easier to understand than the second expression, and the first expression will continue to work even if
you change the order of effects:
effect("Colorama").param("Get Phase From")
effect(1).param(2)
Expression time
Time within an expression is always in composition time (not layer time) and is measured in seconds. The default time for any expression is the
current composition time at which the expression is being evaluated. The following expressions both use the default composition time and return
the same values:
thisComp.layer(1).position
thisComp.layer(1).position.valueAtTime(time)
To use a relative time, add an incremental time value to the time argument. For example, to get the Position value 5 seconds before the current
time, use the following expression:
thisComp.layer(1).position.valueAtTime(time-5)
Default time references to properties in nested compositions use the original default composition time, not remapped time. However, if you use the
source function to retrieve a property, the remapped time is used.
For example, if the source of a layer in the containing composition is a nested composition, and in the containing composition you have remapped
time, when you get the position values of a layer in the nested composition with the following expression, the position values use the default time
of the composition:
comp("nested composition").layer(1).position
However, if you access layer 1 using the source function, the position values use the remapped time:
thisComp.layer("nested composition").source.layer(1).position
Note: If you use a specific time in an expression, After Effects ignores the remapped time.
Because expressions operate on time in units of seconds (not frames), you sometimes need to use time conversion methods to convert time
values to perform operations on frames. (See Time conversion methods (expression reference).)
Expression errors
If an expression cannot be processed, After Effects displays a message explaining the error and automatically disables the expression. A yellow
warning icon
appears next to the expression; click the warning icon to view the error message again.
To show expressions that have errors, select one or more layers, right-click (Windows) or Control-click (Mac OS) a selected layer in the
Timeline panel, and choose Reveal Expression Errors from the context menu.
Some expressions rely on the names of layers or properties in your project; if you change the name of a layer or property that is involved in an
expression, After Effects attempts to update the expression to use the new name. However, in some complex cases, After Effects is unable to
automatically update the expression, in which case the expression may produce an error message, and you must update the expression yourself.
Important: If you are running After Effects in a language other than the one for which an expression was written, or if you have changed the
names of items (such as layers, effects, or other property groups), then the expression may not work until you modify the expression to use the
new names or the strings that match the language in which you are running After Effects. Because the examples in this document were created for
the default state of After Effects running in English, some examples in this document will not work without such modification.
Note: The arguments for some After Effects effects have changed from the arguments in previous versions. If you have existing expressions that
use argument index references rather than argument names, you may need to update the expressions to use argument names.
Precomposing multiple layers can also cause expressions that refer to a property of one of the layers to produce an error, requiring you to update
these expressions to refer to the layer within the new composition. This is especially a concern with expressions that use thisComp instead of
referring to a composition by its name. (See About precomposing and nesting.)
Jeff Almasol provides a script on his
redefinery website
with which you can replace instances of thisComp with explicit references to a
composition’s name.
More Help topics
Summary of Contents for 12040118 - After Effects Standard
Page 1: ...ADOBE AFTER EFFECTS Help and tutorials...
Page 2: ...What s New...
Page 21: ......
Page 23: ...Legal Notices Online Privacy Policy...
Page 27: ...Workspace and workflow...
Page 29: ...Legal Notices Online Privacy Policy...
Page 36: ......
Page 42: ...Importing from Adobe After Effects Legal Notices Online Privacy Policy...
Page 76: ...Projects and compositions...
Page 92: ...Importing footage...
Page 97: ...Legal Notices Online Privacy Policy...
Page 102: ......
Page 128: ...Layers and properties...
Page 140: ......
Page 171: ...Views and previews...
Page 185: ...Animation and Keyframes...
Page 206: ...Legal Notices Online Privacy Policy...
Page 241: ...Color...
Page 257: ...Legal Notices Online Privacy Policy...
Page 258: ...Drawing painting and paths...
Page 293: ...Text...
Page 314: ......
Page 325: ...Transparency and compositing...
Page 336: ...Legal Notices Online Privacy Policy...
Page 345: ...Effects and animation presets...
Page 380: ...Legal Notices Online Privacy Policy...
Page 513: ...Legal Notices Online Privacy Policy...
Page 514: ...Markers...
Page 518: ......
Page 524: ...Memory storage performance...
Page 544: ...Expressions and automation...
Page 560: ...Legal Notices Online Privacy Policy...
Page 582: ...Rendering and Exporting...
Page 601: ...Legal Notices Online Privacy Policy...
Page 603: ......