Communitygithub.com

nehakanjamala/personal_website

このスキルは、ユーザーが「スクロールアニメーションを作成」「ScrollTriggerを追加」「スクロール中にセクションを固定」「アニメーションをスクロールに同期」「ヒーロータイムラインを作成」「水平スクロールセクション」「テキストを分割して単語をアニメーション」「GSAP Flipでレイアウト変更をアニメーション」「LenisとScrollTriggerを同期」「Lenisスムーズスクロールのカクつき」「ScrollTriggerマーカーのずれ」「Lenis/LocomotiveでScrollTriggerピンが壊れる」「GSAPピンとスムーズスクロールのセットアップ」などのリクエストに使用します。GSAPのタイムライン、ScrollTrigger、SplitText、Flip、Lenis/Locomotiveのスムーズスクロール同期をカバーし、コード駆動のWebモーションを実現します。

personal_website とは?

このスキルは、GSAP(GreenSock Animation Platform)とそのプラグイン(ScrollTrigger、SplitText、Flip)を使用して、高度なWebアニメーションを実装するための包括的なガイドです。主な機能として、スクロールに連動したストーリーテリング、テキストのリビールアニメーション、レイアウト遷移(Flip)などを、タイムラインを用いた制御で実現します。特に、LenisやLocomotiveなどのスムーズスクロールライブラリとScrollTriggerを同期させる際の注意点(カクつき、マーカーのずれ、ピンの破損など)とその修正方法を詳細に解説している点が特徴です。また、GSAPのパフォーマンス最適化テクニックや、SPAでのクリーンアップ方法、`?t=N`ハーネスを使ったアニメーションの検証方法についても網羅しており、コード駆動のWebモーションにおけるベストプラクティスを学ぶことができます。このスキルは、Claude Code、Coder、Cursorなど、あらゆるAIエージェントがWebアニメーションの実装を支援する際に活用できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/nehakanjamala/personal_website/tree/HEAD/.agents/skills/gsap-web

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

WebのためのGSAP

GSAP(GreenSock Animation Platform)は、コード駆動のWebモーションの主力ツールです。シーケンシャルなタイムライン、スクロール駆動のストーリーテリング、テキストリビール、レイアウト遷移などを実現します。GSAP 3.12+以降、すべてのプラグイン(ScrollTrigger、SplitText、Flip、MotionPath、MorphSVG、Draggable、Observer)は、商用利用を含めて100%無料です。

使用するタイミング

  • スクロール駆動のストーリーテリング:固定セクション、パララックス、進行状況のスクラブ、水平スクロール
  • シーケンシャルなヒーローアニメーションと、正確なオーバーラップ制御を伴う複数要素の複雑なタイムライン
  • 文字/単語/行に分割されたテキストリビール(SplitText)
  • 要素の位置/サイズ/親が変わるレイアウト遷移(Flip)
  • 細かいタイミング制御、イージングの精度、命令的なオーケストレーションが必要なあらゆるモーション

インストールと登録

import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { SplitText } from "gsap/SplitText";
import { Flip } from "gsap/Flip";

gsap.registerPlugin(ScrollTrigger, SplitText, Flip);

プラグインは使用前に必ず登録する必要があります。登録しないと、何もせずに失敗します(no-op)。バンドラーを使用する場合は、アプリのエントリポイントで一度だけ登録します。

コアテクニック

タイムラインファースト

個別のトゥイーンを多数使うよりも、1つのタイムラインを優先します。1つのタイムラインであれば、単一の再生ヘッド、相対的な位置指定、簡単なリバースが可能になります。

const tl = gsap.timeline({ defaults: { ease: "power3.out", duration: 0.6 } });
tl.from(".title", { yPercent: 100, opacity: 0 })
  .from(".sub",   { y: 20, opacity: 0 }, "-=0.3")  // 前のトゥイーンの終了の0.3秒前から開始
  .from(".cta",   { scale: 0.9, opacity: 0 }, "<"); // 前のトゥイーンの開始に合わせる

位置パラメータの早見表:

  • "+=0.5" / "-=0.3" — タイムラインの終了からの相対(間隔 / オーバーラップ)
  • "<" — 前のトゥイーンの開始。">" — 前のトゥイーンの終了
  • "<0.2" — 前のトゥイーンの開始から0.2秒後
  • "myLabel" — tl.addLabel("myLabel") で追加された名前付きラベルの位置

エントランスには .from()(与えられた値から現在のCSSへアニメーション)、終了には .to()、両端を明示する必要がある場合(再実行に対して最も堅牢)には .fromTo() を使用します。

gsap.to vs set vs quickTo

gsap.set(el, { autoAlpha: 0 });           // 瞬時に実行、トゥイーンなし(autoAlpha = opacity + visibility)
const xTo = gsap.quickTo(el, "x", { duration: 0.4, ease: "power3" });
window.addEventListener("pointermove", (e) => xTo(e.clientX)); // 高速な繰り返し更新

autoAlpha は生の opacity よりも推奨されます。0のときに visibility:hidden も同時に切り替え、要素をヒットテストから除外するためです。

ScrollTriggerの基本

gsap.to(".panel", {
  xPercent: -100,
  ease: "none",
  scrollTrigger: {
    trigger: ".wrap",
    start: "top top",      // トリガーのtopがビューポートのtopに当たったとき
    end: "+=2000",         // 2000ピクセルのスクロール距離
    pin: true,             // トゥイーンが再生されている間、.wrapを固定
    scrub: 1,              // 進行状況をスクロールバーに結びつける(1 = 1秒の追従スムージング)
    markers: true,         // 開発用の視覚的マーカー — 本番では削除
  },
});

主要なセマンティクス:

  • start/end は "triggerPos viewportPos"(例:"top center")または "+=px" を受け取ります。
  • scrub: true はアニメーションの進行状況をスクロールに正確にロックします。scrub: <数値> はスムージングのラグを追加します。
  • toggleActions: "play pause resume reverse" は、スクラブされていないトリガーの onEnter/onLeave/onEnterBack/onLeaveBack を制御します。
  • スクラブされたトゥイーンには ease: "none" を使用して、モーションがスクロールに線形に追従するようにします。

スムーズスクロール(Lenis)+ ScrollTrigger

Lenis(またはLocomotive)のスムーズスクロールとScrollTriggerをペアリングすると、両方が1つのループで実行されない限り、同期が解除されます。Lenisは独自のrAFでスクロールをスムーズにし、ScrollTriggerはGSAPのティッカーでスクロールを読み取ります。これらが独立してティックすると、ScrollTriggerは古い位置をサンプリングします。修正方法は、GSAPのティッカーからLenisを駆動し、すべてのLenisスクロールでScrollTriggerを更新することです。

import Lenis from "lenis";

const lenis = new Lenis({ duration: 1.2, smoothWheel: true });

lenis.on("scroll", ScrollTrigger.update);          // 1. すべてのLenisスクロールでScrollTriggerを更新
// 2. 1つのループ:ティッカーがLenisを駆動(秒→ミリ秒)
gsap.ticker.add((t) => lenis.raf(t * 1000));        
gsap.ticker.lagSmoothing(0);                        // 3. 重いフレームでのGSAPのキャッチアップジッターを停止

重要: gsap.ticker は時間を秒で渡し、lenis.raf() はミリ秒を必要とします — 1000倍してください。Lenisのためにスタンドアロンの requestAnimationFrame(raf) ループを実行しないでください。それは二重駆動になります。

よくあるバグ:

  • カクつき/スタッター — ティッカーと競合する残りの requestAnimationFrame(raf) ループ、または lagSmoothing(0) の欠落。不正なループを削除し、ラグスムージングを0に設定します。
  • マーカーがトリガーからずれる — ScrollTrigger.update が lenis.on("scroll", …) にサブスクライブされていない。
  • ピンが壊れる — Lenisでは scrollerProxy を設定しないでください(ドキュメントをスクロールします)。Locomotiveでは、必ず scrollerProxy + pinType を配線し、すべてのトリガーに scroller: を設定する必要があります。
  • スクロールが詰まる/方向が反転する — * 1000 の単位変換の欠落、または2つのループの順序が間違っている。

SPAアンマウント時のクリーンアップ: gsap.ticker.remove(update) + lenis.destroy()、そうしないとループがナビゲーションごとにスタックします。prefers-reduced-motion でガード(Lenisをスキップし、ネイティブスクロールを実行)。完全なLenis + Locomotive配線、アンカーリンクルーティング、data-lenis-prevent、React(useGSAP/useEffect)、および症状→原因テーブルは references/scrolltrigger-lenis.md にあります。

SplitText(テキストリビール)

const split = SplitText.create(".headline", { type: "lines, words", linesClass: "line" });
gsap.from(split.lines, { yPercent: 100, opacity: 0, stagger: 0.08, duration: 0.7, ease: "power4.out" });

落とし穴:

  • 行マスクリビール:行ラッパーに overflow: hidden を設定して、yPercent: 100 をきれいに隠します。autoSplit: true(GSAP 3.13+)を追加して、フォントロード/リサイズ時に再分割します。
  • 再分割前またはアンマウント時に split.revert() を呼び出して、元のDOMを復元し、ノードの重複を避けます。
  • 改行の誤りを防ぐため、常に Webフォントのロード後(document.fonts.ready.then(...))に分割します。

Flip(レイアウト遷移)

Flipは状態を記録し、DOMを即座に変更させ、その後視覚的な差分をアニメーション化します(FLIPテクニック)。グリッド⇔リスト、カードの展開、親の変更に最適です。

const state = Flip.getState(".item");   // 1. 変更前をキャプチャ
container.classList.toggle("grid");      // 2. DOM/CSSを変更(瞬時)
Flip.from(state, {                        // 3. 差分をアニメーション
  duration: 0.6, ease: "power2.inOut", stagger: 0.05,
  absolute: true,                         // 移動中にアイテムをフローから外す(リフローのジッターを防ぐ)
});

イージングクイックガイド

  • power2/3.out — エントランス(速く入って落ち着く)
  • power2.inOut — 2つの画面上の状態間の移動
  • back.out(1.7) — オーバーシュート/ポップ(数値はオーバーシュート量)
  • elastic.out(1, 0.3) — 弾むように、控えめに使用
  • none — スクラブされたスクロールトゥイーン
  • steps(n) — スプライト/ステップモーション
  • カスタムCubic-bezierの代替:CustomEase.create("x", "M0,0 C0.2,0 0,1 1,1")(CustomEaseは無料)

パフォーマンスとクリーンアップ

  • transform(x/y/xPercent/scale/rotation)と opacity のみをアニメーション化します。これらはGPUコンポジットされ、レイアウト/ペイントをスキップします。top/left/width/height のアニメーションは避けてください。
  • 重い/固定された要素には will-change: transform を設定し、その後削除します。
  • 同様のスクロールリビールを多数バッチ処理するには、要素ごとに1つのトリガーを作成する代わりに ScrollTrigger.batch() を使用します。
  • ビューポート/コンテンツの変更後は、ScrollTrigger.refresh() を呼び出します。

SPA / フレームワークのクリーンアップは必須です。孤立したトリガーはメモリリークとゴーストピン留めを引き起こします。gsap.context()(または @gsap/react の useGSAP)を使用します:

useEffect(() => {
  const ctx = gsap.context(() => {
    // ここにすべての gsap + ScrollTrigger コード
  }, rootRef);
  return () => ctx.revert(); // トゥイーン、トリガーを殺し、インラインスタイルを元に戻す
}, []);

成果物の出力と検証(スタンドアロンHTML)

パッケージ化されたヘルパー(scripts/): scripts/seek-shot.sh anim.html 0 1.5 3 は ?t=N ハーネスをフリーズし、各瞬間のスクリーンショットを撮ります。scripts/contact-sheet.sh sheet.png frame-*.png はそれらをタイル状に並べて、ひと目で確認できるようにします。詳細は scripts/README.md を参照してください。

自己完結型のアニメーション(ヒーロー、リビール、ループ、マイクロシーン)の場合、成果物はブラウザで直接開く1つのHTMLファイルです — ビルドステップ、フレームワーク、レンダリングパイプラインは不要です。作業の重みに合わせて成果物を選択してください。1つのファイルで事足りる場合にバンドラーに頼る必要はありません。

出力契約:

  • 1つの .html ファイル:GSAP + プラグインをCDNから、マークアップ、アニメーションを1つのインライン <script> に。
  • すべてのモーションは1つのマスタータイムライン上(const tl = gsap.timeline()) — シーク可能な単一の再生ヘッド。
  • 以下のシークハーネスを含め、任意の瞬間を検査のためにフリーズできるようにします。

シークハーネス — スクリーンショットのために正確な瞬間をフリーズします。 ビデオプレーヤーのフレーム固定に相当するWeb版:?t=N はマスタータイムラインを N 秒にシークして一時停止し、スクリーンショットが静止した決定論的なフレームに着地するようにします。

<script>
  // ... マスタータイムラインを `tl` として構築 ...
  const t = new URLSearchParams(location.search).get("t");
  if (t !== null) { tl.pause(); tl.seek(parseFloat(t)); }  // t秒でフリーズ
  // ?t なし → 通常再生
  window.__ready = true;            // ヘッドレス待機のための準備完了シグナル
  console.log("duration", tl.duration());
</script>

検証ループ — レンダリング → フリーズ → スクリーンショット → 確認:

  1. タイムライン全体の3つの瞬間(開始、中間、終了)でファイルを開きます: …/anim.html?t=0、?t=<dur/2>、?t=<dur>。終了時間はコンソールから tl.duration() を読み取ります。
  2. 各フリーズフレームのスクリーンショットを撮ります。
  3. 忠実度(概要に一致するか?)とアーティファクト(テキストがクリップされていないか、要素がキャンバス外でないか、フォントロード前のFOUC、継ぎ目のカクつき)の両方を確認します。出力は意図的で完成されたように見える必要があります。

任意のヘッドレススクリーンショットツールが機能します — エージェントのブラウザツール、またはPlaywright:

npx playwright screenshot --wait-for-timeout=500 "file://$PWD/anim.html?t=1.2" frame-mid.png

終了前に:

  1. ブラウザでスタンドアロンで開く — コンソールエラーなし、CDNの欠落なし。
  2. すべてのアニメーションが1つのマスタータイムライン上にある。?t=N が正しくフリーズする。
  3. 開始/中間/終了でスクリーンショットを撮影 — 概要と一致し、アーティファクトがない。
  4. prefers-reduced-motion が尊重されている(タイムラインが簡略化またはスキップされている)。
  5. イージングは意図的 — 空間モーションに誤った linear がない。

ハーネスが組み込まれた完全な実行可能テンプレートは examples/standalone-template.html にあります。

クイックリファレンス

目的API
オーバーラップを含むシーケンスtl.from(...).from(..., "-=0.3")
スクロール中にピン留めscrollTrigger:{ pin:true, end:"+=N" }
スクロールにスクラブscrollTrigger:{ scrub:1, ease:"none" }
テキストの行をリビールSplitText.create(el,{type:"lines"})
レイアウト変更をアニメーションFlip.getState → 変更 → Flip.from
高速ポインタ追従gsap.quickTo(el,"x",{...})
すべてをキルScrollTrigger.getAll().forEach(t=>t.kill())

リファレンスファイル

  • references/scrolltrigger-cookbook.md — ピン、スクラブ、水平スクロール、スナップ、ScrollTrigger.batch() リビール、パララックス、ネストされたトリガー、および完全なコード付きのSPAクリーンアップパターン。
  • references/scrolltrigger-lenis.md — ScrollTrigger + Lenis/Locomotive スムーズスクロール同期の完全版:標準的な配線、scrollerProxy、アンカーリンク、縮小モーション、React(useGSAP/useEffect)、デバッグチェックリスト、症状→原因テーブル。
  • examples/hero-timeline.js — SplitText、スタガーリビール、縮小モーション処理を備えた、完全で実行可能なヒーローエントランスタイムライン。
  • examples/standalone-template.html — 成果物テンプレート:自己完結型(CDN GSAP)、1つのマスタータイムライン、スクリーンショット検証用の ?t=N シークハーネス、縮小モーション処理。

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

nehakanjamala/personal_website

This skill should be used when the user asks to "fix janky CSS animation", "make animation 60fps", "stop layout thrashing", "animate width/height/top/left smoothly", "convert animation to transform", "animate box-shadow performantly", "animate height auto", "FLIP animation", or "why is my scroll/hover animation choppy".

nehakanjamala/personal_website

This skill should be used when the user asks to "respect prefers-reduced-motion", "honor reduced motion", "make my animations accessible", "fix vestibular / motion-sickness issues", "add a useReducedMotion hook", "gate GSAP / Framer Motion / Lenis for reduced motion", or "meet WCAG 2.3.3 / C39". Provides tiered (not all-or-nothing) reduced-motion patterns in CSS and JS.

nehakanjamala/personal_website

Create, modify, debug, and deploy Apify Actors, and write their input and output schemas. Use when building an Actor from scratch, changing or troubleshooting Actor code, generating or updating .actor schema files, or pushing an Actor to the Apify platform. To wrap an existing non-Actor project, use apify-actorization instead.

nehakanjamala/personal_website

Convert existing projects into Apify Actors - serverless cloud programs. Actorize JavaScript/TypeScript (SDK with Actor.init/exit), Python (async context manager), or any language (CLI wrapper). Use when migrating code to Apify, wrapping CLI tools as Actors, or adding Actor SDK to existing projects.

nehakanjamala/personal_website

Deprecated. Output schema generation moved to the apify-actor-development skill; prefer that skill whenever it is available.

nehakanjamala/personal_website

Design and build an official Apify integration for a company's product - workflow-automation apps (Zapier/n8n-style), AI agent plugins (coding-agent skills+MCP bundles or OpenClaw/Hermes-style harnesses), AI framework packages (LangChain/LlamaIndex-style), or direct application clients via apify-client. Use when planning, creating, or reviewing an integration that exposes Apify Actors, runs, datasets, or key-value stores inside another product.

nehakanjamala/personal_website

Universal AI-powered web scraper for any platform. Scrape data from Instagram, Facebook, TikTok, YouTube, LinkedIn, X/Twitter, Google Maps, Google Search, Google Trends, Reddit, Airbnb, Yelp, and 15+ more platforms. Use for lead generation, brand monitoring, competitor analysis, influencer discovery, trend research, content analytics, audience analysis, review analysis, SEO intelligence, recruitment, or any data extraction task.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a glassmorphism effect", "frosted glass UI", "Apple liquid glass style", "frosted blur card", "translucent glass panel animation", "make a frosted nav bar", "build a glass modal/dialog", "animate a glass card on hover", or "add a refracting liquid-glass hero". Covers frosted translucent panels with backdrop-filter blur, edge/specular highlights, SVG liquid-glass refraction, motion on hover/scroll/enter, and accessible reduced-transparency fallbacks.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a Lottie animation", "play a .lottie or .json animation", "integrate a Bodymovin/After Effects animation on web or mobile", "control Lottie playback / segments", "make a scroll-driven Lottie", "recolor a Lottie at runtime", or "export an AE animation to Lottie". Covers dotLottie/lottie-web integration, playback control, interactivity, theming, and the AE export checklist.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a hover/press effect", "animate a toggle or switch", "build an animated like button", "make a toast/snackbar slide in", "animate a drawer or modal", "animate list reordering or add/remove", "do a shared-element layout transition", or "polish UI feedback". Covers UI motion with Framer Motion (motion/react) and modern CSS.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate page or route transitions", "add a page transition or crossfade between views", "animate route changes in Next.js App Router", "use the View Transitions API", "AnimatePresence exit doesn't fire on navigation", or "Framer Motion exit animation not working / exit animation before unmount in Next.js". Covers enter/exit page-transition animation with the View Transitions API and Framer Motion, for Next.js App Router and general SPA routing.

nehakanjamala/personal_website

Scrape web pages using Scrapling with anti-bot bypass (like Cloudflare Turnstile), stealth headless browsing, spiders framework, adaptive scraping, and JavaScript rendering. Use when asked to scrape, crawl, or extract data from websites; web_fetch fails; the site has anti-bot protections; write Python code to scrape/crawl; or write spiders.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate an SVG", "make a line draw itself on", "do a stroke draw-on / signature animation", "morph one shape into another", "move an element along a path", "animate an icon/logo", or "animate an SVG gradient or filter". Covers stroke-dashoffset draw-on, path morphing, motion-along-path, and animated icons/gradients/filters via CSS, SMIL, and GSAP.

関連スキル