gsap-tanstack-router
Skill5 starsChanged 2 months agoMITView on GitHub
Build or review GSAP animation in TanStack Router projects for React, including TanStack Start: page transitions, enter and exit motion across client-side navigation, animated show and hide of conditional content, and scroll-driven effects. Use whenever a project on @tanstack/react-router or @tanstack/react-start needs any of these, even if GSAP is not named, and whenever an outro is cut off by navigation, an intro fails to replay on a param change, layout jank, interrupted animations, or cleanup matter. Covers useBlocker as the outro-before-navigation hook, Link interception, pendingComponent and pendingMs, useRouterState, router.subscribe events, Outlet and layout persistence, remountDeps, createFileRoute lifetimes, Link preload, viewTransition and defaultViewTransition, scrollRestoration, back and forward, and SSR with HeadContent, Scripts, and ScriptOnce. Not for Next.js (gsap-nextjs), React Router (gsap-react-router), React without a router (gsap-react), 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★ 2254% 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-sveltekitSkill
- 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, 9 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
6
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 26
Read the router options: defaultPreload, defaultPendingComponent, defaultPendingMs, defaultPendingMinMs, defaultViewTransition, …
- Very specific: line 27
Look at the root route, layouts, navigation components, global CSS, accessibility conventions, tests, and any motion already in use: …
- Distinctive: line 28
Keep the project's package manager, language, file layout, styling, and component conventions.
- Very specific: line 30
Add GSAP, @gsap/react, or a plugin only when the requested motion needs it.
- Distinctive: line 36
Use View Transitions for:
- Distinctive: line 44
Use GSAP when the effect needs:
- Distinctive: line 62
Before calling work done: Verification.
- Distinctive: line 85
Keep outgoing pages mounted and visible through outro and end state.
- Very specific: line 86
No router event fires before the URL changes.
- Very specific: line 90
Keep native link behavior, preloading, activeProps, focus, scroll, and no-JavaScript readability.
- Very specific: line 93
Prefer transforms and autoAlpha.
- Distinctive: line 94
Use timelines for sequences.
- Distinctive: line 95
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 TanStack Router
Every animated page or component runs through the same lifecycle:
mount → initial state → intro → settled → outro → end state → unmount
Mount and unmount belong to React. The five phases between them belong to your animation code and happen while the node exists. This skill covers getting those phases right when TanStack Router decides when route components mount, update in place, and unmount: navigation timing, blockers, pending UI, route reuse, interruptions, and cleanup. The user's request and the existing design decide how things look.
TanStack Router waits for the destination's loaders before it swaps the tree, keeps a route component mounted when only its params or search change, and never unmounts a layout its child navigations share. Treat a param change as a new page lifecycle even though nothing mounts. See Route lifetime.
Start with the project
- Read repository instructions and the current code.
- Confirm
@tanstack/react-router. Next.js belongs togsap-nextjs, React Router togsap-react-router, React without a router togsap-react. Solid Router is out of scope. - Read the installed
@tanstack/react-routerversion and, when present,@tanstack/react-start. Prefer their bundled types over memory:node_modules/@tanstack/router-core/dist/esm/router.d.tsforRouterOptions,RouterState, andRouterEvents,node_modules/@tanstack/react-router/dist/esm/useBlocker.d.tsfor the blocker,node_modules/@tanstack/history/dist/esm/index.d.tsfor history actions. The TanStack/router repository'sdocs/router/anddocs/start/are the source of truth. The loading architecture changed during the 1.16x and 1.17x releases;RouterState.isTransitioningis gone from router-core 1.171.2x, anduseBlockeris still marked experimental. - Tell file-based routes (
createFileRoute,routeTree.gen.ts,__root.tsx) from code-based routes (createRoute,createRootRoute). The lifecycle is the same; only where route options live differs. - Tell TanStack Start (SSR, a root document shell with
HeadContentandScripts) from a client-only Vite app (RouterProviderrendered into a div). Client-only apps paint nothing before React, so they need no pre-paint rule. Checkssrper route,defaultSsr,spa.enabled, and prerendering. - Read the router options:
defaultPreload,defaultPendingComponent,defaultPendingMs,defaultPendingMinMs,defaultViewTransition,scrollRestoration,defaultStaleTime,defaultRemountDeps. Each changes when pages mount and what the user sees while they load. - Look at the root route, layouts, navigation components, global CSS, accessibility conventions, tests, and any motion already in use:
viewTransition, Framer Motion, or GSAP. - Keep the project's package manager, language, file layout, styling, and component conventions.
Add GSAP, @gsap/react, or a plugin only when the requested motion needs it. Do not replace an animation library the project already chose unless asked.
Pick GSAP or View Transitions per effect
TanStack Router can wrap a navigation's DOM update in document.startViewTransition, from defaultViewTransition on the router or viewTransition on a Link or navigate call, with types for direction.
Use View Transitions for:
- A shared element that morphs between two routes.
- A whole-page slide or crossfade keyed by view transition types.
- A pending fallback giving way to loaded content.
They need no lifecycle code 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 before the router loads and swaps.
- Interruption, reversal, or scrubbing mid-transition. A view transition is a fixed pair of snapshots.
- Sequenced timing across many targets, split text, or scroll-linked progress.
- A completion callback that gates navigation, focus, or unmount.
Mixing is fine: the browser morphs one image while GSAP animates the rest. Never give one element to both in the same transition. See Combining with View Transitions.
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
- Router APIs and the order of one navigation, outro before navigation with
useBlockeror an intercepted Link, the lock, back and forward, pending UI, the swap gap, scroll, focus, View Transitions: TanStack navigation. - Route reuse versus
remountDeps, layouts andOutlet, the React lifecycle for GSAP, conditional content, TanStack Start SSR and hydration, deferred data: Route lifetime. - The five phases, GSAP setup, show and hide, layout stability, scroll, text, plugins: Lifecycle implementation.
- Before calling work done: Verification.
The official GSAP skills (gsap-core, gsap-react, gsap-timeline, gsap-scrolltrigger, gsap-plugins, gsap-utils, gsap-performance, gsap-frameworks) cover the GSAP API, useGSAP, contextSafe, and cleanup inside one component. This skill covers how GSAP fits TanStack Router.
Pieces to add, only as needed
- One client-only module that registers GSAP and plugins.
- A route transition controller in the root route component, the one component that outlives every navigation, with one stable route container around
<Outlet />. useBlockerin the controller as the wait, when the outro must finish before the router loads the next route.- A
router.history.subscribelistener that records the last history action so back and forward take the intro-only path. - Refs or data attributes marking the elements a page animates.
- A controller per page or component that owns its five phases, keyed on the route's params when the component is reused.
- Intro and outro timeline builders.
- A presence controller when conditional content must stay mounted through its outro.
Persistent header, nav, and footer live in the root or a layout route outside the route container. A component owns its own lifecycle; the root controller owns page lifecycles.
Rules
- GSAP runs only on the client.
useGSAPnever runs on the server; keep GSAP calls out of module scope in files Start renders on the server. Scope selectors. Clean up every tween, trigger, split, and listener. - 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. Under Start, server HTML paints before hydration, so hide intro targets only under a root attribute set by a
ScriptOnceinline 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. The router swaps only after every blocker allows the navigation and the loaders finish; resolve the blocker from the end callback.
- No router event fires before the URL changes.
onBeforeNavigateruns after the history commit; only a blocker runs before it. - A navigation to the same route with new params reuses the component. Run the lifecycle again against DOM that already holds settled values, keyed on the params, or set
remountDeps. - Back and forward arrive with
actionBACK,FORWARD, orGO. Never run an outro for them; the URL has already moved when the blocker runs. Give them an intro-only path after scroll restoration. useLocationmoves to the destination when loading starts, before the new page mounts. Do not key route content on it; key on the presented matches or onresolvedLocation.- Keep native link behavior, preloading,
activeProps, 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, including the one that lets the blocked navigation proceed.
- 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.

