An arc swings through the bottom of a faint ring like a pendulum, stretching as it speeds past the middle and bunching up at each end. Less restless than a spinner for long waits.
Also known as: pendulum spinner, back and forth arc loader, rocking arc animation.
<svg class="ldr-swinging-arc" viewBox="0 0 48 48" role="status" aria-label="Loading"> <circle class="ldr-swinging-arc-track" cx="24" cy="24" r="19"></circle> <circle class="ldr-swinging-arc-arc" cx="24" cy="24" r="19" pathLength="100"></circle> </svg>
.ldr-swinging-arc {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
width: var(--s);
height: var(--s);
}
.ldr-swinging-arc circle {
fill: none;
stroke-width: 5;
stroke-linecap: round;
}
.ldr-swinging-arc-track {
stroke: color-mix(in srgb, var(--ldr-color, #3b82f6) 16%, transparent);
}
/* The dash is centred on 6 o'clock (25 of 100), then the circle rocks either side of it. */
.ldr-swinging-arc-arc {
stroke: var(--c);
transform-origin: center;
animation:
ldr-swinging-arc-swing 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate,
ldr-swinging-arc-stretch 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes ldr-swinging-arc-swing {
from { transform: rotate(-105deg); }
to { transform: rotate(105deg); }
}
@keyframes ldr-swinging-arc-stretch {
0%, 100% { stroke-dasharray: 8 92; stroke-dashoffset: -21; }
50% { stroke-dasharray: 30 70; stroke-dashoffset: -10; }
}
@media (prefers-reduced-motion: reduce) {
.ldr-swinging-arc, .ldr-swinging-arc *, .ldr-swinging-arc::before, .ldr-swinging-arc::after, .ldr-swinging-arc *::before, .ldr-swinging-arc *::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.