AI CSS Animations

Pinwheel Spinner

Four two-tone paper blades whirl up to speed and coast to a stop each turn, like a pinwheel in gusts of wind. Every blade is the same clip-path triangle, rotated a quarter turn from the last.

Also known as: windmill loader, fan spinner, paper pinwheel animation.

HTML

<div class="ldr-pinwheel-spinner" 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>
</div>

CSS

.ldr-pinwheel-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  animation: ldr-pinwheel-spinner-whirl 1.6s cubic-bezier(0.55, 0, 0.45, 1) infinite;
}
/* Each blade fills half of a quadrant; transform-origin is the hub at the centre. */
.ldr-pinwheel-spinner span {
  position: absolute;
  left: 50%;
  top: 14%;
  width: 36%;
  height: 36%;
  background: linear-gradient(135deg, var(--c) 50%, color-mix(in srgb, var(--ldr-color, #3b82f6) 55%, transparent) 50%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  transform-origin: 0 100%;
  transform: rotate(calc(var(--i) * 90deg));
}
.ldr-pinwheel-spinner::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--s) / 8);
  height: calc(var(--s) / 8);
  border: calc(var(--s) / 32) solid var(--c);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 30%, transparent);
  transform: translate(-50%, -50%);
}
@keyframes ldr-pinwheel-spinner-whirl {
  to { transform: rotate(360deg); }
}

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