A showcase of modern scroll-based animations using the CSS view-timeline
property, without any JavaScript!
This project demonstrates how to create engaging scroll animations using pure CSS with the modern view-timeline
property. Each section showcases a different animation technique that triggers as you scroll:
- Hero Section - Fade effects
- Split Section - Panels sliding from both sides
- Card Stack - Cards spreading out in a fan effect
- Text Motion - Text flowing across the screen from alternate sides
- Final Section - Gradient transition with fade effects
The CSS View Timeline feature allows you to create scroll-linked animations without JavaScript. It's part of the CSS Scroll-driven Animations specification.
view-timeline-name
: Names a timeline based on an element's position in the viewportview-timeline-axis
: Defines the axis (block/inline) for measuring the element's progressanimation-timeline
: Binds an animation to a view timelineanimation-range
: Defines when the animation starts and ends in relation to the view timeline
Each section creates its own timeline:
.section {
view-timeline-name: --section-timeline;
view-timeline-axis: block;
}
Elements are animated as the section moves through the viewport:
.animate-title {
animation: fade-up 1s linear forwards;
animation-timeline: --section-timeline;
animation-range: cover 50% cover 90%;
}
.split-half.left {
animation: slide-right 1s linear forwards;
animation-timeline: --section-timeline;
animation-range: entry 20% cover 40%;
}
.card {
animation: fan-out 1s linear forwards;
animation-timeline: --section-timeline;
animation-range: entry 20% cover 60%;
}
.text-line:nth-child(odd) {
animation-name: move-left-to-right;
animation-timeline: --section-timeline;
animation-range: entry 0% exit 100%;
}
The view-timeline
property is relatively new and is supported in:
- Chrome 115+
- Edge 115+
- Safari 16.4+
- Firefox 116+
For older browsers, you would need to use JavaScript alternatives like Intersection Observer.
To dive deeper into CSS view timelines:
- index.html - The structure with sections for each animation type
- styles.css - All the animation logic using view-timeline
- No JavaScript required!
Check out the full tutorial and demo on my YouTube channel: chunkydotdev
Feel free to fork this repository and experiment with your own scroll animations!
MIT License - Feel free to use and modify for your own projects.
Made with ❤️ by chunkydotdev