Skip to content
IndexRequest a UIAboutContact

Easing Comparison

Four dots race over the same distance and time with different easing curves.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Build an easing comparison with four horizontal tracks labelled Linear, Ease in, Ease out and Overshoot, each 240px wide with a 16px dot at the left and a 12px mono label above. A Play button starts all four at once: each dot moves to the right end of its track over 1200ms using a CSS transition on transform with the timing functions linear, cubic-bezier(.5,0,1,.5), cubic-bezier(.2,.7,.2,1) and cubic-bezier(.3,1.4,.5,1) respectively. Disable the button while playing and re-enable it on transitionend of the last dot, which also resets all dots to the start with transitions off before the next run. Under prefers-reduced-motion skip the travel and place the dots at the end instantly, with a note "Reduced motion is on: showing the end state". Label each track with the exact curve value in a monospace caption.

About this pattern

Definition

Easing describes how an animation's speed changes over its duration. This demo moves four dots across the same distance in the same time, each with a different curve, so the character of each curve is visible side by side.

Purpose & UX principles

  • Pick the curve by intent: ease-out for things entering, ease-in for things leaving, ease-in-out for things moving across the screen, overshoot for playful emphasis.
  • Linear motion feels mechanical and is best for continuous things such as spinners and progress.
  • Keep durations short (150 to 400ms for UI); the curve matters more than the length.

Interaction states

  • Ready, playing, finished; the Replay button is disabled while playing.

Motion specification

  • All four tracks run 1200ms: linear, ease-in cubic-bezier(.5,0,1,.5), ease-out cubic-bezier(.2,.7,.2,1) and overshoot cubic-bezier(.3,1.4,.5,1).
  • Reduced motion: the dots jump to the end with no travel, and the demo says so.

Responsive behaviour

  • Tracks use the container width in percentages, so the comparison holds at any size.
  • Replay is a plain button usable by touch and keyboard.

Code

HTML
<div class="box">
  <div class="tr" data-e="linear"><small>Linear <code>linear</code></small><i></i></div>
  <div class="tr" data-e="cubic-bezier(.5,0,1,.5)"><small>Ease in <code>(.5,0,1,.5)</code></small><i></i></div>
  <div class="tr" data-e="cubic-bezier(.2,.7,.2,1)"><small>Ease out <code>(.2,.7,.2,1)</code></small><i></i></div>
  <div class="tr" data-e="cubic-bezier(.3,1.4,.5,1)"><small>Overshoot <code>(.3,1.4,.5,1)</code></small><i></i></div>
  <button id="play" type="button">Play</button><p id="note" class="note"></p>
</div>

Related patterns

Spring Follow

↗
Spring FollowMotion & Transitions

Staggered Entrance

↗
Staggered EntranceMotion & Transitions

Press Feedback

↗
Press FeedbackButtons & Actions