Transitions
How the site changes from one page to the next. Each demo is a mock page in a small frame: use its two links to see the transition play.
[ Fade - Transition ]
The page you leave drifts up and fades out, then the new one rises into place and fades in. To use it on the site, mount <PageTransition /> once in routes/(site)/+layout.svelte. It wraps every in-app navigation in a view transition, so browsers without them simply change pages as normal, and it is off with reduced motion. To remove it, delete the tag, components/page-transition.svelte and utils/page-transition.ts.
Available props:
name'fade'. Which transition plays between pages. Defaults tofade.preserveHeaderA boolean. Keeps the header in place and on top while the page changes, for every transition. Defaults tofalse.durationA number, milliseconds. The total for both halves. Defaults to600for fade.
The first page
A mock page. Use the links below to see the transition play.
[ Tiles - Transition ]
A grid of tiles fades in over the whole screen, the page changes underneath, then the tiles fade away in the same order. The page is divided into as many tiles as fit tileSize, so a bigger screen has more. It is off with reduced motion. Mount it like Fade: <PageTransition name="tiles" />.
Available props:
preserveHeaderA boolean. Keeps the header in place and on top while the page changes, for every transition. Defaults tofalse.tileSizeA number, the approximate width and height of a tile in px. Smaller tiles make a finer grid. Defaults to160.sequence'linear' | 'circle' | 'checkers'. The order tiles appear and disappear: reading order from the top left, outward from the center, or a checkerboard in two waves. Defaults tolinear.durationA number, milliseconds each tile takes to fade. Defaults to200.spreadA number, milliseconds from the first tile starting to the last. A bigger number is a slower sweep. Defaults to600.colorA string, any CSS color. Defaults to the surface color, which follows light and dark themes.
Linear, large tiles
tileSize: 90. Tiles sweep in from the top left.
The first page
A mock page. Use the links below to see the transition play.
Circle, small tiles
sequence: 'circle', tileSize: 50. Tiles spread outward from the center.
The first page
A mock page. Use the links below to see the transition play.
Checkers
sequence: 'checkers', tileSize: 70. Half the squares appear, then the rest.
The first page
A mock page. Use the links below to see the transition play.