Mono-Flop Tut 1
Xpresso – by: base80
March 13th, 2006
Well here is a mini tutorial about a major node, the Mono-Flop.
In plain English Mono-Flop means Timer, it is a timer node.
The term mono-flop comes from the worlds of electronics and is there to intimidate you.
Well because it is a timer I’ll show the most common use of a timer and that is the light in the hallway.
![monoflop](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/monoflop2.gif)
[More:]
Here is an image of the node:
![monoflop-node](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/node.jpg)
To make it work you need to connect a time-node to the time port.
What the node does is count from 0 to 1 when triggered with a given Duration.
You can trigger (bool) with all kind of things like a collision or a compare or any event.
Ok lets make the light thing.
I made a little model of a button and a light bulb.
What I want is when the button is pressed the light switches on and stays on for a given time.
So I set up a compare node to determine the Y position of the button, when the button goes down to a given point the compare node says True.
I connect this to the trigger port of the mono-flop.
As said before I connect a time node to the time port. And in the Duration port I type 30 frames.
On the output side I connect the Out-port to the intensity of a volumetric light.
Like this,
![monoflop-setup](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/monoflop-setup.jpg)
The result will be like this,
![monoflop1](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/monoflop1.gif)
As you can see the result is very sudden, it is completely on or off. That is because the Out-port gives a bool (0 or 1).
That is ok for a lot of setups but I want a more realistic effect.
So I open the State port, this one gives a range from 0 to 1 on trigger for the given duration.
I connect the State-port to a range mapper to make the smoothness.
![mono-mapper](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/mono-mapper.jpg)
The range mapper makes a smooth bow up and down again. I make it go up and down to map 0 > 1 to 0>1>0
![range-spline](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/range-spline.jpg)
The result is a lamp that glows on and off again.
![monoflop](https://web.archive.org/web/20061026120557im_/http://www.base80.com/xpresso-files/monoflop/light-timer/monoflop2.gif)
There are many possibilities with this node. I makes it possible to make a sequence of events on trigger. Like doors opening and closing automatically as described Here