How do you reveal text line by line with clip-path?
Revealing text with a moving mask is one of the classiest headline entrances, like a curtain lifting off each word. We split the text into whole words only, so Arabic stays intact.
Steps
- Split the headline into words, each whole word inside an inline-block span.
- Hide each word by clipping it from the bottom with clip-path: inset.
- Animate the clip to zero with a small translateY rise, so the word seems to climb out from behind a mask.
- Delay each word with an increasing animation-delay for a staggered entrance.
- Under prefers-reduced-motion, remove the clip and animation and show the full text at once.
The code
HTML
<h2 class="reveal">
<span class="w">حرّك</span>
<span class="w">أفكارك</span>
<span class="w">الآن</span>
</h2>
<style>
.reveal .w {
display: inline-block;
clip-path: inset(0 0 100% 0);
transform: translateY(0.4em);
animation: reveal-rise 0.7s cubic-bezier(.22, .61, .36, 1) forwards;
}
.reveal .w:nth-child(2) { animation-delay: 0.15s; }
.reveal .w:nth-child(3) { animation-delay: 0.3s; }
@keyframes reveal-rise {
to {
clip-path: inset(0 0 0 0);
transform: none;
}
}
@media (prefers-reduced-motion: reduce) {
.reveal .w {
animation: none;
clip-path: none;
transform: none;
}
}
</style>RTL & Arabic notes: splitting at word level while keeping spaces never touches the joining inside a word; this is the only safe way to animate Arabic text in pieces.
Didn't find the motion you need? Request it from the Vellox team.