Communitygithub.com

zroeschen/Video-Production-Factory

GSAP 動畫參考,專為 HyperFrames 設計。涵蓋 gsap.to()、from()、fromTo()、緩動、交錯、預設值、時間軸 (gsap.timeline()、位置參數、標籤、嵌套、播放控制) 以及效能優化 (變形、will-change、quickTo)。請於撰寫 HyperFrames 合成中的 GSAP 動畫時使用。

Video-Production-Factory 是什麼?

此技能提供全面的 GSAP 動畫參考,專為 HyperFrames 平台優化。它詳細說明了核心補間方法,包括 `gsap.to()`、`gsap.from()` 和 `gsap.fromTo()`,並強調使用駝峰式命名屬性,如 `backgroundColor` 和 `rotationX`。技能文件涵蓋了常見的變數如 `duration`、`ease`、`stagger` 和回呼函數,特別說明了 GSAP 的變換別名(如 `x`、`y`、`scale`、`rotation`)優先於原始 CSS transform 字串,以獲得更好的效能。對於複雜的動畫排序,技能深入介紹了時間軸(`gsap.timeline()`)及其強大的位置參數和標籤系統,允許精確控制動畫序列。此外,它還包含了進階主題,例如 `gsap.matchMedia()` 以實現響應式和無障礙設計、`gsap.quickTo()` 以實現滑鼠移動等頻繁更新,以及明確的效能最佳實踐,例如偏愛變換和透明度動畫、使用 `will-change` 以及正確清理補間。此技能是 HyperFrames 開發者不可或缺的參考資源。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/zroeschen/Video-Production-Factory/tree/HEAD/.agents/skills/gsap

在你喜歡的 AI 中提問

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

說明文件

GSAP

核心補間方法

  • gsap.to(targets, vars) — 從當前狀態動畫到 vars。最常用。
  • gsap.from(targets, vars) — 從 vars 動畫到當前狀態(入場效果)。
  • gsap.fromTo(targets, fromVars, toVars) — 明確指定開始與結束狀態。
  • gsap.set(targets, vars) — 立即套用(持續時間為 0)。

始終使用 駝峰式 (camelCase) 屬性名稱(例如 backgroundColor、rotationX)。

常用變數 (vars)

  • duration — 秒(預設為 0.5)。
  • delay — 開始前的延遲秒數。
  • ease — "power1.out"(預設)、"power3.inOut"、"back.out(1.7)"、"elastic.out(1, 0.3)"、"none"。
  • stagger — 數字 0.1 或物件:{ amount: 0.3, from: "center" }、{ each: 0.1, from: "random" }。
  • overwrite — false(預設)、true 或 "auto"。
  • repeat — 數字或 -1 用來無限重複。yoyo — 配合 repeat 使用,會交替方向。
  • onComplete、onStart、onUpdate — 回呼函數。
  • immediateRender — 對於 from()/fromTo() 預設為 true。對稍後針對相同屬性和元素的補間設為 false 以避免覆寫。

變換 (Transforms) 與 CSS

優先使用 GSAP 的 變換別名 (transform aliases) 而非原始的 transform 字串:

GSAP 屬性等效 CSS
x、y、ztranslateX/Y/Z (px)
xPercent、yPercenttranslateX/Y (%)
scale、scaleX、scaleYscale
rotationrotate (deg)
rotationX、rotationY3D rotate
skewX、skewYskew
transformOrigintransform-origin
  • autoAlpha — 優先於 opacity。值為 0 時,同時設定 visibility: hidden。
  • CSS 變數 — "--hue": 180。
  • svgOrigin (僅 SVG) — 全域 SVG 座標空間原點。請勿與 transformOrigin 結合使用。
  • 方向性旋轉 — "360_cw"、"-170_short"、"90_ccw"。
  • clearProps — "all" 或以逗號分隔;在補間完成時移除內聯樣式。
  • 相對值 — "+=20"、"-=10"、"*=2"。

基於函數的值 (Function-Based Values)

gsap.to(".item", {
  x: (i, target, targets) => i * 50,
  stagger: 0.1,
});

緩動 (Easing)

內建緩動函數:power1–power4、back、bounce、circ、elastic、expo、sine。每個都有 .in、.out、.inOut 變體。

預設值 (Defaults)

gsap.defaults({ duration: 0.6, ease: "power2.out" });

控制補間 (Controlling Tweens)

const tween = gsap.to(".box", { x: 100 });
tween.pause();
tween.play();
tween.reverse();
tween.kill();
tween.progress(0.5);
tween.time(0.2);

gsap.matchMedia() (響應式 + 無障礙設計)

僅在媒體查詢符合時執行設置;當不符合時會自動還原。

let mm = gsap.matchMedia();
mm.add(
  {
    isDesktop: "(min-width: 800px)",
    reduceMotion: "(prefers-reduced-motion: reduce)",
  },
  (context) => {
    const { isDesktop, reduceMotion } = context.conditions;
    gsap.to(".box", {
      rotation: isDesktop ? 360 : 180,
      duration: reduceMotion ? 0 : 2,
    });
  },
);

時間軸 (Timelines)

建立時間軸

const tl = gsap.timeline({ defaults: { duration: 0.5, ease: "power2.out" } });
tl.to(".a", { x: 100 }).to(".b", { y: 50 }).to(".c", { opacity: 0 });

位置參數 (Position Parameter)

第三個參數控制放置位置:

  • 絕對位置:1 — 在第 1 秒處
  • 相對位置:"+=0.5" — 在結束之後;"-=0.2" — 在結束之前
  • 標籤:"intro"、"intro+=0.3"
  • 對齊:"<" — 與前一個相同時間開始;">" — 在前一個結束後開始;"<0.2" — 在前一個開始後 0.2 秒開始
tl.to(".a", { x: 100 }, 0);
tl.to(".b", { y: 50 }, "<"); // 與 .a 同時開始
tl.to(".c", { opacity: 0 }, "<0.2"); // 在 .b 開始後 0.2 秒開始

標籤 (Labels)

tl.addLabel("intro", 0);
tl.to(".a", { x: 100 }, "intro");
tl.addLabel("outro", "+=0.5");
tl.play("outro");
tl.tweenFromTo("intro", "outro");

時間軸選項 (Timeline Options)

  • paused: true — 建立時暫停;呼叫 .play() 開始。
  • repeat、yoyo — 套用至整個時間軸。
  • defaults — 變數將會合併到每個子補間中。

嵌套時間軸 (Nesting Timelines)

const master = gsap.timeline();
const child = gsap.timeline();
child.to(".a", { x: 100 }).to(".b", { y: 50 });
master.add(child, 0);

播放控制 (Playback Control)

tl.play()、tl.pause()、tl.reverse()、tl.restart()、tl.time(2)、tl.progress(0.5)、tl.kill()。


效能 (Performance)

優先使用變換和透明度

動畫 x、y、scale、rotation、opacity 可在合成器上執行。若變換能達到相同效果,應避免使用 width、height、top、left。

will-change

will-change: transform;

僅對實際進行動畫的元素使用。

gsap.quickTo() 用於頻繁更新

let xTo = gsap.quickTo("#id", "x", { duration: 0.4, ease: "power3" }),
  yTo = gsap.quickTo("#id", "y", { duration: 0.4, ease: "power3" });
container.addEventListener("mousemove", (e) => {
  xTo(e.pageX);
  yTo(e.pageY);
});

使用 Stagger 而非多個補間

使用 stagger 而非帶手動延遲的多個獨立補間。

清理 (Cleanup)

暫停或終止螢幕外的動畫。


參考資料 (按需載入)

  • references/effects.md — 即用型效果:打字機文字、音訊視覺化器。當需要 HyperFrames 的現成效果模式時請閱讀。

最佳實踐

  • 使用駝峰式屬性名稱;優先使用變換別名和 autoAlpha。
  • 優先使用時間軸而非鏈式 delay;使用位置參數。
  • 使用 addLabel() 添加標籤以實現可讀性高的序列。
  • 將預設值傳入時間軸建構函數。
  • 當需要控制播放時,儲存補間/時間軸的回傳值。

避免事項

  • 在變換可達成效果時,動畫化佈局屬性 (width/height/top/left)。
  • 在同一個 SVG 元素上同時使用 svgOrigin 和 transformOrigin。
  • 當時間軸可以對動畫進行排序時,使用 delay 鏈式串接動畫。
  • 在 DOM 存在之前建立補間。
  • 跳過清理 — 在不再需要時始終終止補間。

Individual skills in this repo

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

zroeschen/Video-Production-Factory

Agent 2 of the video editing pipeline. Finds and removes spoken mistakes — stutters, repeated words, false starts, and retakes (re-recorded lines) — from a talking-head recording. Use after cut-silences, when asked to cut mistakes, remove stutters / repeats / filler restarts, clean up flubs, or keep the best take. Works review-gated: it proposes every cut with context and a reason for approval, then renders only the approved cuts via ffmpeg. Requires a word-level transcript.

zroeschen/Video-Production-Factory

Agent 1 of the video editing pipeline. Removes silences and dead air from a talking-head recording. Use when asked to cut silences, trim pauses, remove dead air / gaps, or tighten the pacing of a raw video, given a word-level transcript. Produces an edit list (EDL), a re-timed transcript for downstream agents, and optionally the cut video via ffmpeg. Does NOT cut mistakes, repeats, or false starts — that is the cut-mistakes agent.

zroeschen/Video-Production-Factory

Edit a raw talking-head video through transcription, silence trimming, mistake review, visual storytelling, motion graphics, and verified HyperFrames rendering. Use for a complete edit; route a single requested operation directly to its specialist skill.

zroeschen/Video-Production-Factory

HyperFrames CLI tool — hyperframes init, lint, preview, render, transcribe, tts, doctor, browser, info, upgrade, compositions, docs, benchmark. Use when scaffolding a project, linting or validating compositions, previewing in the studio, rendering to video, transcribing audio, generating TTS, or troubleshooting the HyperFrames environment.

相關技能