
Gsap Frameworks
Add GSAP animations in Vue, Nuxt, Svelte, or SvelteKit with correct mount timing, scoped selectors, and cleanup on unmount.
Overview
GSAP Frameworks is an agent skill for the Build phase that teaches correct GSAP lifecycle, scoping, and cleanup patterns in Vue, Nuxt, Svelte, and SvelteKit.
Install
npx skills add https://github.com/greensock/gsap-skills --skill gsap-frameworksWhat is this skill?
- Official GSAP guidance for Vue/Nuxt and Svelte/SvelteKit lifecycles (not React—use gsap-react)
- Create tweens and ScrollTriggers after mount; kill or revert on unmount to prevent leaks
- Scope selectors to the component root so global classes do not animate the wrong nodes
- Runnable Vue 3 + Vite examples under `examples/vue/`
- Cross-links to gsap-core, gsap-timeline, and gsap-scrolltrigger for composition
Adoption & trust: 18.2k installs on skills.sh; 8.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You add GSAP in a Vue or Svelte app and get wrong targets, animations on unmounted DOM, or memory leaks because lifecycle and selector scoping were ignored.
Who is it for?
Indie front-end devs using Vue 3, Nuxt, Svelte, or SvelteKit who want official GSAP patterns without guessing cleanup or selector scope.
Skip if: React-specific animation (use gsap-react), server-only backends with no DOM lifecycle, or projects that mandated a different animation library by design spec.
When should I use this skill?
User wants GSAP animation in Vue, Nuxt, Svelte, or SvelteKit, or asks about onMounted, onMount, onDestroy, scoping, or cleanup with GSAP (non-React).
What do I get? / Deliverables
You ship scoped GSAP tweens and ScrollTriggers that start after mount and are killed or reverted on unmount, with clear pointers to gsap-core, timeline, scroll, or gsap-react skills as needed.
- Lifecycle-safe GSAP tween and ScrollTrigger code scoped to the component
- Review guidance aligned with official Greensock framework principles
Recommended Skills
Journey fit
How it compares
Framework lifecycle cookbook for GSAP—not a generic CSS animation snippet pack or the React useGSAP hook skill.
Common Questions / FAQ
Who is gsap-frameworks for?
Solo builders and small teams animating UIs with GSAP in Vue, Nuxt, Svelte, or SvelteKit who need mount/unmount-safe patterns.
When should I use gsap-frameworks?
Use it during Build (frontend) when writing or reviewing GSAP in non-React frameworks, especially around onMounted/onMount, scoped selectors, ScrollTrigger setup, and unmount cleanup.
Is gsap-frameworks safe to install?
It is documentation-style procedural knowledge; review the Security Audits panel on this page and your repo’s usual skill install policy before enabling it in the agent.
SKILL.md
READMESKILL.md - Gsap Frameworks
# GSAP with Vue, Svelte, and Other Frameworks ## When to Use This Skill Apply when writing or reviewing GSAP code in Vue (or Nuxt), Svelte (or SvelteKit), or other component frameworks that use a lifecycle (mounted/unmounted). For **React** specifically, use **gsap-react** (useGSAP hook, gsap.context()). **Related skills:** For tweens and timelines use **gsap-core** and **gsap-timeline**; for scroll-based animation use **gsap-scrolltrigger**; for React use **gsap-react**. ## Principles (All Frameworks) - **Create** tweens and ScrollTriggers **after** the component’s DOM is available (e.g. onMounted, onMount). - **Kill or revert** them in the **unmount** (or equivalent) cleanup so nothing runs on detached nodes and there are no leaks. - **Scope selectors** to the component root so `.box` and similar only match elements inside that component, not the rest of the page. ## Vue 3 (Composition API) See `examples/vue/` for a runnable Vite + Vue 3 project demonstrating these patterns. Use **onMounted** to run GSAP after the component is in the DOM. Use **onUnmounted** to clean up. ```javascript import { onMounted, onUnmounted, ref } from "vue"; import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; gsap.registerPlugin(ScrollTrigger); // once per app, e.g. in main.js export default { setup() { const container = ref(null); let ctx; onMounted(() => { if (!container.value) return; ctx = gsap.context(() => { gsap.to(".box", { x: 100, duration: 0.6 }); gsap.from(".item", { autoAlpha: 0, y: 20, stagger: 0.1 }); }, container.value); }); onUnmounted(() => { ctx?.revert(); }); return { container }; }, }; ``` - ✅ **gsap.context(scope)** — pass the container ref (e.g. `container.value`) as the second argument so selectors like `.item` are scoped to that root. All animations and ScrollTriggers created inside the callback are tracked and reverted when **ctx.revert()** is called. - ✅ **onUnmounted** — always call **ctx.revert()** so tweens and ScrollTriggers are killed and inline styles reverted. ## Vue 3 (script setup) Same idea with `<script setup>` and refs: ```javascript <script setup> import { onMounted, onUnmounted, ref } from "vue"; import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; const container = ref(null); let ctx; onMounted(() => { if (!container.value) return; ctx = gsap.context(() => { gsap.to(".box", { x: 100 }); gsap.from(".item", { autoAlpha: 0, stagger: 0.1 }); }, container.value); }); onUnmounted(() => { ctx?.revert(); }); </script> <template> <div ref="container"> <div class="box">Box</div> <div class="item">Item</div> </div> </template> ``` ## Nuxt 4 > See `examples/nuxt/` for a runnable Nuxt 4 project with plugin registration, lazy loading, and SSR-safe patterns. Use a **reusable composable** to register GSAP Plugins and also to lazy load Plugins that are not extensively used in your application: ```typescript // composables/useGSAP.ts import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; const PLUGINS = [ "CSSRulePlugin", "CustomBounce", "CustomEase", "CustomWiggle", "Draggable", "DrawSVGPlugin", "EaselPlugin", "EasePack", "Flip", "GSDevTools", "InertiaPlugin", "MorphSVGPlugin", "MotionPathHelper", "MotionPathPlugin", "Observer", "Physics2DPlugin", "PhysicsPropsPlugin", "PixiPlugin", "ScrambleTextPlugin", "ScrollSmoother", "ScrollToPlugin", "ScrollTrigger", "SplitText",