Community程式設計與開發github.com

HyperFrames

以 HTML 為影片製作的核心,透過 GSAP 時間軸與 data-* 屬性,實現剪輯、動畫與同步的框架。

HyperFrames 是什麼?

HyperFrames 是一個以 HTML 為影片真相來源的框架,讓開發者與創作者能透過撰寫 HTML、CSS 與 GSAP 動畫來製作影片。它將影片分解成多個「合成」(composition),每個合成都是一個 HTML 檔案,並使用 `data-*` 屬性來定義時機、播放與同步。框架會自動處理剪輯的可見性、媒體播放與時間軸同步,大幅降低影片製作的技術門檻。此技能支援 Claude Code 等 AI 代理,提供從探索需求、設計系統、提示擴展到最終動畫規劃的完整工作流程。其核心原則是「佈局先於動畫」,要求先以靜態 CSS 定位每個元素在其最顯眼時刻的正確位置,再透過 GSAP 的 `from()` 與 `to()` 方法加入進出場動畫,以確保無意外重疊。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add delorenj/skills

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

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

預覽

來自技能 README

說明文件

HyperFrames 是做什麼的?

HTML 是影片的真相來源 (source of truth)。一個合成 (composition) 就是一個包含 data-* 屬性用於時機控制、GSAP 時間軸用於動畫、以及 CSS 用於外觀的 HTML 檔案。此框架負責處理剪輯的可見性、媒體播放以及時間軸同步。

方法

探索階段 (僅限開放式請求)

對於開放式請求(例如「幫我做一支產品發表影片」、「為我們的品牌創作一些內容」),在使用者尚未確定方向時,請先了解意圖,再挑選顏色:

  • 受眾 — 誰會看這支影片?開發者?高階主管?一般消費者?
  • 平台 — 影片會在哪裡播放?社群媒體(15 秒)、網站首頁、產品展示、內部使用?
  • 優先級 — 什麼最重要?動畫品質?內容準確性?品牌忠實度?製作速度?
  • 變體 — 使用者想要多種選項,還是單一最佳結果?

對於明確的請求(例如「加上一個標題卡」、「修正場景 3 的時機」),則跳過探索階段。

對於探索性請求,考慮提供 2-3 個有實質差異的變化 — 不只是換色,而是不同的節奏、能量層級或結構方法。一個是安全/符合預期的風格,一個是較大膽的風格。不要強制執行這個做法 — 這只是一個在適當情況下可用的工具。

步驟 1:設計系統

如果專案中存在 design.md 或 DESIGN.md,請先讀取它(請檢查兩種大小寫 — 在 Linux 上是不同的檔案)。它是品牌顏色、字體和限制條件的真相來源。使用其精確數值 — 不要自行發明顏色或替代字體。任何格式都可以(YAML 前置資料、散文、表格 — 只要提取出數值即可)。

如果它指定了你在本地找不到的字體(沒有 fonts/ 目錄包含 .woff2 檔案,也不是內建字體),請在撰寫 HTML 前警告使用者:「design.md 指定了 [字體名稱],但找不到字體檔案。請將 .woff2 檔案加入 fonts/ 目錄,否則我將回退到 [最接近的內建替代字體]。」

如果沒有 design.md 存在,請提供使用者選擇:

  1. 使用者指定了風格或氛圍? → 讀取 visual-styles.md 查看 8 個命名預設。選取最接近的。
  2. 想要視覺化瀏覽選項? → 執行設計選擇器:讀取 references/design-picker.md 了解完整工作流程。這會提供一個視覺選擇頁面。使用者在瀏覽器中設定氛圍、色板、字體與動態,然後複製產生的 design.md 並貼回對話中。
  3. 想要跳過並快速進行? → 詢問:氛圍、深色或淺色、是否有任何品牌顏色/字體?然後從 house-style.md 中選取一個色板。

design.md 定義品牌。它不定義影片合成規則。 那些規則來自 references/video-composition.md 和 house-style.md。請以適合影片的尺度使用品牌顏色 — 不要用網頁 UI 的不透明度。

步驟 2:提示擴展

總是對每個合成執行此步驟(除非是單一場景片段或瑣碎的編輯)。此步驟將使用者的意圖與 design.md 和 house-style.md 相對應,並產生一個一致的中間產物,讓所有下游代理都能以相同方式解讀。

請讀取 references/prompt-expansion.md 了解完整流程與輸出格式。

步驟 3:規劃

在撰寫 HTML 之前,先從高層次思考:

  1. 是什麼 — 觀眾應該體驗到什麼?識別敘事弧線、關鍵時刻和情感節拍。
  2. 結構 — 有多少個合成,哪些是子合成 vs 內聯合成,哪些音軌承載什麼(影片、音訊、疊加層、字幕)。
  3. 節奏 — 在實作之前宣告你的場景節奏。哪些場景是快速切換、哪些是靜止停留、哪裡使用著色器、哪裡是能量高峰。命名模式:快速-快速-慢速-快速-著色器-停留。請讀取 references/beat-direction.md 了解節奏模板。
  4. 時機 — 哪些剪輯決定了持續時間、轉場落在哪裡、節奏如何?
  5. 佈局 — 先建立結束狀態。請參閱下方的「佈局先於動畫」。
  6. 動畫 — 然後使用下列規則加入動態。

只製作被要求的內容。 「一個標題卡」的請求,並不代表「一個標題卡 + 3 個輔助場景 + 背景音樂 + 字幕」。每個場景、每個元素、每個補間動畫都必須有其存在的理由。如果額外的場景或元素能真正改善作品,請提出建議 — 但不要直接加入。

對於小型編輯(修正顏色、調整時間、加入一個元素),請直接跳到規則部分。

佈局先於動畫

將每個元素放置在其最顯眼的時刻所在的位置 — 也就是它完全進入、位置正確且尚未退出的影格。首先將其編寫為靜態的 HTML+CSS。不要加入 GSAP。

為什麼這很重要: 如果你將元素放在其動畫的起始狀態(畫面外、縮放為 0、透明度 0),然後補間到你認為它們應該到達的位置,你是在猜測最終佈局。重疊問題在影片渲染之前是不可見的。透過先建立結束狀態,你可以在加入任何動態之前看到並修正佈局問題。

流程

  1. 為每個場景識別主要影格 (hero frame) — 也就是最多元素同時可見的時刻。這就是你要建立的佈局。
  2. 為該影格編寫靜態 CSS。.scene-content 容器必須使用 width: 100%; height: 100%; padding: Npx; 加上 display: flex; flex-direction: column; gap: Npx; box-sizing: border-box 來完整填滿場景。使用 padding 將內容向內推 — 永遠不要對內容容器使用 position: absolute; top: Npx。絕對定位的內容容器在內容高於剩餘空間時會溢出。將 position: absolute 保留給裝飾性元素。
  3. 使用 gsap.from() 加入進場動畫 — 從畫面外/不可見狀態動畫到 CSS 位置。CSS 位置是真實情況;補間動畫描述了到達那裡的路徑。(在透過 data-composition-src 載入的子合成中,建議使用 gsap.fromTo() — 請參閱 references/motion-principles.md 中關於承載 GSAP 的規則。)
  4. 使用 gsap.to() 加入出場動畫 — 從 CSS 位置動畫到畫面外/不可見狀態。

範例

/* scene-content 填滿場景,padding 定位內容 */
.scene-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 120px 160px;
  gap: 24px;
  box-sizing: border-box;
}
.title {
  font-size: 120px;
}
.subtitle {
  font-size: 42px;
}
/* 容器能填滿任何場景尺寸 (1920x1080、1080x1920 等)。
   Padding 定位內容。Flex + gap 處理間距。 */

錯誤示範 — 硬編碼尺寸與絕對定位:

.scene-content {
  position: absolute;
  top: 200px;
  left: 160px;
  width: 1920px;
  height: 1080px;
  display: flex; /* ... */
}
// 步驟 3:動畫進入這些位置
tl.from(".title", { y: 60, opacity: 0, duration: 0.6, ease: "power3.out" }, 0);
tl.from(".subtitle", { y: 40, opacity: 0, duration: 0.5, ease: "power3.out" }, 0.2);
tl.from(".logo", { scale: 0.8, opacity: 0, duration: 0.4, ease: "power2.out" }, 0.3);

// 步驟 4:從這些位置動畫退出
tl.to(".title", { y: -40, opacity: 0, duration: 0.4, ease: "power2.in" }, 3);
tl.to(".subtitle", { y: -30, opacity: 0, duration: 0.3, ease: "power2.in" }, 3.1);
tl.to(".logo", { scale: 0.9, opacity: 0, duration: 0.3, ease: "power2.in" }, 3.2);

當元素在時間上共享空間時

如果在同一區域,元素 A 在元素 B 進入之前退出,兩者都應在其各自的主要影格中具有正確的 CSS 位置。時間軸的順序保證它們不會在視覺上同時存在 — 但如果你跳過了佈局步驟,你就不會發現因時間錯誤而意外重疊的情況。

什麼算是「刻意重疊」

分層效果(文字後方的光暈、陰影元素、背景圖案)和 Z 軸堆疊設計(卡片堆疊、深度層次)是刻意為之的。佈局步驟的目的是為了捕捉非刻意的重疊 — 例如兩個標題彼此覆蓋、一個統計數字蓋住標籤、內容跑出畫面邊界。

Data 屬性

所有剪輯

屬性必要與否值
id是唯一識別符
data-start是秒數或剪輯 ID 參考("el-1"、"intro + 2")
data-duration對 img/div/compositions 為必要秒數。影片/音訊預設為媒體長度。
data-track-index是整數。同一個音軌的剪輯不能重疊。
data-media-start否從來源中裁剪的偏移量(秒)
data-volume否0-1(預設為 1)

data-track-index 不會影響視覺層級 — 請使用 CSS z-index。

合成剪輯

屬性必要與否值
data-composition-id是唯一的合成 ID
data-start是開始時間(根合成:使用 "0")
data-duration是優先於 GSAP 時間軸的持續時間
data-width / data-height是像素尺寸(1920x1080 或 1080x1920)
data-composition-src否外部 HTML 檔案的路徑

合成結構

透過 data-composition-src 載入的子合成使用 <template> 包裝器。獨立合成(主要的 index.html)不要使用 <template> — 它們直接將帶有 data-composition-id 的 div 放在 <body> 中。在獨立檔案上使用 <template> 會將所有內容對瀏覽器隱藏,並破壞渲染。

子合成結構:

<template id="my-comp-template">
  <div data-composition-id="my-comp" data-width="1920" data-height="1080">
    <!-- 內容 -->
    <style>
      [data-composition-id="my-comp"] {
        /* 限定範圍的樣式 */
      }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
    <script>
      window.__timelines = window.__timelines || {};
      const tl = gsap.timeline({ paused: true });
      // 補間動畫...
      window.__timelines["my-comp"] = tl;
    </script>
  </div>
</template>

在根層級載入:<div id="el-1" data-composition-id="my-comp" data-composition-src="compositions/my-comp.html" data-start="0" data-duration="10" data-track-index="1"></div>

影片與音訊

影片必須設定為 muted playsinline。音訊始終是一個獨立的 <audio> 元素:

<video
  id="el-v"
  data-start="0"
  data-duration="30"
  data-track-index="0"
  src="video.mp4"
  muted
  playsinline
></video>
<audio
  id="el-a"
  d

Individual skills in this repo

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

delorenj/skills

Plan and generate terminal ASCII animations/screensaver-style output (FPS, refresh rules, loop policy, low-flicker guidance), with a static poster frame and an optional local demo script.

delorenj/skills

ASCII video: convert video/audio to colored ASCII MP4/GIF.

delorenj/skills

Plan, build and quality-check a premium short commercial for a real business (roofing, property, ecommerce, B2B software) using AI-generated footage, code-built motion (HTML/GSAP), selective Three.js and an independent-critic "Gauntlet" loop. Use when asked to make a launch-style / SaaS-style video, business ad, explainer, sample reel or pitch video, or to review and improve one. Encodes motion principles distilled from 28 professional launch films, a quality bar, audio rules and a business-offer playbook.

delorenj/skills

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.

delorenj/skills

Generate professional voiceovers using ElevenLabs AI. Use when the user needs to create voiceovers for videos, audio narration, or text-to-speech content. Supports multiple voices with character presets (narrator, salesperson, expert) for natural delivery. Includes single scene regeneration for fine-tuning.

delorenj/skills

HyperFrames CLI dev loop — `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.

delorenj/skills

Asset preprocessing for HyperFrames compositions — text-to-speech narration (Kokoro), audio/video transcription (Whisper), and background removal for transparent overlays (u2net). Use when generating voiceover from text, transcribing speech for captions, removing the background from a video or image to use as a transparent overlay, choosing a TTS voice or whisper model, or chaining these (TTS → transcribe → captions). Each command downloads its own model on first run.

delorenj/skills

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, and registry discovery.

delorenj/skills

Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For dev-loop CLI commands (init, lint, inspect, preview, render) see the hyperframes-cli skill; for asset preprocessing commands (tts, transcribe, remove-background) see the hyperframes-media skill.

delorenj/skills

Manim CE animations: 3Blue1Brown math/algo videos.

delorenj/skills

Join a Google Meet or Zoom call as a video meeting agent via PikaStreaming. Trigger: user drops a Google Meet or Zoom link, or asks to join a meeting.

delorenj/skills

Translate an existing Remotion (React-based) video composition into a HyperFrames HTML composition. Use ONLY when the user explicitly asks to port, convert, migrate, translate, or rewrite a Remotion composition as HyperFrames (e.g. "port my Remotion project to HyperFrames"). Do NOT use when (a) authoring a NEW HyperFrames composition (even if A/B-testing a Remotion video); (b) Remotion is mentioned in passing; (c) Remotion code is shared as reference, not for translation; (d) the user wants "the same video as my Remotion one" without explicitly asking to migrate the source — treat as a fresh HyperFrames build. When in doubt, default to the `hyperframes` skill. Detects unsupported patterns (useState, useEffect side effects, async calculateMetadata, third-party React component libraries, `@remotion/lambda`) and recommends the runtime interop escape hatch instead of a lossy translation.

delorenj/skills

Generate speech using the self-hosted voxxy (vox) TTS service at https://vox.delo.sh. Use when the user asks to speak, say, narrate, synthesize speech, clone a voice, create a voice, add or register a voice, pipe TTS, or control voice qualities by description (e.g. "a young woman with a cheerful voice"). Handles HTTP API usage, voice profile management, description-based voice design, cloning, MCP registration, and integration patterns for new platforms.

delorenj/skills

Capture a website and create a HyperFrames video from it. Use when: (1) a user provides a URL and wants a video, (2) someone says "capture this site", "turn this into a video", "make a promo from my site", (3) the user wants a social ad, product tour, or any video based on an existing website, (4) the user shares a link and asks for any kind of video content. Even if the user just pastes a URL — this is the skill to use.

delorenj/skills

YouTube transcripts to summaries, threads, blogs.

相關技能