Resources

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 to fade.
  • preserveHeader A boolean. Keeps the header in place and on top while the page changes, for every transition. Defaults to false.
  • duration A number, milliseconds. The total for both halves. Defaults to 600 for fade.
Page one

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:

  • preserveHeader A boolean. Keeps the header in place and on top while the page changes, for every transition. Defaults to false.
  • tileSize A number, the approximate width and height of a tile in px. Smaller tiles make a finer grid. Defaults to 160.
  • 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 to linear.
  • duration A number, milliseconds each tile takes to fade. Defaults to 200.
  • spread A number, milliseconds from the first tile starting to the last. A bigger number is a slower sweep. Defaults to 600.
  • color A 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.

Page one

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.

Page one

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.

Page one

The first page

A mock page. Use the links below to see the transition play.