Communitygithub.com

スクロールアニメーションスキル

IntersectionObserver を使用したスクロール連動アニメーションを、Tailwind 対応のアニメーションクラスとキーフレームで作成します。スクロールリビール、アニメーション・オン・スクロール、ビューポートに入ったときの要素のシーケンスアニメーションが求められたときに使用します。

スクロールアニメーションスキル とは?

このスキルは、IntersectionObserver を利用して、スクロールに合わせて要素をアニメーションさせるシンプルかつ強力な仕組みを提供します。Tailwind CSS のユーティリティクラスと CSS キーフレームを組み合わせ、要素がビューポートに現れたときに「フェードイン」「スライドイン」「ブラー解除」などの動きを実現します。アニメーションはデフォルトで一度のみ実行され、要素が再び表示されても繰り返しませんが、設定を変更すれば繰り返し再生も可能です。しきい値や余白(rootMargin)、アニメーションの持続時間・遅延・変形値なども簡単にカスタマイズでき、Claude Code、Cursor、Codex などの AI エージェントツール上で使用することを想定しています。実装は、キーフレームを `<head>` 内に挿入し、対象要素に `animate-on-scroll` クラスと Tailwind アニメーション値を追加するだけで完了します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/MengTo/Skills/tree/HEAD/agent-skills/web-design/animation-on-scroll

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

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

ドキュメント

アニメーション・オン・スクロール スキル

ワークフロー

  1. アニメーションのスタイル、タイミング、およびアニメーションを1回だけ実行するか繰り返すかを確認します。
  2. キーフレームと JS オブザーバースニペット、および適用する正確な Tailwind クラスを提供します。
  3. しきい値、rootMargin、持続時間、遅延、transform/blur 値などの調整のみに集中します。

使用チェックリスト

  • JS スニペットをキーフレームの後に <head> 内に挿入します。
  • 要素にアニメーションクラスと animate-on-scroll を追加します。
  • キーフレーム名が Tailwind アニメーションの参照と一致していることを確認します。

IntersectionObserver トリガー

<script>
  /*
    表示されたときにスクロールに連動したアニメーションを実行します。アニメーションキーフレームが必要です。使い方:

    1) このコードをアニメーションキーフレームコードと一緒に <head> に挿入します。

    2) Tailwind クラスに追加:[animation:animationIn_0.8s_ease-out_0.1s_both] animate-on-scroll
  */
  (function () {
    // 一時停止/実行中の状態を注入
    const style = document.createElement("style");
    style.textContent = `
      /* デフォルト:一時停止 */
      .animate-on-scroll { animation-play-state: paused !important; }
      /* JS によってアクティブ化 */
      .animate-on-scroll.animate { animation-play-state: running !important; }
    `;
    document.head.appendChild(style);

    const once = true;

    if (!window.__inViewIO) {
      window.__inViewIO = new IntersectionObserver((entries) => {
        entries.forEach((entry) => {
          if (entry.isIntersecting) {
            entry.target.classList.add("animate");
            if (once) window.__inViewIO.unobserve(entry.target);
          }
        });
      }, { threshold: 0.2, rootMargin: "0px 0px -10% 0px" });
    }

    window.initInViewAnimations = function (selector = ".animate-on-scroll") {
      document.querySelectorAll(selector).forEach((el) => {
        window.__inViewIO.observe(el); // 2回監視しても no-op
      });
    };

    document.addEventListener("DOMContentLoaded", () => initInViewAnimations());
  })();
</script>

キーフレーム

<style>
  /*
    シーケンスアニメーションイントロ。使い方:

    1) このコードを <head> に挿入します。

    2) Tailwind クラスに追加:[animation:animationIn_0.8s_ease-out_0.1s_both]
  */
  @keyframes animationIn {
    0% {
      opacity: 0;
      transform: translateY(30px);
      filter: blur(8px);
    }

    100% {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0px);
    }
  }
</style>

Tailwind の例

<div class="animate-on-scroll [animation:animationIn_0.8s_ease-out_0.1s_both]">
  ...
</div>

カスタマイズのつまみ

  • トリガー:threshold と rootMargin を調整して、表示タイミングを早めたり遅くしたりします。
  • 繰り返し:once = false に設定すると、再表示されたときにアニメーションを再実行できます。
  • モーション:キーフレーム内の translateY と blur を調整します。
  • タイミング:Tailwind アニメーション値の duration と delay を変更します。

よくある落とし穴

  • JS スニペットの前にキーフレームを挿入するのを忘れる。
  • Tailwind アニメーションと異なるキーフレーム名を使用する。
  • オブザーバーが初期化される前に要素がすでにビューポート内にあるため、アニメーションが実行されない。

仕様が不足している場合の質問項目

  • アニメーションは一度だけ実行しますか、それとも要素が再表示されるたびに実行しますか?
  • 要素がビューポートに入るどのくらい前からアニメーションを開始しますか?
  • どのようなモーションスタイル(フェード、スライド、ブラー、スケール)にしますか?

Individual skills in this repo

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

MengTo/Skills

Create polished 60 fps 4:3 4K browser screen-recording style videos from Codex in-app browser captures, with browser-only crop, natural macOS cursor styling, deliberate click choreography, zoom-follow framing, ffprobe/thumbnail verification, and optional native recording compatibility checks. Use when the user asks to record or re-record browser actions, show cursor clicks and zooms, make Dribbble/UI inspiration or product demo recordings, or asks whether Codex, Playwright, or an MCP can produce a natural browser demo video.

MengTo/Skills

Generate ElevenLabs text-to-speech audio from scripts or inline text using local voice profiles. Use when the user asks for ElevenLabs, text-to-speech, TTS, narration, voiceover, speech audio, or voice generation; load voice names, voice ids, emails, owners, and account-specific defaults only from local config outside the skill.

MengTo/Skills

Profile, audit, and optimize frontend page performance with emphasis on animation work, memory-leak risks, long-session slowdowns, CSS animations, canvas/WebGL requestAnimationFrame loops, marquees, skeletons, GSAP/Three/Matter effects, timers, listeners, and observers. Use when the user asks to make animations performant, pause offscreen animations, look for memory leaks, profile pages that slow the computer over time, fix janky scrolling, reduce CPU/GPU use, or repeat the "only play in view" optimization on React/Vite/Next/frontend pages using Codex Browser.

MengTo/Skills

Turn a reference video into a super detailed recreation or inspiration prompt. Use when the user provides, mentions, uploads, links, or points to a video and asks to analyze the design, UI, animations, transitions, scroll interactions, typography, colors, assets, WebGL/Three.js, storytelling, section-by-section behavior, or to create a prompt/article that recreates the page, app, interaction, or motion system.

MengTo/Skills

Use when designing or implementing product-grade web motion like Stripe, Linear, Apple, and Vercel. Covers motion principles, easing/duration defaults, choreography patterns, scroll/hover interactions, performance, accessibility (reduced motion), and implementation guidance.

MengTo/Skills

Create premium cinematic web motion systems with GSAP, ScrollTrigger, and Lenis. Use for luxury editorial websites, creative studio portfolios, Awwwards-style interactions, smooth scroll reveals, staggered text, parallax, pinned sections, magnetic hover states, custom cursors, and mouse-reactive layered movement.

MengTo/Skills

Create cinematic scroll-driven landing pages with Lenis smooth scrolling, GSAP ScrollTrigger, scroll-linked progression, staggered text reveals, sticky card stacks, parallax backgrounds, scroll-scrubbed transitions, footer reveals, and immersive preloaders. Use when analyzing or building premium editorial scroll experiences, sticky project stacks, kinetic typography, or section-by-section storytelling.

MengTo/Skills

Use when designing or rewriting a high-converting SaaS pricing page (structure, plan design, copywriting, SEO/AEO, FAQs, layout patterns, experiments). Includes checklists, templates, and common pitfalls.

MengTo/Skills

Use when creating or refining WebGL-heavy landing pages and you need to steer toward a specific visual outcome (premium, technical, playful, cinematic) while balancing conversion clarity, performance, and implementation complexity.

関連スキル