Simplifying expressions
 
 
 

You can simplify the expression to make it easier to read.

  1. Change the expression to this:
    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.