User Guide > Animation Paths > Expression Columns > Operators and Operands

Operators and Operands

Expressions include operators and operands.

Operators are symbols that represent an action, like + for addition.
Operands are values that are manipulated by the operators.

In the expression (10 + 5), 10 and 5 are the operands and + is the operator.

In Animate Pro, you build expressions with following operators:

+ (addition)
- (subtraction)

You must include spaces around the minus sign when it is part of a mathematical expression because “-” is also a valid character in element names. Further, you can also use “-” as a unary minus sign, meaning that you can negate entire operations with the minus sign. For example, - (5-3) would result in the value -2.

* (multiplication)
/ (division)

Multiplication and division are performed before addition and subtraction. You can use parentheses ( ) to enclose discreet operations.

To refer to the values in a column, you use the column name and the frame number. If you do not state the frame number, then Animate Pro assumes you want the value of the current frame. You can refer to the frame numbers in the following ways:

frame: refers to the current frame number.
previous: refers to the frame before the current frame.

You must provide an argument in parentheses () to get a value. The argument is the name of the column whose previous frame values you want to retrieve.

Nframe: refers to the total number of frames in a scene.
[ ], in the square brackets you can refer to specific frame numbers.

For example [frame - 2] refers to the frame before the previous frame. You must put space between frame, the minus sign and the number for the expression to be valid.

Consider the expression: previous(peg_x)

This expression says that the current frame value will be the same as the previous frame value of the element peg_x.

Now consider this expression: peg_angle[frame - 2] * 3

In this expression, we are telling the Animate Pro to look two frames before the current frame in the column "peg_angle" and multiply the value by 3 to derive the value for the current frame of the expression column.

There are also a number of predefined functions that you can use:

sum: adds all previous frames to create the value at the current frame).
tan (tangent), cos (cosine), sin (sine), atan (arc tangent), acos (arc cosine) and asin (arcsine).

These functions are useful in calculating camera angles and angles of rotation.

round: rounds a number with digits after the decimal to the nearest whole number.
int: removes the values after the decimal point to make a whole number.
atan2(y, x): unlike the other arc tangent function (atan), this function gives you a value between -180 and 180. In the other arc tangent function you would loose the positive/negative signs that indicate which quadrant the value would be in. With the atan2 function, the resulting quadrant is preserved. You would use this function when working with a directional blur where the direction of the blur is important to preserve.
ceil: rounds the value to the next integer. For example:
If the value is 3.7, the ceil value is 4.
If the value is 3, then the ceil value is 3.
floor: rounds the value to the lower integer. For example:
If the value is 3.7, the floor value is 3.
If the value is 3, then the floor value is 3.
abs: the absolute value of the number. For example:
If the number is -2, then the result of this function would be 2.
If the number is 2, the result of the function would be 2.
sqrt: square root of the value.
Comparison functions (=, ==, !=, <, <=, >, >=): these functions compare arguments. When the function is true, the result is 1. When the function is false, the result of the function is 0 (zero). You can use these functions with the conditional (if) function.
=, == : compares the two arguments to find out if they are equal
!=: compares the two arguments to find out if they are NOT equal
< : less than
<= : less than or equal to
> : greater than
>= : greater than or equal to
exp: indicates that the argument is an exponent of e (2.71828).
For example: exp(5) = 2.718285
ln: logarithm of a value
Conditional function (if, then, else): use this function to execute calculations conditionally.

You can use conditional expressions with the comparison functions. The value 0, is considered false. Any value not 0 is considered true.

For example: if (peg_x >= pegant_x) then (peg_x * 2) else pegant_x * 2

This conditional expression says that if the peg_x column is greater than or equal to the value in the pegant_x column, then the value of the function is peg_x multiplied by 2, otherwise the value of the function is pegant_x multiplied by 2.

Related Topics 

Creating an Expression for an Effect