16Object 16 · Dials & knobs
Search Dial
The heavy dial of an edit console. JOG steps frames under your finger, SHTL is a spring-return shuttle whose angle is the speed, SCRL is a flywheel you flick and it coasts. J, K and L work as in every editor.
- Version
- 0.1.0
- Size
- 15.3 KB gzipped
- Access
- With a Pass
- Needs
- search-dial.mjs + search-dial.css
- Tests
- 8 tests · 13 states
On this page
Use it
Moving through time with a hand on it: scrubbing a video or a call recording, stepping through an agent run's trace or a deploy's log, reviewing a sensor's history frame by frame. Bound to an audio or video element it follows the media's time and seeks it. It is a real slider over the timeline (seconds, spoken as minutes, seconds and frame) with arrows for frames, Shift for seconds, Page keys for ten, and J K L; the three modes are a radio group of lit keys.
Copy the search-dial folder from its package next to your page, link its stylesheet and construct it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).
<link rel="stylesheet" href="search-dial/search-dial.css">
<div id="search-dial" style="width: min(90vw, 400px)"></div>
<script type="module">
import SearchDial from './search-dial/search-dial.mjs';
const searchDial = new SearchDial(document.getElementById('search-dial'), {
mode: 'jog',
position: 83.56,
duration: 600,
});
// searchDial.update({ … }); change any option in place
// searchDial.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| mode | jog · shtl · scrl | 'jog' | JOG steps frames under the finger; SHTL is a spring-return shuttle, its angle its speed; SCRL is a flywheel you flick. |
| position | number, 0 to 3600 | 83.56 | Playhead (s) |
| duration | number, 10 to 36000 | 600 | Bound to an audio or video element, the media’s own length is used. |
| fps | 24 · 25 · 30 · 50 · 60 | '25' | The timecode’s frames, and one JOG step. |
| finish | auto · aluminium · graphite | 'auto' | Auto follows the page’s data-finish. Aluminium reads on an LCD, graphite on a VFD. |
| light | number, 0 to 345 | 315 | The turned face’s bow-tie points at it and stays there as the dial turns. |
| readonly | boolean | false | Read-only |
| sound | boolean | false | Synthesised, no audio file: the shuttle ring clicks at each speed step, out and back; a mode key latches. Only after the dial is touched. |
| label | text | 'Timeline' | Accessible name |
Methods
new SearchDial(element, options)- Builds it inside the element with these options.
value- The playhead, seconds.
speed- How fast the playhead runs: the shuttle's while it is off rest or held, else J K L's.
update(opts = {})- Change options in place.
setMode(mode, { user = false } = {})shuttleKey(k)- J / K / L: play backwards (faster each press), stop, play forwards (faster each press).
destroy()- Stops it and cleans up after it.
Events it fires, which bubble from the element: change, input.
States
- At restThe timecode on the lit display, the lamp on the mode in use, the turned face's bow-tie toward the room lamp; nothing runs.
- JOGThe dial under the finger with no lag; the playhead steps whole frames, two seconds to a turn.
- SCRLTwelve seconds to a turn; flick and let go and the dial keeps turning, slowed by its own friction, until it stops.
- SHTLTurn up to 150° either way: the further, the faster, from a quarter to thirty-two times; let go and it swings home and the playhead stops.
- Tap a sideFor a single pointer with no drag: a click or tap left or right of the dial's centre moves one notch that way. JOG a frame, SCRL a second, both turning the dial as far as a hand would have; SHTL one speed step, latched (faster the same way, slower the other, through stop into reverse). A press that wanders more than 8 px is a turn, not a tap; the middle of the dial takes no tap; touching the wheel in JOG or SCRL stops the transport.
- J K LL plays, each further L doubles the speed; J the same backwards; K stops.
- At an endThe playhead stops at the start or the end.
- MediaBound to an audio or video element it takes the media's length and follows its time; moving the dial seeks it.
- AluminiumA bead-blasted plate, a turned aluminium dial, a reflective LCD.
- GraphiteA soft-touch plate, a dark turned dial, a vacuum-fluorescent display.
- Read-onlyA display of the playhead: the hand does nothing.
- Off screen or hiddenIt draws nothing.
- Reduced motionNo coasting and no spring: the dial stops where it is let go; taps step exactly as they do with motion; every reading is the same.
How it works
Made of: Turned anisotropic sheen, Heightfield turned metal, Pitch slip rubber ring, Concentric well stack, Room fixed sheen, Jog shuttle scroll, Flywheel friction, Shuttle return spring, Jkl transport, Tap a side notch, Media binding, Sleeping loop.
Original. The dial's face is a heightfield shaded per pixel once per size and finish, with an anisotropic term for the turned grooves; a rubber shuttle ring with grip ridges is baked once and drawn turned by the part of its angle inside one ridge pitch, so it turns in SHTL and springs home; the wheel turns in JOG and SCRL. The well, the wheel's side wall and every shadow are baked once, and the finger cup is a round sprite carried round. A frame is three drawImage calls and two small sprites.