AI CSS Animations

Electric Arc Loader

A jagged arc crackles between two charged nodes, then cuts out while the nodes build charge again. Three bolt shapes swap in stepped keyframes, which is what makes it jitter like real current.

Also known as: lightning loader, electric spark animation, tesla coil arc.

HTML

<svg class="ldr-electric-arc" viewBox="0 0 120 50" role="status" aria-label="Loading">
  <g class="ldr-electric-arc-bolts">
    <polyline points="12,25 22,17 30,30 41,15 51,33 61,19 71,31 81,16 91,30 100,20 108,25" />
    <polyline points="12,25 21,32 31,18 40,34 50,16 60,31 70,17 80,33 90,19 99,29 108,25" />
    <polyline points="12,25 20,20 29,34 40,21 49,29 59,13 70,28 79,20 90,34 99,23 108,25" />
  </g>
  <circle class="ldr-electric-arc-node" cx="10" cy="25" r="7" />
  <circle class="ldr-electric-arc-node" cx="110" cy="25" r="7" />
</svg>

CSS

.ldr-electric-arc {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: calc(var(--s) * 2);
  height: calc(var(--s) * 0.84);
  overflow: visible;
  filter: drop-shadow(0 0 calc(var(--s) / 16) var(--c));
}
.ldr-electric-arc-bolts {
  animation: ldr-electric-arc-burst 1.6s steps(1, end) infinite;
}
.ldr-electric-arc-bolts polyline {
  fill: none;
  stroke: var(--c);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0;
  animation: ldr-electric-arc-jump 0.24s steps(1, end) infinite;
}
.ldr-electric-arc-bolts polyline:nth-child(2) { animation-delay: -0.08s; }
.ldr-electric-arc-bolts polyline:nth-child(3) { animation-delay: -0.16s; }
.ldr-electric-arc-node {
  fill: var(--c);
  stroke: color-mix(in srgb, var(--ldr-color, #3b82f6) 35%, transparent);
  stroke-width: 6;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: ldr-electric-arc-charge 1.6s cubic-bezier(0.5, 0, 0.9, 0.6) infinite;
}
@keyframes ldr-electric-arc-jump {
  0%          { opacity: 1; }
  33.3%, 100% { opacity: 0; }
}
@keyframes ldr-electric-arc-burst {
  0%        { opacity: 1; }
  55%, 100% { opacity: 0; }
}
@keyframes ldr-electric-arc-charge {
  0%   { transform: scale(1.15); }
  12%  { transform: scale(0.85); }
  55%  { transform: scale(0.85); }
  100% { transform: scale(1.15); }
}

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