User Guide

Using Help | Contents | Index Back 322
Adobe After Effects Help Using Motion Math (PB only)
Using Help | Contents | Index Back 322
The third type of assignment creates a keyframe by placing the value function or the
effect_value function on the left. In the following example, the value function creates a
rotation keyframe in layer 1 from the current value of the variable angle:
value (layer1, rotation) = angle;
For a description of the value function, see “Layer property functions (PB only)” on
page 322.
Numbers (PB only)
In Motion Math scripts, numbers must be expressed either as whole numbers or as
decimals. Numbers between –1 and 1 must be expressed with the preceding 0. For
example, the value .5 must be expressed as 0.5.
Variables (PB only)
In Motion Math, variables do not need to be declared a particular type, such as integer or
vector. Variables automatically assume the types you assign them. For example, if the
variable P1 is assigned the value of sin(a), P1 is automatically a real or floating point
number, in radians. If V1 is assigned a two-dimensional vector, such as {2, 7}, then V1
automatically becomes a vector with values 2 and 7 for its dimensions. For more infor-
mation about vectors, see “About vectors (PB only)” on page 327.
The names of variables must adhere to the following requirements:
Must start with a letter, but can contain numbers after the first letter.
Cannot contain a space or operators.
Cannot be x or y, since this would conflict with vector indexing (see “About vectors (PB
only)” on page 327). However, the name can contain the letter x or y.
In addition, the Motion Math language is not case-sensitive. For example, the variables
circle, CIRCLE, and Circle are identical in Motion Math.
Layer property functions (PB only)
Using layer property functions, you can obtain values of specified properties or create
keyframes, depending on how the properties and keyframes are used in an assignment. A
layer property function uses the following format:
function ()
The function acts on variables inside the parentheses and then returns a value. For
example, the function value (layer, property) obtains a value for the specified property in
the specified layer at the currently sampled frame.
Motion Math includes three different types of layer property functions:
Functions that obtain only values Functions such as time () or comp_audio_amplitude
() can be used only on the right side of an assignment. In the following example, the
current time is assigned to the variable T1:
T1 = time ();
Functions that can either obtain a value or create a keyframe Three functions obtain
values or create keyframes, depending on which side of an assignment they are placed on:
value()
velocity()
effect_value()