Three dots ride a flat carousel: they swell and come forward as they pass left to right in front, then shrink and dim on the way back behind. A sine x-axis plus a cosine depth keyframe.
Also known as: dot carousel, 3d rotating dots, revolving dots loader.
<div class="ldr-carousel-dots" role="status" aria-label="Loading"> <span></span><span></span><span></span> </div>
.ldr-carousel-dots {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
--d: calc(var(--s) / 3.6);
position: relative;
width: calc(var(--s) * 1.4);
height: calc(var(--s) * 0.6);
}
.ldr-carousel-dots span {
position: absolute;
top: calc(50% - var(--d) / 2);
left: calc(50% - var(--d) / 2);
width: var(--d);
height: var(--d);
animation:
ldr-carousel-dots-x 0.9s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate,
ldr-carousel-dots-layer 1.8s step-end infinite;
}
.ldr-carousel-dots span::before {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
background: var(--c);
animation: ldr-carousel-dots-depth 1.8s infinite;
}
.ldr-carousel-dots span:nth-child(2),
.ldr-carousel-dots span:nth-child(2)::before { animation-delay: -0.6s; }
.ldr-carousel-dots span:nth-child(3),
.ldr-carousel-dots span:nth-child(3)::before { animation-delay: -1.2s; }
@keyframes ldr-carousel-dots-x {
from { transform: translateX(calc(var(--s) * -0.5)); }
to { transform: translateX(calc(var(--s) * 0.5)); }
}
@keyframes ldr-carousel-dots-layer {
0% { z-index: 2; }
50% { z-index: 1; }
}
@keyframes ldr-carousel-dots-depth {
0%, 50%, 100% { transform: scale(0.75); opacity: 0.7; animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1); }
25% { transform: scale(1.12); opacity: 1; animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
75% { transform: scale(0.45); opacity: 0.35; animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-carousel-dots, .ldr-carousel-dots *, .ldr-carousel-dots::before, .ldr-carousel-dots::after, .ldr-carousel-dots *::before, .ldr-carousel-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.