AI CSS Animations

Breathing Long Shadow

A stacked, stepped shadow gives the text a chunky 3D look, and the shadow slowly extends and retracts as if the light were moving. Retro poster energy.

Also known as: 3D text shadow, retro text shadow, layered shadow text.

RETRO

HTML

<div class="txt-long-shadow">RETRO</div>

CSS

.txt-long-shadow {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c);
  letter-spacing: 0.06em;
  animation: txt-long-shadow-breathe 2.4s ease-in-out infinite alternate;}
@keyframes txt-long-shadow-breathe {
  from {
    text-shadow:
      0.02em 0.02em 0 color-mix(in srgb, var(--c) 60%, transparent),
      0.04em 0.04em 0 color-mix(in srgb, var(--c) 45%, transparent),
      0.06em 0.06em 0 color-mix(in srgb, var(--c) 30%, transparent);
  }
  to {
    text-shadow:
      0.05em 0.05em 0 color-mix(in srgb, var(--c) 60%, transparent),
      0.10em 0.10em 0 color-mix(in srgb, var(--c) 45%, transparent),
      0.15em 0.15em 0 color-mix(in srgb, var(--c) 30%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .txt-long-shadow, .txt-long-shadow *, .txt-long-shadow::before, .txt-long-shadow::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations