feat(core): capture motion blur runtime lifecycle · heygen-com/hyperframes@254e20a · GitHub
Skip to content

Commit 254e20a

Browse files
vanceingallsclaude
andcommitted
feat(core): capture motion blur runtime lifecycle
Wire the pure modules into the composition runtime. A root that opts in with data-motion-blur wraps itself in a capture canvas and, per frame, redraws its fast movers along their paths into an output canvas. The runtime turns itself off, and says why, when the browser lacks html-in-canvas, when a WebGL or nested capture canvas is present, or when the engine's own sub-frame blur is on. It unwraps when paused so Studio can select inside. A frame whose paint never comes within 2000 ms is rendered as plain DOM (root back in the page, movers revealed), counted in report().failedFrames and never counted toward giving up. The page-side off switch, PAGE_MOTION_BLUR_OFF_GLOBAL, is exported from @hyperframes/core for the engine to set. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent af29b40 commit 254e20a

7 files changed

Lines changed: 991 additions & 2 deletions

File tree

‎packages/core/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Set by the engine: its own sub-frame blur runs, or the Studio preview could not blur.
2+
export const PAGE_MOTION_BLUR_OFF_GLOBAL = "__HF_PAGE_MOTION_BLUR_OFF__";
3+
4+
export function supportsCaptureMotionBlur(win: Window = window): boolean {
5+
const w = win as Window & {
6+
CanvasRenderingContext2D?: { prototype: object };
7+
HTMLCanvasElement?: { prototype: object };
8+
};
9+
const ctx = w.CanvasRenderingContext2D?.prototype;
10+
const canvas = w.HTMLCanvasElement?.prototype;
11+
return !!ctx && !!canvas && "drawElementImage" in ctx && "requestPaint" in canvas;
12+
}
Lines changed: 311 additions & 0 deletions

0 commit comments

Comments
 (0)