User Guide

CHAPTER 10
330
Creating Expressions
Layer, Light, or Camera layer(“name”) {name is a string} Retrieves the layer by name.
Names are matched by layer name, or source name if there is no layer name. If duplicate
names exist, After Effects uses the first one in the Timeline window. For example,
“this_comp.layer("Solid 1")”.
Layer, Light, or Camera layer(other_layer, rel_index) {other_layer is a layer object, and
rel_index is a number} Retrieves the layer that is the rel_index (number) of layers above or
below the other_layer (name). For example, “layer(this_layer, -2)” returns the layer that is
two layers higher in the Timeline window than the layer on which the expression is
written.
Footage attributes and methods
To use footage from the Project window as an object in an expression, use the global
footage() method, as in “footage("filename")” and then use any of the attributes below.
You can also access a footage object using the source attribute on a layer whose source is a
footage item.
Number width Returns the width of the footage in pixels.
Number height Returns the height of the footage in pixels.
Number duration Returns the duration of the footage in seconds.
Number frame_duration Returns the duration of a frame in seconds.
Number pixel_aspect Returns the pixel aspect ratio of the footage, expressed as
width/height.
Layer attributes and methods
Number width Returns the width of the layer in pixels. It is the same as “source.width.
Number height Returns the height of the layer in pixels. It is the same as “source.height”.
Number start_time Returns the start time of the layer in seconds.
Number in_point Returns the In point of the layer in seconds.
Number out_point Returns the Out point of the layer in seconds.
Boolean has_video Returns a true value if the layer has video, or a false if it doesn’t.
Boolean has_audio Returns a true value if the layer has audio, or a false if it doesn’t.
UG.book Page 330 Wednesday, February 21, 2001 12:05 PM