CSS View Transition Generator: Smooth Page Morphs Without JavaScript Frameworks
Learn how the CSS View Transition Generator helps you build smooth, native page transitions with view-transition-name and ::view-transition-old/new() pseudo-elements β no libraries required.
Table of Contents
Page transitions used to be the exclusive territory of native apps and heavyweight JavaScript frameworks. You either accepted the jarring white flash of a full page load, or you committed to a client-side router with a animation library bolted on top. The CSS View Transition API changed that equation: smooth, animated morphs between page states are now a platform feature, driven almost entirely by CSS.
The catch is that the API has its own vocabulary β view-transition-name, ::view-transition-old(), ::view-transition-new(), snapshot groups, blend modes β and writing those declarations by hand gets repetitive fast. That is exactly the problem the CSS View Transition Generator solves. You describe the transition you want (name, duration, easing, blend mode, direction), and it hands you clean, copy-ready CSS with a live preview so you can see the motion before shipping it.
In this guide, we will walk through what the tool does, how the underlying View Transition API works, and how to put it to work in real projects β both single-page apps and traditional multi-page sites.
Why Use the CSS View Transition Generator?
- Zero hand-typing of boilerplate. The pseudo-element syntax is fiddly β colons, parentheses, easy to mistype. The generator emits syntactically correct ::view-transition-old/new() rules every time, so you skip the trial-and-error loop entirely.
- Live preview while you iterate. Instead of saving, reloading, and squinting at your actual site, you can nudge duration from 500ms to 350ms, switch the easing curve, and watch the demo box morph in real time. Tuning a transition this way takes seconds instead of minutes.
- Works for both SPA and MPA architectures. Whether you trigger transitions with document.startViewTransition() in a single-page app, or let the browser animate cross-document navigations with the @view-transition rule, the generated CSS applies to both. One snippet, two architectures.
- Validation built in. The tool rejects invalid view-transition-name values (they must start with a letter and contain only letters, numbers, and hyphens) and out-of-range durations (0β60000ms), catching mistakes that would otherwise silently break your transition in production.
- No dependencies, no build step. The output is plain CSS. Paste it into your stylesheet, a <style> block, or a CSS-in-JS template β nothing to install and nothing that fights your bundler.
- Discoverable API surface. Because the generator exposes options like mix-blend-mode and animation-direction as form fields, it doubles as documentation of what the API can actually do. Many developers first learn about ::view-transition-group() direction control through a generator like this one.
Key Features
| Feature | What it controls | Default |
|---|---|---|
| view-transition-name | The identifier that pairs the old and new snapshots | hero-image |
| Duration | How long the morph runs, in milliseconds (0β60000) | 500ms |
| Timing function | The easing curve applied to the animation | cubic-bezier(0.4, 0, 0.2, 1) |
| mix-blend-mode | How the old and new snapshots composite during the crossfade | normal |
| animation-direction | both, reverse, or alternate on the group | both |
| Style both pseudo-elements | Emit rules for ::view-transition-old() and ::view-transition-new() | on |
- The output mirrors how the API is structured. The generated snippet always includes the .target { view-transition-name: β¦ } declaration first, then the pseudo-element rules, then the optional ::view-transition-group() block β the same mental model you would use reading the spec.
- Copy, download, or clear. One click puts the CSS on your clipboard; a download button saves it as a file for reference; and the clear button resets every field to sensible defaults.
- Shared-element morphs, not just crossfades. Because the same view-transition-name is applied to the element in both states, the browser interpolates position and size too β the signature "morph" effect that makes view transitions feel native.
How to Use
- Open the CSS View Transition Generator and enter a view-transition-name for the element you want to animate β for example hero-image, product-thumb, or article-title.
- Set the duration. Start at 500ms and adjust to taste; short transitions (200β300ms) feel snappy for UI chrome, while 500β700ms suits large hero morphs.
- Pick an easing curve. The default cubic-bezier(0.4, 0, 0.2, 1) is a safe material-style curve; try ease-in-out or a custom cubic-bezier for different personalities.
- Optionally tune the advanced options β mix-blend-mode for creative crossfades, animation-direction for reversed group animation, and the toggle for styling both old and new pseudo-elements separately.
- Copy the generated CSS into your project, attach the view-transition-name to the real element in both the outgoing and incoming page state, and trigger the navigation. Watch it morph.
Understanding the View Transition API
To use the generated CSS well, it helps to know what the browser is actually doing. When a view transition starts, the browser takes a screenshot-style snapshot of the old state and a live representation of the new state, then constructs a pseudo-element tree on top of the page for the duration of the animation:
- ::view-transition β the root overlay covering the whole viewport.
- ::view-transition-group(name) β a group box that animates from the old element's position/size to the new one's. This is where the morph interpolation happens.
- ::view-transition-old(name) β a static snapshot of the outgoing element, which fades out.
- ::view-transition-new(name) β the live incoming element, which fades in.
The generator's output targets exactly these pseudo-elements: setting animation-duration and animation-timing-function on the old/new snapshots controls the crossfade, while the group rule controls the overall motion.
Same-document vs cross-document. There are two flavors of view transitions:
- Same-document (SPA) transitions. In a single-page app, you call document.startViewTransition(() => updateTheDOM()). The browser snapshots the current state, runs your callback to mutate the DOM, snapshots the new state, and animates between them. Your generated CSS controls how that animation looks. This is the approach used by most React/Vue/Svelte apps today.
- Cross-document (MPA) transitions. For traditional multi-page navigation, browsers support opt-in transitions between full page loads via:
@view-transition {
navigation: auto;
}
With that rule in place, clicking a link to another page on your site animates the old document into the new one β same pseudo-elements, same generated CSS, no JavaScript at all.
Browser support. Chromium-based browsers have shipped the API for both flavors, Safari supports same-document transitions, and Firefox is progressively rolling it out. The good news: view transitions are an enhancement. Where unsupported, navigation simply proceeds without animation β the generated CSS degrades silently. Pair it with a small feature check or progressive-enhancement mindset and every user gets a working site.
One rule to remember: each view-transition-name must be unique per page state. If two visible elements share a name, the transition is skipped. That is why the generator validates the name format β a typo'd or duplicated identifier is the number one reason a view transition "mysteriously" does not fire.
Practical Use Cases
E-commerce product image morph
A grid page shows product thumbnails; the detail page shows the same product large. Give the thumbnail view-transition-name: product-thumb-42 (unique per product), and on the detail page apply the same name to the hero image. Navigating from grid to detail makes the thumbnail visibly grow into the hero β a premium feel that used to require FLIP-style JS measurement. Use the generator to set a slightly longer duration (600β700ms) with an ease-out curve so the expansion lands softly.
Article hero continuity in a blog or news site
On the article list, each featured image gets a name like article-hero; on the article page, the header image repeats it. With @view-transition { navigation: auto; } in your stylesheet, plain MPA navigation animates the hero from card to header β zero JavaScript on a statically-generated site. This site itself (a Next.js static export) is a good example of the architecture this enables.
Dashboard layout changes
Dashboards reflow constantly: filters collapse, panels expand, tabs switch charts. Wrapping the state update in document.startViewTransition() and giving each panel a stable view-transition-name makes panels glide to their new positions instead of teleporting. For panel motion specifically, tune the ::view-transition-group() rule β the generator's animation-direction and duration fields feed straight into it.
List-to-detail navigation in SPAs
The classic mobile pattern β tap a list row, the row expands into the detail screen β maps perfectly onto view transitions. Name each row (or use a shared name applied only to the tapped row before triggering), then apply the same name to the detail container. The generated old/new crossfade plus the group's size interpolation produce the effect with ~10 lines of CSS and one startViewTransition() call.
Best Practices
- Keep durations short. 200β400ms for small UI, 400β700ms for large morphs. Anything longer than a second feels laggy rather than smooth, no matter how nice the curve is.
- Respect reduced-motion preferences. Wrap transitions in @media (prefers-reduced-motion: no-preference), or set ::view-transition-group(*) { animation-duration: 0.01s; } under prefers-reduced-motion: reduce so users who opt out get instant swaps.
- Use unique names per element. Duplicate names skip the transition entirely. For lists, assign item-1, item-2β¦ or name only the interacted element.
- Prefer one hero morph per navigation. Animating every element on the page turns elegance into noise. Pick the one or two elements where continuity genuinely helps β usually the image or title the user tapped.
- Match the curve to the gesture. Navigating forward with a decelerating curve (ease-out) feels responsive; reversing navigation with an accelerating curve (ease-in) feels natural. The generator's custom cubic-bezier field makes both easy.
- Test the fallback. Load the page in a browser without View Transition support and confirm the experience is still fully functional β it should be, by design.
Start Generating
Smooth page transitions are no longer a framework perk β they are a few lines of platform CSS. Grab the vocabulary right, and the rest is tuning. Open the CSS View Transition Generator, dial in a name, duration, and curve that match your design system, preview the morph live, and copy the CSS straight into your project. Your navigation will feel noticeably more polished within five minutes.
Related Tools You Might Like:
- CSS Animation Generator β build @keyframes animations with a visual editor when you need more than transitions.
- CSS Spring Easing Generator β craft natural, physics-based spring curves for your timing functions.
- CSS Scroll-Driven Animations Generator β generate scroll-linked animations with animation-timeline for scroll storytelling effects.
Happy morphing!