HyperFrames 註冊表
註冊表提供可透過 hyperframes add <name> 安裝的可重用區塊與元件。
- 區塊 — 獨立的子組合(有自己的尺寸、時長、時間軸)。透過宿主組合中的
data-composition-src引入。 - 元件 — 效果片段(沒有自己的尺寸)。直接貼入宿主組合的 HTML 中。
快速參考
hyperframes add data-chart # 安裝區塊
hyperframes add grain-overlay # 安裝元件
hyperframes add shimmer-sweep --dir . # 指定目標專案
hyperframes add data-chart --json # 輸出機器可讀格式
hyperframes add data-chart --no-clipboard # 跳過剪貼簿(CI/無頭模式)
安裝後,CLI 會印出已寫入的檔案以及一個可以貼入宿主組合的程式碼片段。該片段只是一個起點——接線區塊時,你需要手動加入 data-composition-id(必須與區塊內部的合成 ID 一致)、data-start 和 data-track-index 屬性。
注意:hyperframes add 僅適用於區塊與元件。對於範例,請改用 hyperframes init <dir> --example <name>。
安裝位置
區塊預設安裝到 compositions/<name>.html。
元件預設安裝到 compositions/components/<name>.html。
這些路徑可在 hyperframes.json 中設定:
{
"registry": "https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry",
"paths": {
"blocks": "compositions",
"components": "compositions/components",
"assets": "assets"
}
}
詳細資訊請參閱 install-locations.md。
接線區塊
區塊是獨立的組合——透過宿主 index.html 中的 data-composition-src 引入:
<div
data-composition-id="data-chart"
data-composition-src="compositions/data-chart.html"
data-start="2"
data-duration="15"
data-track-index="1"
data-width="1920"
data-height="1080"
></div>
關鍵屬性:
data-composition-src— 區塊 HTML 檔案的路徑data-composition-id— 必須與區塊內部的 ID 一致data-start— 區塊在宿主時間軸中出現的時間(秒)data-duration— 區塊播放的持續時間data-width/data-height— 區塊畫布尺寸data-track-index— 圖層順序(數值越高越在上層)
詳細資訊請參閱 wiring-blocks.md。
接線元件
元件是片段——將它們的 HTML 貼入組合的標記中,CSS 貼入樣式區塊,JS 貼入腳本(如果有的話):
- 讀取已安裝的檔案(例如
compositions/components/grain-overlay.html) - 將 HTML 元素複製到組合的
<div data-composition-id="...">中 - 將
<style>區塊複製到組合的樣式中 - 將任何
<script>內容複製到組合的腳本中(在時間軸程式碼之前) - 如果元件公開了 GSAP 時間軸整合(請參閱片段中的註解區塊),將那些呼叫加入你的時間軸中
詳細資訊請參閱 wiring-components.md。
探索
瀏覽可用項目:
# 讀取註冊表清單
curl -s https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/registry.json
每個項目的 registry-item.json 包含:名稱、類型、標題、說明、標籤、尺寸(僅區塊)、時長(僅區塊)以及檔案列表。
有關按類型和標籤篩選的詳細資訊,請參閱 discovery.md。
貢獻新的區塊或元件
若要編寫一個全新的註冊表項目(字幕樣式、VFX 區塊、轉場、下三分之一、或可重用元件),並將其作為上游 PR 提交——而不是安裝現有項目——請遵循 contributing.md 中完整的構想 → 建構 → 驗證 → 預覽 → 發布工作流程。複製貼上起手範本(字幕 / VFX / 元件 / registry-item.json)位於 templates.md。