AI CSS Animations

Gear Spinner

A single toothed gear turning steadily. Drawn with a repeating conic gradient and a radial mask, so it stays razor sharp at any size and needs no icon.

Also known as: cog loader, settings gear animation.

HTML

<div class="ldr-gear" role="status" aria-label="Working"></div>

CSS

.ldr-gear {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle, transparent calc(var(--s) * 0.17), var(--c) calc(var(--s) * 0.17 + 1px) calc(var(--s) * 0.36), transparent calc(var(--s) * 0.36 + 1px));
  animation: ldr-gear-turn 4s linear infinite;
}
.ldr-gear::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(var(--c) 0 22deg, transparent 22deg 45deg);
  -webkit-mask: radial-gradient(circle, transparent calc(var(--s) * 0.3), #000 calc(var(--s) * 0.3 + 1px));
  mask: radial-gradient(circle, transparent calc(var(--s) * 0.3), #000 calc(var(--s) * 0.3 + 1px));
}
@keyframes ldr-gear-turn {
  to { transform: rotate(360deg); }
}

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