View Transitions
The View Transitions API provides a way to allow CSS animations and transitions to run during page navigation. This creates a smooth navigation experience like SPA (single page app) style routers but for MPA (multi-page apps), or simply links between static HTML pages.
Installation
To enable view transitions for you application import the following CSS:
@import '@nvidia-elements/styles/view-transitions.css';
Apply the following attribute to the root HTML element:
<html nve-transition="auto">
Use the nve-page element to enable the transition animations for page content.
import '@nvidia-elements/core/page/define.js';
<body>
<nve-page>
...
</nve-page>
</body>
This enables the View Transition API and provides a basic speculation ruleset that pre-renders and enables smooth page transitions via user navigation. To see how view transitions work in action browse the starter demo apps and note the smooth animation transition between UI frameworks.