Four short bars take turns crouching, leaping and landing with a squash, like a row of springy characters. Anticipation and follow-through are baked into one keyframe set.
Also known as: bouncing bars loader, squash and stretch loader.
<div class="ldr-jumping-bars" role="status" aria-label="Loading"> <span></span><span></span><span></span><span></span> </div>
.ldr-jumping-bars {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
display: flex;
align-items: flex-end;
justify-content: center;
gap: calc(var(--s) / 8);
width: calc(var(--s) * 1.3);
height: var(--s);
}
.ldr-jumping-bars span {
width: calc(var(--s) / 6);
height: calc(var(--s) / 2.6);
border-radius: calc(var(--s) / 20);
background: var(--c);
transform-origin: 50% 100%;
animation: ldr-jumping-bars-jump 1.2s infinite;
}
.ldr-jumping-bars span:nth-child(2) { animation-delay: 0.12s; }
.ldr-jumping-bars span:nth-child(3) { animation-delay: 0.24s; }
.ldr-jumping-bars span:nth-child(4) { animation-delay: 0.36s; }
@keyframes ldr-jumping-bars-jump {
0%, 74%, 100% { transform: translateY(0) scale(1, 1); }
10% { transform: translateY(0) scale(1.28, 0.7); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
18% { transform: translateY(calc(var(--s) * -0.26)) scale(0.84, 1.2); animation-timing-function: cubic-bezier(0.3, 0.6, 0.5, 1); }
32% { transform: translateY(calc(var(--s) * -0.52)) scale(1, 1); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
46% { transform: translateY(calc(var(--s) * -0.14)) scale(0.88, 1.14); animation-timing-function: linear; }
52% { transform: translateY(0) scale(1.34, 0.64); animation-timing-function: ease-out; }
61% { transform: translateY(0) scale(0.92, 1.08); animation-timing-function: ease-in-out; }
68% { transform: translateY(0) scale(1.04, 0.97); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-jumping-bars, .ldr-jumping-bars *, .ldr-jumping-bars::before, .ldr-jumping-bars::after, .ldr-jumping-bars *::before, .ldr-jumping-bars *::after {
animation-duration: 3s;
}
}--ldr-color on the element or a parent.
Currently previewing #3b82f6.--ldr-size. Every dimension in the snippet is
derived from it. Currently previewing 64px.animation shorthand.
Delays on the children are relative, so they keep their rhythm.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.