AI CSS Animations

Chasing Dots Spinner

Two dots on opposite sides of a turning frame take turns swelling to full size and shrinking to nothing, so they seem to chase each other around. The SpinKit classic with sine easing.

Also known as: spinkit chasing dots, two dots spinner, rotating dots spinner.

HTML

<div class="ldr-chasing-dots" role="status" aria-label="Loading">
  <span></span><span></span>
</div>

CSS

.ldr-chasing-dots {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  animation: ldr-chasing-dots-spin 2s linear infinite;
}
.ldr-chasing-dots span {
  position: absolute;
  top: 0;
  left: 21%;
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: var(--c);
  animation: ldr-chasing-dots-grow 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.ldr-chasing-dots span:last-child {
  top: auto;
  bottom: 0;
  animation-delay: -1s;
}
@keyframes ldr-chasing-dots-spin {
  to { transform: rotate(360deg); }
}
@keyframes ldr-chasing-dots-grow {
  0%, 100% { transform: scale(0); }
  50%      { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-chasing-dots, .ldr-chasing-dots *, .ldr-chasing-dots::before, .ldr-chasing-dots::after, .ldr-chasing-dots *::before, .ldr-chasing-dots *::after {
    animation-duration: 3s;
  }
}

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries role="status" and an aria-label so screen readers announce the wait. The reduced-motion rule at the end slows the animation for users who asked for less motion.

Similar loaders