mcpField
A
anime-js

anime-js

github.com/dylantarreデザイン・UI134645 回インストール43 週間前に更新
リポジトリ

anime-js について

Anime.jsでDisneyの12のアニメーション原則を実装するためのコーディング資料です。JavaScriptの例を通じて、タイムライン、キーフレーム、遅延のずらし方、イージングを紹介します。

主な機能

  1. 0112原則すべての実装例
  2. 02Anime.jsのタイムラインとキーフレーム
  3. 03遅延のずらしと相対タイミング
  4. 04SVGパスとイージングの選択肢

活用シーン

  1. 01UIの動きに予備動作やフォロースルーを加える
  2. 02複数要素のアニメーション順序を設定
  3. 03Anime.jsで曲線運動やずらした動きを作成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/dylantarre/animation-principles --skill anime-js

インストール後、Claude Code で/anime-jsを入力して読み込まれたか確認します。

詳細

Anime.js のアニメーション原則

Anime.js の柔軟なアニメーションエンジンを使って、ディズニーのアニメーション12原則すべてを実装します。

1. つぶしと伸ばし

anime({
  targets: '.ball',
  scaleX: [1, 1.2, 1],
  scaleY: [1, 0.8, 1],
  duration: 300,
  easing: 'easeInOutQuad'
});

2. 予備動作

anime.timeline()
  .add({
    targets: '.character',
    translateY: 10,
    scaleY: 0.9,
    duration: 200
  })
  .add({
    targets: '.character',
    translateY: -200,
    duration: 400,
    easing: 'easeOutQuad'
  });

3. 演出

anime({
  targets: '.background',
  filter: 'blur(3px)',
  opacity: 0.6,
  duration: 500
});
anime({
  targets: '.hero',
  scale: 1.1,
  duration: 500
});

4. ストレート・アヘッドとポーズ・トゥ・ポーズ

anime({
  targets: '.element',
  keyframes: [
    { translateX: 0, translateY: 0 },
    { translateX: 100, translateY: -50 },
    { translateX: 200, translateY: 0 },
    { translateX: 300, translateY: -30 }
  ],
  duration: 1000
});

5. フォロースルーとオーバーラッピング・アクション

anime.timeline()
  .add({ targets: '.body', translateX: 200, duration: 500 })
  .add({ targets: '.hair', translateX: 200, duration: 500 }, '-=450')
  .add({ targets: '.cape', translateX: 200, duration: 600 }, '-=500');

6. スローインとスローアウト

anime({
  targets: '.element',
  translateX: 300,
  duration: 600,
  easing: 'easeInOutCubic'
});
// Options: easeInQuad, easeOutQuad, easeInOutQuad
// easeInCubic, easeOutCubic, easeInOutCubic
// spring(mass, stiffness, damping, velocity)

7. 運動の弧

anime({
  targets: '.ball',
  translateX: 200,
  translateY: [
    { value: -100, duration: 500 },
    { value: 0, duration: 500 }
  ],
  easing: 'easeOutQuad',
  duration: 1000
});

// Or use SVG path
anime({
  targets: '.element',
  translateX: anime.path('.motion-path')('x'),
  translateY: anime.path('.motion-path')('y'),
  duration: 1000
});

8. 副次動作

const tl = anime.timeline();
tl.add({
  targets: '.button',
  scale: 1.1,
  duration: 200
})
.add({
  targets: '.icon',
  rotate: 15,
  duration: 150
}, '-=150')
.add({
  targets: '.particles',
  opacity: [0, 1],
  delay: anime.stagger(50)
}, '-=100');

9. タイミング

// Fast - snappy
anime({ targets: '.fast', translateX: 100, duration: 150 });

// Normal
anime({ targets: '.normal', translateX: 100, duration: 300 });

// Slow - dramatic
anime({ targets: '.slow', translateX: 100, duration: 600 });

// Spring physics
anime({ targets: '.spring', translateX: 100, easing: 'spring(1, 80, 10, 0)' });

10. 誇張

anime({
  targets: '.element',
  scale: 1.5,
  rotate: '2turn',
  duration: 800,
  easing: 'easeOutElastic(1, 0.5)' // overshoot
});

11. 立体感のある描画

anime({
  targets: '.box',
  rotateX: 45,
  rotateY: 30,
  perspective: 1000,
  duration: 500
});

12. 魅力

anime({
  targets: '.card',
  scale: 1.02,
  boxShadow: '0 20px 40px rgba(0,0,0,0.2)',
  duration: 300,
  easing: 'easeOutQuad'
});

スタッガーアニメーション

anime({
  targets: '.item',
  translateY: [20, 0],
  opacity: [0, 1],
  delay: anime.stagger(100), // 100ms between each
  easing: 'easeOutQuad'
});

Anime.js の主な機能

  • anime.timeline() - アニメーションを連続させます
  • keyframes - 複数のポーズ
  • anime.stagger() - 遅延時間をずらします
  • anime.path() - SVG のモーションパス
  • 組み込みのイージング + spring() + elastic()
  • '-=200' - 相対的なオフセットタイミング
  • anime.set() - プロパティを即時に設定します

コメント