SVG 角色動畫
當需要為由 SVG 部件組成的角色骨架製作動畫時,請使用此技能。
執行規則
- 對
x、y、scale、rotation等轉換屬性進行動畫,而非布局屬性。 - 使用時間軸來編排多部件的表演節拍。
- 對於 SVG 元素,請使用穩定的樞紐(
svgOrigin或正確設定的變換原點)。 - 在 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