gsap-sveltekit
Skill5 starsChanged 2 months agoMITView on GitHub
Build or review GSAP animation in SvelteKit projects on Svelte 5: page transitions, enter and exit motion across client-side navigation, animated show and hide of conditional content, and scroll-driven effects. Use whenever a SvelteKit project needs any of these, even if GSAP is not named, and whenever a page intro fails to replay, an outro is cut off by navigation, layout jank, interrupted animations, or cleanup matter. Covers beforeNavigate, afterNavigate, onNavigate, goto, +page.svelte and +layout.svelte lifetimes, runes and $effect cleanup, and choosing between GSAP, Svelte transition:, in: and out: directives, {#key} blocks, and View Transitions for a navigation effect. Not for Svelte components outside SvelteKit routing, which gsap-frameworks covers, or isolated GSAP API questions.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- johnpolacek/animaxxing-skillsedited, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- johnpolacek/animaxxing-skills★ 2252% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- adversarial-reviewSkill
- aesthetic-animaxxingSkill
- ai-search-optimizationSkill
- announceSkill
- audio-trackSkill
- blindspotSkill
- brave-wesSkill
- chrome-wesSkill
- clihubSkill
- dashclaw-governanceSkill
- deskclawSkill
- de-vibeSkill
- dispatch-blocksSkill
- epic-infographicsSkill
- fable-gptSkill
- frontend-verifySkill
- gsap-astroSkill
- gsap-coreSkill
- gsap-frameworksSkill
- gsap-nextjsSkill
- gsap-nuxtSkill
- gsap-performanceSkill
- gsap-pluginsSkill
- gsap-react-routerSkill
- gsap-reactSkill
- gsap-scrolltriggerSkill
- gsap-tanstack-routerSkill
- gsap-timelineSkill
- gsap-utilsSkill
- gsap-vanillaSkill
- harness-healthSkill
- iphoneSkill
- landing-page-cro-expertSkill
- launchSkill
- launch-videoSkill
- logo-revealSkill
- marketingSkill
- marketing-studioSkill
- meditateSkill
- moleresearchSkill
- og-assetsSkill
- petstoreSkill
- phone-gotchasSkill
- phoneSkill
- preflightSkill
- product-demoSkill
- ship-itSkill
- shipSkill
- show-meSkill
- skillfindSkill
- social-clipSkill
- spec-probeSkill
- teamSkill
- tregSkill
- wes-voiceSkill
- wrapSkill
- xplainerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 8 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Every animated page or component runs through the same lifecycle:
- Distinctive: line 21
Read repository instructions and the current code.
- Very specific: line 23
Read the installed @sveltejs/kit and svelte versions.
- Very specific: line 24
Check svelte.config.js, page options (ssr, csr, prerender), data-sveltekit-preload-data on body in src/app.html, and links marked …
- Very specific: line 25
Look at layouts, navigation components, global CSS, accessibility conventions, tests, and any motion already in use: Svelte transition: …
- Distinctive: line 26
Keep the project's package manager, language, file layout, styling, and component conventions.
- Distinctive: line 28
Add GSAP or a plugin only when the requested motion needs it.
- Very specific: line 39
Use View Transitions, started from onNavigate, for a shared element that morphs between two routes or a whole-page crossfade or slide keyed …
- Distinctive: line 41
Use GSAP when the effect needs:
- Distinctive: line 59
Before calling work done: Verification.
- Very specific: line 85
Do not read page, data, or navigating inside the effect that builds GSAP setup unless it should rebuild on every navigation.
- Very specific: line 87
Keep native link behavior, data-sveltekit-* options, focus, scroll, and no-JavaScript readability.
- Very specific: line 90
Prefer transforms and autoAlpha.
- Distinctive: line 91
Use timelines for sequences.
- Distinctive: line 92
Verify in a real browser when practical.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GSAP SvelteKit
Every animated page or component runs through the same lifecycle:
mount → initial state → intro → settled → outro → end state → unmount
Mount and unmount belong to Svelte. The five phases between them belong to your animation code and happen while the node exists. This skill covers getting those phases right when SvelteKit's router decides when pages mount, update in place, and unmount: navigation timing, page reuse, interruptions, and cleanup. The user's request and the existing design decide how things look.
SvelteKit reuses components across navigation. A +page.svelte that stays on the same route with new params updates in place, and layouts persist through every child navigation. Treat a param change as a new page lifecycle even though nothing mounts. See Page lifetime.
Start with the project
- Read repository instructions and the current code.
- Confirm SvelteKit with Svelte 5 in runes mode. Plain Svelte without SvelteKit routing belongs to
gsap-frameworks. For Svelte 4 or legacy mode, say so and map$effectadvice ontoonMountandonDestroy. - Read the installed
@sveltejs/kitandsvelteversions. Prefer their bundled types over memory:node_modules/@sveltejs/kit/types/index.d.tsdocuments every navigation object, andnode_modules/svelte/types/index.d.tsthe runes and lifecycle exports. Version gates:onNavigate(1.24),$app/state(2.12; use$app/storesbefore),to.scrollon navigation targets (2.51),prefersReducedMotioninsvelte/motion(5.7),{@attach}(5.29). - Check
svelte.config.js, page options (ssr,csr,prerender),data-sveltekit-preload-dataonbodyinsrc/app.html, and links markeddata-sveltekit-reload. A page withcsr = falsehas no client router and no navigation hooks; a reload link is a full document load. Treat both as plain documents. - Look at layouts, navigation components, global CSS, accessibility conventions, tests, and any motion already in use: Svelte
transition:directives,svelte/animate, a View Transitions setup, or GSAP. - Keep the project's package manager, language, file layout, styling, and component conventions.
Add GSAP or a plugin only when the requested motion needs it. Do not replace an animation library the project already chose unless asked.
Pick GSAP, Svelte transitions, or View Transitions per effect
Three engines can animate a navigation. Choose per effect, one engine per element. Use Svelte transition:, in:, and out: for:
- A block that appears and disappears with a fade, fly, or slide and gates nothing on completion.
- A page swap inside
{#key}where holding the old page until itsout:finishes is the whole effect.
They keep the outgoing block mounted until every outro ends, reverse cleanly, and need no lifecycle code.
Use View Transitions, started from onNavigate, for a shared element that morphs between two routes or a whole-page crossfade or slide keyed by a class on html. They need no lifecycle code beyond the hook and fall back to an instant swap in unsupported browsers.
Use GSAP when the effect needs:
- An outro that finishes on the live outgoing page while the router waits.
- Interruption, reversal, or scrubbing mid-transition. A view transition is a fixed pair of snapshots; a directive reverses only itself.
- Sequenced timing across many targets, split text, or scroll-linked progress.
- A completion callback that gates navigation, focus, or removal.
Mixing across elements is fine: the browser morphs one image while GSAP animates the rest, or an out: holds a block while GSAP works inside it. Never give one element to two engines in the same transition. See Combining engines.
Follow the requested motion
The user's request decides effects, direction, timing, easing, and intensity. Map it onto the five phases without changing the look. For anything unspecified, keep the project's existing convention or pick a quiet default.
Read only what you need
- Navigation hooks and their order, outro before navigation, the lock, back and forward, scroll, focus, links, preloading, View Transitions: SvelteKit navigation.
- Page reuse versus remount, layouts,
{#key}versusafterNavigate, the Svelte 5 lifecycle, Svelte transitions beside GSAP, shallow-routed modals, SSR: Page lifetime. - The five phases, GSAP setup, contexts, show and hide, layout stability, scroll, text, plugins: Lifecycle implementation.
- Before calling work done: Verification.
The official GSAP skills (gsap-core, gsap-frameworks, gsap-timeline, gsap-scrolltrigger, gsap-plugins, gsap-utils, gsap-performance) cover the GSAP API and the onMount, gsap.context, and cleanup pattern inside one Svelte component. This skill covers how GSAP fits SvelteKit's router.
Pieces to add, only as needed
- One browser-only module that registers GSAP and plugins, guarded by
browserfrom$app/environment. - A route transition controller in the root
+layout.svelte, the one component that outlives every navigation, with one stable route container around{@render children()}. beforeNavigatewithcancel()and a guardedgotoas the hold, when the outro must finish with the URL unchanged, oronNavigatereturning the outro's promise when a URL that leads the animation is acceptable.afterNavigatein pages or the controller to start intros, compared on pathname so param and search changes do not replay them.bind:thisrefs or data attributes marking the elements a page animates.- A controller per page or component that owns its five phases.
- Intro and outro timeline builders.
- A presence controller when conditional content must stay mounted through a GSAP outro, or an
out:directive on the block when that is the whole effect.
Persistent header, nav, and footer live in the layout outside the route container. A component owns its own lifecycle; the layout controller owns page lifecycles.
Rules
- GSAP runs only in the browser.
onMountand$effectnever run on the server; module-level code needs abrowserguard. Scope selectors withgsap.contextto abind:thisroot. Clean up every tween, trigger, split, and listener in the effect teardown or theonMountreturn. - Lay out the final page with normal CSS first. One stable wrapper owns the geometry through every phase.
- Mount, then set initial values, then paint. Users never see the settled state before the intro. Server HTML paints before hydration, so hide intro targets only under a root attribute set by an inline script, only during the initial phase, with a no-JavaScript path.
- Animate to one settled state and clear temporary styles there.
- Keep outgoing pages mounted and visible through outro and end state. Hold the navigation with
beforeNavigateand re-issue it from the end callback, or return the outro's promise fromonNavigate. The URL changes beforeonNavigateruns, so only the first keeps it unchanged during the outro. - A navigation to the same route with new params updates the page in place. Run the lifecycle again from
afterNavigateagainst DOM that already holds settled values, or remount with{#key}. - Back and forward arrive as
popstatethrough the same hooks. Never run an outro for them. Give them an intro-only path after scroll restoration. - Do not read
page,data, ornavigatinginside the effect that builds GSAP setup unless it should rebuild on every navigation. - One engine per element. An
out:directive on a node GSAP also animates fights it, and the block stays in the DOM until the directive finishes. - Keep native link behavior,
data-sveltekit-*options, focus, scroll, and no-JavaScript readability. - Prepare incoming targets before revealing the swap. Never flash settled or stale content.
- Reduced motion reaches the same settled state and still fires every completion callback. Svelte transitions ignore CSS reduced-motion rules; zero them from
prefersReducedMotion. - Prefer transforms and
autoAlpha. Setwill-changeonly while animating, then clear it. - Use timelines for sequences. Decide up front what happens on rapid clicks and interrupted animations.
- Verify in a real browser when practical. Use a production build for route, config, dependency, or release changes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

