Communitygithub.com

heygen-com/hyperframes

HyperFrames 合成协议——构建一个可渲染的项目。用于合成结构、`data-*` 时间属性、`class="clip"`、轨道、子合成、变量、框架自有媒体播放、确定性渲染规则以及验证。在编写合成 HTML 之前请先阅读。

hyperframes 是什么?

HyperFrames 是一个将 HTML 文档渲染为视频的框架。此技能描述了构建一个 HyperFrames 合成项目的技术协议。它涵盖了两种根形式(独立式和子合成)、`data-*` 属性的声明式时间控制、通过 GSAP 时间线实现的确定性渲染、媒体(视频/音频)的框架自有管理,以及严格的验证规则。 该技能帮助开发者在一个项目中组织组成结构,包括轨道、剪辑、子合成和变量。它强制执行关键的可移植性约束,例如避免 CSS 变换与 GSAP 动画之间的冲突,禁止在剪辑元素上设置可见性,以及确保时间线唯一标识符。 该技能支持多个平台(例如 Claude Code、Cursor),并与 `hyperframes-cli` 等 CLI 工具集成以进行检查、预览和渲染。它依赖于一个参考文档生态系统(`references/`),其中包含关于最小合成、模式、属性、轨道、子合成、媒体和确定性规则的详细指南。 通过遵循此协议,AI 代理可以生成保证可预测、可查找且错误最少的合成,从而确保 Studio IDE 和服务器端渲染流水线之间的行为一致。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/heygen-com/hyperframes/tree/main/skills/hyperframes-core

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

插件安装: 在执行安装或更新命令之前,如果此技能位于 HyperFrames 插件内部,请遵循 插件执行规则。独立安装则保留下方的更新说明。

HyperFrames 核心

Agent 常见陷阱(先读):

  • 使用 flex/inset 居中,而不是在节点上使用 CSS transform: translate(-50%,-50%) 然后使用 GSAP x/y。Lint 规则:gsap_css_transform_conflict。请使用 fromTo 或 xPercent/yPercent。
  • 不要添加场景退出的 tl.set(..., {visibility:"hidden"})。运行时已经隐藏了定时剪辑。在内部节点(或 .clip 上的 opacity)上使用不透明度淡入淡出就足够了。字幕硬消失是另一条规则。
  • window.__timelines["id"] 必须与根元素的 data-composition-id 匹配。
  • 在 render 之后,阅读摘要的第二行:beginframe vs screenshot、GPU 模式、阶段时长。screenshot + Linux 上的 software gpu 是慢路径。

HyperFrames 从 HTML 渲染视频。合成是一个 HTML 文件,其 DOM 使用 data-* 属性声明时间,其动画运行时是可查找的,并且其媒体播放由框架拥有。

此技能是技术协议——如何构建一个 HyperFrames 项目。以下内容是构建指南;按主题的详细信息位于 references/(索引如下),按需阅读。流程文档(简报、故事板、审核、制作、分发、帧处理工作器)位于 /hyperframes → references/。其他关注点位于同级领域技能中——hyperframes-animation、hyperframes-creative、media-use、hyperframes-cli、hyperframes-registry。/hyperframes 中的能力映射说明了每个技能覆盖的内容。

参考

文件阅读目的
references/minimal-composition.md从最小的可渲染合成骨架开始
references/composition-patterns.md选择整体式与模块化;构建模块化 index.html;选择子合成原型
references/data-attributes.md查阅任何 data-*(根 / 剪辑 / 子合成宿主 / 旧别名);使用 class="clip"
references/tracks-and-clips.md了解 data-track-index 的作用(和不作用)、z-index、相对于另一个剪辑的时间定位;使用 npx hyperframes timeline 列出每个轨道和剪辑
references/creator-editing-recipes.md复制真实的剪切/修剪/重新排序/重新计时/冻结/相机/遮罩/交叉淡入淡出/音频编辑配方及其限制
references/sub-compositions.md连接子合成(宿主属性、<template>、实例变量)并在其内部进行动画
references/variables-and-media.md声明变量;放置 <video>/<audio>,设置音量,修剪
references/determinism-rules.md构建可查找的时间线;确定性禁令;布局/文本适配
references/full-screen-motion.md使用共享背景创作全帧运动
references/tailwind.md在 Tailwind v4 项目中工作(init --tailwind;运行时合约与 Studio 的 v3 不同)

有关动画运行时细节(GSAP API、Lottie、Three.js 等),请转到 hyperframes-animation → adapters/<runtime>.md。

构建合成

两种根形式(不可互换)

  • 独立式(顶层 index.html):根 <div data-composition-id="…"> 直接位于 <body> 中,没有 <template> 包装器。包装独立根会隐藏所有内容,并且 lint 会拒绝它(standalone_composition_wrapped_in_template,错误)。
  • 子合成(通过 data-composition-src 加载):将根包装在 <template> 中。这是推荐的编写形式:加载器也接受纯完整文档并回退到其 <body>,但模板化形式是示例和工具假设的形式。

⚠ 传输规则:对于模板化子合成,组装器会丢弃文件自身的 <head> <style>/<script>(packages/core/src/compiler/compositionAssembly.ts,hasTemplate 门),因此请将 <style>/<script> 放在模板内部。<link> 在两种情况下都会被提升。 ⚠ 宿主 ID 约定:给宿主槽、内部模板和 window.__timelines["<id>"] 键使用相同的 ID。支持不同的本地 ID(组装器回退到文件中的第一个根),但不匹配是静默的,因此除非有理由不这样做,否则请使它们匹配。

文件形状、宿主连接和渲染前检查清单 → references/sub-compositions.md。

根必须有尺寸(静默布局错误)

独立根使用 width/height: 100%。画布大小是 data-width/data-height。运行时将这些像素标记到合成根上。不要硬编码 1920px/1080px 到 #root。骨架 → references/minimal-composition.md。

一个暂停的时间线

每个合成注册恰好一个 gsap.timeline({ paused: true }) 到 window.__timelines["<id>"](键 = 根 data-composition-id)。在异步回调(document.fonts.ready)内部构建它是支持的;重要的是仅在构建完成后注册。渲染长度是根的 data-duration,而不是时间线的长度:超出根时长的部分会被截断,提前结束则保持其最后一帧。省略根 data-duration 则将推断长度(时间线、媒体窗口或适配器)。您不需要 window.__timelines = window.__timelines || {}:运行时在您的内联脚本运行之前创建注册表,并且 lint 不再要求它。不要手动将子时间线嵌套到宿主中;运行时自动嵌套已注册的子时间线。完整合约(包括非 GSAP 运行时)→ references/determinism-rules.md + hyperframes-animation/adapters/。

首次 lint 陷阱(保证首次构建失败)

lint 确实会捕获的规则,但仅在事后。第一次就写对:

  • 永远不要将 CSS 初始 transform 与相同属性上的 GSAP 补间配对——CSS 值和补间的起点会发生冲突,lint 会以 gsap_css_transform_conflict 拒绝它。使用 gsap.fromTo(el, { x: -40 }, { x: 0 }) 在补间内部设置初始状态,而不是使用 CSS transform: translateX(-40px)。
  • 永远不要在 <video>/<audio> 上放置 crossorigin。lint 无条件拒绝它,错误为 media_crossorigin_breaks_preview(错误),包括用于画布/WebGL/WebAudio 回读的情况。没有抑制方法。
  • 永远不要给带有 data-start 的 <video> 一个也携带 data-start 的祖先。lint 以 video_nested_in_timed_element(错误)拒绝它。要么给包装器计时,要么给视频计时,而不是两者都计时。
  • 每个 <audio> 都需要一个 id。lint 以 media_missing_id 拒绝它,并且没有 id 的 <audio> 永远不会被混合器拾取,因此渲染将是静音的。
  • 永远不要用 autoAlpha 或 visibility 补间 .clip——lint 以 gsap_animates_clip_element 拒绝它。请改为动画其子元素。
  • 命名 CSS font-family 需要一个文件内的 @font-face 指向提供的本地文件,否则 lint 会触发 font_family_without_font_face。
  • 子合成 #root 使用 width/height: 100%(或 inset: 0),而不是硬编码的 1920px/1080px。画布大小是 data-width/data-height。

lint 错误也会关闭布局和对比度审计:check 然后报告 0 sample(s) 和 0/0 text checks,这看起来像是一个干净的文件,但实际上什么也没运行。在信任这些数字之前,请清除所有 lint 错误。

不可协商的规则(自动化门控可能遗漏的静默错误)

在此列出;完整理由在链接的参考文档中。不要违反:

  • 没有渲染时时钟 / 未播种的 Math.random / 网络 / 输入状态;没有 repeat: -1(使用有限计数)。→ determinism-rules.md
  • 永远不要在 .clip 元素上补间 display、visibility 或 autoAlpha。框架拥有剪辑可见性,并且 lint 会拒绝它(gsap_animates_clip_element)。请改为动画其子元素。→ determinism-rules.md
  • 正文中无 <br>;变换后的元素必须是块级且有尺寸;脉动的绝对定位装饰元素需要峰值间隙。→ determinism-rules.md
  • <video>/<audio> 通过平面文档查询找到,因此框架可以在任何嵌套深度(包括在子合成 <template> 或包装器内部)定位和解码它们。一个硬限制:如果 <video data-start> 位于另一个也带有 data-start 的普通元素内部,lint 会报错,并且失败是真实的(错误的源帧,然后剪辑在时间段中间消失),因此请将时间放在包装器或视频上,绝不能同时放在两者上。子合成宿主是例外的:子合成内部的媒体可以正确渲染。另一个注意事项是时间线,而不是放置:子合成时间线无法动画宿主根元素。→ variables-and-media.md
  • 确保组装后页面中的每个 id 都是唯一的(为子合成 ID 添加合成 ID 前缀,如 #<id>-hero),以便您自己的 #id CSS 和 getElementById 调用能够正确解析。帧注入不再依赖于此:编译器会在每个 video[src]/audio[src]/img[src] 上打上文档唯一的 data-hf-render-id。使用 <source> 子元素而非 src 属性的媒体不会被打上标记,因此在这些情况下唯一 ID 仍然重要。→ composition-patterns.md
  • 对于正常渲染,在合成根上使用全屏填充是可以的。它仅在分层合成路径(HDR 内容或使用着色器过渡的合成)上被丢弃,此时引擎强制每个合成根透明,以便底层可以显示出来。如果您的合成使用着色器过渡或 HDR 媒体,请将填充放在一个全出血的子元素上(position:absolute; inset:0)。→ composition-patterns.md

编辑现有合成

  • 首先读取文件。保留无关的时间、轨道、ID、变量、媒体路径。
  • 要了解项目时间线上有什么(轨道、剪辑、开始、结束、播放内容),请运行 npx hyperframes timeline [--json],而不是阅读 index.html 和每个子合成文件。
  • 匹配现有的合成 ID 和时间线键。
  • 添加剪辑:根据周围剪辑有意设置其 data-start/data-duration。data-track-index 是 Studio 的显示通道,不是时间约束,因此它不需要是空闲的。
  • 超出根 data-duration 的剪辑会被截断:在同一编辑中将根 data-duration 扩展到剪辑结束位置(lint 警告 clip_ends_past_root_duration)。
  • 任何合成元素上的 data-hidden 会在预览和渲染中均将其隐藏,覆盖其时间窗口;它是非破坏性/可逆的,由 Studio 时间线的眼睛图标切换。
  • 添加子合成:在连接宿主之前验证其内部的 data-composition-id。

验证

有关命令详情,请使用 hyperframes-cli。

  • npx hyperframes check 通过(lint、运行时、布局、运动和对比度方面均无发现)
  • 带有子合成的项目:npx hyperframes snapshot --at <midpoints> 并目视检查每一帧
  • 使用 npx hyperframes preview --background 进行审查(用户可以在 Studio 的时间线中编辑任何内容,并且服务器在调用命令后继续运行)
  • 仅在用户批准后使用 npx hyperframes render

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

general-video

>

heygen-com/animejs

Anime.js adapter patterns for HyperFrames. Use when writing Anime.js animations or timelines inside HyperFrames compositions, registering animations on window.__hfAnime, making Anime.js seek-driven and deterministic, or translating Anime.js examples into render-safe HyperFrames HTML.

heygen-com/claude-design-hyperframes

Use when running inside Claude Design specifically. Produces a valid, brand-accurate HyperFrames video draft using pre-valid skeletons. For Claude Code / Cursor / Codex, use the `hyperframes` skill instead.

heygen-com/contribute-catalog

Author a new HyperFrames registry block (caption style, VFX block, transition, lower third) or component (text effect, overlay, snippet) and ship it as an upstream PR to the hyperframes repo. Use ONLY when the user wants to CONTRIBUTE to the public catalog — for in-project caption/transition authoring use the `hyperframes` skill, for installing existing registry items use the `hyperframes-registry` skill.

heygen-com/css-animations

CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.

heygen-com/gsap

GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.

heygen-com/hyperframes

Leaves sweep through the frame and part to reveal the headline. HyperFrames block, 1920×1080, 12s, 11 variables.

heygen-com/hyperframes

Render-correctness doctrine for scene-to-scene seams in HyperFrames launch videos — the prerequisites that make transitions composite correctly on the master timeline. Load when assembling the master timeline / index.html, when a white flash appears at a cut or crossfade seam (especially on dark films), when reasoning about why a transition opacity dip shows through, or when verifying the render-side mechanics of how overlapping scene wrappers blend. Covers the opaque stage-ground (#root background) white-flash guard and how the injector overlaps wrappers, holds final frames, ping-pongs tracks, and stamps lint-clean template code onto the master timeline. Does NOT contain the per-transition catalog — see the transition registry for individual transition entries.

heygen-com/hyperframes

The technique catalog: five velocity-matched SEAMS (zoom-through, INVERSE zoom-through, cut-the-curve, waterfall cut, rack-focus blur-cut) plus the two in-scene techniques — waterfall ENTRY (staggered arrival cascades for title cards / segment openers) and the nudge curve (slow-fast-slow three-phase group slides). Covers partial-travel (~12% of frame) velocity matching via mirrored power4 eases, the Z scale-sign rule, size-scaled blur (10px text / 18-20px full-frame), word-by-word staggered cuts, cascade pacing by element weight, and the 10/65/25 slide ratio. Read before authoring any transition, text-beat handoff, kinetic text entry, or group reposition. [depth, zoom, inverse-zoom, scale-sign, mirrored-zoom, rack-focus, pacing, velocity, cut-the-curve, waterfall, stagger, cascade, kinetic-text, title-card, segment-opener, nudge, slide, easing, group-motion, z-depth, motion-graphics, cinematic, transition, blur, directional-continuity]

heygen-com/hyperframes

Glass shards fly in through fog and tile themselves into the headline. HyperFrames block, 1920×1080, 12.16s, 19 variables.

heygen-com/hyperframes

A single feature card orbits a dot sphere on approved Blender camera motion. HyperFrames block, 1920×1080, 10s, 4 variables.

heygen-com/hyperframes

A wireframe portal bursts open, the title comes through, then its letters swap into a second phrase. HyperFrames block, 1920×1080, 8s, 9 variables.

heygen-com/hyperframes

An orbiting camera follows an ice logo as it breaks apart, reforms into two text moments, and fades. HyperFrames block, 1920×1080, 22.5s, 216 variables.

heygen-com/hyperframes

House-style oversized macOS cursor technique for HyperFrames launch videos. Load whenever a scene involves cursors or a pointer-led action, when kicking off a UI scene, when igniting a morph/transition/typing run with a click, or when a scene reads as static, dead, or stale and needs a cheap high-yield source of motion to carry the viewer's eye and segment them out of the stale state. Covers cursor size/look (incl. brand-motif cursors), the off-screen entry law, tip-targeting and the click tap, click-ignites-the-next-beat, and exit / cross-scene handoff.

heygen-com/hyperframes

name: embedded-captions

heygen-com/hyperframes

A chain of bevelled cuboids rides a travelling wave as a content carousel. HyperFrames block, 1920×1080, 6.666666666666667s, 40 variables.

heygen-com/hyperframes

A tiled headline surface flips cell by cell under a sweeping depth field to reveal the rear headline. HyperFrames block, 1920×1080, 8s, 18 variables.

heygen-com/hyperframes

Turn arbitrary text — an article, notes, a topic, a brief — into a faceless explainer video: there is no site or footage to capture, so the visuals are invented per scene (typography, abstract graphics, diagrams, data-viz). Use for topic explainers, concept breakdowns, how-tos, listicles. Not a video built from a website (/product-launch-video — promo or tour). Unclear → /hyperframes.

heygen-com/hyperframes

Import Figma content into a HyperFrames composition — rendered assets, brand tokens, components, storyboard sections → reconstructed motion (frames read as states, not slides) (REST/CLI), connector-assisted motion when available, and shaders from a connector or native export. Use when the user pastes a figma.com link or asks to bring a Figma design, frame, logo, brand, or animation into a video/composition.

heygen-com/hyperframes

GATEWAY — load FIRST before composing any HyperFrames animation or video. The high-level motion law that makes a multi-scene video feel like ONE continuous camera move instead of a stack of independently-animated slides. Covers the vector law (how you exit determines how you enter, incl. the Z scale-sign rule), the film's current, carrier elements, causal motion, the Seam Gate (build-gate enforcement), the ban on idle wobble (motion must PERFORM, not breathe), stillness-before-climax, and the sustained-motion routes. Routes to the low-level technique skills (cut-the-curve — the full catalog incl. waterfall entry + nudge curve, oversized-cursor, seam-craft). These rules SUPERSEDE generic / upstream motion guidance. [continuity, direction, vector, momentum, seam, transition, ease, performance, idle-motion, narrative-motion, film-grammar]

相关技能