gsap
GSAPを使用してハイパフォーマンスなアニメーションを構築するためのエキスパートガイドラインを提供するスキルです。GreenSock Animation Platformの機能を最大限に活用したアニメーション実装をサポートします。
description の原文を見る
Expert guidelines for building high-performance animations with GSAP (GreenSock Animation Platform)
SKILL.md 本文
GSAP アニメーションガイドライン
GSAP (GreenSock Animation Platform)、JavaScript、Web アニメーションパフォーマンスの専門家です。アニメーションを作成する際は、以下のガイドラインに従ってください。
コアプリンシパル
インポートとセットアップ
// Modern ES Module import
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
// Register plugins
gsap.registerPlugin(ScrollTrigger);
gsap.to()、gsap.from()、gsap.fromTo() を使用する
// Animate TO a state
gsap.to(".element", { x: 100, duration: 1 });
// Animate FROM a state
gsap.from(".element", { opacity: 0, y: 50, duration: 0.5 });
// Animate FROM one state TO another
gsap.fromTo(".element",
{ opacity: 0 },
{ opacity: 1, duration: 0.5 }
);
パフォーマンス最適化
ハードウェアアクセラレーションの活用
// Use transforms instead of positional properties
gsap.to(".element", {
x: 100, // Good - uses transform
y: 50, // Good - uses transform
rotation: 45, // Good - uses transform
scale: 1.2, // Good - uses transform
// Avoid: left, top, width, height when possible
});
// Enable force3D for GPU acceleration
gsap.to(".element", {
x: 100,
force3D: true // Ensures GPU acceleration
});
will-change を賢く使用する
// Apply will-change before animation
element.style.willChange = "transform";
gsap.to(element, {
x: 100,
onComplete: () => {
element.style.willChange = "auto"; // Remove after animation
}
});
複数要素に対してスタッガーを使用する
// Always use stagger for multiple elements
gsap.to(".items", {
opacity: 1,
y: 0,
stagger: 0.1, // Prevents all elements animating at once
duration: 0.5
});
// Advanced stagger options
gsap.to(".grid-items", {
scale: 1,
stagger: {
each: 0.1,
from: "center",
grid: "auto"
}
});
ラグスムージングを使用する
// Prevent animation stuttering during CPU spikes
gsap.ticker.lagSmoothing(1000, 16);
タイムラインのベストプラクティス
複雑なシーケンスにはタイムラインを使用する
const tl = gsap.timeline({
defaults: { duration: 0.5, ease: "power2.out" }
});
tl.to(".header", { y: 0, opacity: 1 })
.to(".content", { y: 0, opacity: 1 }, "-=0.3") // Overlap
.to(".footer", { y: 0, opacity: 1 }, "-=0.3");
ラベルを使用して整理する
const tl = gsap.timeline();
tl.addLabel("start")
.to(".intro", { opacity: 1 })
.addLabel("middle")
.to(".main", { x: 100 })
.addLabel("end")
.to(".outro", { opacity: 0 });
// Jump to label
tl.play("middle");
タイムラインをコントロールする
const tl = gsap.timeline({ paused: true });
// Methods
tl.play();
tl.pause();
tl.reverse();
tl.restart();
tl.seek(1.5); // Go to 1.5 seconds
tl.progress(0.5); // Go to 50%
ScrollTrigger のベストプラクティス
ScrollTrigger の基本セットアップ
gsap.to(".element", {
x: 500,
scrollTrigger: {
trigger: ".element",
start: "top center",
end: "bottom center",
scrub: true,
markers: false // Enable for debugging only
}
});
要素をピン止めする
ScrollTrigger.create({
trigger: ".panel",
pin: true,
start: "top top",
end: "+=500",
pinSpacing: true
});
ScrollTrigger をバッチ処理してパフォーマンスを向上させる
ScrollTrigger.batch(".items", {
onEnter: (elements) => {
gsap.to(elements, {
opacity: 1,
y: 0,
stagger: 0.1
});
}
});
React 統合
useGSAP フックを使用する
import { useGSAP } from "@gsap/react";
function Component() {
const containerRef = useRef(null);
useGSAP(() => {
gsap.to(".box", { x: 100 });
}, { scope: containerRef }); // Scopes selectors to container
return <div ref={containerRef}>...</div>;
}
アニメーションをクリーンアップする
useGSAP(() => {
const tl = gsap.timeline();
tl.to(".element", { x: 100 });
return () => {
tl.kill(); // Clean up on unmount
};
}, []);
セレクターの最適化
DOM セレクターをキャッシュする
// Bad - queries DOM on every call
gsap.to(".element", { x: 100 });
gsap.to(".element", { y: 50 });
// Good - cache the reference
const element = document.querySelector(".element");
gsap.to(element, { x: 100 });
gsap.to(element, { y: 50 });
gsap.utils で効率化する
// Convert NodeList to Array
const items = gsap.utils.toArray(".items");
// Create reusable selector
const select = gsap.utils.selector(container);
gsap.to(select(".box"), { x: 100 });
イージング
適切なイーズを使用する
// Common eases for UI
gsap.to(".element", { x: 100, ease: "power2.out" }); // Decelerate
gsap.to(".element", { x: 100, ease: "power2.in" }); // Accelerate
gsap.to(".element", { x: 100, ease: "power2.inOut" }); // Both
// Bounce and elastic for playful UI
gsap.to(".element", { y: 0, ease: "bounce.out" });
gsap.to(".element", { scale: 1, ease: "elastic.out(1, 0.3)" });
SVG アニメーション
SVG プロパティをアニメーション化する
gsap.to("path", {
strokeDashoffset: 0,
duration: 2,
ease: "none"
});
gsap.to("circle", {
attr: { r: 50, cx: 200 },
duration: 1
});
複雑なアニメーション
パスアニメーションに MotionPath を使用する
import { MotionPathPlugin } from "gsap/MotionPathPlugin";
gsap.registerPlugin(MotionPathPlugin);
gsap.to(".element", {
motionPath: {
path: "#path",
align: "#path",
autoRotate: true
},
duration: 5
});
デバッグ
開発中はマーカーを使用する
ScrollTrigger.defaults({
markers: process.env.NODE_ENV === "development"
});
タイムラインの進捗をデバッグする
tl.eventCallback("onUpdate", () => {
console.log(tl.progress());
});
ベストプラクティス要約
- 常に位置プロパティより transform を使用する
- 複数要素のアニメーションにはスタッガーを使用する
- 複雑なシーケンスにはタイムラインを活用する
- DOM セレクターをキャッシュする
- React では useGSAP フックを使用する
- コンポーネントのアンマウント時にアニメーションをクリーンアップする
- 滑らかな再生のためにラグスムージングを有効にする
- 実デバイス、特にモバイルでテストする
ライセンス: Apache-2.0(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- mindrally
- リポジトリ
- mindrally/skills
- ライセンス
- Apache-2.0
- 最終更新
- 不明
Source: https://github.com/mindrally/skills / ライセンス: Apache-2.0
関連スキル
nano-banana-2
inference.sh CLIを通じてGoogle Gemini 3.1 Flash Image Preview(Nano Banana 2)で画像を生成します。テキストから画像を生成する機能、画像編集、最大14枚の複数画像入力、Google Searchグラウンディング機能に対応しています。トリガーワード:「nano banana 2」「nanobanana 2」「gemini 3.1 flash image」「gemini 3 1 flash image preview」「google image generation」
octocode-slides
洗練されたマルチファイル形式のHTMLプレゼンテーションを生成します。6段階のフロー(概要 → リサーチ → アウトライン → デザイン → 実装 → レビュー)で構成されています。各スライドは独立したHTMLファイルとなり、iframeで読み込まれます。「スライドを作成してほしい」「プレゼンテーションを作ってほしい」「HTMLスライドを生成してほしい」「デックを構築してほしい」といった依頼や、ノート・ドキュメント・コードを洗練されたプレゼンテーションに変換する際に使用できます。
gpt-image2-ppt
OpenAIのgpt-image-2を使用して、視覚的に優れたPPTスライドを生成します。Spatial Glass、Tech Blue、Editorial Monoなど10種類のキュレーション済みスタイルに対応し、ユーザーが提供したPPTXファイルを模倣するテンプレートクローンモードも搭載しています。HTMLビューアと16:9形式のPPTXファイルを出力します。プレゼンテーション、スライド、ピッチデック、投資家向けPPT、雑誌風PPTの作成依頼などで活用してください。
nano-banana
Nano Banana PRO(Gemini 3 Pro Image)およびNano Banana(Gemini 2.5 Flash Image)を使用したAI画像生成機能です。以下の場合に活用できます:(1)テキストプロンプトからの画像生成、(2)既存画像の編集、(3)インフォグラフィックス、ロゴ、商品写真、ステッカーなどのプロフェッショナルなビジュアルアセット制作、(4)複数画像での人物キャラクターの一貫性保持、(5)正確なテキスト描画を含む画像生成、(6)AI生成ビジュアルが必要なあらゆるタスク。「画像を生成」「画像を作成」「写真を作る」「ロゴをデザイン」「インフォグラフィックスを作成」「AI画像」「nano banana」またはその他の画像生成リクエストをトリガーとして機能します。
oiloil-ui-ux-guide
モダンでクリーンなUI/UXガイダンス・レビュースキルです。新機能や既存システム(Webアプリ)に対して、実行可能なUI/UX改善提案、デザイン原則、デザインレビューチェックリストが必要な場合に活用できます。CRAP(コントラスト・反復・配置・近接)をベースに、タスクファーストなUX、情報設計、フィードバック・システムステータス、一貫性、affordances、エラー防止・復旧、認知負荷を重視します。モダンミニマルスタイル(クリーン・余白・タイポグラフィ主導)を強制し、不要なテキストを削減、アイコンとしての絵文字を禁止し、統一されたアイコンセットから直感的で洗練されたアイコンを推奨します。
axiom-hig-ref
Apple Human Interface Guidelines リファレンス — 色(セマンティックカラー、カスタムカラー、パターン)、背景(マテリアル階層、ダイナミック背景)、タイポグラフィ(標準スタイル、カスタムフォント、Dynamic Type)、SF Symbols(レンダリングモード、色、多言語対応)、ダークモード、アクセシビリティ、プラットフォーム固有の考慮事項を網羅したガイドラインです。