AI CSS Animations

Shuttle Dots Loader

Five dots shuttle from one end to the other: the lead dot leaves first, the rest string out behind it, and they bunch up in order at the far end before heading back.

Also known as: back and forth dots loader, dot shuttle, dots bunching side to side.

HTML

<div class="ldr-shuttle-dots" role="status" aria-label="Loading">
  <span style="--i:0"></span><span style="--i:1"></span><span style="--i:2"></span><span style="--i:3"></span><span style="--i:4"></span>
</div>

CSS

.ldr-shuttle-dots {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  --d: calc(var(--s) / 4.5);
  --w: calc(var(--s) * 1.5);
  --k: calc(var(--d) * 0.6);
  position: relative;
  width: calc(var(--w) + var(--d));
  height: var(--d);
}
.ldr-shuttle-dots span {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--c);
  opacity: calc(1 - var(--i) * 0.14);
  animation: ldr-shuttle-dots-shuttle 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  animation-delay: calc(var(--i) * 0.06s - 1.8s);
}
@keyframes ldr-shuttle-dots-shuttle {
  0%, 15%, 100% { transform: translateX(calc(var(--i) * var(--k))); }
  50%, 65%      { transform: translateX(calc(var(--w) - var(--i) * var(--k))); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-shuttle-dots, .ldr-shuttle-dots *, .ldr-shuttle-dots::before, .ldr-shuttle-dots::after, .ldr-shuttle-dots *::before, .ldr-shuttle-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