CSSAnimation
Smooth Page Animations with the View Transitions API
Bondon Datta Nov 5, 2026 4 min read
The View Transitions API lets the browser take a snapshot of the page before and after a change, then animate between the two.
You call document.startViewTransition with a function that updates the DOM. The browser handles the cross-fade, and you can customise it with CSS or the Web Animations API.
A popular trick is a circular reveal when switching between light and dark mode: animate a clip-path circle from the toggle button outward. This portfolio uses exactly that.
Always provide a fallback. If the browser does not support the API, simply update the DOM without animating so nothing breaks.