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

Squash and stretch

Stretching an object along its path when it moves fast and flattening it on impact, so it looks elastic and has weight.

import { motion, useReducedMotion } from 'motion/react';

const DROP = 150; // px
const SQUASH = { scaleX: 1.25, scaleY: 0.75 }; // wider as it gets shorter
const STRETCH = { scaleX: 0.9, scaleY: 1.15 }; // taller and thinner at speed

// One bounce per second: fall (ease-in), 80ms on the ground, rise (ease-out).
const TIMES = [0, 0.44, 0.46, 0.5, 0.54, 0.56, 1];
const bounce = {
  y: [-DROP, -12, 0, 0, 0, -12, -DROP],
  scaleX: [1, STRETCH.scaleX, 1, SQUASH.scaleX, 1, STRETCH.scaleX, 1],
  scaleY: [1, STRETCH.scaleY, 1, SQUASH.scaleY, 1, STRETCH.scaleY, 1]
};

export function BouncingBall() {
  const reduceMotion = useReducedMotion();

  return (
    <div className='flex h-56 items-end justify-center'>
      <motion.div
        animate={reduceMotion ? undefined : bounce}
        transition={{
          duration: 1,
          times: TIMES,
          ease: ['easeIn', 'linear', 'easeOut', 'easeIn', 'linear', 'easeOut'],
          repeat: Infinity
        }}
        // Squash from the bottom so the ball stays planted on the floor.
        className='size-12 origin-bottom rounded-full bg-blue-500'
      />
    </div>
  );
}
Make the mascot ball bounce in a loop: fall 150px with an ease-in curve and rise with an ease-out curve, about 1 second per bounce. On impact, scale it to scaleX 1.25 and scaleY 0.75 from the bottom center for about 80ms, and stretch it to scaleY 1.15 just before and after contact. Show a still ball when prefers-reduced-motion is set.

Paste into Layerwise or any AI coding tool.

What is Squash and stretch?

Squash and stretch is often called the most important of the 12 principles of animation. A bouncing ball stretches tall as it falls, flattens wide when it hits the floor, and stretches again as it takes off. Its volume stays about the same: when it gets shorter, it also gets wider.

In interfaces, use a light touch: a button that squashes slightly when pressed, an icon that stretches as it jumps, a toggle knob that widens as it slides, or a playful loading ball. A 5 to 15 percent change is plenty for UI; cartoon-sized squash suits mascots, games, and onboarding illustrations.

Set transform-origin to the side that touches the surface, the bottom for a bounce, so the object stays planted while it squashes. Change scaleX and scaleY in opposite directions, keep the effect off text, which just looks distorted, and drop it when prefers-reduced-motion is set.

Related terms

All terms

Anticipation

A small move in the opposite direction just before the main action, like crouching before a jump, so the motion that follows reads clearly.

Follow-through

When the main object stops but loose, attached parts keep moving for a moment, swing past, and settle, which makes motion feel physical.

Scale

A CSS transform that draws an element larger or smaller around its transform origin, without pushing neighboring elements.

Transform origin

The point an element rotates and scales around. It defaults to the center, and moving it changes where a transform seems to start.

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
With squash
Rigid