rename jog -> throttle
Hunter
Friday, November 13th, 2026 at 9:59 PM
14
15 ### run it back.
16
-<p align="center"><img src="readme_images/jog.gif" width="390"></p>
17 +<p align="center"><img src="readme_images/throttle.gif" width="390"></p>
18
19 ### wipeout.
20
Binary files differ.
4 const FOLLOW_SECONDS = 0.05;
5 // Extra acceleration for the part of a speed gap beyond 1, so big gaps close fast.
6 const FAST_DECAY_SECONDS = 0.35;
-// A tape jogged slower than this, as a fraction of normal speed, counts as stopped.
-const SLOWEST_JOG = 0.05;
7 +// A throttle setting slower than this, as a fraction of normal speed, counts as stopped.
8 +const SLOWEST_THROTTLE = 0.05;
9 // Volume smoothing, against clicks.
10 const VOLUME_SECONDS = 0.02;
11 const RENDERS_PER_REPORT = 3;
58 }
59 // A deleted tape fades out first, so that a playing one does not click.
60 if (data.type === 'delete') tape.fadeRate = this.deleteRate;
- if (data.type === 'jog') {
61 + if (data.type === 'throttle') {
62 tape.target = tape.base + data.change;
63 this.reportDirection(data.id);
64 }
65 if (data.type === 'drop') tape.pressed = false;
66 if (data.type === 'release') {
67 tape.held = false;
- if (Math.abs(tape.target) < SLOWEST_JOG) {
68 + if (Math.abs(tape.target) < SLOWEST_THROTTLE) {
69 tape.target = 0;
70 tape.speed = 0;
71 }
76
77 reportDirection(id) {
78 const tape = this.tapes[id];
- const direction = Math.abs(tape.target) < SLOWEST_JOG ? 0 : Math.sign(tape.target);
79 + const direction = Math.abs(tape.target) < SLOWEST_THROTTLE ? 0 : Math.sign(tape.target);
80 if (direction === tape.direction) return;
81 tape.direction = direction;
82 this.port.postMessage({type: 'direction', id, direction});
158 pressed: false,
159 // Speed lost per sample while stopping.
160 stopRate: 0,
- // Speed when a jog began.
161 + // Speed when a throttle drag began.
162 base: 0,
- // Last direction reported to the main thread during this jog.
163 + // Last direction reported to the main thread during this throttle drag.
164 direction: null,
165 volume,
166 // Smoothed `volume`.
17 const MAX_VOLUME = 2;
18 // Time constant of bar height changes.
19 const BAR_EASE_SECONDS = 0.035;
-// Jog scroll speed grows with drag distance up to SCROLL_FULL_DRAG px, where it
20 +// Throttle scroll speed grows with drag distance up to SCROLL_FULL_DRAG px, where it
21 // reaches SCROLL_TOP_SPEED px/s.
22 const SCROLL_FULL_DRAG = 100;
23 const SCROLL_TOP_SPEED = 1000;
24 // Sideways drag distance, in CSS px, that changes a tape's speed by 1.
-const JOG_DRAG = 100;
25 +const THROTTLE_DRAG = 100;
26 // The iOS built-in microphone is super quiet with processing off, and while it is
27 // open the speaker plays quieter. These gains compensate.
28 const BUILT_IN_MICROPHONE_GAIN = 20;
357 const upTravel = Math.abs(event.clientY - start.y);
358 if (Math.max(acrossTravel, upTravel) < DRAG_THRESHOLD) return;
359 if (acrossTravel < upTravel && pressed) return;
- mode = acrossTravel >= upTravel ? 'jog' : 'volume';
360 + mode = acrossTravel >= upTravel ? 'throttle' : 'volume';
361 clearTimeout(pressTimer);
362 clearTimeout(holdTimer);
363 row.classList.add('grabbed');
- if (mode === 'jog') send('grab');
364 + if (mode === 'throttle') send('grab');
365 pressed = false;
366 }
- if (mode === 'jog') {
- send('jog', {change: (event.clientX - start.x) / JOG_DRAG});
367 + if (mode === 'throttle') {
368 + send('throttle', {change: (event.clientX - start.x) / THROTTLE_DRAG});
369 } else {
370 const change = (start.y - event.clientY) / row.clientHeight;
371 tape.volume = Math.min(MAX_VOLUME, Math.max(0, start.volume + change));
382 start = null;
383 row.classList.remove('grabbed');
384 if (mode === 'volume') saveVolume(tape);
- if (mode === 'jog') {
385 + if (mode === 'throttle') {
386 send('release');
387 } else if (!mode && event.type === 'pointerup') {
388 send(wasPlaying ? 'brake' : 'play');
396 row.addEventListener('pointercancel', end);
397 }
398
-// Jog control: while held, scroll speed follows the offset from the press point.
399 +// Throttle control: while held, scroll speed follows the offset from the press point.
400 const footer = document.querySelector('footer');
401 let scrollDrag = null;
402