A little fish swims in place with a wagging tail and a gentle bob while bubbles rise from its mouth. Pure CSS: an oval body, a clip-path tail and three ringed bubbles.
Also known as: fish animation css, aquarium loader, fish swimming loading.
<div class="ldr-fish" role="status" aria-label="Loading"> <span class="ldr-fish-body"><span class="ldr-fish-tail"></span></span> <span class="ldr-fish-bubble"></span><span class="ldr-fish-bubble"></span><span class="ldr-fish-bubble"></span> </div>
.ldr-fish {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
position: relative;
width: calc(var(--s) * 1.3);
height: var(--s);
}
.ldr-fish-body {
position: absolute;
left: 31%;
top: 34%;
width: calc(var(--s) * 0.64);
height: calc(var(--s) * 0.42);
border-radius: 55% 45% 45% 55% / 50%;
background:
radial-gradient(circle calc(var(--s) * 0.045) at 76% 40%, color-mix(in srgb, var(--c) 25%, #000) 92%, transparent),
var(--c);
animation: ldr-fish-bob 1.6s ease-in-out infinite;
}
.ldr-fish-body::before {
content: "";
position: absolute;
left: 30%;
bottom: 84%;
width: calc(var(--s) * 0.2);
height: calc(var(--s) * 0.12);
background: var(--c);
clip-path: polygon(0 100%, 26% 0, 100% 100%);
}
.ldr-fish-body::after {
content: "";
position: absolute;
left: 44%;
top: 52%;
width: calc(var(--s) * 0.13);
height: calc(var(--s) * 0.08);
border-radius: 50%;
background: color-mix(in srgb, var(--c) 40%, #fff);
transform-origin: 100% 0;
animation: ldr-fish-wag 0.4s ease-in-out infinite alternate-reverse;
}
.ldr-fish-tail {
position: absolute;
right: 88%;
top: 12%;
width: calc(var(--s) * 0.28);
height: 76%;
background: var(--c);
clip-path: polygon(0 0, 100% 50%, 0 100%, 22% 50%);
transform-origin: 100% 50%;
animation: ldr-fish-wag 0.4s ease-in-out infinite alternate;
}
.ldr-fish-bubble {
position: absolute;
left: 82%;
top: 30%;
width: calc(var(--s) * 0.1);
height: calc(var(--s) * 0.1);
box-sizing: border-box;
border: calc(var(--s) / 30) solid var(--c);
border-radius: 50%;
opacity: 0;
animation: ldr-fish-bubble 1.8s ease-out infinite;
}
.ldr-fish-bubble:nth-of-type(3) { animation-delay: 0.6s; }
.ldr-fish-bubble:nth-of-type(4) { animation-delay: 1.2s; }
@keyframes ldr-fish-bob {
0%, 100% { transform: translateY(0) rotate(-4deg); }
50% { transform: translateY(calc(var(--s) * -0.06)) rotate(3deg); }
}
@keyframes ldr-fish-wag {
from { transform: scaleX(1) rotate(-12deg); }
to { transform: scaleX(0.75) rotate(12deg); }
}
@keyframes ldr-fish-bubble {
0% { transform: translate(0, 0) scale(0.4); opacity: 0; }
15% { opacity: 1; }
100% { transform: translate(calc(var(--s) * 0.08), calc(var(--s) * -0.34)) scale(1.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
.ldr-fish, .ldr-fish *, .ldr-fish::before, .ldr-fish::after, .ldr-fish *::before, .ldr-fish *::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.