2009

Table Of Contents
Ball.scaleX = time + 1;
Ball.scaleY = Ball.scaleX;
Ball.scaleZ = Ball.scaleX;
The second statement sets Ball.scaleY to the value of Ball.scaleX. Because
youve set Ball.scaleX to the value of time + 1, Ball.scaleY also has the value
of time + 1. Youre linking one attributes value to another. The third statement
also sets Ball.scaleZ to the value of the attribute Ball.scaleX.
The advantage of this expression is that if you assign a different value to
Ball.scaleX in the first statement, the second and third statements automatically
receive the new value.
Controlling attributes in two objects
You can add an object to the scene and use the expression to control any of
its attributes also. For example, suppose you added a default NURBS or
polygonal cylinder named Drum to the scene. You could control the attributes
of Ball and Drum with the same expression as in this example:
Ball.scaleY = time/2 + 1;
Drum.scaleX = time + 1;
Drum.scaleY = time + 1;
You can link attributes in different objectsso a change in one attribute alters
the behavior of the other. For example, you could cause Drums scaleY value
to always equal two times Balls scaleY value as in this example:
Ball.scaleY = time + 1;
Drum.scaleY = Ball.scaleY * 2;
If you decide to control attributes in two (or more) objects, you can select
either object to write the expression. In fact, any object or node in a scene
can be selected when you write an expression to control an object other than
a particle object.
Alternatively, you can write two (or more) expressions, for instance, one that
controls Ball.scaleY and one that controls Drum.scaleX and Drum.scaleY.
The advantage of creating separate expressions is that youll have two
expression names, each presumably named after the object and attribute youre
controlling. Having two expression names makes it easier to find the expression
that controls the desired attribute.
The advantage of using a single expression to control the attributes is that all
statements are in a single expression. You dont need to edit two expressions.
572 | Chapter 12 Expressions