2010

Table Of Contents
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.
Beyond the lesson
In this lesson you learned how to:
Create and edit simple expressions using the Expression Editor.
Use variables, for example time, to control the specific attributes within
expressions.
When you write expressions, it is common to assign the built-in time
variable to an attribute so the attribute value predictably increases as the
animation plays. Its also useful to link an attributes value to the value of
632 | Chapter 12 Expressions