AI CSS Animations

Yin Yang Spinner

A yin yang symbol turning with a slow start and a soft stop each revolution. Drawn as one SVG path with an even-odd hole for the inner dot, so both halves stay crisp on any background.

Also known as: yin yang loader, taijitu spinner, balance loading animation.

HTML

<svg class="ldr-yin-yang-spinner" viewBox="0 0 48 48" role="status" aria-label="Loading">
  <circle class="ldr-yin-yang-spinner-disc" cx="24" cy="24" r="20"></circle>
  <path class="ldr-yin-yang-spinner-half" fill-rule="evenodd" d="M24 4a20 20 0 0 1 0 40a10 10 0 0 1 0-20a10 10 0 0 0 0-20ZM20.7 34a3.3 3.3 0 1 0 6.6 0a3.3 3.3 0 1 0-6.6 0Z"></path>
  <circle class="ldr-yin-yang-spinner-dot" cx="24" cy="14" r="3.3"></circle>
</svg>

CSS

.ldr-yin-yang-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: var(--s);
  height: var(--s);
  animation: ldr-yin-yang-spinner-spin 1.6s cubic-bezier(0.65, 0.05, 0.35, 0.95) infinite;
}
.ldr-yin-yang-spinner-disc {
  fill: color-mix(in srgb, var(--ldr-color, #3b82f6) 14%, transparent);
  stroke: var(--c);
  stroke-width: 2;
}
.ldr-yin-yang-spinner-half,
.ldr-yin-yang-spinner-dot {
  fill: var(--c);
}
@keyframes ldr-yin-yang-spinner-spin {
  to { transform: rotate(360deg); }
}

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