Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/cosmic-developer/llms.txt
Use this file to discover all available pages before exploring further.
PageTransition is the invisible glue that makes navigating between routes feel like a cinematic cut rather than an abrupt page swap. It wraps every page component in a Framer Motion motion.div that simultaneously fades, scales, and blurs its way in on mount — and reverses the sequence smoothly on unmount before the next page enters. The result is a polished, space-travel-inspired transition that reinforces the portfolio’s atmosphere with every navigation.
Usage
Every page component in the portfolio wraps its root element in<PageTransition>. The component passes children straight through, so it has no impact on layout or styling.
PageTransition itself renders a motion.div with built-in padding (pt-24 pb-20 px-6 md:px-12 lg:px-24) and min-h-screen w-full flex flex-col, so every page gets consistent spacing and fills the viewport automatically.
How It Works
The animation is driven by three Framer Motion props on the innermotion.div:
| Lifecycle | Opacity | Scale | Blur |
|---|---|---|---|
Enter (initial → animate) | 0 → 1 | 0.95 → 1 | 10px → 0px |
Exit (animate → exit) | 1 → 0 | 1 → 1.05 | 0px → 10px |
0.95) and grows to full size, giving the impression the page is zooming gently into view from a distance. The exit scale overshoots to 1.05 — the page appears to expand and dissolve away, like a warp jump.
The easing curve [0.22, 1, 0.36, 1] is a custom cubic bezier that decelerates sharply at the end of the animation, making the settle feel weighted and physical rather than mechanical.
AnimatePresence Integration
PageTransition only animates on exit when it is a direct child of a Framer Motion <AnimatePresence> component. In the Cosmic Developer app, this is wired up in the AppRoutes component:
location as key
Passing
location.pathname as the key on <Routes> forces React to unmount the old route tree and mount the new one as a completely fresh component — rather than reconciling them in place. This gives Framer Motion the unmount event it needs to play the exit animation.mode="wait"
mode="wait" on <AnimatePresence> tells Framer Motion to fully complete the exit animation of the departing page before beginning the enter animation of the arriving page. Without this, both transitions would play simultaneously and overlap visually.mode="wait" means the total navigation time before the new page appears is slightly over 0.6 s (the exit duration). For pages with heavy content, this is barely perceptible — but if you want snappier transitions, reduce duration in PageTransition.js to 0.3 or 0.4.Customization
All transition values are co-located inPageTransition.js. Common modifications:
Change duration
Edit
transition.duration (currently 0.6). A value of 0.3 produces a snappy cut-style transition; 1.0 creates a slow, dramatic wipe.Add vertical movement
Extend
initial and exit with a y value to add a vertical slide:Change easing
Replace the custom cubic bezier
[0.22, 1, 0.36, 1] with a named Framer Motion ease such as "easeInOut" or "circOut" for a different deceleration feel.Skip blur
Remove the
filter keys from initial, animate, and exit if the blur effect is too heavy on low-powered devices. Opacity + scale alone still produces a clean transition.