AI CSS Animations

Glitch Reveal Text

The word stutters into existence through torn slices and color-split flashes, then settles perfectly clean and stays. Plays once; clip-path slices do the tearing, two copies do the color split.

Also known as: glitch text reveal css, glitch in animation, digital text entrance.

UNLOCKED

HTML

<div class="txt-glitch-reveal" data-text="UNLOCKED">UNLOCKED</div>

CSS

.txt-glitch-reveal {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  color: var(--c);
  letter-spacing: 0.06em;
  opacity: 0;
  animation: txt-glitch-reveal-in 1.1s steps(1, end) forwards;}
.txt-glitch-reveal::before,
.txt-glitch-reveal::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: 1.1s steps(1, end) forwards;
}
.txt-glitch-reveal::before {
  color: #ff2d78;
  animation-name: txt-glitch-reveal-red;
}
.txt-glitch-reveal::after {
  color: #00c2ff;
  animation-name: txt-glitch-reveal-cyan;
}
@keyframes txt-glitch-reveal-in {
  0%   { opacity: 0; clip-path: inset(0 0 100% 0); transform: none; }
  8%   { opacity: 1; clip-path: inset(40% 0 35% 0); transform: translateX(-0.12em); }
  16%  { opacity: 1; clip-path: inset(0 0 62% 0); transform: translateX(0.08em); }
  24%  { opacity: 0; }
  32%  { opacity: 1; clip-path: inset(55% 0 0 0); transform: translateX(-0.05em); }
  40%  { opacity: 1; clip-path: inset(0); transform: skewX(-14deg); }
  48%  { opacity: 1; clip-path: inset(12% 0 22% 0); transform: translateX(0.06em); }
  56%  { opacity: 1; clip-path: inset(0); transform: translateX(-0.02em); }
  64%, 100% { opacity: 1; clip-path: inset(0); transform: none; }
}
@keyframes txt-glitch-reveal-red {
  0%, 64%, 100% { opacity: 0; transform: none; }
  8%  { opacity: 1; transform: translateX(-0.1em); }
  24% { opacity: 1; transform: translateX(0.14em); }
  40% { opacity: 1; transform: translateX(-0.07em); }
  56% { opacity: 1; transform: translateX(-0.04em); }
}
@keyframes txt-glitch-reveal-cyan {
  0%, 64%, 100% { opacity: 0; transform: none; }
  16% { opacity: 1; transform: translateX(0.1em); }
  24% { opacity: 1; transform: translateX(-0.12em); }
  48% { opacity: 1; transform: translateX(0.07em); }
  56% { opacity: 1; transform: translateX(0.04em); }
}

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