Writing Expressions For Source Text; To Add Comments To An Expression - Adobe AFTER EFFECTS 7.0 Manual

Table of Contents

Advertisement

The element
5
t hisC omp
To determine what can follow
objects" on page 571.
Note that
returns a Comp. Next, look at "Comp attributes and methods" on page 576 to see which
6
t hisC omp
attributes and methods you can use with a Comp. One option is
parentheses specifies the layer that you want to use. For this example, we assume Solid 1 is the second layer in your
composition. To retrieve values from the second layer in the active composition, type the following:
t hisC omp.layer(2)
Again, look at the expression elements reference to see that
7
attributes and methods" on page 579, and find the element you want to use. For example, if you want to access the
Position property's values for the layer, type the following:
t hisC omp.layer(2).p osit ion
From "Layer General attributes and methods" on page 579, you can see that the
8
property. Look up "Property attributes and methods" on page 584 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:
t hisC omp.layer(2).p osit ion.va lueAtTime(time-2)
9
From "Property attributes and methods" on page 584, notice that the
Array. When an expression returns a Number, Array, or Boolean (such as true or false), you cannot add further
attributes or methods to the expression (if you want, however, you can add operators such as
See also
"Using the expression elements reference" on page 570

Writing expressions for source text

All expressions produce a result that is a number or an array of numbers—with one exception: expressions written
for the Source Text property of a text layer. The result of an expression that links to the Source Text property is inter-
preted as a JavaScript String. The expression replaces the existing text for the layer, using the style of the first
character. You can use the pick whip to retrieve the source text from another text layer; however, only the style of the
first character of the destination layer is used.
For example, to copy the original text from one layer and add it to another layer in all uppercase characters, type the
following expression:
text.s ou rc eText + "\r" + text.s ourc eText.to Upp erC as e()
You can use
in a string expression to start a new line of text. For more information on the String object, consult
" \r"
a JavaScript guide.

To add comments to an expression

Do either of the following:
Type
at the beginning of the comment. Any text between
/ /
// This is a comment.
Type
at the beginning of the comment and
/ *
For example:
/*This is a mu lt i line comment. */
is a global attribute whose value is a Comp object representing the current composition.
in your expression, look up the return value for
t his C omp
at the end of the comment. Any text between
*/
. The index, or number, inside the
layer(index)
returns a Layer. Look at "Layer General
l ayer ( i nd e x )
p osit ion
method returns a number or
va lueAtTime
and the end of the line is ignored. For example:
//
ADOBE AFTER EFFECTS 7.0
User Guide
under "Global
t hisC omp
attribute returns a
,
,
, or
).
+
-
*
/
and
is ignored.
/*
*/
560

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents