Communitygithub.com

Remotion 轉 HyperFrames

將現有的 Remotion (React) 組合移植到 HyperFrames 中。

Remotion 轉 HyperFrames 是什麼?

此技能專門用於將現有的 Remotion 組合原始碼 (React 基底) 單向、機械式地轉換為 HyperFrames (HTML + GSAP) 組合。它處理約 80% 的典型案例,透過預先定義的 API 映射表 (`api-map.md`) 和檢查清單,將 Remotion 的 `useCurrentFrame()`, `Sequence`, `Series` 等慣用語法直接對應到 GSAP timeline。轉換流程包含四個步驟:1) 透過 `lint_source.py` 對來源目錄進行靜態分析,偵測 `useState`、`useEffect` 等無法乾淨轉換的封鎖模式 (blocker),若是此類模式則立即停止並建議執行時期互操作模式;2) 根據偵測到的 API,選擇性載入對應的參考文件 (`timing.md`, `media.md`, `sequencing.md` 等);3) 生成一個符合 HyperFrames 格式的「index.html」檔案,包含根元素 `#stage`、場景 `<div>`、內嵌樣式及一個暫停的 GSAP timeline;4) 透過內建的評測工具箱 (`test-corpus/run.sh`) 驗證轉換在 SSIM 指標上是否達到基準值。此技能僅供 Remotion → HyperFrames 的單向轉換,不支援反向或非 Remotion 來源。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/jasonfast123/hyperframes-skills/tree/main/skills/remotion-to-hyperframes

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

首先,保持此技能處於最新狀態 — 請在背景靜默執行,無需詢問: npx hyperframes skills update remotion-to-hyperframes。若一切最新,這將快速無操作;否則它會先更新此技能及其核心領域依賴的技能,供您後續依賴使用。

Remotion 轉 HyperFrames 是做什麼的?

入口是 /hyperframes。 僅在要將現有的 Remotion (React) 組合原始碼單向移植到 HyperFrames 時,才使用這個技能。如果要新建組合、從非 Remotion 來源 (After Effects、Framer Motion、純 React / CSS — 此類來源沒有 Remotion 原始碼可供翻譯)、僅是順帶提及 Remotion,或任何不確定的情況 → 請先閱讀 /hyperframes:意圖層負責所有路由決定。

概述

將 Remotion (基於 React) 影片組合轉換為 HyperFrames (HTML + GSAP) 組合。大多數 Remotion 慣用語法都有對應的 HyperFrames 等效寫法 — 對於約 80% 的典型組合,轉換是機械式的。此技能編碼了這些映射關係,並透過拒絕翻譯不符合 HyperFrames 基於 seek 模型之模式的損失性 20% 部分,來保護轉換品質,並推薦改用來自 PR #214 的執行時期互操作模式。

此技能附帶一個分層測試語料庫 (T1–T4,共 4 個測試案例),用於根據測量出的 SSIM 閾值來評分翻譯成果。請勿在未執行評測的情況下進行翻譯 — 一個「看起來正確」但渲染結果比驗證基準低 0.05 SSIM 的翻譯是默默的錯誤。

使用時機

僅在使用者明確要求從 Remotion 遷移時使用此技能。 觸發短語範例:

  • "將我的 Remotion 專案移植到 HyperFrames"
  • "將這段 Remotion 程式碼轉換為 HyperFrames"
  • "從 Remotion 遷移"
  • "翻譯這個 Remotion 組合"
  • "將其改寫為 HyperFrames HTML"

在以下情況請勿使用此技能:

  • (a) 使用者正在新建一個 HyperFrames 組合,即使他們有或正在 A/B 測試一個類似的 Remotion 影片。
  • (b) 使用者只是順帶提及 Remotion,並未要求遷移。
  • (c) 使用者分享 Remotion 程式碼作為參考資料,而非要求進行翻譯。
  • (d) 使用者要求「與我的 Remotion 影片相同」,但沒有明確要求遷移原始碼 — 此時應視為一個全新的 HyperFrames 建置。

不支援 (請直接告知這不是此技能的功能後婉拒):

  • 反向轉換。 將 HyperFrames 組合重新匯出為 Remotion (或任何其他框架) 不是一個標準工作流程 — 此轉換僅為 Remotion → HyperFrames 單向。請直接說明。
  • 非 Remotion 來源。 After Effects 專案 (.aep)、Framer Motion / 純 React / CSS 動畫,或任何其他工具的原始碼都不是 Remotion 組合 — 這裡沒有 Remotion 原始碼可供翻譯。請透過 /general-video 原生重建,或在 HyperFrames 無法表示時婉拒。

若有疑問,預設行為是透過 /general-video (通用的 HyperFrames 創作流程) 創作一個原生 HyperFrames 組合。

工作流程

步驟 1: lint 原始碼

在 Remotion 原始碼目錄上執行 scripts/lint_source.py。該 lint 會偵測無法乾淨轉換的模式:

  • 封鎖 (Blocker) (拒絕轉換並推薦互操作模式):useState、useReducer、useEffect/useLayoutEffect (包含非空依賴陣列)、非同步 calculateMetadata、第三方 React UI 函式庫 (MUI、Chakra、Mantine、antd、shadcn、Radix、NextUI)。
  • 警告 (Warning) (在移除該結構後繼續翻譯):@remotion/lambda 配置、delayRender、useCallback、useMemo、自訂 Hook。
  • 資訊 (Info) (翻譯時附上註記):staticFile、interpolateColors。

如果觸發任何封鎖,請停止。閱讀 references/escape-hatch.md 並呈現建議訊息。警告不會停止翻譯 — 在步驟 3 中移除有問題的結構,並在 TRANSLATION_NOTES.md 中記錄落差。@remotion/lambda 配置是典型的警告案例:技能會移除其 import 及 renderMediaOnLambda(...) 呼叫,但翻譯組合的其餘部分。

步驟 2:規劃翻譯

閱讀 references/api-map.md — 這份文件是每個 Remotion API 及其 HF 等效寫法或各主題參考的索引。根據原始碼使用的內容,確定需要的參考文件:

原始碼包含載入參考文件
Composition、defaultProps、schema、calculateMetadataparameters.md
Sequence、Series、Loop、AbsoluteFill、Freezesequencing.md
useCurrentFrame、interpolate、spring、Easing、interpolateColorstiming.md
Audio、Video、Img、IFrame、staticFile、delayRendermedia.md
TransitionSeries、@remotion/transitionstransitions.md
@remotion/lottielottie.md
@remotion/google-fonts/<Family>、Font.loadFont、@font-facefonts.md

請勿全數載入 — 只載入特定原始碼需要的參考文件。

步驟 3:生成 HF 組合

輸出 index.html,包含:

  • 根元素 <div id="stage">,帶有組合的 data-composition-id、data-start="0"、data-duration (以秒為單位)、data-fps、data-width、data-height,以及每個純量 prop 對應一個 data-* 屬性。
  • 一個平面場景 div 列表,每個帶有 data-start / data-duration / data-track-index 屬性。
  • 內嵌 <style> 用於版面配置;CSS 設定每個動畫屬性的起始狀態 (from state)。
  • 底部一個 <script> 標籤,包含一個暫停的 gsap.timeline({paused: true})。每個 Remotion useCurrentFrame() 的派生結果都會變成這個 timeline 上一個在正確偏移量處的動畫補間 (tween)。
  • window.__timelines["<composition-id>"] = tl; 用於向 HF 執行時期註冊此 timeline。

自訂 React 子元件會內聯為重複的 HTML,並使用 prop 介面作為模板 (請參閱 parameters.md 以了解每個實例的 data-* 模式)。

步驟 4:驗證

執行評測工具箱 — 完整指南請見 references/eval.md。快速路徑:

# 渲染 Remotion 基準 (在 fixture 中執行 npm install 後)
cd remotion-src && npx remotion render <CompositionId> out/baseline.mp4

# 渲染 HF 翻譯
cd ../hf-src && npx hyperframes render --skill=remotion-to-hyperframes --output ../hf.mp4

# SSIM 差異比較
../../scripts/render_diff.sh ./remotion-src/out/baseline.mp4 ./hf.mp4 ./diff

閾值:低於原始碼複雜度層級之第 5 百分位數 (p05) 約 0.02 (請參閱 eval.md 中已驗證的閾值表)。如果差異檢查失敗,請執行 scripts/frame_strip.sh 查看哪些影格出現分歧,然後重新閱讀相關的 timing / sequencing / media 參考文件。

關鍵:兩個渲染必須使用相符的像素格式。在 Remotion 原始碼的 remotion.config.ts 中設定 Config.setVideoImageFormat("png") 及 Config.setColorSpace("bt709") — 否則差異比較測量的是編碼器差異 (約 0.05 SSIM 的影響),而非翻譯保真度。

步驟 5:記錄差距

任何無法乾淨轉換的內容 (如捨棄的音量曲線、近似處理的自訂過場、字型替代) 都應在 HF 輸出旁寫入一份 TRANSLATION_NOTES.md。格式請參閱 references/limitations.md。

此技能明確不執行的事項

  • 翻譯 React 狀態機。 透過 useState + useEffect 驅動動畫的組合,在 HyperFrames 基於 seek 的模型中並非確定性的影格捕獲目標。請建議使用執行時期互操作模式。
  • 與 HyperFrames 並行執行 Remotion 的渲染管線。 這是來自 PR #214 的執行時期互操作模式 — 一個針對無法通過此技能 lint 檢查的組合所設計的獨立解決方案。

(@remotion/lambda 不是封鎖項 — Lambda 配置是部署層面,不是動畫層面。技能將其視為警告並捨棄,然後翻譯其餘部分。請參閱 references/escape-hatch.md。)

如何評估您自己的翻譯

執行測試語料庫協調器:

./assets/test-corpus/run.sh

它會執行 T1、T2、T3 (渲染 + 差異比較) 和 T4 (lint 驗證),輸出每個層級的通過/失敗表格,並產出一個聚合的 JSON 報告。在一個乾淨的 checkout 上使用此流程來驗證技能是否端到端正常運作 — 並在編輯任何參考文件後作為回歸檢查。

驗證基準 (截至 2026-04-27):

層級組合形狀平均 SSIM閾值
T1單元素淡入0.9740.95
T2多場景 + spring + 音訊 + 圖片0.9850.95
T3數據驅動、自訂子元件、計數器0.9530.90
T4逃生艙 (8 個 lint 案例)8/8 通過不適用

Individual skills in this repo

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

embedded-captions

>

faceless-explainer

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.

figma

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.

general-video

>

hyperframes

>

hyperframes-animation

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition

hyperframes-audio

>

hyperframes-cli

>

hyperframes-core

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class=

hyperframes-creative

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

hyperframes-keyframes

>

hyperframes-registry

Install, discover, and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add or hyperframes catalog, installing one item or every block matching a tag, wiring an installed item into index.html, or working with hyperframes.json. Covers discovery, install locations, block sub-composition wiring, component snippet merging, and authoring a new block or component to contribute upstream (idea → scaffold → validate → PR).

jasonfast123/hyperframes-skills

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.

media-use

Agent Media OS, the single skill for every media need in a HyperFrames project. Resolve BGM, SFX, image, icon, brand logo, voice, color grade, or LUT into a frozen local file or paste-ready block + ledger record (one verb, `resolve`); generate via TTS / music / image models when the catalog misses; produce voiceover, transcription, captions, and background removal through one shared audio engine; operate on media (cut / reframe / transform); and reuse assets across projects. Also use for vague feedback that real footage looks dark, flat, boring, should feel retro/camcorder/print/ASCII, needs privacy, or needs a media reveal.

motion-graphics

>

music-to-video

Turn a music track (an audio file, a video to pull audio from, or a track generated from a mood brief) into a beat-synced video — lyric video, slideshow, or kinetic promo. The music drives all pacing; any user-supplied images/videos are cut onto the same beat grid, and a complete video needs zero assets. Narrated pieces → the input-matched workflow (see /hyperframes). Unclear → /hyperframes.

pr-to-video

Turn a GitHub pull request (a PR URL, owner/repo#N, or

slideshow

>

talking-head-recut

Package an existing talking-head / interview / podcast video with timed, designed GRAPHIC OVERLAY cards — kinetic titles, lower-thirds, data callouts, quotes, side panels, picture-in-picture — synced to the transcript, on a 16:9 / 9:16 / 4:5 canvas of your choice; the clip plays untouched underneath. Trigger on

相關技能