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

Layout animation

Also called FLIP animation or auto layout animation

An animation that smoothly moves and resizes elements when the layout changes, such as list items gliding to new spots after a sort or filter.

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

const tasks = [
  { id: 1, title: 'Write launch email', done: false },
  { id: 2, title: 'Review pricing page', done: true },
  { id: 3, title: 'Fix signup redirect', done: false },
  { id: 4, title: 'Book venue for offsite', done: true },
  { id: 5, title: 'Draft Q3 roadmap', done: false }
];
const byTitle = [...tasks].sort((a, b) => a.title.localeCompare(b.title));

export function TaskList() {
  const [sorted, setSorted] = useState(false);
  const [hideDone, setHideDone] = useState(false);
  const ordered = sorted ? byTitle : tasks;
  const visible = hideDone ? ordered.filter((task) => !task.done) : ordered;

  return (
    // reducedMotion='user' turns the movement off for people who prefer less motion.
    <MotionConfig reducedMotion='user'>
      <div className='w-80'>
        <div className='mb-3 flex gap-2 text-sm font-medium *:rounded-full *:border *:px-3 *:py-1.5 *:aria-pressed:bg-muted'>
          <button
            type='button'
            aria-pressed={sorted}
            onClick={() => setSorted(!sorted)}
          >
            Sort A–Z
          </button>
          <button
            type='button'
            aria-pressed={hideDone}
            onClick={() => setHideDone(!hideDone)}
          >
            Hide done
          </button>
        </div>
        {/* popLayout pulls leaving rows out of the flow, so the rest close the gap right away. */}
        <ul className='relative flex flex-col gap-2'>
          <AnimatePresence mode='popLayout' initial={false}>
            {visible.map((task) => (
              <motion.li
                key={task.id}
                layout
                exit={{ opacity: 0, scale: 0.95 }}
                transition={{ duration: 0.3, ease: [0.23, 1, 0.32, 1] }}
                className='rounded-xl border bg-background px-4 py-3 text-sm'
              >
                {task.title}
              </motion.li>
            ))}
          </AnimatePresence>
        </ul>
      </div>
    </MotionConfig>
  );
}
Animate the task list when it is sorted or filtered: each row should glide from its old position to its new one over 300ms with ease-out instead of jumping, and removed rows should fade out and scale to 95% while the rest close the gap. Use Motion’s layout prop with AnimatePresence, and make changes instant when prefers-reduced-motion is set.

Paste into Layerwise or any AI coding tool.

What is Layout animation?

When items are added, removed, sorted, or resized, the browser normally jumps everything to its new position in a single frame. A layout animation measures where each element was before the change and where it ends up after, then animates the difference so items glide into place.

Use it for lists that reorder or filter, grids that change columns, cards that expand, tabs with a sliding indicator, and anywhere an instant jump would make people lose track of an item. It is also the engine behind most morphs and shared element transitions.

The classic technique is called FLIP: First, Last, Invert, Play. Measure the first position, apply the change, measure the last position, invert the difference with a transform, then animate that transform back to zero. Because only transform animates, it stays smooth even though the real layout changed instantly. Motion does all of this when you add the layout prop, and AnimatePresence handles items that leave.

Often confused with

Morph
A morph is one element changing shape. Layout animation is the general technique that animates any element whose position or size changed, and morphs are often built with it.

Related terms

All terms

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.

Drag to reorder

A list you can rearrange by dragging an item to a new spot while the other items slide aside to make room.

Height auto animation

An animation that opens or closes a panel to the exact height of its content, even though that height is unknown ahead of time.

GPU acceleration

A browser technique where the graphics chip moves, fades, or scales an element on its own layer instead of redrawing the page every frame.

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
SortShuffleOdd only

Layout animation

1
2
3
4
5
6

Instant

1
2
3
4
5
6