User Guide
Using Help | Contents | Index Back 323
Adobe After Effects Help Using Motion Math (PB only)
Using Help | Contents | Index Back 323
When used on the right side of an assignment, the functions obtain values of specified
properties and channels in a specified layer. In the following example, the current value of
the Position property in the layer called square1 is multiplied by 1.5, and the result is
assigned to the variable V1:
V1 = value (square1, position) * 1.5;
When used on the left side of an assignment, the functions create or modify keyframes. In
the following example, a rotation keyframe with a value of 60 is created for the layer called
arrow1:
value (arrow1, rotation) = 60;
Functions that obtain a value from the menus Three functions obtain values from the
Layer, Property, and Channel menus:
pop_layer()
pop_property()
pop_channel()
These functions can be used on either side of an assignment. In the following example,
the name of the layer selected in the second Layer menu is assigned to the variable L2.
L2 = pop_layer (2);
If menu functions are used on the left side of an assignment, they must be inside another
function. In other words, you cannot assign a value directly to a menu function. In the
following example, the Scale property in the layer specified by the pop_layer function is
assigned the value of 10:
value (pop_layer (1), scale) = 10;
Using these menu functions makes it easy for other users to run the script by selecting
layers, properties, and channels from the menus. For more information on these functions,
see “Using the Layer, Property, and Channel menus (PB only)” on page 328.
If statements (PB only)
Use If statements to create a conditional portion of the script, which Motion Math
executes only if a specified condition is true or false. The If statement uses the following
format:
if (condition)
statement;
else
statement;
You can also include multiple statements inside the If statement, using braces to group
them:
if (condition) {
statement 1;
statement 2;
} else {
statement 3;
statement 4;
}