8

318 Chapter 12: Animation
changethevariablesormovethetimeslider,
the Debug window automatically updates so
you can interactively view what’s happening
w ith 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
(orthebracesforvectors)dontmatch. Inthis
case, evaluation can proceed f urther before the
error is detected.
Clo se Closes the Expression Controller dialog.
Ex pres sion Controller Techniques
This topic summarizes some useful expression
techniques. The following topics review
trigonometric functions and v ector arithmetic. If
you’re familiar with these subjects you can skip
the review topics. Use these expressions when you
have applied an Expression controller using the
Assign Controller rollout in the M otion panel.
Commonly Used Ex pressions
This topic lists some expressions that y ou might
find useful in situations when you animate.
Circular Path
[ Radius * cos(360*Time),
Radius * sin(360*Time), 0 ]
where
Time
is one of the predefined time variables
such as NT or S.
If you make the two Radius values unequal, you
get an elliptical path.
If you specify a nonzero Z component, the path
is no longer planar.
Following Another Object
[X, Y, Z] + Position
where
Position
is the Position controller of the
second object.
Thevector[X,Y,Z]canbeanoffsetfromthe
second object. (If it’s [0,0,0], the two objects
occupy the same position.) It can also be a vector
expression that specifies some movement in itself.
Keeping an Object Between Two Obje cts
(Position1 + Position2) / 2
where
Position1
and
Position2
are the Position
controllers of two objects.
The divisor 2 constrains the object to be halfway
between the two other objects. Other values
constrain the object to other locations.
Bouncing Between Other Objects
(1+sin(360*Time))/2 * (Pos1-Pos2) + Pos2
where
Time
is one of the predefined time variables
such as NT or S;
Pos1
and
Pos2
are the Position
controllers of two other objects.
The subexpression (1+sin(360*Time))/2 is a
value that oscil lates between 0 and 1 over t ime.
(Pos1-Pos2) is the vector between the two other
objects. Multiplying the two a nd then adding Pos2
asanoffsetlocatestheobjectalongthisvector.