Each letter prints in as a halftone: a grid of tiny dots that swell until they merge into solid type, letter by letter. A radial-gradient mask tile whose dot radius is a registered @property.
Also known as: dot pattern text reveal, halftone text effect css, pixel dissolve text.
<div class="txt-halftone-dot-reveal" aria-label="Print ready"><span style="--i: 0">P</span><span style="--i: 1">r</span><span style="--i: 2">i</span><span style="--i: 3">n</span><span style="--i: 4">t</span><span style="--i: 5"> </span><span style="--i: 6">r</span><span style="--i: 7">e</span><span style="--i: 8">a</span><span style="--i: 9">d</span><span style="--i: 10">y</span></div>
@property --txt-halftone-dot-reveal-r {
syntax: "<length>";
inherits: false;
initial-value: 0px;
}
.txt-halftone-dot-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;}
/* a 0.2em tile with one dot in it; at 0.15em radius the dots cover the tile */
.txt-halftone-dot-reveal span {
display: inline-block;
-webkit-mask: radial-gradient(circle, #000 var(--txt-halftone-dot-reveal-r), transparent calc(var(--txt-halftone-dot-reveal-r) + 0.5px)) 0 0 / 0.2em 0.2em;
mask: radial-gradient(circle, #000 var(--txt-halftone-dot-reveal-r), transparent calc(var(--txt-halftone-dot-reveal-r) + 0.5px)) 0 0 / 0.2em 0.2em;
animation:
txt-halftone-dot-reveal-ink 0.9s cubic-bezier(0.3, 0, 0.4, 1) calc(var(--i) * 70ms) both,
txt-halftone-dot-reveal-done 0s calc(0.9s + var(--i) * 70ms) forwards;
}
@keyframes txt-halftone-dot-reveal-ink {
from { --txt-halftone-dot-reveal-r: 0em; }
to { --txt-halftone-dot-reveal-r: 0.15em; }
}
@keyframes txt-halftone-dot-reveal-done {
to { -webkit-mask: none; mask: none; }
}
@media (prefers-reduced-motion: reduce) {
.txt-halftone-dot-reveal, .txt-halftone-dot-reveal *, .txt-halftone-dot-reveal::before, .txt-halftone-dot-reveal::after, .txt-halftone-dot-reveal *::before, .txt-halftone-dot-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.