gsap-greensock について
GSAPのタイムラインとトゥイーンを使い、Disneyの12のアニメーション原則を実践するガイドです。Webアニメーションを作る開発者向けに、イージング、モーションパス、連続動作、重なりの例を紹介します。
主な機能
- 0112の原則を使うアニメーション例
- 02タイムラインによる動作の構成
- 03イージング、スタガー、ループ制御
- 04モーションパスと動作の重なり
活用シーン
- 01キャラクターやUI要素のアニメーション
- 02複数の動作の連続構成
- 03曲線運動やスタガー効果の作成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ dylantarre/ animation-principles --skill gsap-greensockインストール後、Claude Code で/gsap-greensockを入力して読み込まれたか確認します。
詳細
GSAP アニメーションの原則
GSAP の強力なタイムラインおよびトゥイーンシステムを使って、ディズニーのアニメーション12原則をすべて実装します。
1. つぶしと伸ばし
gsap.to(".ball", {
scaleX: 1.2,
scaleY: 0.8,
yoyo: true,
repeat: 1,
duration: 0.15,
ease: "power2.inOut"
});
2. 予備動作
const tl = gsap.timeline();
tl.to(".character", { y: 20, scaleY: 0.9, duration: 0.2 }) // wind up
.to(".character", { y: -200, duration: 0.4, ease: "power2.out" }); // action
3. 演出
gsap.to(".background", { filter: "blur(3px)", opacity: 0.6 });
gsap.to(".hero", { scale: 1.1, zIndex: 10 });
4. ストレートアヘッドとポーズ・トゥ・ポーズ
// Pose to pose with explicit keyframes
gsap.to(".sprite", {
keyframes: [
{ x: 0, y: 0 },
{ x: 100, y: -50 },
{ x: 200, y: 0 },
{ x: 300, y: -30 }
],
duration: 1
});
5. フォロースルーとオーバーラッピングアクション
const tl = gsap.timeline();
tl.to(".body", { x: 200, duration: 0.5 })
.to(".hair", { x: 200, duration: 0.5 }, "-=0.4") // overlaps
.to(".cape", { x: 200, duration: 0.6 }, "-=0.45"); // more drag
6. スローインとスローアウト
gsap.to(".element", {
x: 300,
duration: 0.6,
ease: "power2.inOut" // slow in and out
});
// Other eases: "power3.in", "power3.out", "elastic.out"
7. アーク
gsap.to(".ball", {
motionPath: {
path: [{ x: 0, y: 0 }, { x: 100, y: -100 }, { x: 200, y: 0 }],
curviness: 1.5
},
duration: 1
});
8. 副次動作
const tl = gsap.timeline();
tl.to(".button", { scale: 1.1, duration: 0.2 })
.to(".icon", { rotation: 15, duration: 0.15 }, "<") // same time
.to(".particles", { opacity: 1, stagger: 0.05 }, "<0.1");
9. タイミング
// Fast snap
gsap.to(".fast", { x: 100, duration: 0.15 });
// Gentle float
gsap.to(".slow", { y: -20, duration: 2, ease: "sine.inOut", yoyo: true, repeat: -1 });
10. 誇張
gsap.to(".element", {
scale: 1.5, // exaggerated scale
rotation: 720, // multiple spins
duration: 0.8,
ease: "back.out(2)" // overshoot
});
11. 立体感のある描画
gsap.to(".box", {
rotationX: 45,
rotationY: 30,
transformPerspective: 1000,
duration: 0.5
});
12. 魅力
gsap.to(".card", {
scale: 1.02,
boxShadow: "0 20px 40px rgba(0,0,0,0.2)",
duration: 0.3,
ease: "power1.out"
});
GSAP タイムラインのパターン
const masterTL = gsap.timeline({ defaults: { ease: "power2.out" }});
masterTL
.add(anticipation())
.add(mainAction())
.add(followThrough());
GSAP の主な機能
gsap.timeline()- アニメーションを順番に再生しますease- 30種類以上の組み込みイージング関数stagger- 複数の要素の開始時間をずらしますmotionPath- アークやパスに沿ったアニメーションyoyo/repeat- ループを制御します"<"/"-=0.2"- アニメーションを重ねるための位置パラメーター
コメント
Markdown 対応