Aurora Drift wraps every page in aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/aurora-drift/llms.txt
Use this file to discover all available pages before exploring further.
PageTransition component that coordinates a three-property entrance and exit animation: the page fades in, slides upward into view, and de-blurs simultaneously on mount — then reverses in the opposite vertical direction on unmount. The result is a continuous, cinematic flow between routes that reinforces the space-portfolio aesthetic. This is achieved with Framer Motion’s motion.div, AnimatePresence, and React Router’s useLocation hook to key transitions by route.
How AnimatePresence Works
Framer Motion’s AnimatePresence component monitors its direct children for unmounting. Normally when a React component unmounts (e.g., the old route’s page component), it disappears instantly. AnimatePresence intercepts the unmount, plays the exit animation to completion, and only then removes the element from the DOM. This is what makes the outgoing page animate out while the incoming page animates in.
The critical requirement is that each child of AnimatePresence must have a unique key prop. When the key changes (i.e., the route changes), React treats it as a new element — the old one exits, the new one enters.
The
y direction is intentional and asymmetric by design. On enter, the page starts at y: 20 (20px below its final position) and slides up into place. On exit, it starts at y: 0 and moves to y: -20 (20px above), sliding up and out. This creates a consistent upward flow — pages always travel upward through the viewport, like turning pages in the same direction.Animation States
PageTransition defines three animation states on a single motion.div:
| State | opacity | y | filter |
|---|---|---|---|
initial (entering, before mount) | 0 | 20px (below) | blur(10px) |
animate (resting, on screen) | 1 | 0px | blur(0px) |
exit (leaving, before unmount) | 0 | -20px (above) | blur(10px) |
[0.22, 1, 0.36, 1] — which produces an ease-out-expo curve: the element accelerates sharply at the start of the animation and decelerates dramatically as it approaches its final position. This makes entrances feel snappy and decisive rather than mechanical.
The PageTransition Component
className on the wrapper does double duty — it applies both the animation and the page layout (pt-24 pb-12 px-6 md:px-12 max-w-7xl mx-auto), so every route automatically gets consistent padding and a centered max-width container.
Full Router Setup
WiringPageTransition into React Router requires three things: getting the current location, passing it as a key to AnimatePresence’s child wrapper, and wrapping each route’s element in <PageTransition>.
Setting Up Page Transitions: Step by Step
Wrap your app in BrowserRouter
useLocation must be called inside a Router context. Wrap your root component:Read the current location
In your
App (or layout) component, call useLocation() to get the current route path:Add AnimatePresence with mode='wait'
Wrap your
<Routes> in <AnimatePresence mode="wait">. Pass location and key={location.pathname} to <Routes>:The Nav Underline: Layout Animation
The navigation bar uses a complementary animation for the active-route indicator. Rather thaninitial/animate/exit states, it uses Framer Motion’s layoutId to automatically animate the underline element from one nav item to the next when the active route changes:
motion.div with layoutId="nav-underline" smoothly slides from the old nav item’s position to the new one using a spring transition — no manual position calculations needed.
Customizing the Easing
AnimatePresence Mode Options
What does mode='wait' do, and when should I use the other modes?
What does mode='wait' do, and when should I use the other modes?
AnimatePresence has three mode options that control how concurrent exit and enter animations are handled:| Mode | Behavior | Best for |
|---|---|---|
"wait" | Exit animation completes fully before the enter animation starts | Page transitions — clean, no overlap |
"sync" | Exit and enter run simultaneously (default) | Subtle crossfades, overlapping elements |
"popLayout" | Exiting element is removed from layout flow immediately | Tab panels, content that needs to reflow fast |
"wait" because the blur + slide transition looks best when the pages don’t overlap — having both blurred pages on screen simultaneously would be visually confusing. Use "sync" if you want a crossfade where both pages are briefly visible.Transition Properties at a Glance
Enter
Starts
20px below final position with opacity: 0 and blur(10px). Eases upward and de-blurs over 0.6s using ease-out-expo.Exit
Starts at final position and moves
20px upward (y: -20) while fading to opacity: 0 and re-blurring to blur(10px) over 0.6s.Duration
0.6s total. Long enough to feel cinematic, short enough to not impede navigation. Adjust between 0.4s–0.8s to taste.Easing
[0.22, 1, 0.36, 1] — cubic bezier with steep initial acceleration and long gentle deceleration tail (ease-out-expo feel).