AI CSS Animations

Bouncing Shapes Loader

A triangle, a circle and a square hop in turn, stretching on take-off and squashing on landing. The triangle and square spin in the air by exactly their symmetry, so each lands looking unmoved.

Also known as: geometric shapes loader, triangle circle square loader, jumping shapes animation.

HTML

<div class="ldr-bouncing-shapes" role="status" aria-label="Loading">
  <span style="--i: 0; --r: 120deg"></span><span style="--i: 1; --r: 0deg"></span><span style="--i: 2; --r: 90deg"></span>
</div>

CSS

.ldr-bouncing-shapes {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: calc(var(--s) * 1.5);
  height: var(--s);
  padding-bottom: calc(var(--s) * 0.1);
}
.ldr-bouncing-shapes span {
  position: relative;
  width: calc(var(--s) * 0.34);
  height: calc(var(--s) * 0.34);
  transform-origin: 50% 100%;
  animation: ldr-bouncing-shapes-hop 1.5s infinite both;
  animation-delay: calc(var(--i) * 0.16s);
}
.ldr-bouncing-shapes span::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c);
  animation: ldr-bouncing-shapes-spin 1.5s cubic-bezier(0.45, 0, 0.55, 1) infinite both;
  animation-delay: calc(var(--i) * 0.16s);
}
.ldr-bouncing-shapes span:nth-child(1)::before {
  clip-path: polygon(50% 6.7%, 100% 93.3%, 0 93.3%);
  transform-origin: 50% 64.4%;
}
.ldr-bouncing-shapes span:nth-child(2)::before {
  border-radius: 50%;
  background: color-mix(in srgb, var(--c) 70%, #000);
}
.ldr-bouncing-shapes span:nth-child(3)::before {
  inset: 6%;
  border-radius: calc(var(--s) / 30);
  background: color-mix(in srgb, var(--c) 60%, #fff);
}
@keyframes ldr-bouncing-shapes-hop {
  0%, 44%, 100% { transform: translateY(0) scale(1, 1); }
  6%  { transform: translateY(0) scale(1.18, 0.8); animation-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1); }
  22% { transform: translateY(calc(var(--s) * -0.5)) scale(0.94, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4); }
  36% { transform: translateY(0) scale(1.14, 0.84); animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
}
@keyframes ldr-bouncing-shapes-spin {
  0%, 6%    { transform: rotate(0deg); }
  36%, 100% { transform: rotate(var(--r)); }
}

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