Four dots count from 0 to 15 in binary, each bit flipping at half the rate of the one to its right. steps() timing gives the hard on and off of real LEDs and the loop is exactly one count.
Also known as: binary loading animation, bit counter dots, counting dots loader.
<div class="ldr-binary-dots" role="status" aria-label="Loading"> <span style="--p:16"></span><span style="--p:8"></span><span style="--p:4"></span><span style="--p:2"></span> </div>
.ldr-binary-dots {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
display: flex;
gap: calc(var(--s) / 7);
}
.ldr-binary-dots span {
width: calc(var(--s) / 4);
height: calc(var(--s) / 4);
border-radius: 50%;
background: var(--c);
animation: ldr-binary-dots-bit calc(var(--p) * 0.25s) steps(1, end) infinite;
}
@keyframes ldr-binary-dots-bit {
0% { opacity: 0.25; transform: scale(0.7); }
50%, 100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-binary-dots, .ldr-binary-dots *, .ldr-binary-dots::before, .ldr-binary-dots::after, .ldr-binary-dots *::before, .ldr-binary-dots *::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.