AI CSS Animations

Radar Sweep

A sweeping beam circles a ringed radar screen and lights up a blip as it passes. A natural fit for search, scanning, syncing and 'looking for devices' states.

Also known as: sonar loader, scanner animation.

HTML

<div class="ldr-radar" role="status" aria-label="Scanning"></div>

CSS

.ldr-radar {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  border: 1px solid color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 33%, color-mix(in srgb, var(--ldr-color, #3b82f6) 35%, transparent) 33% calc(33% + 1px), transparent 0 66%, color-mix(in srgb, var(--ldr-color, #3b82f6) 35%, transparent) 66% calc(66% + 1px), transparent 0);
}
.ldr-radar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 72%, color-mix(in srgb, var(--ldr-color, #3b82f6) 65%, transparent) 100%);
  animation: ldr-radar-sweep 2s linear infinite;
}
.ldr-radar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 78%;
  width: calc(var(--s) / 9);
  height: calc(var(--s) / 9);
  margin: calc(var(--s) / -18);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 calc(var(--s) / 8) var(--c);
  animation: ldr-radar-blip 2s ease-out infinite;
}
@keyframes ldr-radar-sweep {
  to { transform: rotate(360deg); }
}
@keyframes ldr-radar-blip {
  0%, 22%  { opacity: 0; }
  27%      { opacity: 1; }
  70%, 100% { opacity: 0; }
}

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