AI CSS Animations

Glowing Progress Bar

A thin bar that fills in uneven bursts behind a bright glowing head, which flares when it reaches the end. The head is one element with a static glow that only moves by transform.

Also known as: neon progress bar, progress bar with glow, comet loading bar.

HTML

<div class="ldr-glowing-progress-bar" role="progressbar" aria-label="Loading"><span></span></div>

CSS

.ldr-glowing-progress-bar {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  --w: calc(var(--s) * 6);
  position: relative;
  width: var(--w);
  height: calc(var(--s) / 12);
  border-radius: var(--s);
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 14%, transparent);
}
.ldr-glowing-progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 15%, transparent), var(--c));
  box-shadow: 0 0 calc(var(--s) / 6) color-mix(in srgb, var(--ldr-color, #3b82f6) 45%, transparent);
  transform-origin: left;
  animation: ldr-glowing-progress-bar-fill 3.2s infinite;
}
.ldr-glowing-progress-bar span {
  position: absolute;
  top: 50%;
  left: calc(var(--s) / -8);
  width: calc(var(--s) / 4);
  height: calc(var(--s) / 4);
  margin-top: calc(var(--s) / -8);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 25%, #fff) 0 30%, var(--c) 70%);
  box-shadow: 0 0 calc(var(--s) / 6) calc(var(--s) / 20) var(--c), 0 0 calc(var(--s) / 2) calc(var(--s) / 8) color-mix(in srgb, var(--ldr-color, #3b82f6) 40%, transparent);
  animation: ldr-glowing-progress-bar-head 3.2s infinite;
}
@keyframes ldr-glowing-progress-bar-fill {
  0%       { transform: scaleX(0); animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  20%      { transform: scaleX(0.24); animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1); }
  32%      { transform: scaleX(0.3); animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  54%      { transform: scaleX(0.66); animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1); }
  64%      { transform: scaleX(0.72); animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1); }
  82%, 90% { transform: scaleX(1); opacity: 1; }
  100%     { transform: scaleX(1); opacity: 0; }
}
@keyframes ldr-glowing-progress-bar-head {
  0%       { transform: translateX(0); animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  20%      { transform: translateX(calc(var(--w) * 0.24)); animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1); }
  32%      { transform: translateX(calc(var(--w) * 0.3)); animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  54%      { transform: translateX(calc(var(--w) * 0.66)); animation-timing-function: cubic-bezier(0.5, 0, 0.5, 1); }
  64%      { transform: translateX(calc(var(--w) * 0.72)); animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1); }
  82%      { transform: translateX(var(--w)) scale(1); opacity: 1; }
  88%      { transform: translateX(var(--w)) scale(1.7); opacity: 1; }
  100%     { transform: translateX(var(--w)) scale(2.4); opacity: 0; }
}

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