Main toolbar > Curve Editor (Open) > Select a track in the Track View hierarchy. > Track View toolbar > Controller menu > Assign > Expression
Graph Editors > Track View – Curve Editor > Select a track in the Track View hierarchy. > Track View toolbar > Controller menu > Assign > Expression

With the Expression controller you can use mathematical expressions to control the following animation aspects:
You can constrain values by basing them on the controller values of other objects in the scene
An expression is a mathematical function that returns a value. 3ds max evaluates the expression once for each frame of an animation, generating values that can change from frame to frame.
You create and manage expression controllers in Track View — Dope Sheet. You can assign expressions to the following kinds of scene elements:
| Scene element | Controller |
|---|---|
| Creation parameters | Any numeric creation parameter |
| Transforms | Position [X, Y, Z] X Rotation Y Rotation Z Rotation Scale [X%, Y%, Z%] |
| Modifiers | Any numeric modifier parameter (including creation parameters) |
| Materials | Colors [R, G, B] Any numeric material parameter |
Note: Expression controllers can work only with the individual XYZ components of Euler rotation. You can't assign an expression to TCB rotation or other kinds of rotation controllers.
Example: To create an expression that moves a sphere in a precise circle:
Create a sphere 30 units in diameter.
Use Track View to create the Expression controller.
In the Hierarchy list, expand Objects/Sphere01 so the sphere's Position track is visible. Select this track by clicking the Position label once to highlight it.
Click Controller > Assign on the Track View—Dope Sheet toolbar.
The Assign Controller dialog is displayed.
Select Position Expression from the list of controller types, and then click OK.
The Expression Controller dialog is displayed.
Note: You can also open the Expression Controller dialog from the Controller > Properties menu in the Track View-Dope Sheet.
In the Expression Controller dialog, create the expression.
Replace the default expression by typing the following position expression in the Expression field:
[100*cos(360*NT), 100*sin(360*NT), 0]
Click Evaluate.
Play the animation. The sphere moves in a circle about the world origin (0,0,0). The radius of the circular path is 100 units.
You've now specified a circular path for the sphere. NT is a variable that means normalized time. Movement based on NT happens exactly once per the active time segment, regardless of how many frames are in the animation.
Example continued: To change the radius of the circle:
The two 100s in the position expression from the previous procedure specify the radius. To adjust the radius of the circle's path, create a symbolic variable to represent the radius. The variable has a constant value that is easy to edit.
Make Track View—Dope Sheet visible again.
In the Expression Controller dialog, type radius in the Name field. Click Scalar, and then click Create.
"radius" is displayed in the Scalars list in the lower-left of the dialog.
Click Assign to Constant.
A dialog titled "radius" is displayed.
Type 150 in the value field, and then click OK.
The radius variable is now 150.
Now use the new variable in the expression.
Example continued: To make the sphere rotate about a box:
Create a box about 40 units square, and animate its position over three or four keyframes.
Select the sphere.
In the Expression Controller dialog, type boxposn in the Name field. Click Vector, and then click Create.
The name "boxposn" is displayed in the Vectors list in the lower-left part of the dialog.
Variable names are case sensitive; the variable name should be lower case.
Click Assign to Controller.
The Track View Pick dialog is displayed. It shows the object hierarchy as it appears in the left side of Track View-Dope Sheet.
In the Hierarchy list, highlight the Position controller for Box01 and then click OK.
In the Expression field, add boxposn as an offset:
[radius * cos(360*NT), radius * sin(360*NT), 0]+boxposn.
Click Evaluate, and then click Close.
Play the animation again. The sphere moves in a circle around the box and follows the box wherever it moves.

Name—Contains the variable.
Scalar—Selects the type of variable to create.
Vector—Selects the type of variable to create.
Create—Creates the variable.
You must enter a name and specify a type before clicking Create.
Delete—Select a variable in the Scalar or Vector list, then click to delete it.
Tick Offset—Contains an offset value.
A tick is 1/4800 of a second. If a variable has a non-zero tick offset, that value is added to the current time.
Type an expression in the Expression box.
The expression must be a valid mathematical expression. The result is either a three-value vector for a vector expression (position, scale, or point3) or a scalar value for a float expression.
Type text in this group to document an expression. For example, you can describe user-defined variables.
Function list—Displays a list of Expression controller functions.
In the list, p, q, and r represent scalar values or scalar expressions; V and W represent vector values or vector expressions.
Save—Saves an expression. Expressions are saved as files with a .xpr file name extension.
Load—Loads an expression.
A saved expression does not save variable definitions or values. After loading the expression, you need to redefine them.
Debug—Displays the Expression Debug window.
This window shows the values of all variables, and the value of the expression. When you change the variables or move the time slider, the Debug window automatically updates so you can interactively view what's happening with the expression. The values for frames (F), normalized time (NT), secs (S), and ticks (T) are also displayed.
Evaluate—Evaluate the expression for each frame in the animation.
There is no explicit assignment (= or := operator) as in a conventional programming language; the assignment is implicit and takes place over time.
If the expression has a syntax error, an error message is displayed. The error message is the first part of the expression itself. The last character in the error message is the point of the error. This is usually where the error actually is, unless the problem is that opening and closing parentheses (or the braces for vectors) don't match. In this case, evaluation may proceed further before the error is detected.
Close—Closes the Expression Controller dialog.
Web Designer - offers freelance web design services, redesign, graphic design, content
management, web development and e-commerce.
LTD