Claude Code
What is the HyperFrames composition contract for deterministic headless video rendering?
QUICK ANSWER
The HyperFrames composition contract requires: 1) a single paused master GSAP timeline registered on window.__timelines, 2) total elimination of non-deterministic functions like Math.random() or performance.now(), 3) pre-computed layout constants to prevent getBoundingClientRect() layout thrashing, and 4) discrete clip scoping with data-start and data-duration.
The Four Headless Render Contract Rules
- Single Paused Timeline: Instantiate
const master = gsap.timeline({ paused: true }); window.__timelines = [master];so headless Chromium can advance time deterministically viawindow.__hfSeek(time). - Zero Non-Deterministic Time: Never call
Math.random(),Date.now(), orperformance.now(). Use seeded PRNG or frame index math (t = frame / fps). - Pre-Computed Spatial Layout: Never invoke
getBoundingClientRect()oroffsetHeightinside animation loops. Animate GPU transform aliases only (x, y, scale, rotation, skew, opacity). - Discrete Clip Scoping: Wrap scene elements in
<div class='clip' data-start='0s' data-duration='4s'>and passimmediateRender: falseto sub-tweens.
Verified against: HyperFrames Engine Specifications