A line draws across the middle, then the text unfolds out of it vertically with a little overshoot, like an old TV warming up. The line is a pseudo-element; the text only animates scaleY.
Also known as: scale y text reveal, open from line animation, tv turn on text.
<div class="txt-unfold-text-reveal"><span class="txt-unfold-text-reveal-t">Tune in</span></div>
.txt-unfold-text-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;
white-space: nowrap;
color: var(--c);}
.txt-unfold-text-reveal::before {
content: "";
position: absolute;
left: -0.25em;
right: -0.25em;
top: 50%;
height: 0.06em;
margin-top: -0.03em;
border-radius: 0.03em;
background: var(--c);
animation: txt-unfold-text-reveal-line 1.1s both;
}
.txt-unfold-text-reveal-t {
display: inline-block;
animation: txt-unfold-text-reveal-open 1.1s both;
}
@keyframes txt-unfold-text-reveal-line {
0% { opacity: 1; transform: scaleX(0); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
40% { opacity: 1; transform: scaleX(1); animation-timing-function: ease-out; }
62%, 100% { opacity: 0; transform: scaleX(1); }
}
@keyframes txt-unfold-text-reveal-open {
0%, 38% { opacity: 0; transform: scaleY(0.02); animation-timing-function: cubic-bezier(0.3, 1.45, 0.5, 1); }
100% { opacity: 1; transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
.txt-unfold-text-reveal, .txt-unfold-text-reveal *, .txt-unfold-text-reveal::before, .txt-unfold-text-reveal::after, .txt-unfold-text-reveal *::before, .txt-unfold-text-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.