2009

Table Of Contents
The < in the condition is a relational operator. A relational operator tests
how one value relates to another. In the example, the < tested whether
time is less than 2.
Besides the < operator shown in this example, there are several other
relational operators such as >, >=, ==, and so on. See the Maya Help for
more details.
9 Stop the animation and go to the start time. Balloon flattens again because
the scaleY attribute becomes 0 when you go to the start time. Time is 0,
so scaleY is 0.
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.
Other conditional statement options | 577