# Built-in Variables and Functions

The following built-in variables are available for defining actor motion equations or custom parameters with the Script Actor tool.

Variable Description
frame frame number
pi the mathematical value, Pi, which is equal to the angle covered by one-half of a circle
tSeconds elapsed time from beginning of sequence (frame 0) in seconds
beginFrame beginning frame of the section currently being recorded
endFrame end frame of the section currently being recorded
minFrame first frame number at which action is defined (frame 0); also first frame of a preview
maxFrame last frame number at which action is defined; also last frame of a preview
beginSequence frame number of the start of the current script
endSequence last frame number of the current script
sequenceLength length of the current script in frames
tSecondsSequence elapsed time (in seconds) from beginning of the current script

The elapsed time tSeconds is derived as follows:

`tSeconds = frames/frames per second`

For example, if you set frames per second to 30, tSeconds equals 1 second at frame 30, 2 seconds at frame 60 and so on.

You set the number of frames per second in the Animation Settings dialog, which is opened by selecting Settings > General in the Animation Producer dialog.

The following built-in functions are available for defining actor motion equations or custom parameters with the Script Actor tool. These functions are identical to those in the standard C math library, except that all angular values are expected and returned in degrees rather than radians.

Function Description
radiansFromDegrees(d) radians from degrees
degreesFromRadians(r) degrees from radians
secondsFromFrame(f) seconds from frame number
cos(angle) trigonometric cosine of angle
acos(value) arc cosine of value
sin(angle) sine of angle
asin(value) arc sine of value
atan(value) arc tangent of value
atan2(valueY, valueX) arc tangent of valueY/valueX
tan(angle) tangent of angle
cosh(value) hyperbolic cosine of value
sinh(value) hyperbolic sine of value
tanh(value) hyperbolic tangent of value
exp(value) exponential of x
log(value) natural logarithm of value
log10(value) base 10 logarithm of value
pow(x,y) x to y power
sqrt(value) square root of value
fabs(value) absolute value of
ceil(value) smallest integer not less than value
floor(value) largest integer not greater than value
fmod(x,y) floating point remainder of x/y
rand() pseudo random number
srand(x) set random seed