A needle glides along a dial of tick marks, overshoots a little like a mechanical pointer, and flashes each time it locks onto a station. Good for search, scan and connect states.
Also known as: radio dial animation, tuning needle loader, frequency scan loader.
<div class="ldr-radio-tuner" role="status" aria-label="Searching"> <span></span> </div>
.ldr-radio-tuner {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
--tw: calc(var(--s) / 24);
position: relative;
width: calc(var(--s) * 2 + var(--tw));
height: calc(var(--s) * 0.9);
}
.ldr-radio-tuner::before {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 55%;
background:
repeating-linear-gradient(90deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 60%, transparent) 0 var(--tw), transparent 0 calc(var(--s) / 2)),
repeating-linear-gradient(90deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 38%, transparent) 0 var(--tw), transparent 0 calc(var(--s) / 10)) 0 100% / 100% 50% no-repeat;
}
.ldr-radio-tuner span {
position: absolute;
bottom: 0;
left: calc(var(--tw) / 2 - var(--s) / 32);
width: calc(var(--s) / 16);
height: 100%;
border-radius: var(--s);
background: var(--c);
animation: ldr-radio-tuner-seek 4.8s infinite;
}
.ldr-radio-tuner span::before,
.ldr-radio-tuner span::after {
content: "";
position: absolute;
top: calc(var(--s) / -14);
left: calc(50% - var(--s) / 14);
width: calc(var(--s) / 7);
height: calc(var(--s) / 7);
border-radius: 50%;
background: var(--c);
}
.ldr-radio-tuner span::after {
background: color-mix(in srgb, var(--ldr-color, #3b82f6) 35%, transparent);
animation: ldr-radio-tuner-lock 4.8s ease-out infinite;
}
@keyframes ldr-radio-tuner-seek {
0%, 16% { transform: translateX(calc(var(--s) * 0.3)); animation-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1); }
28%, 41% { transform: translateX(calc(var(--s) * 1.4)); animation-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1); }
53%, 66% { transform: translateX(calc(var(--s) * 0.8)); animation-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1); }
78%, 91% { transform: translateX(calc(var(--s) * 1.7)); animation-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1); }
100% { transform: translateX(calc(var(--s) * 0.3)); }
}
@keyframes ldr-radio-tuner-lock {
0%, 26%, 51%, 76% { transform: scale(1); opacity: 0.9; }
12%, 38%, 63%, 88% { transform: scale(2.6); opacity: 0; }
25.9%, 50.9%, 75.9%, 99.9% { transform: scale(1); opacity: 0; }
100% { transform: scale(1); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
.ldr-radio-tuner, .ldr-radio-tuner *, .ldr-radio-tuner::before, .ldr-radio-tuner::after, .ldr-radio-tuner *::before, .ldr-radio-tuner *::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.