---
name: add-scroll-animations
description: Adds a few scroll-linked motions - fade-in on enter, a pinned panel, or a progress cue - with GSAP ScrollTrigger or Motion, and respects reduced motion. Use when the user wants a scroll animation, a fade-in as they scroll, parallax, or a pinned section.
license: MIT
metadata:
  category: design
  tags: "scroll,motion"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-07"
  status: published
  aliases: "gsap scrolltrigger, framer motion, parallax, pinned section, entrance animation"
  source_url: "https://github.com/github/awesome-copilot/tree/5269f7ea2d6c3a9bfda5ed878b6726cf509121fd/skills/gsap-framer-scroll-animation"
  source_license: MIT
  copyright: "Copyright GitHub, Inc."
  original_author: "Utkarsh Patrikar (github/awesome-copilot, gsap-framer-scroll-animation)"
  modified: "Adapted by TheSkillVault: rewritten as a short choice (CSS, Motion whileInView, or GSAP pin) with one original snippet; dropped the recipe catalogue and Copilot prompt list; added reduced-motion, gotchas and done-when."
  imported_on: "2026-11-07"
---

# Add scroll animations

Motion should explain the page, not decorate every block. Start with the smallest effect that still reads. Skip it when the visitor asks for less motion.

## When to use
- Sections should fade or slide in as they enter the viewport.
- One panel should stay pinned while later content moves past it.
- A bar should track how far down the page the reader is.

## When not to use
- The task is the headline, the call to action, or the section order. That is a page-structure task.
- The layout overflows on a phone. Settle the layout, then add motion.
- The user wants a theme, colours, or type scale.

## Steps
1. Pick one effect. Fade-on-enter, pin, or progress. Do not stack all three on the first pass.
2. If the page is mostly static, a CSS animation plus an intersection check is enough. Reach for a library only when you need a pin or a scrubbed timeline.
3. On a React page, use Motion (`motion`, or the older `framer-motion` package). `whileInView` with `viewport={{ once: true }}` covers a fade-in. `useScroll` plus `useTransform` covers a value tied to scroll position.
4. For a pin, a horizontal strip, or a scrubbed timeline, use GSAP. Install `gsap`, import `ScrollTrigger`, and call `gsap.registerPlugin(ScrollTrigger)` once, first.
5. Honour `prefers-reduced-motion: reduce`. Skip the tween and show the final state. In GSAP, `ScrollTrigger.matchMedia` can drop the motion. In Motion, skip the variant.
6. On a client page, create the trigger after the node exists and kill it on unmount so a route change does not leave a stale pin.
7. Scroll the page on a phone and on a wide window. The effect should not cause sideways overflow or a jump when it starts.

```tsx
<motion.section
  initial={{ opacity: 0, y: 12 }}
  whileInView={{ opacity: 1, y: 0 }}
  viewport={{ once: true, amount: 0.3 }}
  transition={{ duration: 0.4 }}
>
  {children}
</motion.section>
```

## Gotchas
- Do not animate a control that reveals a password, a token, or a private balance. Those should be visible without motion.
- `once: true` is kinder than replaying the fade every time the block re-enters.
- A pinned section that is taller than the screen traps the reader. Keep the pin short.
- Register ScrollTrigger once. Registering inside a render loop leaks triggers.

## Portability
GSAP fits vanilla JS, Vue, and React. Motion fits React. If you use neither, a CSS `@keyframes` fade plus `IntersectionObserver` covers the enter effect. The reduced-motion check stays the same.

## Done when
- One scroll effect runs, and it is absent when reduced motion is set.
- Triggers are cleaned up on unmount.
- The page does not overflow sideways because of the motion.

## Example prompt
"Fade each feature block in once as it enters the viewport, using Motion, and skip the animation when the user prefers reduced motion."

---
Adapted from "gsap-framer-scroll-animation" by Utkarsh Patrikar in github/awesome-copilot (MIT, Copyright GitHub, Inc.). See LICENSE.txt.
