SVG 角色動畫
在為由 SVG 部件組成的角色骨架製作動畫時使用此技能。
執行時規則
- 對變形(
x、y、scale、rotation)進行動畫,而非版面配置。 - 使用時間軸來處理多部件的情感表演節拍。
- 對於 SVG 元素,使用穩定的轉動中心(
svgOrigin或正確設定範疇的 transform-origin)。 - 在 Remotion 中,不要讓 GSAP 透過
requestAnimationFrame推進;改為從當前影格驅動一個暫停的時間軸。
瀏覽器模式
gsap.set("#arm_right", { svgOrigin: "390 310" });
const tl = gsap.timeline({ defaults: { ease: "power2.inOut" } });
tl.to("#head", { rotation: -8, duration: 0.2 })
.to("#arm_right", { rotation: 35, duration: 0.4 }, "<");
Remotion 模式
const frame = useCurrentFrame();
const progress = frame / durationInFrames;
timeline.progress(progress);
HyperFrames 模式
使用具備確定性時間軸的 HTML/SVG/GSAP 元件,並在最終渲染前透過 HyperFrames CLI 進行驗證。
品質檢查清單
- 部件在運動期間保持樞軸連接。
- 眨眼、視線和嘴形變化足夠分明易讀。
- 姿勢停留時間足夠長,以傳達情感。
- 影格取樣顯示有意義的變化,而非凍結的動畫。
來源
- GSAP 核心變形屬性與 SVG 處理: https://gsap.com/docs/v3/GSAP/CorePlugins/CSS/
- GSAP 時間軸與序列: https://gsap.com/docs/v3/GSAP/Timeline/
- Remotion
useCurrentFrame: https://www.remotion.dev/docs/use-current-frame