1实现原理 · 为什么它能做到
本技能是 HyperFrames 的『技术契约』:把 HTML 写成可渲染视频的规则全集——单一 paused 时间线、data-* 时序属性、class=clip、sub-composition、确定性渲染禁令。SKILL.md 正文是构建指南,细节全部按需下沉 references/ 19 张卡。
This skill is the **technical contract** — how to build one hyperframes project. The body below is the build guide; per-topic detail lives in `references/` (index next), read on demand.
核心模型:composition = HTML 文件,DOM 用 data-* 属性声明时序、每 composition 恰注册一条 `gsap.timeline({ paused: true })` 到 window.__timelines["<id>"],渲染长度以根 data-duration 为准(不是时间线长度)。
Each composition registers **exactly one** `gsap.timeline({ paused: true })` at `window.__timelines["<id>"]` (key = root `data-composition-id`).
能力落点包含真实 lint 规则集:SKILL.md 逐条列出 lint 能抓的坑(gsap_css_transform_conflict、media_crossorigin_breaks_preview、video_nested_in_timed_element、media_missing_id 等),并警告 lint error 会连带关掉 layout/contrast 审计。
Never put `crossorigin` on `<video>`/`<audio>`. `lint` rejects it unconditionally with `media_crossorigin_breaks_preview` (error), including for canvas/WebGL/WebAudio readback. There is no suppression.
确定性渲染是硬规则(不是建议):禁渲染期时钟/无种子 Math.random/网络/输入态,禁 repeat: -1;禁对 clip 元素 tween display/raw visibility;禁 body 文本 <br>。
No render-time clocks / unseeded `Math.random` / network / input-state; no `repeat: -1` (use a finite count).
sub-composition 装配契约精确到文件形态:standalone 根不能包 <template>(lint error standalone_composition_wrapped_in_template),sub-composition 必须包 <template> 且 style/script 放 template 内(hasTemplate gate 会丢文件头 style/script),host/inner/timeline key 用同一 id。
for a **templated** sub-composition the assembler drops the file's own `<head>` `<style>`/`<script>` (`packages/core/src/compiler/compositionAssembly.ts`, the `hasTemplate` gate), so put `<style>`/`<script>` **inside** the template.
验证闭环真实存在且分级:npx hyperframes check 一次性跑 lint/runtime/layout/motion/contrast 五类、snapshot 抽帧目检、preview --background 供人审、render 需用户批准后执行。
- [ ] `npx hyperframes check` passes (0 findings across lint, runtime, layout, motion, and contrast) - [ ] Projects with sub-compositions: `npx hyperframes snapshot --at <midpoints>` and eyeball each frame
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | hyperframes CLI(check/snapshot/preview/render;命令细节在 /hyperframes-cli) |
| network | GSAP 经 CDN 进 composition(示例/骨架引 jsdelivr gsap;渲染时在 headless 浏览器加载——产物运行依赖,非 skill 自身外发) |
| package | @hyperframes/core / engine(同仓 packages/,真实校验/装配/渲染实现) |
4风险提醒 风险提醒:蓝色 · 知晓即可
- 规则量大且分散正文/references 两层,简单任务可能漏读关键禁令(如 <br>、visibility tween) — SKILL 用『non-negotiable + silent bugs』高亮缓解,但 agent 若跳过 references 仍会踩坑。
- 产物依赖 CDN 库(gsap 等),离线/内网渲染需 vendor — minimal-composition 直接引 jsdelivr;企业内网渲染环境须预置本地副本。
- preview/render 在宿主环境驱动 headless 浏览器跑作者内联 JS — 作品脚本在渲染进程执行(有沙箱与用户批准 gate),但来源不可信的 composition 文件仍是执行面,宿主应限制项目来源。
5第二遍独立确认
- [ok] lint 规则名与真实校验器对应 — SKILL.md 引用的编译器路径 packages/core/src/compiler/compositionAssembly.ts 在仓库 packages/core 下实测存在(仓库级 glob 复核);规则命名风格与 .oxlintrc/engine 校验一致。
- [discrepancy] 『document.fonts.ready 内构建可接受』与『禁 async 构建』是否矛盾 — 首轮将两条规则并置易误读:SKILL.md 正文允许在 async callback(fonts.ready)里构建但『register only after the build completes』;animation SKILL.md 的『no timeline construction inside async/setTimeout』指不能把注册放进未完成的异步流。两条实质一致(注册须在构建完成后同步完成),已在 how_it_works 注明而非判定矛盾。
- [ok] preview 进程存活行为 — SKILL.md 'the server survives the invoking command' 复核一致——preview 是常驻本地服务,属预期行为已列入 file_writes 描述。
- [ok] 有无隐藏脚本/网络(纯文档声称) — find 实测 skills/hyperframes-core 含 1 个共享 lib(scripts/lib/frame-packets-core.mjs,packet 数据组装,无 IO 外发);无网络代码。
- [ok] 与其它 skill 的契约引用一致性 — music-to-video frame-worker.md、hyperframes 路由、hyperframes-audio SKILL 均引用 core 的 determinism/sub-composition 契约且无互相矛盾的定义。
6结论
74bec24a87c21ea7…b8328f9573