AI CSS Animations

Snail Loader

A snail inches along, body stretching and antennae waving, leaving a faint slime trail. A self-aware loader for slow jobs; the whole snail is one SVG with a spiral shell path.

Also known as: slow loading snail, snail animation css, slow loader funny.

HTML

<div class="ldr-snail" role="status" aria-label="Loading">
  <svg viewBox="0 0 60 40" aria-hidden="true">
    <rect class="ldr-snail-trail" x="2" y="36.4" width="20" height="1.6" rx="0.8"/>
    <g class="ldr-snail-snail">
      <g class="ldr-snail-body">
        <path class="ldr-snail-feelers" d="M44.5 19l-2.5-7M47.5 19l2.5-7"/>
        <path d="M5 36c0-3 3-5 7-5h30v-9a4 4 0 0 1 8 0v11c0 2.2-1.8 4-4 4H7c-1.2 0-2-.4-2-1z"/>
        <circle cx="42" cy="12" r="1.8"/>
        <circle cx="50" cy="12" r="1.8"/>
      </g>
      <g class="ldr-snail-shell">
        <circle cx="24" cy="21" r="11"/>
        <path class="ldr-snail-spiral" d="M24 21a1.5 1.5 0 0 1 3 0a3 3 0 0 1-6 0a4.5 4.5 0 0 1 9 0a6 6 0 0 1-12 0a7.5 7.5 0 0 1 15 0"/>
      </g>
    </g>
  </svg>
</div>

CSS

.ldr-snail {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: calc(var(--s) * 1.5);
  height: var(--s);
}
.ldr-snail svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--c);
}
.ldr-snail-snail {
  animation: ldr-snail-glide 4s linear infinite;
}
.ldr-snail-body {
  fill: color-mix(in srgb, var(--ldr-color, #3b82f6) 55%, transparent);
  transform-box: fill-box;
  transform-origin: 0 100%;
  animation: ldr-snail-stretch 1s ease-in-out infinite;
}
.ldr-snail-body circle {
  fill: var(--c);
}
.ldr-snail-feelers {
  fill: none;
  stroke: color-mix(in srgb, var(--ldr-color, #3b82f6) 55%, transparent);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.ldr-snail-shell {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: ldr-snail-shell 1s ease-in-out infinite;
}
.ldr-snail-spiral {
  fill: none;
  stroke: color-mix(in srgb, var(--c) 35%, #fff);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.ldr-snail-trail {
  fill: color-mix(in srgb, var(--ldr-color, #3b82f6) 30%, transparent);
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: ldr-snail-trail 4s linear infinite;
}
@keyframes ldr-snail-glide {
  0%   { transform: translateX(-4%); opacity: 0; }
  10%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateX(10%); opacity: 0; }
}
@keyframes ldr-snail-stretch {
  0%, 100% { transform: scaleX(1); }
  50%      { transform: scaleX(1.07); }
}
@keyframes ldr-snail-shell {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  50%      { transform: translate(3%, -3%) rotate(4deg); }
}
@keyframes ldr-snail-trail {
  0%   { transform: scaleX(0.4); opacity: 0; }
  10%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-snail, .ldr-snail *, .ldr-snail::before, .ldr-snail::after, .ldr-snail *::before, .ldr-snail *::after {
    animation-duration: 3s;
  }
}

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries 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.

Similar loaders