Using Help | Contents | Index Back - Adobe AFTER EFFECTS 5.5 Help Manual

Table of Contents

Advertisement

Adobe After Effects Help
Using Help
|
Contents
To retrieve values from an object other than the layer containing the expression, insert the
object in the expression. For example, if you write an expression on a layer named Solid1
and you want to retrieve position values from a layer named Solid2, use the following
expression:
this_comp.layer("Solid2").position
Accessing elements in an expression
Use the expression language to access properties in After Effects that have a numeric
value. To access a value, use a chain of object references, separated by the period (.)
operator. To understand the order in which you can add elements to an expression, use
the "After Effects expression language guide" on page 254 to learn what the element
returns.
Consider the following procedure as an example of how to construct an expression using
the After Effects expression language guide:
To construct a simple expression:
1 Start with two layers.
2 Select the Position property for the first layer in the composition and choose Animation
> Add Expression. The following expression appears by default:
position
3 Type the following directly over the word "position:"
this_comp
4 The element "this_comp" is a global attribute whose value is a Comp object repre-
senting the current composition.
5 To determine what can follow "this_comp" in your expression, look up the return value
for "this_comp" under "Global attributes and methods" on page 255.
6 Note that "this_comp" returns a Comp. Next, look at the "Comp attributes and
methods" on page 258 to see what you can use with a Comp. One option is "layer(index)" .
The index, or number, inside the parentheses specifies the layer that you want to use. To
retrieve values from the second layer in the active composition, type the following:
this_comp.layer(2)
7 Again, look at the expression language guide to determine that "layer(index)" returns a
Layer. Look at "Layer attributes and methods" on page 259, and find the element you want
to use. For example, if you want to access the Position property values for the layer, type
the following:
this_comp.layer(2).position
8 From "Layer attributes and methods" on page 259, determine that the position
attribute returns a Property. Look up "Property attributes and methods" on page 262 and
notice that you can add a time factor to the expression. To add a specific time, such as
current time minus 2 seconds, type the following:
this_comp.layer(2).position.value_at_time(time-2)
9 From "Property attributes and methods" on page 262, notice that the time factor
"value_at_time(time)" returns a Number. When an element returns a Number, Array, or
Boolean (such as true or false), you cannot add other attributes or methods to the
expression (if you want, however, you can add operators such as +, -, *, or /).
Using Help
|
Contents
|
Index
|
Index
Creating Expressions
Back
250
Back
250

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents