LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. State transitions

Page transition

Also called route transition or navigation transition

An animation that plays when you move from one page or screen to another, such as the old page fading out as the new one fades in.

import { useState } from 'react';
import { AnimatePresence, motion, MotionConfig } from 'motion/react';

const pages = {
  home: {
    title: 'Build apps by describing them',
    text: 'Tell the agent what you need and watch it come together.'
  },
  pricing: {
    title: 'Simple pricing',
    text: 'Start free. Upgrade when your app takes off.'
  },
  docs: {
    title: 'Documentation',
    text: 'Guides for building, previewing, and publishing.'
  }
};
type Page = keyof typeof pages;

export function SiteShell() {
  const [page, setPage] = useState<Page>('home');

  return (
    // reducedMotion='user' drops the slide and keeps a plain fade.
    <MotionConfig reducedMotion='user'>
      {/* The header stays still; only the main content transitions. */}
      <header className='flex gap-6 border-b px-6 py-4 text-sm'>
        {(Object.keys(pages) as Page[]).map((key) => (
          <button
            key={key}
            type='button'
            aria-current={key === page ? 'page' : undefined}
            onClick={() => setPage(key)}
            className='font-medium text-muted-foreground capitalize aria-[current=page]:text-foreground'
          >
            {key}
          </button>
        ))}
      </header>
      {/* With a router, key on the pathname. popLayout lets the old and new pages overlap. */}
      <div className='relative'>
        <AnimatePresence mode='popLayout' initial={false}>
          <motion.main
            key={page}
            initial={{ opacity: 0, y: 8 }}
            animate={{ opacity: 1, y: 0 }}
            exit={{ opacity: 0 }}
            transition={{ duration: 0.25, ease: [0.23, 1, 0.32, 1] }}
            className='px-6 py-10'
          >
            <h1 className='text-2xl font-semibold'>{pages[page].title}</h1>
            <p className='mt-2 text-muted-foreground'>{pages[page].text}</p>
          </motion.main>
        </AnimatePresence>
      </div>
    </MotionConfig>
  );
}
Add a page transition to the site: when navigating between pages, fade the old main content out and fade the new content in while it slides up 8px, 250ms total with ease-out. Keep the header and navigation static, never delay the navigation for the animation, and disable the motion when prefers-reduced-motion is set.

Paste into Layerwise or any AI coding tool.

What is Page transition?

Without a page transition, clicking a link swaps the whole screen at once. A page transition animates the handoff: the outgoing page fades or slides away while the incoming page arrives, usually within 200 to 400ms. Mobile apps have always done this, and websites increasingly do too.

Pick one style and use it everywhere. A quick crossfade suits most sites. A slide works when pages have a clear order, such as tabs or steps, and should follow the direction of travel. Keep shared parts like the header and navigation still, so only the content area moves.

A page transition should never slow people down. Start it right away instead of waiting for data, keep it short, and respect prefers-reduced-motion. In React apps you can animate the route content with a library like Motion, or use the browser’s View Transitions API, which works within a single-page app and, in supporting browsers, across regular page loads.

Often confused with

View Transitions API
A page transition is the effect. The View Transitions API is one browser feature for building it, by snapshotting the old page and animating to the new one.

Related terms

All terms

Crossfade

A transition where the old content fades out while the new content fades in at the same spot, so the two briefly overlap.

Direction-aware transition

A transition that slides new content in from the side you are heading toward, so going forward and going back move in opposite directions.

Shared element transition

A transition where an element from one view, like a thumbnail, travels and grows into its place in the next view, linking the two screens.

Perceived performance

How fast an app feels to people, which skeleton screens, instant feedback, and progressive loading can improve even when the real wait stays the same.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
acme.com
Acme

Ship your app today

Build, preview, and publish in one place.

Get started