2010

Table Of Contents
if (time < 2)
{
Balloon.translateY = 0;
Balloon.scaleY = time;
}
else
Balloon.translateY = time - 2;
We removed the second if statement:
if (time < 2)
In its place, we enclosed the remaining statements with braces { and }.
Maya evaluates both the statements between the braces if the condition
(time < 2) is true. Setting Ball.translateY to 0 here instead of in a separate
if statement makes the expression easier to read and comprehend.
Reducing the statement in this way also makes it more efficient for Maya
to process and easier to troubleshoot if you encounter a problem.
Note that you can put multiple statements between braces for an else
statement, just as you do for an if statement.
2 Click Edit.
3 Play the animation.
The animation plays exactly as before with the new expression.
4 Stop the animation and go to the start time.
Editing expressions to refine an animation
You can further refine the animation by expanding Balloon more slowly.
To edit the expression to scale the balloon more slowly
1 Change the expression to this:
if (time < 2)
{
Balloon.translateY = 0;
Balloon.scaleY = time * 0.6;
}
else
Balloon.translateY = time - 2;
(The asterisk (*) multiplies time by 0.6.)
2 Click Edit.
Editing expressions to refine an animation | 641