I built a smooth scroll reveal text animation using only CSS — no JavaScript, no GSAP, no Framer Motion.
✨ Core idea:
background-clip: text
linear-gradient
animation-timeline: view()
animation-range
The gradient width starts at 0% and expands to 100% as the element enters the viewport — creating a clean reveal effect.
✅ Pros:
• No JavaScript required
• Lightweight and clean
• Better performance (browser handles animation efficiently)
• Less dependency — no GSAP / Framer Motion needed
• Easy to maintain
⚡ Performance Note:
Since this is handled by the browser’s native CSS animation engine, it’s generally optimized and can leverage GPU acceleration better than heavy JS animation libraries.
❌ Cons:
• Limited browser support (scroll-timeline is still evolving)
• Less control compared to GSAP or advanced motion libraries
• Complex scroll interactions may still require JS
🎯 Best Use Cases:
• Landing pages
• Hero text animations
• Portfolio websites
• Modern UI highlights
Sometimes simple CSS is more than enough — you don’t always need a motion library for small interactions.
.text-scroll {
display: inline;
color: hsl(0deg 0% 100% / 58%);
opacity: 0.8;
background-clip: text;
-webkit-background-clip: text;
background-repeat: no-repeat;
background-size: 0% 100%;
background-image: linear-gradient(90deg, #fff, #fff);
animation: scroll-reveal 3.5s linear forwards;
animation-timeline: view(y);
animation-range-start: cover 10.5vh;
animation-range-end: cover 94.5vh;
transition: background-size 0.8s ease, opacity 0.2s ease;
}
@keyframes scroll-reveal {
to {
background-size: 100% 100%;
opacity: 1;
}
}
What’s your take — CSS-only animations or JS libraries? 👀
Top comments (0)