What is this?
A page transition for ordinary multi-page websites. When you click a link, the old page drifts up while a splash screen wipes in from the bottom, holds for a moment, then wipes out again while the new page slides into place. There is no client-side router: every click is still a normal page load. The browser’s cross-document view transitions do the heavy lifting.
How to use it?
Add a hidden splash element to every page and load the stylesheet and script in the head. The script must run before the first render of the page, so keep it in the head and don’t defer it.
<link rel="stylesheet" href="transition.css" />
<script src="transition.js"></script>
...
<div id="splash">Your splash screen</div>
Both pages of a navigation need the stylesheet: the outgoing page opts in to the transition, the incoming one animates it.
How does it work?
The stylesheet opts in with @view-transition {navigation: auto}. On navigation the browser snapshots the old page, loads the new one without showing it, and lets CSS animate the snapshots. transition.js listens for pagereveal and adds html.vt-active, which shows #splash just long enough to be captured as its own snapshot; a clip-path animation on that snapshot does the wipe, so the splash itself never moves. The wipe edge is a shape() that starts as a flat line and bows into an arc; browsers without shape() get a straight edge.
Features
Static splash, curved wipe, old page drifting out and new page sliding in, all timing in a handful of CSS variables. Works in Chrome and Safari; other browsers simply navigate. Respects prefers-reduced-motion.
License
This code is licensed WTFPL.