A plank tips over its fulcrum and a ball rolls down it, speeding up as it goes; when it lands the plank flips with a little overshoot and the ball rolls back.
Also known as: teeter totter loader, balance ball loader, rolling ball seesaw.
<div class="ldr-seesaw" role="status" aria-label="Loading"> <span class="ldr-seesaw-plank"><span class="ldr-seesaw-ball"></span></span> </div>
.ldr-seesaw {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
position: relative;
width: calc(var(--s) * 1.8);
height: calc(var(--s) * 0.92);
}
.ldr-seesaw::before {
content: "";
position: absolute;
bottom: 0;
left: 50%;
width: calc(var(--s) * 0.36);
height: calc(var(--s) * 0.32);
margin-left: calc(var(--s) * -0.18);
background: color-mix(in srgb, var(--ldr-color, #3b82f6) 35%, transparent);
clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.ldr-seesaw-plank {
position: absolute;
left: 5%;
right: 5%;
bottom: calc(var(--s) * 0.3);
height: calc(var(--s) / 14);
border-radius: calc(var(--s) / 28);
background: var(--c);
animation: ldr-seesaw-tilt 2.4s infinite;
}
.ldr-seesaw-ball {
position: absolute;
bottom: 100%;
left: 0;
width: calc(var(--s) / 4);
height: calc(var(--s) / 4);
border-radius: 50%;
background: conic-gradient(var(--c) 0 50%, color-mix(in srgb, var(--ldr-color, #3b82f6) 50%, transparent) 0);
animation: ldr-seesaw-roll 2.4s cubic-bezier(0.33, 0, 0.67, 0.33) infinite;
}
@keyframes ldr-seesaw-tilt {
0% { transform: rotate(-12deg); animation-timing-function: cubic-bezier(0.3, 1.6, 0.6, 1); }
10% { transform: rotate(12deg); }
50% { transform: rotate(12deg); animation-timing-function: cubic-bezier(0.3, 1.6, 0.6, 1); }
60% { transform: rotate(-12deg); }
100% { transform: rotate(-12deg); }
}
@keyframes ldr-seesaw-roll {
0%, 12% { transform: translateX(0) rotate(0deg); }
46%, 62% { transform: translateX(calc(var(--s) * 1.37)) rotate(630deg); }
96%, 100% { transform: translateX(0) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-seesaw, .ldr-seesaw *, .ldr-seesaw::before, .ldr-seesaw::after, .ldr-seesaw *::before, .ldr-seesaw *::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.