How to play a scene once then stop and reset when pressing a button?

79 views
Skip to first unread message

Mathieu

unread,
Nov 14, 2017, 10:12:56 AM11/14/17
to ligh...@googlegroups.com
In this scenario, you start an effect by pressing a MIDI note (or any other trigger) and then a source starts moving from the left to the right while activating each column one by one, like a step sequencer. 

You want the source to stop when reaching the right side of the grid and wait until you press the MIDI note again.

To do so, you can use this formula for the source's x slider:

xtopercent(noloopcounter(0, grid.lastx, pulse(0.05), 0, onbeat(midi.note(1, 12))))

The trick is to use the noLoopCounter function, which doesn't automatically restarts like the counter function. The pulse(0.05) controls the speed at which the source is moving. In this case, it moves forward each 0.05 second. The MIDI note 12 of the channel 1 is used to start/restart the effect.

If you also want to restart the effect when the grid has just been activated, use this:

xtopercent(noloopcounter(0, grid.lastx, pulse(0.05), 0, onbeat(midi.note(1, 12)) | grid.onactivated))
Reply all
Reply to author
Forward
0 new messages