A head dot and five fading followers loop an upright figure eight. The path is a 1:2 Lissajous curve made from two sine-eased axes, so no SVG path or offset-path is needed.
Also known as: lissajous dots loader, figure 8 loader, looping dots trail.
<div class="ldr-figure-eight-dots" role="status" aria-label="Loading"> <span style="--k:0"></span><span style="--k:1"></span><span style="--k:2"></span> <span style="--k:3"></span><span style="--k:4"></span><span style="--k:5"></span> </div>
.ldr-figure-eight-dots {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
--d: calc(var(--s) / 5.5);
position: relative;
width: calc(var(--s) * 0.9);
height: calc(var(--s) * 1.2);
}
.ldr-figure-eight-dots span {
position: absolute;
top: calc(50% - var(--d) / 2);
left: calc(50% - var(--d) / 2);
width: var(--d);
height: var(--d);
animation: ldr-figure-eight-dots-y 1s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
animation-delay: calc(var(--k) * 0.1s - 0.6s);
}
.ldr-figure-eight-dots span::before {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
background: var(--c);
opacity: calc(1 - var(--k) * 0.15);
animation: ldr-figure-eight-dots-x 0.5s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
animation-delay: calc(var(--k) * 0.1s - 0.85s);
}
@keyframes ldr-figure-eight-dots-y {
from { transform: translateY(calc(var(--s) * -0.5)); }
to { transform: translateY(calc(var(--s) * 0.5)); }
}
@keyframes ldr-figure-eight-dots-x {
from { transform: translateX(calc(var(--s) * -0.34)) scale(calc(1 - var(--k) * 0.12)); }
to { transform: translateX(calc(var(--s) * 0.34)) scale(calc(1 - var(--k) * 0.12)); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-figure-eight-dots, .ldr-figure-eight-dots *, .ldr-figure-eight-dots::before, .ldr-figure-eight-dots::after, .ldr-figure-eight-dots *::before, .ldr-figure-eight-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.