Event Messages
Event
Data
Events
such as enter and button1 can also carry information
about the event with them.
We
can access the data by placing a keyword after the dollar sign.
For
example, the userTrigger
event enter carries with it the name of the user that entered.
Whe can access the user name only when the event
happens:
myUserTrigger.when( enter,
print($user has entered the trigger) )
Loops
and Pendulums
A timer can be paused at
any time by sending the stop message.
The direction the timer
continues in depends on the message it receives, either forward or reverse.
The timer mode can be setup
to repeat in one of two modes.
The loop mode behaves somewhat like a music or movie file, looping back
to the beginning:
myTImer.when( end, start )
The start message always
begins the timer at the front.
The pendulum mode
behaves more like a swinging door or the wings of a bird, moving in forward and
reverse:
myTimer.when( back,
reverse )
myTimer.when( front,
forward )
Dynamic Events
Most events are discrete
events, meaning that they happen at a single moment in time (i.e. enter,
exit).
Some events, called dynamic events, can happen over a period of time.
The timer
node creates a dynamic event called changed and carries with it the
current value of the timer node:
myTimer.when( changed,
print(the current value is $value) )
The value of the timer node moves between the startValue and the endValue
over the duration.
The default start value is 0.0 and the default end
value is 1.0.