AI CSS Animations

Pendulum Wave Loader

Six pendulums of different lengths swing from one pivot, each a little slower than the one above, so the dots drift through waves and snakes and line back up every 9.6 seconds.

Also known as: pendulum dots loader, pendulum wave animation, swinging dots.

HTML

<div class="ldr-pendulum-wave-dots" role="status" aria-label="Loading">
  <span style="--l:0.3;--t:0.4"></span>
  <span style="--l:0.44;--t:0.4364"></span>
  <span style="--l:0.58;--t:0.48"></span>
  <span style="--l:0.72;--t:0.5333"></span>
  <span style="--l:0.86;--t:0.6"></span>
  <span style="--l:1;--t:0.6857"></span>
</div>

CSS

.ldr-pendulum-wave-dots {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  --d: calc(var(--s) / 7.5);
  position: relative;
  width: calc(var(--s) * 1.1);
  height: calc(var(--s) + var(--d));
}
.ldr-pendulum-wave-dots::before {
  content: "";
  position: absolute;
  top: calc(var(--d) / -4);
  left: calc(50% - var(--d) / 4);
  width: calc(var(--d) / 2);
  height: calc(var(--d) / 2);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent);
}
.ldr-pendulum-wave-dots span {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: calc(var(--l) * var(--s));
  border-left: 1px solid color-mix(in srgb, var(--ldr-color, #3b82f6) 14%, transparent);
  transform-origin: 50% 0;
  transform: rotate(26deg);
  animation: ldr-pendulum-wave-dots-swing calc(var(--t) * 1s) cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
}
.ldr-pendulum-wave-dots span::after {
  content: "";
  position: absolute;
  bottom: calc(var(--d) / -2);
  left: calc(var(--d) / -2);
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--c);
}
@keyframes ldr-pendulum-wave-dots-swing {
  from { transform: rotate(26deg); }
  to   { transform: rotate(-26deg); }
}

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