Using Timers With Lights
You can use the timer to fade a light in and out or change its color, using the diffuse message. First, lets try using a timer to move a light.object file: whiteroom.pfb
#include "User0" object (("whiteroom.pfb")) // a light moving up and down light whitelight ((0 0 5 1)) timer ((5),(0),(10),, when(changed,whitelight.(0 0 $value 1)), when(,), when(,))
Now let's animate the color instead. The diffuse message takes 3 arguments, float values for red, green and blue, on a range of 0 to 1. This example will make the light fade to red, then back to black.
// a light turning on and off light redlight ((0 0 7 1),(0 0 0)) timer ((5),(0),(1),, when(changed,redlight.($value 0 0)), when(,), when(,))
Giving the timer 3 variables, we can smoothly fade between two colors.
// a light changing between two colors light mylight ((0 0 7 1),(1 0 .3)) timer ((5),(1 0 .3),(0 1 .3),, when(changed,mylight.($value $value1 $value2)), when(,), when(,))
(c) Ben Chang