Skip to content
Back to Concepts
CSS UniverseTrack 8: Transitions & AnimationTransitions & Timing
Transitions & Animation ยท Track 8Core Concept 30

CSS Transitions & Timing Functions

Eliminate jarring, abrupt visual snaps. Learn how the browser calculates intermediate animation frames, master the sacred 60fps GPU rule (transform & opacity only!), and build snappy bouncy interfaces with custom cubic-bezier() curves.

1. Mental Model: Elevator Doors vs. Sci-Fi Teleportation

Without Transitions: Instant Pop

When a CSS pseudo-state (like :hover or :active) matches, the browser instantly changes properties in a single frame (0ms). To the human eye, this feels unnatural, robotic, and abrasive.

With CSS Transitions: Physics In-Betweening

A transition tells the browser: "Don't teleport immediately. Interpolate smoothly from State A to State B over 300 milliseconds using physics curves!"

2. The Sacred 60fps Rule: What Properties Can You Safely Animate?

CategoryCSS PropertiesBrowser Pipeline CostFrame Rate Performance
GPU Composited (Gold Standard)transform, opacityCompositing ONLY (Zero layout, zero repaint!)Silky Smooth 60fps / 120fps ProMotion
Paint Triggeringcolor, background-color, box-shadowTriggers Paint + CompositeFine for small buttons; lags full-screen elements
Layout Thrashing (The CPU Killer)width, height, top, left, margin, paddingTriggers Layout + Paint + Composite!Horrible stuttering and battery drain

3. Interactive Studio: Live Timing Function Race Track

Duration0.4s
Delay0s
CSS Transition Shorthand
transition: transform 0.4s ease 0s;
Race Track Preview
๐Ÿš€

Notice how the elastic bounce timing function overshoots its target and settles back into place naturally!

First-Year Student Traps: Transitions

  • 1.Never write transition: all 0.3s;! Transitioning "all" forces the browser to watch and recalculate all 300+ CSS properties on every frame. If an ancestor element changes font or color, the entire DOM tree stutters. Always specify exact properties: transition: transform 0.2s ease, opacity 0.2s ease;.
  • 2.Putting transition inside :hover instead of the base class: If you write .btn:hover { transition: transform 0.3s; }, the button will animate smoothly when mouse enters, but snap abruptly back when the mouse leaves! Place transition on the base .btn selector so it animates smoothly both ways.
Next Masterclass

Keyframe Animations & animation-fill-mode

Create autonomous loops, multi-step choreographies with @keyframes, and embedded Animation Studio.

Continue to Concept 31