trig:<object> — cues fired by a moving object
Any cue that can be fired by the playhead can instead be fired by another
object passing over it: give the cue trig:<uid> naming the object. The
object becomes a playhead of its own — a trans() or o2p() mover, a
drag()-able shape, a controlXY point — and nothing has to be declared on
it; it is found by its uid.
trans(uid:readPH, to:[w1e, w2s, w2e], dur:[6, 0.15, 6], trig:auto) ← the "playhead"
synth(uid:n1, wave:sine, freq:m67, dur:0.3, trig:readPH) ← fired when readPH crosses it
audio(file:hit.flac, trig:readPH)
rotate(uid:r1, dur:1, trig:hand) ← fired by drag(uid:hand, …)
notation(…, trig:readPH) ← notes play one by one
How it fires
- Enter / leave. The object's bounding box is tested against the cue's
every frame (screen space, so nested transforms, page overlays and the
scrolling score are all the same). The cue fires when the object enters
it and re-arms when it leaves — a
mode:looporalternatemover retriggers on every pass. Addonce:1to fire a single time. - Same path as the playhead. Firing goes through the normal cue trigger,
so audio, synth, text, osc, midi, animations and
notation()all work. Animation cues withtrig:<uid>wait for their object even in page mode, where they would otherwise start on load. - Notation. A
notation()host expands to its notes: each note fires its own OSC/MIDI as the object crosses it — a reading line moving along a stave plays the stave. - Per client, like playhead cues: every client tests its own copy. A
sync:0mover with random legs will therefore fire at different moments on different devices — by design. - A referenced object keeps running while offscreen (it is exempt from the offscreen pause), so its cues fire whether or not the mover is in view.
Where it is useful
Page mode has no transport playhead, so page cues are otherwise limited
to trig:auto and clicks. A trans() line following the staves of a
notation page, with trig:<uid> targets on the notes, turns the page into a
playable score — see the demo-score-follow project: the reading line
readPH on the Bach page fires a small synth on every note it crosses.
Scroll mode gains a second, free-roaming playhead: an o2p() object
circling a path can fire cues on each lap while the transport playhead does
its own work. A cue has one trig:, so nothing fires twice.
Demo project
demo-trig-object walks through the four shapes of it on one scrolling
score: an o2p disc circling a path fires colour, rotation, scale and a
synth every lap (A); a trans bar in mode:alternate plays five notes
forwards and, because they re-arm on leave, again on the way back (B); a
drag() disc you move by hand fires whatever you cross, with one target on
once:1 (C); and a notation() stave is played note by note by a reading
line (D). Rehearsal marks A–D jump between the sections.
In the DSL editor
The trig selector has an object… entry that reveals a box for the
uid; the cue serialises as trig:<uid>.
Notes
- The uid must not be one of the built-in modes (
playhead,click,toggle,extent,touch,auto,manual,osc,midi). - Hits are box-against-box. A thin line sweeping a note works; two large overlapping shapes fire as soon as their boxes touch.
extent:has no effect on an object-triggeredaudio/synthcue: the extent is the playhead's crossing region, and here the hit box is the element itself. Give the voice a length withdur:(the editor hides the extent handle for these). Make the element big enough to read — a synth draws its waveform inside its own box.
Tip: use ← → or ↑ ↓ to navigate the docs