2010

Table Of Contents
Other conditional statement options
You can make Balloon rise after it inflates by adding another if statement to
the expression.
To add an if statement to the expression
1 Change the expression to this:
if (time < 2)
Balloon.scaleY = time;
if (time >= 2)
Balloon.translateY = time;
2 Click Edit to compile the expression.
3 Play the animation.
Balloon inflates for two seconds. After two seconds, Balloon stops inflating
and its position skips from a Y-axis position of 0 to 2. Youll eliminate
the motion skip in a later step.
The new if statement increases the translateY position of Balloon after
the animation time rises above two seconds. The >= symbols mean greater
than or equal to. Whenever time is greater than or equal to 2, the
expression assigns Balloons translateY the value of time. The translateY
value therefore increases for the rest of your animations playback range.
Notice that a semicolon ends each statement for a particular condition.
Forgetting a semicolon after each statement causes a syntax error, and
the changes youve made to the expression wont take effect.
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.
Other conditional statement options | 637