×

css · level 3 · unit 6 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

The timing function shapes the speed, smooth or in steps.

Animations take the same speed curves as transitions, through animation-timing-function. The default, ease, starts slowly, rushes, then slows down. Anything that spins should use linear, one steady speed, so it never seems to stutter at the end of each turn.

is different. steps(4) jumps between four frames with no motion in between, like a flip book. It suits a ticking clock, a blinking cursor or a row of loading dots.

<div class="spinner"></div>
@keyframes spin {
  to { rotate: 1turn; }
}
.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #e5e7eb;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation-name: spin;
  animation-duration: 1s;
  animation-timing-function: linear;
}

Press show my page to see it here.

A to stop on its own is fine: the browser starts from the box's normal style.