ui()
ui() applies performer-facing UI changes during playback — most commonly to hide or reveal interface elements such as the playhead, play zone, overlays, or control panels.
It can target:
- HTML elements using a CSS selector
- SVG animation elements using the
uidparameter (including associated HTML overlays)
The UI cue system was primarily designed to manage visibility of the playhead and play zone, allowing scores to shift between guided, open, or reduced-UI performance states.
Syntax
Selector mode (HTML elements)
ui("<css selector>", opacity:<number>, scale:<number>, x:<px>, y:<px>, rotate:<deg>, visible:<bool>, color:<css>, bg:<css>, z:<number>, dur:<seconds>)
UID mode (SVG animations + overlays)
ui(uid:<animation-uid>, visible:<bool>, action:toggle, dur:<seconds>, click:1)
What it affects
Selector mode
- Works on: HTML UI elements
- Does not affect: SVG score elements
- Multiple matches: All matching elements are updated
UID mode
- Works on: SVG animation elements registered in
oscillaAnimRegistry - Also affects: Associated HTML overlays (hit labels, OSC controls, etc.)
- Single target: Matches by animation uid
UID Mode — Targeting SVG Animations
The uid parameter targets SVG animation elements by their unique identifier. This is especially useful for:
- Hiding/showing animated polygons or objects
- Toggling visibility of elements and their associated overlays
- Creating clickable toggle buttons in the score
Syntax
ui(uid:<animation-uid>, visible:true|false, dur:<seconds>)
ui(uid:<animation-uid>, action:toggle, dur:<seconds>)
What gets hidden/shown
When targeting by uid, the following are affected:
- SVG element — The animated element itself
- HTML overlays — Hit labels, OSC controls, waveforms associated with that uid
- O2P overlays — Object-to-path animation overlays
Example: Hide a polygon
ui(uid:rot_triangle, visible:false, dur:0.3)
Example: Toggle visibility
ui(uid:rot_triangle, action:toggle)
Creating Clickable Toggle Buttons
Combine ui() with click:1 to create native SVG toggle buttons:
<g id="ui(uid:rot_triangle, action:toggle, click:1)">
<rect x="0" y="0" width="50" height="30" rx="4" fill="#d4af37"/>
<text x="25" y="20" text-anchor="middle" fill="#000">TRI</text>
</g>
When clicked, this toggles visibility of the element with uid:rot_triangle and all its associated overlays.
See button() documentation for more on click:1.
Initial Visibility State
When using click:1 with a ui() cue, you can set the initial visibility state of the target element using the visible parameter:
<!-- Target starts HIDDEN - click to show -->
<g id="ui(uid:rot_triangle, action:toggle, visible:false, click:1)">
<path d="M 20,-18 L 38,18 L 2,18 Z" style="fill:#d4af37"/>
<text x="20" y="38">TRI</text>
</g>
<!-- Target starts VISIBLE (default) - click to hide -->
<g id="ui(uid:rot_pentagon, action:toggle, click:1)">
<path d="M 15,-10 L 25,-3 L 21,9 L 9,9 L 5,-3 Z" style="fill:#9370db"/>
<text x="15" y="22">PENT</text>
</g>
visible:false— Target element starts hidden when the page loadsvisible:trueor omitted — Target element starts visible (default behavior)
This is useful for scores where certain animated elements should be revealed during performance rather than shown from the start.
Toggle State Indicator
When using click:1 or drag-click:1 with action:toggle, the clickable overlay displays a visual indicator showing the current state of the target element:
- Green solid outline — Target element is currently visible
- Red dashed outline — Target element is currently hidden
This helps performers quickly identify which elements are toggled on or off without needing to search the score.
The indicator updates automatically when:
- The toggle button is clicked
- Initial visibility is set via
visible:false - Visibility state is restored from saved JSON
- A preset is recalled that includes visibility state
State Persistence
Visibility state is automatically saved to JSON and restored when the score reloads. The indicator reflects the correct state on load by checking (in priority order):
- Saved JSON state — Previously persisted visibility
visible:parameter — Initial state defined in the cue- Default — Visible (true)
Multiple Buttons for Same Target
If multiple toggle buttons target the same uid, all their indicators stay synchronized. Clicking any one of them updates all indicators for that target:
<!-- Both buttons toggle the same element and stay in sync -->
<g id="ui(uid:rot_triangle, action:toggle, click:1)">
<rect x="0" y="0" width="45" height="24" fill="#d4af37"/>
<text x="22.5" y="16">TRI</text>
</g>
<g id="ui(uid:rot_triangle, action:toggle, click:1)">
<rect x="100" y="0" width="45" height="24" fill="#d4af37"/>
<text x="122.5" y="16">TRI 2</text>
</g>
Preset Integration
Visibility state is included when saving and recalling presets. This allows presets to capture both fader positions AND which UI elements are visible or hidden, restoring the complete performance state.
Built-in UI toggle button
Oscilla includes a GUI button in the bottom-right corner that toggles:
- Playhead
- Play zone
on and off.
This button uses the same internal UI logic as the ui() cue and exists to allow fast switching between visible guidance and reduced interface modes during performance.
Parameters
Common
dur(seconds, default0) — Transition durationclick:1— Make the element clickable (creates invisible HTML overlay)drag-click:1— Make the element both draggable AND clickable (click triggers action, drag repositions)tooltip:"text"— Add hover tooltip text
Selector mode only
visible:true|falseopacity(number)x,y(px)scale(number)rotate(degrees)color(CSS color)bg(CSS background color)z(z-index)
Transforms are stateful and combined.
UID mode only
uid:<string>— Target animation by unique identifiervisible:true|false— Set visibility explicitly (also sets initial state when used withclick:1)action:toggle— Toggle current visibility state
Examples
Selector mode (HTML elements)
// Fade out playhead
ui("#playhead", opacity:0, dur:0.3)
// Hide playhead
ui("#playhead", visible:false, dur:0.3)
// Hide multiple elements
ui("#playhead, #playzone", visible:false, dur:0.25)
// Show multiple elements
ui("#playhead, #playzone", visible:true, dur:0.25)
UID mode (SVG animations)
// Hide a polygon animation and its overlays
ui(uid:rot_triangle, visible:false, dur:0.5)
// Show it again
ui(uid:rot_triangle, visible:true, dur:0.5)
// Toggle visibility
ui(uid:rot_pentagon, action:toggle)
Clickable toggle buttons (click:1)
<!-- Create a clickable SVG button that toggles the triangle -->
<g id="ui(uid:rot_triangle, action:toggle, click:1)">
<rect x="0" y="0" width="45" height="24" rx="4" fill="#d4af37"/>
<text x="22.5" y="16" font-size="10" text-anchor="middle">TRI</text>
</g>
<!-- Toggle the pentagon -->
<g id="ui(uid:rot_pentagon, action:toggle, click:1)">
<rect x="55" y="0" width="45" height="24" rx="4" fill="#9370db"/>
<text x="77.5" y="16" font-size="10" text-anchor="middle">PENT</text>
</g>
Draggable + clickable toggle buttons (drag-click:1)
Use drag-click:1 when you want the toggle button to be repositionable:
<!-- Draggable toggle button - drag to move, click to toggle -->
<g id="ui(uid:synthLevels, action:toggle, drag-click:1, visible:false)">
<rect x="0" y="0" width="50" height="48" rx="4" fill="#f0f0f0" stroke="#999"/>
<!-- Drag handle lines at top -->
<line x1="15" y1="6" x2="35" y2="6" stroke="#888" stroke-width="1.5"/>
<line x1="15" y1="10" x2="35" y2="10" stroke="#888" stroke-width="1.5"/>
<!-- Icon -->
<text x="25" y="38" text-anchor="middle" font-size="18">🎚</text>
</g>
- Click triggers the toggle action (show/hide the target element)
- Drag repositions the button (position is persisted)
- The drag handle lines indicate it's draggable
Design notes
- Intended for performance-state control
- Touch- and tablet-friendly
- Reduces visual clutter
- Suitable for audience-facing projections
- UID mode allows control over animated elements and their overlays as a unit
click:1enables creation of custom toggle buttons using native SVG visualsdrag-click:1combines draggability with click actions for repositionable controls
Tip: use ← → or ↑ ↓ to navigate the docs