Rendering PipelineBaseline · Newly

View Transitions API

Mental Model

document.startViewTransition() captures rasterized textures of the current DOM, runs your update callback, and animates a ::view-transition pseudo-element tree between the old snapshot and the new live DOM, turning state swaps into smooth hero morphs without duplicate DOM nodes.

Interactive Simulator

View Transition Snapshot Lifecycle

Step through how the engine captures, swaps, and animates old and new DOM states.

Old Capture
DOM Swap
New Capture
Pseudo-Tree Anim
Step 1 / 3: 1. Capture Old Snapshots

Engine freezes rendering and captures GPU textures for root and every unique view-transition-name.

const vt = document.startViewTransition(() => renderNextView());
Internal State / Memory
renderingPaused
true
oldSnapshots
2
domMutated
false

Under the Hood

Instead of keeping two competing UI trees alive in memory during a route change, the engine takes a photograph of the outgoing room, swaps the furniture, and cross-fades the photo into reality.

  1. Snapshot Phase: Elements with a unique view-transition-name are captured during Paint & Rasterization as isolated textures.
  2. Mutation Phase: Rendering pauses while the callback mutates the DOM.
  3. Pseudo-Tree Morph: The engine injects ::view-transition-group, -old, and -new pseudo-elements over the viewport, animating size, transform, and opacity on GPU Compositor Layers.
JS
function navigateToCard(card, nextHtml) {
  if (!document.startViewTransition) return (main.innerHTML = nextHtml);
  card.style.viewTransitionName = 'active-card';
  const vt = document.startViewTransition(() => {
    main.innerHTML = nextHtml;
  });
  vt.finished.finally(() => { card.style.viewTransitionName = ''; });
}

Problem Genealogy

  • 2015–2022: Shared-element transitions in SPAs required FLIP measurements, cloning DOM nodes into portals, and manual cleanup.
  • 2023–2025: View Transitions Level 1 standardized native snapshot-and-morph transitions for same-document updates.

Production Pitfalls

Production Pitfall
  • Duplicate view-transition-name: Two visible elements with the same view-transition-name abort the entire transition.
  • Async network calls inside the callback: Awaiting fetch() inside startViewTransition() freezes user input until the network responds.
When Not to Use
  • When not to use View Transitions: Avoid wrapping high-frequency micro-interactions (hover states, typing) in startViewTransition(); reserve it for route or panel transitions, and gate motion behind User-Preference Media Queries (prefers-reduced-motion).

Connections & Logical Next Steps

Mechanical Comparisons