gsap-astro

Implements GSAP page transitions and component lifecycles in Astro sites using ClientRouter.

1|Updated Aug 17, 2026
One-click install
npx skills add https://github.com/NalinDalal/skillset --skill gsap-astro-nalindalal
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gsap-astro
Source: https://github.com/NalinDalal/skillset/tree/main/skills/ui/gsap-astro
Command: npx skills add https://github.com/NalinDalal/skillset --skill gsap-astro-nalindalal

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? GSAP animations in Astro break in subtle ways: duplicated motion after navigation, missing intros, leaked listeners, and flashes of hidden content when ClientRouter swaps pages. This Skill provides the lifecycle rules and cleanup patterns to build or review animation that survives Astro's client-side routing. ## Core Features & Use Cases - ClientRouter navigation lifecycle: Implements the five phases (mount, initial state, intro, settled, outro, end state, unmount) across astro:before-preparation, astro:before-swap, astro:after-swap, and astro:page-load events. - Cleanup and leak prevention: Kills GSAP contexts, ScrollTriggers, splits, and document-level listeners before each swap so timelines and observers do not outlive their pages. - Initialization and recovery: Preserves invisible-to-visible intros with pre-paint markers, bounded deadlines, and per-owner recovery so content stays readable when bundles fail or JavaScript is disabled. - Use Case: A user adds GSAP page transitions to an Astro site with <ClientRouter /> and finds animations replay or content stays hidden after navigating back; this Skill diagnoses the router event sequence and fixes the outro, cleanup, and intro wiring. ## Quick Start Use the gsap-astro skill to add GSAP page transitions to my Astro site that uses ClientRouter.

Frequently Asked Questions about gsap-astro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add GSAP page transitions to an Astro site?▼

Add <ClientRouter /> to a shared layout, then play the outro inside event.loader in astro:before-preparation so the router waits for it. Set initial values in astro:after-swap and start the intro in astro:page-load, cleaning up the page's gsap.context in astro:before-swap.

Should I use transition:animate or GSAP for Astro animations?▼

Use transition:name and transition:animate for snapshot morphs, fades, or slides under ClientRouter. Use GSAP for live-DOM outros that hold the swap, interruptible sequences, split text, or scroll-linked motion, with one engine per element.

Why do my GSAP animations duplicate after Astro navigation?▼

Module scripts run once per visit, not once per page, so setup must run from astro:page-load and be correct when run twice on the same body. Listeners on document and window also outlive pages, so register router listeners once and clean up per-page work in astro:before-swap.

Does GSAP work inside Astro framework islands?▼

Yes, but page-level selectors stop at astro-island; the framework owns that subtree. GSAP inside the island follows the framework's rules with the island root as scope, and its cleanup runs at astro:after-swap via astro:unmount.

Why is my Astro content invisible after a failed GSAP intro?▼

Hidden intros need a bounded initialization deadline and per-owner recovery that reverts splits, kills owned timelines, and restores the readable settled state on timeout or setup failure. Never hide server content through unconditional CSS that a failed bundle cannot undo.

When should I use gsap-vanilla instead of ClientRouter animation?▼

Use gsap-vanilla when the site has no <ClientRouter />, since every navigation is then a full document load. It also remains the baseline for browsers without View Transitions when the router's fallback prop is set to none.