mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-11 19:09:20 +00:00
The prior implicit-transform-from fix corrected EVERY implicit-from tween matching a decomposed transform property, not just the first one on a given target. Confirmed via a real render + PSNR A/B test against the commit before that fix: registry/examples/product-promo's nested scene1-logo-intro.html animates each Figma logo piece with two tweens on the same target+property (an instant duration:0 jump off-screen, then an implicit-from "converge to center" tween) -- the second tween correctly inherits its "from" from the first tween's just-set value inside anime.js, but the prior fix overwrote it with the element's true CSS/page-load identity value instead, making the piece appear already-assembled at the center from frame 0. This regressed product-promo's PSNR from ~50.5dB to ~47.0dB. Only apply the CSS-cascade correction to the tween with the smallest `_absoluteStartTime` for each distinct (target, property) pair; every later implicit-from tween on that same pair is left untouched, since anime.js already chains it correctly from the preceding tween. Verified: the product-promo regression is resolved (51.2dB, back above baseline) while flowchart/kinetic-type retain their original fix's improvement.
@hyperframes/core
Types, parsers, generators, compiler, linter, runtime, and frame adapters for the Hyperframes video framework.
Install
npm install @hyperframes/core
Most users don't need to install core directly — the CLI, producer, and studio packages depend on it internally.
What's inside
| Module | Description |
|---|---|
| Types | TimelineElement, CompositionSpec, Asset, canvas dimensions, defaults |
| Parsers | parseHtml — extract timeline elements from HTML; parseGsapScript — parse GSAP animations |
| Generators | generateHyperframesHtml — produce valid Hyperframes HTML from a composition spec |
| Compiler | compileTimingAttrs — resolve data-start / data-duration into absolute times |
| Linter | lintHyperframeHtml — validate Hyperframes HTML (missing attributes, overlapping tracks, etc.) |
| Runtime | IIFE script injected into the browser — manages seek, media playback, and the window.__hf protocol |
| Frame Adapters | Pluggable animation drivers (GSAP, Lottie, CSS, or custom) |
Frame Adapters
A frame adapter tells the engine how to seek your animation to a specific frame:
import { createGSAPFrameAdapter } from "@hyperframes/core";
const adapter = createGSAPFrameAdapter({
getTimeline: () => gsap.timeline(),
compositionId: "my-video",
});
Implement FrameAdapter for custom animation runtimes:
import type { FrameAdapter } from "@hyperframes/core";
const myAdapter: FrameAdapter = {
id: "my-adapter",
getDurationFrames: () => 300,
seekFrame: (frame) => {
/* seek your animation */
},
};
Parsing and generating HTML
import { parseHtml, generateHyperframesHtml } from "@hyperframes/core";
const { elements, metadata } = parseHtml(htmlString);
const html = generateHyperframesHtml(spec);
Linting
import { lintHyperframeHtml } from "@hyperframes/core/lint";
const result = lintHyperframeHtml(htmlString);
// result.findings: { severity, message, elementId }[]
Documentation
Full documentation: hyperframes.heygen.com/packages/core
Related packages
@hyperframes/engine— rendering engine that drives the browser@hyperframes/producer— full render pipeline (capture + encode)hyperframes— CLI