beautypg.com

Expression errors – Adobe After Effects CS4 User Manual

Page 665

background image

659

USING AFTER EFFECTS CS4

Expressions

Last updated 12/21/2009

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)

” on page 661.)

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

” on page 60.)

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.

This manual is related to the following products: