Expressions
Mathematical expressions can be used in relationships. For example, a light’s intensity can be set to increase as the light’s width gets larger, or the cartoon line bias can decrease as a model scales smaller. Character rigging can also benefit greatly from expressions: an angular limit may be two times the elbow’s roll angle.
When editing an expression, you can use values of other properties within the expression. You can do this by either typing the relative name of the property, or simply selecting the other property from the Project Workspace. You can also choose from a list of functions by clicking the function button (just to the right of the expression's name), or typing the function yourself.
Here is a list of functions available when writing an expression:
|
Function |
Description |
|
Abs( n ) |
Returns the absolute value of n (n without its sign). |
|
ACos( n0...1 ) |
Returns the arccosine of n in the range of 0 to Pi radians. The arccosine is the angle whose cosine is n |
|
ASin( n0...1 ) |
Returns the arcsine of n in the range of -Pi/2 to Pi/2 radians. |
|
ATan( n ) |
Returns the arctangent of n in the range of -Pi/2 to Pi/2 radians. |
|
ATan2( y, x ) |
Returns the arctangent of the specified x and y coordinates, in the range of -Pi to Pi radians, excluding Pi |
|
Ceiling( n ) |
Rounds n up to the nearest whole number, where 1.2 becomes 2, and -1.2 becomes -1. |
|
Cos( radians ) |
Returns the cosine of an angle specified in radians. |
|
Exp( power ) |
Returns e raised to the power given. |
|
Fact( n>1 ) |
Returns the factorial of n, equal to 1*2*3*...*n |
|
Floor( n ) |
Rounds n down to the nearest whole number, where 1.2 becomes 1, and -1.2 becomes -2. |
|
GetTime() |
Returns the relative time within the action. When in a choreography, this is equal to the chor's time. |
|
Ln( n>0 ) |
Returns the natural logarithm of n. |
|
Log( n>0, base>0 ) |
Returns the logarithm of n to the base you specify. |
|
LogTen( n>0 ) |
Returns the base-10 logarithm of n. |
|
Max( a, b ) |
Returns the larger of the two arguments. |
|
Min( a, b ) |
Returns the smaller of the two arguments. |
|
Mod( n, divisor<>0 ) |
Returns the remainder after n is divided by the divisor. |
|
Pi() |
Returns the value of PI: 3.14159265358979 |
|
Rand() |
Returns a random number greater than or equal to 0 and less than 1, seeded off the choreography's current time. |
|
Round( n, modulo<>0 ) |
Round n to the nearest number specified by modulo. |
|
Sign( n ) |
Returns the sign of n: 1 if the number is positive, 0 if the number is zero, and -1 if the number is negative. |
|
Sin( radians ) |
Returns the sine of an angle specified in radians. |
|
Sqrt( n>0 ) |
Returns the square root of n. n must be greater than 0. |
|
Tan( radians ) |
Returns the tangent of an angle specified in radians. |
|
Trunc( n ) |
Truncates n to an integer by removing the decimal, or fractional, part of the number. |
The example images below demonstrates the use of expressions to maintain the volume of a character. In this case, there is a simple channel controlling the Y-Scale of the model but the X-Scale and Z-Scale are computed with an expression to keep the volume constant.
Volume is maintained when: X-Scale * Y-Scale * Z-Scale = 1
Therefore, add this expression to both X-Scale and Z-Scale
Sqrt( 1 / Y-Scale )
Stills
Movie