DevTools Logo

CSS View Transitions API Animation Lab

CSS View Transitions API Animation Lab

Generate valid view-transition CSS for root or named pairs, then preview it locally in your browser.

Transition settings

Configure a root transition or pair a named element with the same view-transition-name.

Live demo

Current view

Click Run live demo to call document.startViewTransition when supported.

Examples

Root fade with custom duration

Input
buildViewTransitionCss({ preset: "fade", duration: "400ms", timingFunction: "ease-in-out" })
Output
@keyframes vt-fade-root-old/new + animation-duration: 400ms;

The default root name pairs ::view-transition-old(root) with ::view-transition-new(root) under one shared timing block.

Named morph pair

Input
buildViewTransitionCss({ transitionName: "card", preset: "morph" })
Output
::view-transition-old(card) + ::view-transition-new(card) with clip-path

A valid identifier emits both pseudo-element rules keyed to the card transition with inset clip-path keyframes.

About this tool

CSS View Transitions Builder emits crossfade-style page-transition CSS with buildViewTransitionCss(options): pick a preset (fade, slide, scale, flip, morph), a duration ("350ms" default, numbers become ms), a timing function, and a transition name (root by default) to receive paired old/new keyframes, shared duration/timing/fill rules, and per-side animation-name selectors.

Names and timing validate strictly: validateViewTransitionName accepts root or CSS identifiers (letters, digits, hyphens, underscores), the timing pattern accepts linear/ease variants plus steps() and cubic-bezier(), and anything invalid flips valid to false with a message while the emitted CSS sanitizes back to safe fallbacks (root for the name, ease-in-out for timing).

Each preset ships fixed keyframe bodies — slide translates ±24 px, scale zooms .92↔1.08, flip rotates ±90° in 800 px perspective, morph insets a rounded clip-path, fade only fades — and identical options always produce byte-identical CSS, so output is safe to snapshot.

How to use this tool

  1. Choose a preset

    Select fade, slide, scale, flip, or morph — slide keyframes carry translateX, morph carries clip-path, and every preset pairs an old (exit) with a new (enter) animation.

  2. Name the transition

    Set transitionName to a valid CSS identifier (or root); names with spaces fail validation and the CSS falls back to the root transition.

  3. Set duration and timing

    Pass duration as "600ms"/"0.6s" or a millisecond number, plus a timing function like ease-in-out or cubic-bezier(...) — the duration lands verbatim in animation-duration.

Use cases

Scaffolding SPA route transitions

Generate the keyframes and pseudo-element selectors for document.startViewTransition-driven navigation.

Theming per-element transitions

Assign named transitions (card, panel) with distinct presets so shared elements morph while the backdrop fades.

Validating transition config

Catch illegal names and timing functions via the valid flag before pasting CSS into production.

Common mistakes

Mistake:Using display names with spaces as transition names.

Fix:Only CSS identifiers validate — "card detail" fails and the CSS silently targets root, so slugify names to card-detail first.

Mistake:Passing a free-form timing string like "wat".

Fix:Only keyword easings, steps(), and cubic-bezier() validate; anything else flips valid to false and falls back to ease-in-out.

Mistake:Expecting slide to move elements across the screen.

Fix:Slide offsets are a subtle ±24 px fade-assist, not a full off-canvas traversal — write custom keyframes for hero-style travel.

Frequently asked questions

What does this tool do?

It generates paired old/new keyframes plus the ::view-transition-old()/::view-transition-new() selectors for the fade, slide, scale, flip, or morph preset, with your duration and timing function wired in — deterministically, so identical options give byte-identical CSS.

Why did my custom name fall back to root?

Transition names must be root or valid CSS identifiers — "card detail" with a space fails validation, so the tool marks the build invalid and emits the CSS against root. Slugify it to card-detail to get a named old/new pair.

Is my transition configuration uploaded or stored?

No. Preset selection, validation, and CSS assembly run entirely in your browser — nothing leaves your device.

What does the slide preset actually animate?

A subtle ±24 px translateX with a fade — old content exits left while new content enters from the right. It is a fade-assist, not a full off-canvas traversal; write custom keyframes if you need hero-style travel.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML