AI CSS Animations

Eclipse Spinner

A thin crescent sweeps around a faint disc, like the bright edge of an eclipse. The crescent is just an offset box-shadow on a rotating circle, so it is one element with no pseudo parts.

Also known as: crescent spinner, moon spinner, box shadow spinner.

HTML

<div class="ldr-eclipse-spinner" role="status" aria-label="Loading"></div>

CSS

.ldr-eclipse-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 10%, transparent);
  box-shadow: 0 calc(var(--s) / 12) 0 0 var(--c);
  animation: ldr-eclipse-spinner-spin 1s linear infinite;
}
@keyframes ldr-eclipse-spinner-spin {
  to { transform: rotate(360deg); }
}

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

Tailwind CSS version

The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.

<div class="h-12 w-12 animate-spin rounded-full bg-blue-500/10 shadow-[0_4px_0_0_#3b82f6]" role="status" aria-label="Loading"></div>

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