6.5 · Motion

Animate between pages: cross-document view transitions

Animate between pages with one at-rule. No single-page app needed.

@view-transition { navigation: auto; } on both pages turns a normal link click into a view transition. The old page crossfades into the new one, and elements with the same view-transition-name on both pages morph from one into the other.

It works for same-origin navigations on a plain multi-page site. This site uses it: moving between lessons crossfades.

Before
// A client-side router, or
// a single-page app, just to
// animate between two pages
Now
/* On both pages */
@view-transition {
  navigation: auto;
}

.thumb,
.hero {
  view-transition-name: photo;
}