Aller au contenu
Skillpedia
Sites et interfaces (frontend)7.2k · #13396

animation-on-scroll

Ce qu’il fait

Ce skill guide un agent IA pour ajouter des animations d'apparition au défilement sur une page web. Il s'adresse aux propriétaires de sites qui veulent que les sections s'animent en entrant dans le champ de vision.

Quand l’utiliser

  • ✓Quand vous voulez que des éléments s'animent en apparaissant pendant que les visiteurs descendent la page.
  • ✓Quand vous avez besoin d'un effet d'apparition au défilement rapide sur un site basé sur Tailwind.
  • ✓Quand vous voulez que chaque élément d'une liste apparaisse avec un petit délai.

Lien du skill

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/animation-on-scroll/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/animation-on-scroll/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Fais apparaître mes cartes de fonctionnalités en fondu et en glissement, une à une, quand les gens descendent ma page.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent ajoute un petit script qui surveille l'entrée des éléments dans le champ de vision. Quand un élément y entre, il lance l'animation, définie par une image-clé et une classe Tailwind.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Animation On Scroll Skill

Workflow

  1. Confirm animation style, timing, and whether animations should run once or repeat.
  2. Provide the keyframes + JS observer snippet and the exact Tailwind class to apply.
  3. Offer focused tweaks only (threshold, rootMargin, duration, delay, transform/blur values).

Usage checklist

  • Insert the JS snippet in the <head> after the keyframes.
  • Add the animation class and animate-on-scroll to elements.
  • Ensure your keyframes name matches the Tailwind animation reference.

IntersectionObserver trigger

<script>
  /*
    Sequence animation on scroll when visible. Requires Animation Keyframe. Usage:

    1) Insert this code in the <head> along with the Animation Keyframe code.

    2) Add to Tailwind Classes: [animation:animationIn_0.8s_ease-out_0.1s_both] animate-on-scroll
  */
  (function () {
    // Inject CSS for paused/running states
    const style = document.createElement("style");
    style.textContent = `
      /* Default: paused */
      .animate-on-scroll { animation-play-state: paused !important; }
      /* Activated by 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); // observing twice is a no-op
      });
    };

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

Keyframes

<style>
  /*
    Sequence animation intro. Usage:

    1) Insert this code in the <head>

    2) Add to Tailwind Classes: [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 example

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

Customization knobs

  • Trigger: adjust threshold and rootMargin for earlier/later reveals.
  • Repeat: set once = false to allow replays when re-entering.
  • Motion: tweak translateY and blur in keyframes.
  • Timing: change duration and delay in the Tailwind animation value.

Common pitfalls

  • Forgetting to include the keyframes before the JS snippet.
  • Using a different keyframe name than in the Tailwind animation.
  • Animations not running because the element is already in view before observer init.

Questions to ask when specs are missing

  • Should animations run once or every time the element re-enters?
  • How far before entering the viewport should they start?
  • What motion style (fade, slide, blur, scale) do you want?
Questions fréquentes

L'animation se répète-t-elle quand je remonte ?

Le skill comprend un réglage pour jouer une seule fois ou en boucle, à votre choix.

Où va le code ?

Le script va dans l'en-tête de la page, après les images-clés, et la classe est ajoutée à chaque élément.

Puis-je changer le timing ?

Oui. Le skill propose des réglages sur la distance à partir de laquelle un élément doit être visible, ainsi que la durée, le délai et le mouvement.

Détails

Description originale de l’auteur

Create an on-scroll animation trigger using IntersectionObserver with Tailwind-friendly animation classes and keyframes. Use when asked for scroll-reveal, animate-on-scroll, or sequencing element animations when they enter the viewport.

repo: MengTo/Skills

Popularité

Étoiles GitHub
7.2k
Position au classement
#13396
Licence
MIT
Mis à jour
01/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires