Introduction to Expressions
Geometry
Project Index
HOME

Layer Parameters
These are the layer parameters to which you can apply expressions. (You can also apply expressions to effect parameters and to some mask parameters.)
Use this table to know what each parameter expects from your expressions: how many dimensions, what kind of units, and common value ranges. For instance, using this table, you can see that an expression applied to the position parameter should produce results of 2 dimensions (3 if a 3D layer), with each component typically ranging from zero to the comp height or width.
anchor_point 
2* [x, y, (z)] 
pixels 
±inf 
0–layer width, height 
position 
2* [x, y, (z)] 
pixels 
±inf 
0–comp width, height 
scale 
2* [width, height, (depth)] 
percentage 
±inf 
±100 
rotation 
1 
degrees 
±inf 
0–360 (periodic) 
opacity 
1 
percentage 
0–100 
0–100 
orientation (3Donly) 
3 [x, y, z] 
degrees 
±inf 
0360 (periodic) 
audio_levels 
2 [left, right] 
decibels 
192–24 
48–12 
ambient 
1 
percentage 
0–100 
0–100 
diffuse 
1 
percentage 
0–100 
0–100 
specular 
1 
percentage 
0–100 
0–100 
shininess 
1 
percentage 
0100 
0100 
* 3 dimensions when layer is 3D. 
Global Objects
This table lists all of the global objects available in After Effects, and the type of objects they return. Anytime you refer to an element outside the current layer, you'll need to start with one of these objects.
this_layer 
Layer or Light or Camera 
this_comp 
Comp 
comp("name") 
Comp 
footage("name") 
Footage 
time 
Number 
value 
Number 
Comp Attributes and Methods
This table lists all of the attributes, methods and subobjects belonging to comp objects. In addition, it tells you what kinds of objects, or type of values, are returned by each method or attribute.
active_camera 
Camera 


width 
Number 
1 
pixels 
height 
Number 
1 
pixels 
duration 
Number 
1 
seconds 
frame_duration 
Number 
1 
seconds 
bg_color 
Vector 
4 
0 to 1 
shutter_angle 
Number 
1 
degrees 
shutter_phase 
Number 
1 
degrees 
num_layers 
Number 
1 

pixel_aspect 
Number 
1 
NA (width/height) 
layer(index or name) 
Layer 


layer(other layer, relative index) 
Layer 


Layer Attributes and Methods
This table lists all of the attributes, methods and subobjects belonging to layer objects. In addition, it tells you what kinds of objects, or type of values, are returned by each method or attribute.
width 
Number 
1 
pixels 
height 
Number 
1 
pixels 
start_time 
Number 
1 
seconds 
in_point 
Number 
1 
seconds 
out_point 
Number 
1 
seconds 
has_video 
Boolean 
1 
Boolean 
has_audio 
Boolean 
1 
Boolean 
active 
Boolean 
1 
Boolean 
audio_active 
Boolean 
1 
Boolean 
audio_levels 
Property 
2 [left, right] 
decibels 
index 
Number 
1 
Number 
parent 
Layer, Light or Camera 


anchor_point 
Property 
2 or 3 [x, y, (z)] 
pixels (layer space) 
position 
Property 
2 or 3 [x, y, (z)] 
pixels 
scale 
Property 
2 or 3 [width, height, (depth)] 
percentage 
opacity 
Property 
1 
percentage 
rotation 
Property 
1 
degrees 
orientation (3Donly) 
Property 
3 [x, y, z] 
degrees 
ambient (3Donly) 
Property 
1 
percentage 
shininess (3Donly) 
Property 
1 
percentage 
casts_shadows (3Donly) 
Boolean 
1 
Boolean 
accepts_shadows (3Donly) 
Boolean 
1 
Boolean 
accepts_lights (3Donly) 
Boolean 
1 
Boolean 
time_remap 
Property 
1 
seconds 
source 
Comp or Footage 


mask(index or name) 
Mask 


effect(index or name) 
Effect 


Footage Attributes and Methods
This table lists all of the attributes, methods and subobjects belonging to layer objects. In addition, it tells you what kinds of objects, or type of values, are returned by each method or attribute.
width 
Number 
1 
pixels 
height 
Number 
1 
pixels 
duration 
Number 
1 
seconds 
frame_duration 
Number 
1 
seconds 
pixel_aspect 
Number 
1 
NA (width/height) 
Property Attributes and Methods
These are the attributes and methods belonging to Property objects such as 'rotation' and 'opacity'. How do you know when you have a Property object? By checking the 'returns object of type' column in the Layer Attributes and Methods table, above. For instance, 'position' returns a Property object. This table is how you know when it's OK to write something like 'position.value_at_time(0)'.
value 
Number or Vector 

value_at_time(t) 
Number or Vector 

velocity 
Number or Vector 

velocity_at_time(t) 
Number or Vector 

speed 
Number 
1 
speed_at_time(t) 
Number 
1 
Vector Math Methods
These are the vector math methods which After Effects has conveniently made available as part of the default object, so that you don't need to write "Math.add(vector1,vector2)". If none of these methods fits your need, you may want to consult a Javascript reference to see if there's an additional, more useful, tool belonging to the Math object.
add(vector1, vector2) 
highest of vector 1 or 2 
dimensions needn’t match 
sub(vector1, vector2) 
highest of vector 1 or 2 
dimensions needn’t match 
mul(vector, Number) 
Vector 

div(vector, Number) 
Vector 

clamp(value, limit1, limit2) 
Number 
result: limit1_value_limit2 
dot(vector1, vector2) 
Number 
Only uses first two dimensions of either vector 
cross(vector1, vector2) 
Vector 

normalize(vector) 
Vector 
Gives vector with same direction but length of 1 
length(vector) 
Number 

length(from_point, to_point) 
Number 

look_at(from_point, to_point) 
Vector 
Apply result to orientation, 3D only 
Interpolation Methods
These methods smoothly interpolate between the usersupplied values 1 and 2.
linear(t,t_min, t_max,
value1, value2) 
same as value1 
value2 will be coerced
to same dimension as value 1 
ease(t,t_min, t_max,
value1, value2) 
same as value1 
value2 will be coerced
to same dimension as value 1 
ease_in(t,t_min, t_max,
value1, value2) 
same as value1 
value2 will be coerced
to same dimension as value 1 
ease_out(t,t_min,
t_max, value1, value2) 
same as value1 
value2 will be coerced
to same dimension as value 1 
note: t_min and t_max are optional; if omitted, AE will assume default range of 0 to 1. 

