2009

Table Of Contents
region of radius 1. The left, middle, and right rgbPP color components
get a value no less than -1 and no greater than 1. (R, G, and B values less
than 0 are treated as 0a black color).
The sphrand function returns a different random vector each execution,
so each particle receives a different random rgbPP value, and therefore,
a different color. The color changes each frame.
5 Rewind and play the animation again.
The particles become red when you go to the start time, and random
colors during playback.
NOTE You can use only one creation and one runtime expression per particle
object (shape node) in your scene. To control multiple attributes of a single
particle object, you must do so within one creation expression and one
runtime expression. You cant create a separate expression for each attribute
as you can for other types of objects. You therefore dont need to select an
attribute from the Expression Editors Attributes list.
Modifying runtime expressions
You might have trouble seeing the color of a particle in any instant because
the color changes so quickly. You can slow the change of colors to create a
flashing Christmas light effect. The following steps make the particles change
colors every second of animation.
To adjust the timing of the change of color
1 Change the runtime expression to this:
if ((frame % 24) == 0)
BubblesShape.rgbPP = sphrand(1);
This expression uses the modulus operator (%) to control when the rgbPP
attribute of the particles receives a random color. The modulus operator
588 | Chapter 12 Expressions