The text opens behind horizontal slats, like venetian blinds tilting open. A repeating gradient mask whose stop is a registered @property, animated from 0% to 100% of each slat.
Also known as: blinds text effect css, striped text reveal, slat reveal animation.
<div class="txt-venetian-blinds-reveal">Good morning</div>
@property --txt-venetian-blinds-reveal-p {
syntax: "<percentage>";
inherits: false;
initial-value: 0%;
}
.txt-venetian-blinds-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;
display: inline-block;
white-space: nowrap;
color: var(--c);
/* each 0.24em slat fills from its top edge down */
-webkit-mask: linear-gradient(#000 var(--txt-venetian-blinds-reveal-p), transparent 0) 0 0 / 100% 0.24em;
mask: linear-gradient(#000 var(--txt-venetian-blinds-reveal-p), transparent 0) 0 0 / 100% 0.24em;
animation: txt-venetian-blinds-reveal-open 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards, txt-venetian-blinds-reveal-done 0s 1.1s forwards;}
@keyframes txt-venetian-blinds-reveal-open {
to { --txt-venetian-blinds-reveal-p: 100%; }
}
/* hand back plain text once the slats are fully open */
@keyframes txt-venetian-blinds-reveal-done {
to { -webkit-mask: none; mask: none; }
}
@media (prefers-reduced-motion: reduce) {
.txt-venetian-blinds-reveal, .txt-venetian-blinds-reveal *, .txt-venetian-blinds-reveal::before, .txt-venetian-blinds-reveal::after, .txt-venetian-blinds-reveal *::before, .txt-venetian-blinds-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.