stopwatch (with autostart support)

Displays a stopwatch overlay above the score. Stopwatch overlays may show the main stopwatch time or create their own independent stopwatch.

This cue now supports autostart, meaning it can begin running automatically when the SVG is loaded — in both page and scroll modes — without requiring the playhead to cross.


Syntax

stopwatch(source:<main|new>, hold:<seconds>, scroll:<true|false>,
          offsetX:<pixels>, style:"<css rules>", trig:<auto|edge>)

Arguments

Arg Values Default Behaviour
source "main" / "new" "main" Use global clock or create/reset local stopwatch
hold seconds 0 When >0, overlay fades+removes at timeout
scroll true / false false Follows scrolling score or fixed overlay
offsetX px 0 X-offset from cue location
style CSS — Inline CSS, use ; separated
trig "auto" / "edge" "edge" auto means autostart on load

Behaviour


Autostart (NEW)

Autostart activates when:

trig:auto

Example:

stopwatch(source:new,style:"font-size:3em;color:red",trig:auto)

Autostart behaviour:


Autostart Examples

Main stopwatch, always visible

stopwatch(source:main,style:"font-size:2.5em;",trig:auto)

Independent timer with 10s hold

stopwatch(source:new,hold:10,style:"font-size:2em;",trig:auto)

Scrolling stopwatch

stopwatch(source:new,scroll:true,trig:auto)

Stylised overlay

stopwatch(source:new,
          style:"font-size:4em;color:#0ff;text-shadow:0 0 5px #000;",
          trig:auto)

Edge-triggered Examples (non-autostart)

stopwatch(source:new)
stopwatch(source:main,scroll:true)
stopwatch(source:new,hold:8,offsetX:-30)

Developer Notes


Known Limitations


Driving other cues

Give the stopwatch a uid: and it publishes the time, so the clock can drive the score rather than only being read off it:

Channel Meaning
elapsed seconds since it started
t through its hold, 0–1
remaining seconds left of the hold

t and remaining need a hold: — without an end there is nothing to be a fraction of, so only elapsed is published.

stopwatch(uid:clock, source:new, hold:300)
fade(uid:f1, mode:out, to: follow(clock.t))

The display renders mm:ss and so ticks once a second; the signal is separate and runs at 10 Hz, because a value stepping once a second would visibly stair-step anything it drove. Nothing is published at all unless the cue has a uid: — a score that never names its stopwatch pays nothing for this.

Demo project

See demo-transport: global and private stopwatches, fixed and scroll-following.

http://localhost:8001/?project=demo-transport

Tip: use ← → or ↑ ↓ to navigate the docs