A square flips over on the X axis, then the Y axis, with a little perspective. The 'rotating plane' from SpinKit, in one element.
<div class="ldr-flip-square" role="status" aria-label="Loading"></div>
.ldr-flip-square {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
width: calc(var(--s) * 0.8);
height: calc(var(--s) * 0.8);
margin: calc(var(--s) * 0.1);
background: var(--c);
border-radius: calc(var(--s) / 16);
animation: ldr-flip-square-flip 1.2s ease-in-out infinite;
}
@keyframes ldr-flip-square-flip {
0% { transform: perspective(120px) rotateX(0deg) rotateY(0deg); }
50% { transform: perspective(120px) rotateX(-180deg) rotateY(0deg); }
100% { transform: perspective(120px) rotateX(-180deg) rotateY(-180deg); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-flip-square, .ldr-flip-square *, .ldr-flip-square::before, .ldr-flip-square::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.