2009

Table Of Contents
NOTE Always examine the Script Editor for error messages after you edit an
expression and click the Create button. If you alter a previously successful
expression and a syntax error occurs, Maya executes the previous successful
expression when you play the animation. This might make you believe your
changes took effect. Error messages are preceded by the text // Error:.
4 Stop the animation and go to the start time. Balloon flattens but doesnt
return to the origin. (If Balloon has risen out of view, adjust your camera
to see it.)
Balloon doesnt return to the origin because the expression doesnt assign
Balloon a starting point for the beginning of the animation.
5 To make Balloon return to the origin, change the expression to this:
if (time < 2)
Balloon.translateY = 0;
if (time < 2)
Balloon.scaleY = time;
if (time >= 2)
Balloon.translateY = time;
The new first statement sets Balloon.translateY to 0 whenever time is less
than 2.
Note that you can put the three statements in any order in this example.
When Maya plays each frame, it executes each statement in the expression
in the order listed. In this example, the statements work independently,
so their order doesnt matter.
We put the statements in the order of time execution because its easier
to see the logic of the expression. If you ever need to change the
expression, youll be able to grasp the expressions actions more quickly.
6 Click Edit.
7 Stop the animation and go to the start time.
578 | Chapter 12 Expressions