A five-point star turns while its inner corners swell out into a pentagon and pull back into a star. Both shapes share one ten-point clip-path polygon, so the tween between them is smooth.
Also known as: star loader, star spinner, clip-path star animation.
<div class="ldr-star-morph" role="status" aria-label="Loading"></div>
.ldr-star-morph {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
width: var(--s);
height: var(--s);
background: var(--c);
animation: ldr-star-morph-shift 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes ldr-star-morph-shift {
0%, 8% {
transform: rotate(0deg) scale(1);
clip-path: polygon(50% 2%, 60.8% 35.2%, 95.7% 35.2%, 67.4% 55.7%, 78.2% 88.8%, 50% 68.3%, 21.8% 88.8%, 32.6% 55.7%, 4.3% 35.2%, 39.2% 35.2%);
}
42%, 58% {
transform: rotate(72deg) scale(0.86);
clip-path: polygon(50% 2%, 72.8% 18.6%, 95.7% 35.2%, 86.9% 62%, 78.2% 88.8%, 50% 88.8%, 21.8% 88.8%, 13.1% 62%, 4.3% 35.2%, 27.2% 18.6%);
}
92%, 100% {
transform: rotate(144deg) scale(1);
clip-path: polygon(50% 2%, 60.8% 35.2%, 95.7% 35.2%, 67.4% 55.7%, 78.2% 88.8%, 50% 68.3%, 21.8% 88.8%, 32.6% 55.7%, 4.3% 35.2%, 39.2% 35.2%);
}
}
@media (prefers-reduced-motion: reduce) {
.ldr-star-morph, .ldr-star-morph *, .ldr-star-morph::before, .ldr-star-morph::after, .ldr-star-morph *::before, .ldr-star-morph *::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.