General
Turn on a button for X seconds
Started by Westbam on .
Sign in or create an account to join the conversation.
I am have some effects, that really only need to last a few seconds. And I if I forget to turn it off, well, lemur can do that for me.
But I am not able to turn a button of after X amount of time.
I tried to make it with a canvas overlay, send to front, to catch the clicks.
I figured I made 2 expressions, one on "On cursor Down" to make X 0 or 1, and Catch the time on that press, and another on that is set 'On Expression x==1' to see when my delay time is passed.
So far I have no success, really hope someone has a golden tip for me.
But I am not able to turn a button of after X amount of time.
I tried to make it with a canvas overlay, send to front, to catch the clicks.
I figured I made 2 expressions, one on "On cursor Down" to make X 0 or 1, and Catch the time on that press, and another on that is set 'On Expression x==1' to see when my delay time is passed.
So far I have no success, really hope someone has a golden tip for me.
To get a button to react after x seconds, you need a few things:
- An expression that is set to the current time, when the button is pressed => timePressed = currenttime
- An expression that calculates the delay => delayPassedcurrenttime - timePressed > delayTime
- An script that listens to that expression and react if it evaluates true => delayPassed == 1
I've attached an example. It has a lot of extra objects to show the above logic.
Button Reset.jzml
- An expression that is set to the current time, when the button is pressed => timePressed = currenttime
- An expression that calculates the delay => delayPassedcurrenttime - timePressed > delayTime
- An script that listens to that expression and react if it evaluates true => delayPassed == 1
I've attached an example. It has a lot of extra objects to show the above logic.
Button Reset.jzml
Wow, I think I understand it, and learned some new tricks about the scripting.
So the expressions keep on monitoring the values, regardless if you do anything with the button.
Thank you soo much, spend too much time in trying to solve this one.
So the expressions keep on monitoring the values, regardless if you do anything with the button.
Thank you soo much, spend too much time in trying to solve this one.
It is also possible to use a Pad and adjust the behaviour parameters and message timing to achieve a delayed turn-off
It can also be used as a ramp up/down if controlling send/return volume rather then just being on-off..
cheers
It can also be used as a ramp up/down if controlling send/return volume rather then just being on-off..
cheers