Vectors; Vector And Array Indices - Adobe AFTER EFFECTS 7.0 Manual

Table of Contents

Advertisement

[myAr r ay[0], 5]
[ 1 0 , 5 ]
The Position property arrays are indexed as follows:
is the x coordinate of position.
p osition[0]
is the y coordinate of position.
p osition[1]
is the z coordinate of position.
p osition[2]
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,
Many of the properties and methods in the After Effects expression language take Array objects as arguments or
return them as values. For example,
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 osition[1];
[ 9 , y]
The following is even more succinct:
[9, p osition[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 hisC omp.layer("L ayer A").p osit ion[0];
y = t hisC omp.layer("L ayer B").p osit ion[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
However, while a function like
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,
computes a third vector that is at right angles to the input vectors. This is useful when
cro ss ( ve c1 , ve c2)
are two vectors representing directions in space, but not if they just represent two arbitrary collections of
ve c 2
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 ayer ( 1 )
causes an error, but
myAr ray[2]
is an Array that is either two-dimensional or three-dimen-
t his L ayer. p osit ion
does return a two-dimensional value (the left and right channel levels),
audioL e vels
returns the z coordinate of Position.
p osition[2]
p osit ion
ADOBE AFTER EFFECTS 7.0
User Guide
as returning a vector.
and
ve c 1
566

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents