AI CSS Animations

Rain Ripple Loader

Raindrops land at scattered spots on a puddle and each sends out a pair of flattened ripples. A wide, calm loader for empty states, with drop positions set inline.

Also known as: raindrop ripple animation, puddle ripples, rain loader.

HTML

<div class="ldr-rain-ripple" role="status" aria-label="Loading">
  <span style="--x: 24%; --y: 34%; --d: 0s"></span>
  <span style="--x: 68%; --y: 24%; --d: -0.5s"></span>
  <span style="--x: 46%; --y: 72%; --d: -1s"></span>
  <span style="--x: 78%; --y: 66%; --d: -1.5s"></span>
</div>

CSS

.ldr-rain-ripple {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: calc(var(--s) * 2);
  height: calc(var(--s) * 0.9);
}
.ldr-rain-ripple span {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: calc(var(--s) * 0.8);
  height: calc(var(--s) * 0.28);
  margin: calc(var(--s) * -0.14) 0 0 calc(var(--s) * -0.4);
  box-sizing: border-box;
  border: calc(var(--s) / 22) solid var(--c);
  border-radius: 50%;
  opacity: 0;
  animation:
    ldr-rain-ripple-spread 2s cubic-bezier(0.2, 0.7, 0.4, 1) infinite,
    ldr-rain-ripple-fade 2s linear infinite;
  animation-delay: var(--d);
}
.ldr-rain-ripple span::after {
  content: "";
  position: absolute;
  inset: 26%;
  box-sizing: border-box;
  border: calc(var(--s) / 30) solid color-mix(in srgb, var(--ldr-color, #3b82f6) 75%, transparent);
  border-radius: 50%;
}
@keyframes ldr-rain-ripple-spread {
  from { transform: scale(0.08); }
  to   { transform: scale(1); }
}
@keyframes ldr-rain-ripple-fade {
  0%, 30% { opacity: 1; }
  100%    { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-rain-ripple, .ldr-rain-ripple *, .ldr-rain-ripple::before, .ldr-rain-ripple::after, .ldr-rain-ripple *::before, .ldr-rain-ripple *::after {
    animation-duration: 3s;
  }
}

Tailwind CSS version

The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.

<div class="relative h-16 w-40" role="status" aria-label="Loading">
  <span class="absolute left-[16%] top-[26%] h-3 w-8 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite] rounded-[50%] border-2 border-blue-500"></span>
  <span class="absolute left-[58%] top-[16%] h-3 w-8 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite] rounded-[50%] border-2 border-blue-500 [animation-delay:-0.5s]"></span>
  <span class="absolute left-[36%] top-[62%] h-3 w-8 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite] rounded-[50%] border-2 border-blue-500 [animation-delay:-1s]"></span>
  <span class="absolute left-[68%] top-[56%] h-3 w-8 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite] rounded-[50%] border-2 border-blue-500 [animation-delay:-1.5s]"></span>
</div>

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