EasyManua.ls Logo

Adobe AFTER EFFECTS 7.0 - To Add Comments to an Expression; Writing Expressions for Source Text

Adobe AFTER EFFECTS 7.0
684 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ADOBE AFTER EFFECTS 7.0
User Guide
560
5 The element thisComp is a global attribute whose value is a Comp object representing the current composition.
To determine what can follow
thisComp in your expression, look up the return value for thisComp under “Global
objects” on page 571.
6 Note that thisComp returns a Comp. Next, look at “Comp attributes and methods” on page 576 to see which
attributes and methods 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. 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:
thisComp.layer(2)
7 Again, look at the expression elements reference to see that layer(index) returns a Layer. Look at “Layer General
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:
thisComp.layer(2).position
8 From “Layer General attributes and methods” on page 579, you can see that the position attribute returns a
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:
thisComp.layer(2).position.valueAtTime(time-2)
9 From Property attributes and methods on page 584, notice that the valueAtTime method returns a number or
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
+, -, * , or /).
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.sourceText + "\r" + text.sourceText.toUpperCase()
Yo u c a n u s e "\r" in a string expression to start a new line of text. For more information on the String object, consult
a JavaScript guide.
To add comments to an expression
Do either of the following:
Type // at the beginning of the comment. Any text between // and the end of the line is ignored. For example:
// This is a comment.
Type /* at the beginning of the comment and */ at the end of the comment. Any text between /* and */ is ignored.
For example:
/*This is a multiline comment. */

Table of Contents

Related product manuals