AI CSS Animations

Dot to Dash Ring Spinner

Eight round dots stretch into long dashes until the ring almost closes, then shrink back to dots, all while turning. A zero length dash with round caps is what draws each dot.

Also known as: dotted circle loader, dashed circle animation, morphing dashed ring.

HTML

<svg class="ldr-dash-morph-ring" viewBox="0 0 48 48" role="status" aria-label="Loading">
  <circle cx="24" cy="24" r="19" pathLength="100"></circle>
</svg>

CSS

.ldr-dash-morph-ring {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: var(--s);
  height: var(--s);
  animation: ldr-dash-morph-ring-turn 3.2s linear infinite;
}
/* Eight segments of 12.5 each; the offset keeps every dash centred on its dot. */
.ldr-dash-morph-ring circle {
  fill: none;
  stroke: var(--c);
  stroke-width: 4.5;
  stroke-linecap: round;
  animation: ldr-dash-morph-ring-morph 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes ldr-dash-morph-ring-turn {
  to { transform: rotate(360deg); }
}
@keyframes ldr-dash-morph-ring-morph {
  0%, 100% { stroke-dasharray: 0 12.5; stroke-dashoffset: 0; }
  50%      { stroke-dasharray: 8 4.5;  stroke-dashoffset: 4; }
}

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