AI CSS Animations

Hexagon Segments Loader

A hexagon cut into six wedges that grow out from the center one by one, then retract in the same order while the whole shape turns. Alternating shades give it a kaleidoscope look.

Also known as: hexagon loader, hexagon spinner, hexagon pie loader.

HTML

<div class="ldr-hexagon-segments" role="status" aria-label="Loading">
  <span style="--i: 0"></span><span style="--i: 1"></span><span style="--i: 2"></span><span style="--i: 3"></span><span style="--i: 4"></span><span style="--i: 5"></span>
</div>

CSS

.ldr-hexagon-segments {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: calc(var(--s) * 0.9);
  height: calc(var(--s) * 1.04);
  animation: ldr-hexagon-segments-turn 2.4s linear infinite;
}
.ldr-hexagon-segments span {
  position: absolute;
  inset: 0;
  background: var(--c);
  animation: ldr-hexagon-segments-grow 2.4s infinite both;
  animation-delay: calc(var(--i) * 0.1s);
}
.ldr-hexagon-segments span:nth-child(even) {
  background: color-mix(in srgb, var(--c) 65%, #000);
}
.ldr-hexagon-segments span:nth-child(1) { clip-path: polygon(50% 50%, 50% 0, 100% 25%); }
.ldr-hexagon-segments span:nth-child(2) { clip-path: polygon(50% 50%, 100% 25%, 100% 75%); }
.ldr-hexagon-segments span:nth-child(3) { clip-path: polygon(50% 50%, 100% 75%, 50% 100%); }
.ldr-hexagon-segments span:nth-child(4) { clip-path: polygon(50% 50%, 50% 100%, 0 75%); }
.ldr-hexagon-segments span:nth-child(5) { clip-path: polygon(50% 50%, 0 75%, 0 25%); }
.ldr-hexagon-segments span:nth-child(6) { clip-path: polygon(50% 50%, 0 25%, 50% 0); }
@keyframes ldr-hexagon-segments-grow {
  0%        { transform: scale(0); animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1); }
  15%, 50%  { transform: scale(0.94); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  64%, 100% { transform: scale(0); }
}
@keyframes ldr-hexagon-segments-turn {
  to { transform: rotate(120deg); }
}

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