Skip to content

fix: keep frame animations of later Presents off HyperFrames' adapters - #373

Merged
rponeawa merged 1 commit into
hypit-ai:mainfrom
oil-oil:fix/frame-animation-late-present
Oct 8, 2026
Merged

rponeawa merged 1 commit into
hypit-ai:mainfrom
oil-oil:fix/frame-animation-late-present

Conversation

@oil-oil

@oil-oil oil-oil commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #372.

Problem

Since 089c39a, frameAnimationRuntime keeps each element's CSS animation live and paused, and sets its currentTime to Present-relative time on hf-seek. The HyperFrames runtime's own css and waapi adapters also seek every live document animation on each seek, to absolute composition time, and the last writer wins. When a Present starts after frame 0, the captured frame therefore shows the pose at absolute time. For example, a @hypit/media-track Item with enter: fade disappears for most of its window. The issue has a reduced Source and measurements.

Change

  • Setup: read each materialized animation's keyframes and timing once, then cancel() it and set animation-name: none, as 0.2.13 did. HyperFrames then has no live animation to discover or seek.
  • On each seek:
    1. For the Presents active at that frame, build transient Animations from the constructor, which the engine's waapi adapter does not patch.
    2. Set them to the Present-relative time.
    3. Read the animated properties in one computed-style pass.
    4. Cancel the transient Animations before the handler returns.
    5. Write the pose inline.

This keeps 0.2.15's intent of not tabulating every Present frame in every Worker. The cost is now one style evaluation per seek for the animations active at that frame. The frame-work index, selection filtering and absolute-frame derivation are unchanged.

Tests

  • Updated unit test: HyperFrames emits compact absolute-frame animation… now uses a fake DOM that also plays the engine adapters after every seek, moving each still-live animation to absolute time. It asserts:
    • which pose is shown;
    • that no materialized animation stays live;
    • the recorded evaluation positions.
  • New regression case: a Present spanning 30–90 is seeked to 33, 60 and 86 and must show local frame 56, not 86. Against the previous runtime this case fails with the absolute pose.
  • Static checks: the test still rejects a per-frame table, and now also rejects .animate(.
  • pnpm check passes.
  • pnpm test: 1124 tests, 1101 pass, 0 fail, 23 skipped (environment-gated suites).

Render verification

I rendered the reduced Source from #372 on a local HyperFrames Runtime (managed Chrome Headless Shell 152, macOS arm64). Values are the mean luma of the middle Item B, which starts at 30f and fades:

frame 0.2.13 0.2.16 0.2.16 + this PR
33 57.6 116.2 57.6
60 117.0 0.0 117.0
86 88.4 0.0 88.4

The Item that starts at frame 0 and the Item without motion are unchanged in all three.

🤖 Generated with Claude Code

Since 089c39a the frame animation runtime kept each CSS animation live
and paused, and set its currentTime to Present-relative time on hf-seek.
HyperFrames' own css and waapi adapters also seek every live document
animation, to absolute composition time, and the last writer wins. A
Present that starts after frame 0 therefore rendered the pose at absolute
time: a media-track Item with a fade disappeared for most of its window.

Read the authored keyframes and timing once, then cancel the CSS animation
and set animation-name to none, as 0.2.13 did, so the engine never
discovers it. On each seek, evaluate the active poses with transient
Animations built from the constructor, which the waapi adapter does not
patch, read the computed values, cancel them and write the pose inline.
This still avoids tabulating every Present frame.

Fixes hypit-ai#372

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SanHsien added a commit to SanHsien/hypit that referenced this pull request Sep 30, 2026
Triage 19 commits, 20 PRs (hypit-ai#339-hypit-ai#373) and 17 issues (hypit-ai#338-hypit-ai#374) past
the v0.2.12 baseline. Four isolated, tested fixes were cherry-picked
with -x (hypit-ai#347, hypit-ai#345, hypit-ai#339, hypit-ai#361); the rest are recorded as adoption
pending, follow-upstream, monitor or not-applicable in
docs/fork/DECISIONS.md.

Baseline now v0.2.16 (557497b), PR through 373, issue through 374.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@rponeawa
rponeawa merged commit 3a561a9 into hypit-ai:main Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Frame animations of Presents that start after frame 0 render at absolute time since 0.2.15

2 participants