mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
Replaces the bundled percentage-keyframe model (one GSAP tween per element
with all properties in each keyframe) with per-property-group tweens. Each
studio operation creates/edits only its own group's tween:
drag → position group (x, y)
resize → scale group (scale, scaleX, scaleY) or size group (width, height)
rotate → rotation group (rotation, skewX, skewY)
This eliminates cross-property contamination: dragging no longer changes
scale, resizing no longer changes position, and backfill no longer bleeds
values between unrelated properties.
Architecture:
- PropertyGroupName type + PROPERTY_GROUPS constant + classification functions
- Group-aware animation IDs: #box-to-0-position, #box-from-500-scale
- split-into-property-groups atomic server mutation for legacy tween migration
- resolveGroupTween helper routes each intercept to the correct group tween
- Lazy legacy split: first keyframe edit on a mixed tween splits it into groups
- replace-with-keyframes atomic mutation for extend operations
- Tween cache tracks propertyGroup per keyframe for diamond display
- activeKeyframePct targeting: clicking a diamond targets that exact keyframe
Foundation fixes (from the 6 root causes trace investigation):
- Timeline position resolver for chained tweens (+=, -=, <, >)
- Parse timeline({defaults}) and inherit ease/duration
- Numeric keyframe matching with 2% tolerance
- Non-destructive from/fromTo conversion (merge, not replace)
- Server returns changed:false for no-op mutations
- ID rescue on all mutation functions
- Soft reload: clearProps after kill, globalTimeline sweep, success check
- Drag draft reads GSAP base + delta, cancel restores base
- Gesture recording: sign fix, selection capture, per-property RDP epsilon
- GSAP drag intercept enabled by default
@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