Skip to Content
Motion and transitions

Motion and transitions

How the site moves and which piece of code owns each movement. The probes that keep navigation from regressing, and their budgets, are in Motion probes.

Motion tokens

src/config/motion.ts is the single source of truth. Components and .css.ts files use its tokens and never hard-code a duration, easing, distance or stagger.

TokenValueUsed for
duration.fast200 mshover and state changes, small items
duration.base400 mspanels and the route fade
duration.slow800 mspage entrances
ease.outcubic-bezier(0.16, 1, 0.3, 1)exponential ease-out, the entrance curve
ease.standardcubic-bezier(0, 0, 0.58, 1)small, quick state changes
distance.rise20 px (1.25rem)entrance travel
stagger.step120 msdelay between groups (header, then body)

The values are plain data, so the same constants feed vanilla-extract (through the easeCss and distanceCss strings) and framer-motion (through the numbers and tuples, with seconds() for durations). I allow no bounce or overshoot anywhere.

The transition model

Moving between pages layers three things, each with one owner.

  1. The route fade (PageWrapper). src/partials/ClientLayout/PageWrapper.tsx wraps the routed page. When the pathname changes it starts one enter-only Web Animation: opacity 0 to 1 over duration.base on ease.out (src/partials/ClientLayout/routeTransition.ts). There is no travel and no exit animation, so the new page is never delayed and clicks are never blocked. The animation starts in a layout effect, before the first paint of the new route, so there is no flash at full opacity. It does not run on first mount (a hard load), for hash-only moves on the same page, or under reduced motion. shouldFadeRoute is the pure rule and is unit tested.
  2. Each page’s own entrance. Sub-pages (role pages, /resume) rise in once: the rise keyframes (opacity plus distance.rise) over duration.slow on ease.out, the header first and the body one stagger.step later (src/partials/PagePrimitives/riseIn.ts, with the keyframes in PagePrimitives.css.ts). The landing hero does the same family of entrance with CSS keyframes on the same tokens (LandingHero.css.ts), so it plays from the first paint, before any JavaScript. The scroll-driven choreography of the landing sections (framer-motion, LandingAbout, LandingSkills) also reads the tokens. The fade and the rise layer on purpose: the fade is the arrival of the page, the rise is the page’s own moment. /about has its own, a “come into focus” (see The About entrance).
  3. The chrome. The header, floating nav and floating logo sit outside PageWrapper, so they are never faded or remounted by a navigation. Their show and hide rules live in src/modules/chrome/chrome.ts (nextChromeHidden, dockProgress, CHROME_EASE, the same curve as ease.out). On desktop, on every page, the logo docks into the left gutter as a pure function of scroll, unless the viewport is wide enough that the full-size logo keeps 1rem clear of the content and the nav (hasDockFreeRoom, measured per page); then it stays put and does not transition. Sub-pages have content right under the logo, so they dock within the first 64 px of scroll (PAGE_DOCK_DISTANCE in Header.tsx); the landing page, with an empty hero there, docks over 0.4 of the viewport height. An arrival that lands already scrolled eases from rest into the docked position instead of snapping.

The About entrance

/about is the one page whose entrance is not the rise. Its parts come into focus (opacity, a blur that resolves, and a scale from aboutEntrance.scale to 1) in a fixed order, each one stagger.tight after the last, while the portrait stays out of it. The values are in aboutEntrance (src/config/motion.ts); the keyframes are focusIn and focusInPhoto (src/config/styles/helpers/focusIn); focusInStyle and standInStyle (src/partials/PagePrimitives/focusIn.ts) apply them. PageHeader takes entrance="focus" (the default stays rise, so no other page changes) and the letter’s parts carry their own steps (AboutLetter.css.ts).

How the page is reached decides when it starts:

  • After the morph. The portrait is carried by the shared view transition (about-portrait), so the page starts aboutEntrance.arrivalDelayMs (160 ms, two fifths of the morph’s duration.base) in and resolves around the photo as it lands. The morph’s ease-out has covered most of its distance by then, so the two overlap and read as one move; starting at the full 400 ms felt like waiting for the morph to finish. AboutPageContent renders AboutArrival, which calls useMorphArrival (@/modules/morph): in a layout effect, before the first paint and before PageWrapper settles the morph, it sees isMorphing() and sets data-arrival="morph" on <html>; the mark goes when the page unmounts. arrivalDelay (PagePrimitives/arrival.css.ts) turns the mark into the delay.
  • A direct visit (hard load, deep link, a navigation that did not morph). Nothing carries the portrait in, so the photo plays a stand-in: it resolves from aboutEntrance.standIn (larger and softer), and the rest follows with no extra delay. The stand-in rule does not apply while the mark is set.

Everything is backwards-filled so no filter or transform is held on the glass plates afterwards. Reduced motion and print switch it all off; on a hard load the splash hold pauses it like every other CSS animation. The below-the-fold sections keep their scroll-driven reveal. The options that were compared are kept in Storybook under Prototypes / AboutEntrance (src/prototypes/about-entrance).

The download dialog

The one overlay, the full-page dialog on /resume (src/partials/ResumeDownload), has its own short moment, in CSS only (ResumeDownload.css.ts), so every way of opening and closing it behaves the same.

  • Enter. A “come into focus” in three beats, with the values in dialogEntrance (src/config/motion.ts). The page behind blurs up on the ::backdrop over duration.slow while the headline resolves from a 12 px blur. One stagger.step later the plate’s frame fades in and settles, and then its parts (the attachment strip, the two rows, the footer) come into focus one stagger.tight apart, each rule drawing in from the left. The dialog itself does not fade, so the content’s own fades are not slowed by a second one. The plate has no filter of its own, so its parts’ blur does not stack with it. Everything is backwards-filled, never both, because a held transform or filter would make the element a containing block for the plate’s glass. The content is transparent and blurred for its first frames but already focusable.
  • Exit. Opacity only, duration.fast on ease.standard, shorter than the enter. A native <dialog> removes itself and leaves the top layer in a single frame, so the closed style carries transition: opacity, display allow-discrete, overlay allow-discrete: the dialog stays rendered until the fade ends. That covers Close, Escape and close() from Skip and Download with no JavaScript, and the download still starts on the click, not after the fade. The grid template sits on the base style so the layout holds while it fades. The closed ::backdrop has no backdrop-filter: fading a full-page blur repainted the page every frame and cut the exit to about 5 frames in headless Chromium (#479), so the blur drops as the fade starts and only the tinted scrim fades.
  • Support. Measured in Chromium (enter and exit), WebKit (enter and exit; its ::backdrop does not fade out) and Firefox (enter only: it closes at once, which is the accepted fallback). The enter is a keyframe animation rather than @starting-style, which vanilla-extract cannot emit. A close during the enter fades from the current opacity.
  • Scroll lock. While it is open the page behind does not move. useLenis().stop() runs on open and start() on the native close event (so Escape is covered), html:has(dialog[open]:modal) freezes native wheel, touch and keyboard scrolling (the scrollbar gutter is kept, so nothing reflows), and the dialog has overscroll-behavior: contain plus data-lenis-prevent so it scrolls inside itself on short screens. Focus returns to the trigger with preventScroll, so the position is restored exactly.
  • The custom cursor stays visible. The site hides the system cursor and draws its own dot (src/components/Cursor). A modal dialog is in the browser’s top layer, which paints above any z-index, so the dot would vanish behind it. While a dialog is visible (including its exit fade) the cursor wrapper is shown as a manual popover, which puts it in the top layer after the dialog; it is raised again for each new dialog and hidden once the last one is gone. It is never inside the dialog, so it does not fade with it and keeps tracking the pointer. Without the popover API the system cursor is restored while a dialog is visible, so there is always a pointer. Verified in Chromium; WebKit’s popover state follows the dialog, but headless WebKit and Firefox do not draw the dot at all, so the pixel check is Chromium only.

Rules that keep navigation instant:

  • There is no loading.tsx in src/app. A loading boundary makes React hold the new page back for about 300 ms behind a fallback, even when the data is ready. src/app/no-route-loading.test.ts fails if one is added.
  • Internal links use next/link, so a click is a client navigation and the document is kept. The footer and the floating nav are covered by the probe.
  • Nothing on the landing page pins. The hero is a full-height section in CSS, so the first paint has the same layout as the settled page and arriving does not shift it.
  • Hash moves on the landing page (nav pills, back and forward between anchors) are handled by src/partials/HashScroll/HashScroll.tsx: Lenis glides there, or jumps when reduced motion is set.

Landing focus motion

The landing sections share one gesture, coming into focus: content resolves from soft to sharp, and the page reflects where the visitor is reading. Tokens live in src/config/motion.ts (focusBlur, focusScale, focusOpacity, spotlight, stagger.tight, stagger.tile, staggerCap).

  • Headers (About, Skills, Experience): FocusReveal resolves the title, DrawLine draws the separator, the subtitle follows. One shot, on enter-view.
  • Hero: scrolls like any section. Over its own height the body copy fades out, the two title lines slide toward each other and the hero dims to focusOpacity.recede, all as a pure function of scroll (LandingHero). There is no pin, no scroll takeover and no automatic glide, so wheel, touch and keyboard always move the page. The Lenis smoothing in ClientLayout is the only thing between input and scroll position. About has no pin or parallax either; its content moves with the page.
  • About gallery: a pre-blurred copy of each photo sits over it and scroll scrubs that layer’s opacity (ImageGalleryItem, galleryScrub). No filter is animated; reduced motion renders no soft layer. The gallery progress is derived from the figure’s visual rect (visualProgress, sampled per frame while near the viewport) because framer’s target-based useScroll ignores the sticky wrapper the section lives in. Sampling per frame also follows Lenis smoothing, which keeps the page moving after the wheel stops.
  • Skills index: a search, a group switch and a sort over one list. Rows reveal on first view (rise and de-blur, staggered up to staggerCap), then a search, sort, regroup or collapse moves rows with a position-only layout animation and fades the rows that leave; no row is ever left with a filter. A raised pill glides between the sort options, the direction label crossfades inside a button sized to its widest label (so the toolbar never moves), and a count reads “N of 22 skills”. Resting on a row on a fine pointer for previewCard.delayMs (150 ms) shows a preview card on the cursor’s spring; passing over rows shows nothing. The /skills/[skill] related tiles use the same card through useSkillPreview.
  • Experience: stat cards trace their border once; the timeline has a scroll-drawn spine and the role at the reading line stays at full strength while the others recede to focusOpacity.inactive (opacity only, no blur on text).
  • Floating nav: the active section’s label is sharp and the others soften (focusOpacity.nav, focusBlur.nav). useActiveSection holds a clicked target while Lenis glides so the label never flickers through other sections.
  • Seams: About and Skills recede (focusOpacity.recede, focusScale.recede, the hero’s values) as the next section arrives (useRecede).

The reading line is 40% down the viewport (src/modules/readingLine). Under reduced motion none of this moves: headers, cards and images are sharp at once, the spine is fully drawn, every role is at full opacity, and the skills index applies a search, sort or regroup instantly; the active nav label and the search result still show.

The probe covers it with four scenarios (focus: nav active section, focus: experience timeline, focus: about gallery, focus: skills index) and the budgets focusInactiveMax, focusGalleryEnterMin and focusGalleryReadMax.

Image hover

Image cards (ImageSpotlight) reveal a fine dot grid inside a soft circle that follows the pointer. The image itself is never brightened, darkened or blurred; only the dots appear. Tokens: imageSpotlight in src/config/motion.ts (radius, dot size and pitch, recede saturation), plus lift, press and spotlight.

  • The pointer position comes from glassPointerMove, like every glass surface; with no pointer (keyboard focus) the circle sits at the centre. The circle grows from 0 over duration.base through a registered custom property, so it is a compositor-friendly paint change and not a layout one.
  • Hovering a card lifts it and presses like a glass surface. In an imageSpotlightGroup (the landing gallery) the other cards recede to spotlight.opacity, and desaturate, only while one is hovered or focused, not when the pointer crosses a gap.
  • A card may pass caption: a glass plate over the foot of the image, stacked with the image in one grid cell so the card grows to fit a long caption or text zoom instead of clipping it. It is always in view, never revealed by hover, because a caption is content that keyboard and touch users must reach too. Use it only where the image has a caption of its own (role memories). The landing gallery has no captions, and the About portrait already carries a name tag, so neither passes one.
  • The custom cursor hides over a card (useHideCursor, as over a button or a link’s text). Reduced motion keeps the state changes but drops the lift, the scale and the circle’s growth; print hides the dots.

Reduced motion

prefers-reduced-motion: reduce means content is shown immediately, in its final state:

  • Entrance animations are switched off in CSS (animation: none, also for print), so the base styles are the final state and a page is simply there. Titles are opaque on the first frame and travel 0 px.
  • The route fade does not run.
  • The landing hero’s scroll-driven motion is off, and hash moves jump instead of gliding.
  • The download dialog has no fade and no rise (animation: none, transition: none): it is opaque on the first frame and gone on the first frame after closing. The scroll lock still applies.
  • Framer-motion pieces use a duration of 0 (useReducedMotion), and MotionConfig reducedMotion="user" is set in ClientLayout. The logo never docks.

Pending navigation

A client navigation that is still unresolved after routePending.delayMs (200 ms, src/config/motion.ts) shows a fixed glass hairline at the top of the viewport (src/partials/RoutePending). It is feedback only:

  • It never replaces or delays the page. There is no loading.tsx and no Suspense fallback (see #92); the old route stays on screen until the new one commits, and the line takes no layout space.
  • Fast and prefetched navigations finish inside the delay and never show it. There is no minimum visible time: it leaves on the same commit that swaps the route.
  • It starts from a click the router took over (next/link has called preventDefault()) or from back/forward to another route. It ends when the pathname changes (including redirects and error pages), when the page unloads (a failed fetch falls back to a hard load), or at routePending.capMs. A newer navigation keeps it up; a link to the current route is a router no-op and changes nothing.
  • A live region (role="status") is always mounted but holds “Loading page” only while the line is shown. Under reduced motion the highlight is still instead of sweeping. It is hidden in print.

The probe’s pending: scenarios hold back every RSC request to force a slow navigation, and check the line’s delay, dismissal, no flash on fast navigations, rapid successive clicks and CLS.

Initial load

Two layers, with different jobs.

Splash (intentional). A full-viewport splash (src/partials/SplashScreen) shows the logo mark for a fixed hold from first paint, whatever the network does, then dissolves over splash.fadeMs (200 ms). The mark arrives as a grid of rounded pixels (the same grid as the assistant icon, PIXELS in src/components/LogoMark) that swell on the diagonal until their edges touch while the solid logo fades in underneath (SplashMark, timed by splash.entrance). It takes under 960 ms, so it has settled before the shortest hold ends, and splashScreen.test.ts fails if a change breaks that. The six entrances that were compared are kept in Storybook under Prototypes / SplashEntrance (src/prototypes/splash-entrance). Each load draws its own hold at random from 1300 to 1900 ms in 10 ms steps (splash.holdMs, src/config/motion.ts; centred on 1600 ms) so the wait feels organic rather than mechanical. A small inline script in <head> (splashScript) draws it before first paint and sets --splash-hold; if the script cannot run the hold is 1600 ms. Once drawn, nothing ends it early and nothing extends it. This is a product decision rather than a loading state. The hold itself is a CSS animation delay on the server-rendered element, so it is the same on every network and cannot be cut short by hydration; the component only removes the element once its animations have finished, so no invisible layer is left behind. It is aria-hidden and non-interactive, and the page beneath stays in the DOM and accessibility tree. Under reduced motion it shows the solid logo from the first frame for the same hold and then cuts instead of fading. With no JavaScript and in print it is hidden. The page’s own animations wait for the splash: the same script sets data-splash-active on <html> and clears it when the splash’s animation ends, CSS pauses every other animation while it is set (delays included, so entrances start from the beginning once it clears), and the scripted reveals (useInViewAfterSplash: focus reveals, draw lines, sheen titles, the About subtitle, the skills list) hold off through useSplashDone. Without scripts the attribute is never set and nothing is held. It plays on a hard reload, fresh tab and deep link, and never on client navigation or back/forward within the app.

First-load chip (a slow start). The first page is prerendered, so its content is readable before any script runs. The only wait left is hydration on a slow network or device. A small fixed glass chip (src/partials/AppLoading) covers that wait and nothing else:

  • It is part of the server HTML and stays hidden for appLoading.delayMs (800 ms, src/config/motion.ts) through a CSS animation delay, so a normal load never shows it and no script has to arm it. It is removed as soon as the client hydrates, and CSS hides it at appLoading.capMs if hydration never happens.
  • It never covers or shifts the page, takes no focus, and ignores pointer input. The chip itself is aria-hidden. Its announcement is a separate empty role="status" region in the root layout that a small inline script fills with “Loading” after the same delay (a CSS animation cannot change text, and a status region is only announced when its text changes), so a fast load announces nothing. Hydration cancels the script and empties the region. The chip sits at the bottom centre, clear of the floating navigation. Under reduced motion it appears without a fade or moving highlight. With no JavaScript, and in print, it is hidden.
  • Hard reload, a fresh tab and a deep link all mount the root layout, so each runs this once. Client navigation never remounts it, so the pending line above is the only feedback there. Back/forward within the app behaves the same as client navigation.

node scripts/probes/app-loading.mjs (against pnpm start) checks fast and slow-script loads on the landing page and a role page, reduced motion, no JS, CLS and that a client navigation does not bring the chip back.

The probes that guard all of this, with their budgets, are in Motion probes.

Last updated on