
ADOBE AFTER EFFECTS 7.0
User Guide
566
[ my A r r ay [ 0 ] , 5 ]
[ 1 0 , 5 ]
The Position property arrays are indexed as follows:
•
p o s it i on [ 0 ]
is the x coordinate of position.
•
p o s it i on [ 1 ]
is the y coordinate of position.
•
p o s it i on [ 2 ]
is the z coordinate of position.
Colors are represented as 4D arrays [
r
,
g
,
b
,
a
]. Each value in a color array ranges from 0 (black) to 1 (white). For
example, red can range from 0 (no color) to 1 (red). So, [0,0,0,0] is black and transparent, and [1,1,1,1] is white and
completely solid.
If you use an index that is greater than the index of the highest-dimension component in an Array, After Effects
returns an error. For example,
my A r r ay [ 2 ]
causes an error, but
p o s it i on [ 2 ]
returns the z coordinate of Position.
Many of the properties and methods in the After Effects expression language take Array objects as arguments or
return them as values. For example,
t h i s L aye r. p o s it i on
is an Array that is either two-dimensional or three-dimen-
sional depending on whether your layer is 2D or 3D.
If you want to write an expression that keeps the y value of an object's animation but fixes the x value at 9, you would
use the following:
y = p o s it i on [ 1 ] ;
[ 9 , y ]
The following is even more succinct:
[ 9 , p o s it i on [ 1 ] ]
This is an important point, so let’s look at one more example. If you want to combine the x position value from Layer
A with the y position value from Layer B, you would use the following:
x = t h i s C omp. l aye r ( " L aye r A " ) . p o s it i on [ 0 ] ;
y = t h i s C omp. l aye r ( " L aye r B " ) . p o s it i on [ 1 ] ;
[ x , y ]
Vectors
In After Effects, many properties and methods take or return
vectors
. After Effects refers to an Array as a
vector
if it
represents either a point or direction in space. For example, After Effects describes
p o s it i on
as returning a vector.
However, while a function like
au d i o L e ve l s
does return a two-dimensional value (the left and right channel levels),
it is not called a
vector
because it does not represent a point or direction. Some functions in After Effects accept
vector arguments, but they are generally only useful when the values passed represent a direction. For example,
c ro ss ( ve c 1 , ve c 2 )
computes a third vector that is at right angles to the input vectors. This is useful when
ve c 1
and
ve c 2
are two vectors representing directions in space, but not if they just represent two arbitrary collections of
numbers.
Vector and array indices
Indexing for Layer, Effect, and Mask elements in After Effects starts from 1. For example, the first layer in the
Timeline panel is
l aye r ( 1 )
.
Summary of Contents for AFTER EFFECTS 7.0
Page 1: ...Chapter 1 User Guide...