Make the mouth lead legible and assertable
"It feels like it does nothing" is indistinguishable from "it does nothing", and at 24fps a lead of 1 is 42ms - small enough to reasonably doubt. So the shift is now provable and visible rather than taken on trust: - shiftIndex is a pure exported function with assertions covering identity, both directions, and clamping at each end - the frame label always shows the mouth frame, not only when shifted, so the number can be watched diverging from f; non-zero leads also report in ms - the slider readout carries an explicit + sign - the stabilised pane draws the unshifted contour as a dark-green ghost when a lead is set, so the offset is something you can see Also: leadIndex called opts() on every invocation - ~14 DOM reads, once per strip thumbnail, so ~1000 per redraw at 74 frames. It reads a cached scalar now. The "different pose" assertion checks the whole track rather than one pair: synthetic poses hold for nine-frame beats, so a single pair can legitimately be identical while the shift works correctly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f9b8ec8617
commit
dc0a3f34e6
4 changed files with 56 additions and 10 deletions
|
|
@ -177,3 +177,12 @@ export function heldFrame(kept, f) {
|
|||
for (const k of kept) { if (k <= f) hit = k; else break; }
|
||||
return hit;
|
||||
}
|
||||
|
||||
// Shift a performance track against the clock, clamped at the ends.
|
||||
//
|
||||
// Pure and exported so the shift can actually be asserted: "the slider feels
|
||||
// like it does nothing" is otherwise indistinguishable from "the slider does
|
||||
// nothing", and at 24fps a lead of 1 is 42ms, which is small enough to doubt.
|
||||
export function shiftIndex(f, lead, n) {
|
||||
return Math.min(n - 1, Math.max(0, f + lead));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue