commit e819953379767994f451f1b4a43a7376f67818a3
parent 9178c6271f7318d4dcd95afe3da98cfea122262d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 29 Oct 2026 17:23:56 -0400
umtool frame list: find a frame's run by binary search, seek the exact cut time
The frame-list page played each run as a child tween of an outer GSAP
timeline, and every seek walked all the children: a deck's first render
lists ~10,000 one-frame runs (its fuse). Now one tween drives a clock
whose setter finds the run by binary search and seeks the page's own
timeline at cutFrame / fps -- the very time a whole render seeks, where
the nested tweens reached it through their own arithmetic.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/umtool/report-to-video/compose-chrome.mjs b/umtool/report-to-video/compose-chrome.mjs
@@ -1076,10 +1076,14 @@ export function frameRuns(list) {
/**
* The page that renders only some of the cut's frames: its timeline is swapped,
- * where the page registers it, for one that plays each run of `runs`
- * (frameRuns') as a piece of the cut's timeline in turn -- the windowed
- * render's own tween, once per run -- and the page declares their length.
- * null when the page does not register its timeline the one way this knows.
+ * where the page registers it, for one whose frame f is the cut's frame
+ * `n + (f - j)` of the run `[j, n, len]` of `runs` (frameRuns') holding it --
+ * one tween on a clock whose setter seeks the page's own timeline there, at
+ * exactly the cut time a whole render seeks (`cutFrame / fps`) -- and the
+ * page declares their length. The run is found by binary search: a deck's
+ * first render lists ~10,000 one-frame runs, and a timeline of one child per
+ * run cost every seek a walk over all of them. null when the page does not
+ * register its timeline the one way this knows.
*/
export function frameListHtml(html, region, runs, fps) {
const reg = `window.__timelines["${region}"] = tl;`;
@@ -1091,9 +1095,21 @@ export function frameListHtml(html, region, runs, fps) {
const count = runs.reduce((n, r) => n + r[2], 0);
const helper =
`<script>window.__hfFrames = function (inner) {\n` +
- ` const R = ${JSON.stringify(runs)}, fps = ${Number(fps)};\n` +
+ ` const R = ${JSON.stringify(runs)}, fps = ${Number(fps)}, count = ${count};\n` +
+ ` const cutAt = (f) => {\n` +
+ ` let lo = 0, hi = R.length - 1;\n` +
+ ` while (lo < hi) { const mid = (lo + hi + 1) >> 1; if (R[mid][0] <= f) lo = mid; else hi = mid - 1; }\n` +
+ ` return (R[lo][1] + Math.min(f - R[lo][0], R[lo][2] - 1)) / fps;\n` +
+ ` };\n` +
+ ` let now = 0;\n` +
+ ` const clock = {};\n` +
+ ` Object.defineProperty(clock, "t", { get() { return now; }, set(v) {\n` +
+ ` now = v;\n` +
+ ` inner.seek(cutAt(Math.max(0, Math.min(count - 1, Math.round(v * fps)))), false);\n` +
+ ` } });\n` +
+ ` clock.t = 0;\n` +
` const tl = gsap.timeline({ paused: true });\n` +
- ` for (const [j, n, len] of R) tl.add(inner.tweenFromTo(n / fps, (n + len) / fps, { duration: len / fps, ease: "none" }), j / fps);\n` +
+ ` tl.to(clock, { t: count / fps, duration: count / fps, ease: "none" }, 0);\n` +
` return tl;\n` +
`};</script>\n `;
return html