You can simplify the expression to make it easier to read.
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.
The animation plays exactly as before with the new expression.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License