AI CSS Animations

Spinning Beach Ball Loader

A glossy six-color wheel spinning under a fixed highlight, the busy cursor everyone recognises. The colors are your accent hue-shifted with relative color syntax, with a two-tone fallback.

Also known as: mac spinning wheel, rainbow wheel loader, spinning wait cursor.

HTML

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

CSS

.ldr-beach-ball-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  overflow: hidden;
}
.ldr-beach-ball-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(var(--c) 0 60deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent) 0 120deg, var(--c) 0 180deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent) 0 240deg, var(--c) 0 300deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent) 0);
  background: conic-gradient(
    var(--c) 0 60deg,
    oklch(from var(--c) l c calc(h + 60)) 0 120deg,
    oklch(from var(--c) l c calc(h + 120)) 0 180deg,
    oklch(from var(--c) l c calc(h + 180)) 0 240deg,
    oklch(from var(--c) l c calc(h + 240)) 0 300deg,
    oklch(from var(--c) l c calc(h + 300)) 0
  );
  animation: ldr-beach-ball-spinner-spin 0.9s linear infinite;
}
/* The shine stays put while the colors turn underneath it. */
.ldr-beach-ball-spinner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0) 38%),
    radial-gradient(circle at 50% 50%, rgb(0 0 0 / 0) 60%, rgb(0 0 0 / 0.22));
}
@keyframes ldr-beach-ball-spinner-spin {
  to { transform: rotate(360deg); }
}

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