AI CSS Animations

3D Flip Bars Loader

Five bars flip over on their vertical axis one after another, showing a solid face and then a pale back, like a row of dominoes turning. Built with preserve-3d and backface-visibility.

Also known as: flipping bars loader, 3d bars animation, domino flip loader.

HTML

<div class="ldr-flip-bars-3d" role="status" aria-label="Loading">
  <span></span><span></span><span></span><span></span><span></span>
</div>

CSS

.ldr-flip-bars-3d {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: flex;
  gap: calc(var(--s) / 12);
  height: calc(var(--s) * 0.9);
  perspective: calc(var(--s) * 3);
}
.ldr-flip-bars-3d span {
  position: relative;
  width: calc(var(--s) / 5);
  transform-style: preserve-3d;
  animation: ldr-flip-bars-3d-flip 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.ldr-flip-bars-3d span::before,
.ldr-flip-bars-3d span::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--s) / 24);
  background: var(--c);
  backface-visibility: hidden;
}
.ldr-flip-bars-3d span::after {
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 30%, transparent);
  transform: rotateY(180deg);
}
.ldr-flip-bars-3d span:nth-child(2) { animation-delay: 0.09s; }
.ldr-flip-bars-3d span:nth-child(3) { animation-delay: 0.18s; }
.ldr-flip-bars-3d span:nth-child(4) { animation-delay: 0.27s; }
.ldr-flip-bars-3d span:nth-child(5) { animation-delay: 0.36s; }
@keyframes ldr-flip-bars-3d-flip {
  0%, 8%    { transform: rotateY(0deg); }
  38%, 58%  { transform: rotateY(180deg); }
  88%, 100% { transform: rotateY(360deg); }
}

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