AI CSS Animations

Scramble Text Loader

Each letter of LOADING flickers through random symbols before it locks in, left to right, then scrambles again. Pure CSS: the symbols are animated content on a pseudo-element.

Also known as: decrypting text animation, hacker text loading, text scramble css.

HTML

<div class="ldr-scramble-text" role="status" aria-label="Loading">
  <span aria-hidden="true">L</span><span aria-hidden="true">O</span><span aria-hidden="true">A</span><span aria-hidden="true">D</span><span aria-hidden="true">I</span><span aria-hidden="true">N</span><span aria-hidden="true">G</span>
</div>

CSS

.ldr-scramble-text {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: inline-flex;
  font: 700 calc(var(--s) / 2.2) / 1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  color: var(--c);
}
.ldr-scramble-text span {
  position: relative;
  animation: ldr-scramble-text-lock 2.8s steps(1, end) infinite;
  animation-delay: calc(var(--i, 0) * 0.09s - 2.8s);
}
.ldr-scramble-text span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  color: color-mix(in srgb, var(--ldr-color, #3b82f6) 65%, transparent);
  animation: ldr-scramble-text-glyph 2.8s steps(1, end) infinite;
  animation-delay: calc(var(--i, 0) * 0.09s - 2.8s);
}
.ldr-scramble-text span:nth-child(2) { --i: 1; }
.ldr-scramble-text span:nth-child(3) { --i: 2; }
.ldr-scramble-text span:nth-child(4) { --i: 3; }
.ldr-scramble-text span:nth-child(5) { --i: 4; }
.ldr-scramble-text span:nth-child(6) { --i: 5; }
.ldr-scramble-text span:nth-child(7) { --i: 6; }
@keyframes ldr-scramble-text-lock {
  0%   { color: transparent; }
  30%  { color: var(--c); }
  86%, 100% { color: transparent; }
}
@keyframes ldr-scramble-text-glyph {
  0%   { content: "#"; }
  5%   { content: "%"; }
  10%  { content: "&"; }
  15%  { content: "@"; }
  20%  { content: "$"; }
  25%  { content: "?"; }
  30%  { content: ""; }
  86%  { content: "*"; }
  91%  { content: "/"; }
  96%  { content: "+"; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-scramble-text, .ldr-scramble-text *, .ldr-scramble-text::before, .ldr-scramble-text::after, .ldr-scramble-text *::before, .ldr-scramble-text *::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