The word sits as a faint ghost while its letters switch on in a shuffled order, each with a small pop. The order lives in a --d index on every span, so any permutation works.
Also known as: random order text animation, letters light up randomly, shuffle reveal text.
<div class="txt-random-letter-reveal" aria-label="Top secret"><span style="--d: 3">T</span><span style="--d: 7">o</span><span style="--d: 1">p</span><span style="--d: 9"> </span><span style="--d: 5">s</span><span style="--d: 0">e</span><span style="--d: 8">c</span><span style="--d: 2">r</span><span style="--d: 6">e</span><span style="--d: 4">t</span></div>
.txt-random-letter-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;
color: var(--c);
white-space: nowrap;}
/* --d is each letter's place in the shuffled order */
.txt-random-letter-reveal span {
display: inline-block;
animation: txt-random-letter-reveal-on 0.45s ease-out calc(0.2s + var(--d) * 90ms) both;
}
@keyframes txt-random-letter-reveal-on {
0% { opacity: 0.14; transform: scale(1); }
35% { opacity: 1; transform: scale(1.22); }
100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.txt-random-letter-reveal, .txt-random-letter-reveal *, .txt-random-letter-reveal::before, .txt-random-letter-reveal::after, .txt-random-letter-reveal *::before, .txt-random-letter-reveal *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.