AI CSS Animations

Shimmer Progress Bar

A squared-off install bar that steps forward with a slight spring while a band of light keeps running through the filled part, the way desktop installers show they are still alive.

Also known as: windows progress bar, shine progress bar, glossy loading bar.

HTML

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

CSS

.ldr-shimmer-progress-bar {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: calc(var(--s) * 6);
  height: calc(var(--s) / 4);
  border-radius: calc(var(--s) / 16);
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ldr-color, #3b82f6) 24%, transparent);
  overflow: hidden;
}
.ldr-shimmer-progress-bar span {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(color-mix(in srgb, var(--c) 80%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 85%, #000));
  transform-origin: left;
  animation: ldr-shimmer-progress-bar-fill 5s infinite;
}
.ldr-shimmer-progress-bar span::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.6), transparent);
  transform: translateX(-100%);
  animation: ldr-shimmer-progress-bar-shine 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes ldr-shimmer-progress-bar-fill {
  0%       { transform: scaleX(0); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  10%, 26% { transform: scaleX(0.22); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  36%, 52% { transform: scaleX(0.48); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  62%, 72% { transform: scaleX(0.74); animation-timing-function: cubic-bezier(0.34, 1.2, 0.64, 1); }
  82%, 94% { transform: scaleX(1); opacity: 1; }
  100%     { transform: scaleX(1); opacity: 0; }
}
@keyframes ldr-shimmer-progress-bar-shine {
  70%, 100% { transform: translateX(260%); }
}

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