AI CSS Animations

Letter by Letter Blur In Text

Letters sharpen out of a blur one after another, so a wave of focus travels across the word. Unlike a whole-line blur in, the long overlap between letters gives a soft gradient of focus.

Also known as: letter blur reveal, staggered blur text, focus pull text animation.

Soft focus

HTML

<div class="txt-letter-by-letter-blur-in" aria-label="Soft focus"><span style="--i: 0">S</span><span style="--i: 1">o</span><span style="--i: 2">f</span><span style="--i: 3">t</span><span style="--i: 4">&nbsp;</span><span style="--i: 5">f</span><span style="--i: 6">o</span><span style="--i: 7">c</span><span style="--i: 8">u</span><span style="--i: 9">s</span></div>

CSS

.txt-letter-by-letter-blur-in {
  --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);
  white-space: nowrap;}
.txt-letter-by-letter-blur-in span {
  display: inline-block;
  animation: txt-letter-by-letter-blur-in-focus 1s cubic-bezier(0.25, 0.6, 0.3, 1) calc(var(--i) * 80ms) both;
}
@keyframes txt-letter-by-letter-blur-in-focus {
  0%   { opacity: 0; filter: blur(0.35em); transform: translateX(0.15em); }
  40%  { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-letter-by-letter-blur-in, .txt-letter-by-letter-blur-in *, .txt-letter-by-letter-blur-in::before, .txt-letter-by-letter-blur-in::after, .txt-letter-by-letter-blur-in *::before, .txt-letter-by-letter-blur-in *::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