LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Timing & sequencing

Keyframes

Also called keyframe animation or @keyframes

Snapshots that define how an element looks at set points in an animation. The browser fills in the motion between them.

import { useEffect, useRef } from 'react';
import { useAnimate, useReducedMotion } from 'motion/react';

// The angle at each keyframe, and when (0 to 1) each one is reached.
const ROTATE = [0, 14, -12, 8, -4, 0, 0];
const TIMES = [0, 0.15, 0.3, 0.45, 0.6, 0.75, 1];

export function NotificationBell({ unread }: { unread: number }) {
  const [scope, animate] = useAnimate<HTMLSpanElement>();
  const reduceMotion = useReducedMotion();
  const previous = useRef(unread);

  // Ring once each time the unread count goes up.
  useEffect(() => {
    const hasNew = unread > previous.current;
    previous.current = unread;
    if (!hasNew || reduceMotion) return;
    animate(
      scope.current,
      { rotate: ROTATE },
      { duration: 0.9, times: TIMES, ease: 'easeInOut' }
    );
  }, [unread, reduceMotion, animate, scope]);

  return (
    <button
      type='button'
      aria-label={`Notifications, ${unread} unread`}
      className='grid size-10 place-items-center rounded-full hover:bg-muted'
    >
      {/* Swing from the top, where a bell hangs. */}
      <span ref={scope} className='block origin-top'>
        <svg
          viewBox='0 0 24 24'
          fill='none'
          stroke='currentColor'
          strokeWidth={2}
          className='size-5'
          aria-hidden
        >
          <path d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9' />
          <path d='M10.3 21a1.94 1.94 0 0 0 3.4 0' />
        </svg>
      </span>
    </button>
  );
}
Add a CSS @keyframes animation that rings the notification bell when a new message arrives: rotate it to 14deg at 15%, -12deg at 30%, 8deg at 45%, -4deg at 60%, and back to 0 at 75%, over 900ms with ease-in-out, rotating from the top center. Play it once per message and skip it when prefers-reduced-motion is set.

Paste into Layerwise or any AI coding tool.

Keyframes explained

A keyframe pins down an element’s style at one moment of an animation, such as its position, rotation, or opacity at 0%, 50%, and 100% of the way through. The browser works out every frame in between, so a handful of keyframes can describe a path with several turns.

In CSS you write keyframes in an @keyframes rule and attach them with the animation property. In Motion for React you pass an array of values, like x: [0, 100, 0], and an optional times array that says when each value is reached.

Reach for keyframes when an animation needs more than a start and an end: a bounce, a shake, a pulse, or a path with turns. For a simple change from one state to another, a transition is shorter to write and easier to interrupt.

Often confused with

Tweening
Keyframes are the fixed points you define. Tweening is the in-between motion the computer generates from them.

Related terms

All terms

Tweening

Generating the in-between frames of an animation from a start and an end state, so an element moves smoothly from one to the other.

Shake animation

A quick side-to-side jiggle that tells someone their input was rejected, such as a wrong password or an invalid code.

Looping animation

An animation that plays more than once, either a set number of times or forever, set in CSS with animation-iteration-count.

Easing

A curve that controls how an animation’s speed changes over time, so motion can start slow, land softly, or keep one steady pace.

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
0%
30%
70%
100%