发布

  • fix(shader-transitions): add engine-render-mode init using tl.set tweens

    frostbyte_neo 发布于 2026-04-19 21:26:24 +00:00

    When the page is loaded by the Hyperframes engine, init() would happily set
    up GL contexts and html2canvas captures even though the engine composites
    every transition itself from window.__hf.transitions metadata. That work was
    both wasted and harmful: scenes were left at opacity: 0 (waiting for the
    async capture to resolve) when the engine sampled the DOM, so
    queryElementStacking() reported them invisible and the layered HDR
    compositor produced black frames between transitions.

    Engine mode is detected via window.__HF_VIRTUAL_TIME__ (the shim the engine
    injects). When present, initEngineMode() runs instead of the GL pipeline and
    schedules deterministic opacity flips:

    • tl.set('#toId', { opacity: 1 }, T) // crossfade start
    • tl.set('#fromId', { opacity: 0 }, T + d) // crossfade end

    tl.set (zero-duration tweens) is required instead of tl.call, because
    tl.call only fires in the direction of playback. The engine's warmup loop
    seeks forward through every transition start and then the main render loop
    seeks back to t=0 — tl.call-set state would get stuck. tl.set tweens
    revert cleanly on backward seeks.

    The new path still calls the shared registerTimeline() helper so the timeline
    shows up on window.__timelines[compId] for the engine to drive.

    Made-with: Cursor

    下载附件