4
Color [red, green, blue, alpha]
You can access the individual elements of an Array object by using brackets and an index number to indicate which element you want. The
elements in an Array object are indexed starting from 0. Using the previous example, myArray[0] is 10 and myArray[1] is 23.
The following two expressions are equivalent:
[myArray[0], 5]
[10, 5]
The Position property arrays are indexed as follows:
position[0] is the x coordinate of position.
position[1] is the y coordinate of position.
position[2] is the z coordinate of position.
Colors are represented as four-dimensional arrays [red, green, blue, alpha]. In projects with a color depth of 8 bpc or 16 bpc, 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 opaque. In projects with a color depth of 32 bpc, values under 0 and over 1 are allowed.
If you use an index that is greater than the index of the highest-dimension component in an Array object, After Effects returns an error. For
example, myArray[2] causes an error, but position[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, thisLayer.position is an Array object that is either two-dimensional or three-dimensional depending on whether the layer is 2D or 3D.
If you want to write an expression that keeps the y value of an animation of Position but fixes the x value at 9, you would use the following:
y = position[1];
[9,y]
The following is even more succinct:
[9, position[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 = thisComp.layer("Layer A").position[0];
y = thisComp.layer("Layer B").position[1];
[x,y]
You can create an expression that refers to just one value within the array of a 2D or 3D property. By default, the first value is used, unless you
specify otherwise. For example, if you drag the pick whip from the Rotation property of Layer A to Scale property of Layer B, the following
expression appears:
thisComp.layer("Layer B").scale[0]
By default, this expression uses the first value of the Scale property, which is width. If you prefer to use the height value instead, drag the pick
whip directly to the second value instead of the property name, or change the expression as follows:
thisComp.layer("Layer B").scale[1]
Conversely, if you drag the pick whip from the Scale property of Layer B to the Rotation property of Layer A, After Effects automatically creates a
variable, assigns the one-dimensional Rotation property value to it, and then uses that variable for both dimensions of the Scale property:
temp = thisComp.layer(1).transform.rotation;
[temp, temp]
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 position as returning a vector.
However, though a function like audioLevels 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, cross(vec1, vec2) computes a third vector that is at right angles to the input vectors.
The cross product is useful when vec1 and vec2 are two vectors representing directions in space, but not if they just represent two arbitrary
collections of numbers.
Summary of Contents for 12040118 - After Effects Standard
Page 1: ...ADOBE AFTER EFFECTS Help and tutorials...
Page 2: ...What s New...
Page 21: ......
Page 23: ...Legal Notices Online Privacy Policy...
Page 27: ...Workspace and workflow...
Page 29: ...Legal Notices Online Privacy Policy...
Page 36: ......
Page 42: ...Importing from Adobe After Effects Legal Notices Online Privacy Policy...
Page 76: ...Projects and compositions...
Page 92: ...Importing footage...
Page 97: ...Legal Notices Online Privacy Policy...
Page 102: ......
Page 128: ...Layers and properties...
Page 140: ......
Page 171: ...Views and previews...
Page 185: ...Animation and Keyframes...
Page 206: ...Legal Notices Online Privacy Policy...
Page 241: ...Color...
Page 257: ...Legal Notices Online Privacy Policy...
Page 258: ...Drawing painting and paths...
Page 293: ...Text...
Page 314: ......
Page 325: ...Transparency and compositing...
Page 336: ...Legal Notices Online Privacy Policy...
Page 345: ...Effects and animation presets...
Page 380: ...Legal Notices Online Privacy Policy...
Page 513: ...Legal Notices Online Privacy Policy...
Page 514: ...Markers...
Page 518: ......
Page 524: ...Memory storage performance...
Page 544: ...Expressions and automation...
Page 560: ...Legal Notices Online Privacy Policy...
Page 582: ...Rendering and Exporting...
Page 601: ...Legal Notices Online Privacy Policy...
Page 603: ......