A pyramid metronome whose weighted arm swings from side to side at a steady tempo. The arm pivots at its base with sine easing, like a real pendulum.
Also known as: metronome animation, tempo loader, ticking metronome.
<div class="ldr-metronome" role="status" aria-label="Loading"> <span class="ldr-metronome-arm"></span> </div>
.ldr-metronome {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
position: relative;
width: calc(var(--s) * 0.9);
height: var(--s);
}
.ldr-metronome::before {
content: "";
position: absolute;
inset: 0;
background: color-mix(in srgb, var(--ldr-color, #3b82f6) 22%, transparent);
clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%);
}
.ldr-metronome::after {
content: "";
position: absolute;
left: 50%;
bottom: calc(var(--s) * 0.16);
width: calc(var(--s) / 6);
height: calc(var(--s) / 6);
margin-left: calc(var(--s) / -12);
border-radius: 50%;
background: var(--c);
}
.ldr-metronome-arm {
position: absolute;
left: 50%;
bottom: calc(var(--s) * 0.24);
width: calc(var(--s) / 16);
height: calc(var(--s) * 0.72);
margin-left: calc(var(--s) / -32);
border-radius: calc(var(--s) / 32);
background: var(--c);
transform-origin: 50% 100%;
animation: ldr-metronome-swing 0.6s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
.ldr-metronome-arm::before {
content: "";
position: absolute;
top: 18%;
left: 50%;
width: calc(var(--s) / 4.5);
height: calc(var(--s) / 8);
margin-left: calc(var(--s) / -9);
border-radius: calc(var(--s) / 30);
background: var(--c);
}
@keyframes ldr-metronome-swing {
from { transform: rotate(-28deg); }
to { transform: rotate(28deg); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-metronome, .ldr-metronome *, .ldr-metronome::before, .ldr-metronome::after, .ldr-metronome *::before, .ldr-metronome *::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.