timer

The timer node is one of the most crucial nodes in the Ygdrasil language. It runs a timer for a specified duration, and can send messages to other nodes when the timer finishes. It can also loop and run forwards and backwards, to make something happen repeatedly.
The real power of the timer is that it also outputs a constant stream of numbers while it is running. These numbers can be just a measure of how much of the time has passed, or it can output ranges of numbers that represent changes in attributes of other nodes like color, position, etc. By connecting the timer to another node, you can create animation - the timer acts as an engine, constantly sending messages to the connected node to change its attributes as the timer runs.

Things you could use a timer for:

Calculating the range of values between a beginning and end value is called interpolation. The timer is based on the interpolate node, which does just that. An interpolate node has a beginning and end value, and you give it a number from 0.0 to 1.0 (meaning, 0 to 100%) to get a value that is somewhere between the beginning and ending values.

The timer just extends the interpolator to automatically change its values over time. The idea of interpolation is also used in other nodes like the fader, which changes transparency based on a value from 0.0 to 1.0, or the pointFollower, which moves objects along a path of points based on a value from 0.0 to 1.0.

The timer (and the interpolator) are linear interpolators, meaning that they interpolate on a straight line from the start to end values. If you make a 10-second timer, then at 5 seconds, the output value will be exactly halfway between the start and end values; at 7.5 seconds, it will be exactly three-quarters of the way between them. Some other, more complex forms of interpolation allow a curve, so the values might change more quickly at the beginning than at the end. In animation this is known as "ease-in" and "ease-out", and is used to make motions less stiff and more lifelike.

Node Reference

Derived from: interpolate
All messages and events from interpolate and value can be used; only the most commonly used are listed here. See the reference pages for interpolate and value for more information.

Messages

MessageParametersDefaultDescription
duration float 1.0 set the timer duration, in seconds
start start the timer moving forward, from zero
stop stop the timer
forward move timer forward
reverse move timer backwards
front move timer to the front
back move timer to the back
startValue float or int 0.0 set the start value for the timer
endValue float or int 1.0 set the end value for the timer
startValues multiple floats or multiple ints 0.0 set multiple start values, to interpolate more than one value at once.
endValues multiple floats or multiple ints 1.0 set multiple end values, to interpolate more than one value at once.
notethe number of start values and the end values must be the same

Events

EventVariablesDescription
front the timer has reached the front
back the timer has reached the back
end the timer has ended at one extreme
changed$value {,$value1, $value2 ...} the value or values of the timer have changed. updates continuously as the timer is running.

(c) Ben Chang