Marcus Andrey Study
Ler em português Library

Motion and Interaction · Step 5 · 7 min read

Web Animations and View Transitions

Two browser APIs that go past CSS alone: the Web Animations API, which lets code play, pause and reverse an animation, and View Transitions, which animate between two states of a page, or two pages. What each does, what a designer needs to know to spec them, and where they work as of November 2026.

CSS describes motion. These two APIs let the page conduct it. CSS transitions and keyframes are enough for most of an interface. But some motion depends on things CSS can't see: a gesture that's half done, a list that was just filtered, a page that's about to be replaced by another. The Web Animations API and View Transitions are how the browser handles those, and you don't need to write them to design for them. You need to know what they can do, so you ask for it.

What you'll be able to do after reading:

  • Say what the Web Animations API adds to CSS animations
  • Explain a view transition in one sentence: snapshot, swap, animate
  • Spec a shared element between two states or two pages
  • Check where cross-document view transitions work today, and plan for where they don't

1. The Web Animations API: keyframes you can steer

The Web Animations API is the engine under CSS animations, opened up to JavaScript. You give an element keyframes and timing, the same ideas as @keyframes, and you get back an Animation object you can play, pause, reverse, speed up, jump to a point in time, or wait for (MDN, Web Animations API · MDN, Element.animate()).

const lift = card.animate(
  [{ transform: "translateY(0)" }, { transform: "translateY(-8px)" }],
  { duration: 200, easing: "ease-out", fill: "both" }
);
lift.reverse();          // play it backwards from wherever it is
await lift.finished;     // wait for it, then do the next thing

This is a sketch, not code running on this page (the site runs no inline scripts). What matters for a designer is the list of verbs. When you design an interaction that follows a finger, can be interrupted halfway, or must finish before something else happens, that's Web Animations work, and you can say so in the spec. It has been supported in every major browser since 2020 (webstatus.dev, Web animations).


2. View Transitions: snapshot, swap, animate

A view transition animates the change from one state of the page to the next. The browser does it in three moves (MDN, View Transition API · Chrome for Developers, Smooth transitions with the View Transition API):

  1. Snapshot. It takes a picture of the page as it is now.
  2. Swap. Your code changes the page: a new list, a new screen.
  3. Animate. It animates from the old picture to the new page. By default, the old one fades out while the new one fades in.
Show the page
What a view transition does by default, rebuilt in CSS: the old page fades out while the new one fades in, in 250 ms, and an element with its own name moves and grows from where it was to where it lands. With reduced motion on, only the crossfade is left. In a real view transition the browser takes the snapshots and builds this for you.

The figure rebuilds the default in plain CSS so you can see it here: a 250 ms crossfade, which is the duration the specification's own stylesheet gives the transition (W3C, CSS View Transitions Module Level 1, user agent stylesheet). The default easing is CSS's ease. The demo's code is just two layered pages and one moving box:

.mo-c-vt__page { grid-area: 1 / 1; display: grid; align-content: start; gap: 4cqi; padding: 5cqi; transition: opacity 250ms ease; }
.mo-c-vt:has([value="detail"]:checked) .mo-c-vt__page--list { opacity: 0; }
.mo-c-vt:has([value="detail"]:checked) .mo-c-vt__page--detail { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .mo-c-vt__shared { display: block; transition: transform 250ms ease; }
  .mo-c-vt:has([value="detail"]:checked) .mo-c-vt__shared { transform: scale(3); }
}

3. Shared elements: give it a name

The moving picture in the figure is the interesting part. In a real view transition you get it by giving the element the same view-transition-name on both states. The browser then animates that element on its own, from its old size and position to its new ones, while the rest of the page crossfades (MDN, Using the View Transition API).

.product-row img  { view-transition-name: product-photo; }   /* on the list */
.product-hero img { view-transition-name: product-photo; }   /* on the detail page */

One rule to remember: a name can only be used by one element at a time on the page. If two elements share it, the browser skips the transition. In a list, only the row you tapped should carry the name. For a designer, this turns the spec into something very concrete: "the photo of the tapped product travels to the hero; everything else crossfades." That's a shared element transition (see Shared element transitions), and the browser now does the hard part.


4. Within a page or between pages

View transitions come in two kinds, and their support is not the same. As of November 2026 (checked on 17 November):

Kind How it starts Where it works
Same-document (single-page apps) JavaScript calls document.startViewTransition() around the change Chrome and Edge 111, Safari 18, Firefox 144. Baseline since 14 October 2025 (webstatus.dev)
Cross-document (normal links between pages) Both pages opt in with CSS: @view-transition { navigation: auto; } Chrome and Edge 126, Safari 18.2. Not in Firefox yet, so not Baseline (webstatus.dev)

Cross-document transitions are the exciting one for ordinary websites: no framework, no JavaScript, two pages on the same origin and one CSS rule on each (MDN, @view-transition · Chrome for Developers, Cross-document view transitions). Where they're not supported, the link simply loads the next page as it always did. That's the right way to think about it: a view transition is an enhancement, never the only way a person understands where they went. The page they land on must make sense without the animation.

Support changes fast, so check the two webstatus.dev pages above before you promise anything in a spec.


5. Reduced motion in view transitions

A view transition is still motion, and a shared element flying across the screen is exactly the kind of large movement that can make people unwell (see Vestibular disorders and reduced motion). The browser doesn't turn it off for you. Wrap the movement in a media query, as the figure does: with reduced motion on, it keeps only the crossfade. A common pattern for real view transitions:

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*) { animation: none; }
}

This is a sketch for your own code. It stops named elements from travelling and resizing, so they jump to their new place, while the default crossfade of the old and new pictures stays. Fading is not the kind of motion that triggers symptoms, so that's usually the right amount.


6. Common mistakes

  • Using the same view-transition-name on every card in a list, which breaks the transition.
  • Making the transition the only clue to what changed.
  • Designing a cross-document transition and forgetting that Firefox users get a normal page load.
  • Long, showy transitions on every navigation: the first one delights, the twentieth is in the way (see Navigation transitions).
  • No reduced-motion version, because "the browser handles it". It doesn't.

7. Vocabulary

Term Meaning
Web Animations API The browser API that lets code create and control animations: play, pause, reverse, seek
View transition An animation from a snapshot of the old state to the new one
Same-document A view transition inside one page, started by JavaScript
Cross-document A view transition between two pages, opted into with CSS
view-transition-name The name that makes an element animate on its own, as a shared element
Baseline A feature that works in the current versions of all major browsers

8. Try it (no tools needed)

  1. Open a shop on your phone. Tap a product in a list.
  2. Watch the photo. Does it travel to the detail page, or does the page just change?
  3. Sketch both states on paper and draw an arrow for each element that should travel. Circle the one that matters most.

Reflection questions: If only one element could move, which would it be, and why? What would someone who turned off motion still need to see?


9. If you already practise

  • Spec shared elements by name: "product-photo travels from row to hero, 250 ms, the rest crossfades."
  • Try cross-document view transitions on a marketing site or docs; they cost one CSS rule per page and fall back cleanly.
  • Ask for Web Animations when a motion must be interruptible or must follow a gesture.
  • Put the support table in the spec with a date, and check it again before release.

Checklist

Learn more

Books, courses and videos to go deeper

Book links go to Amazon. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.

CSS transitions and animations · Shared element transitions · Navigation transitions · The spatial model of an interface · Designing a reduced-motion version

Saved only on this device.

↑ ↓ to move · Enter to open · Esc to close