By Tim King · Updated
Scroll Animation CSS Previewer
Reveal Elements on Scroll with CSS
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Scroll Animation works
This scroll animation CSS previewer shows reveal effects as you scroll. Scroll inside the preview box and watch each section arrive as it comes into view. Pick the effect, how far it travels, how long it takes and how much of the element must be visible before it starts, then copy the code. You can have either a pure-CSS scroll-driven animation or a small IntersectionObserver script that adds a class once and leaves it alone.
Scroll animation CSS: reveal on scroll
There are two ways to animate things on scroll, and they feel different. Play once when
visible is the classic pattern: the element starts hidden, a script watches for it to enter the
viewport, and when enough of it is showing the script adds a class that transitions it to its
final state. The animation runs at its own speed once triggered and never runs again, which suits
content sections, cards and feature lists. The snippet uses IntersectionObserver, which is
cheap and does not fire on every scroll event, and it stops observing each element after it has
revealed so nothing keeps running in the background.
Scrub with scroll position ties the animation's progress directly to the scrollbar using
animation-timeline: view(). Scroll down a little and the element moves a little; scroll back up
and it reverses. There is no JavaScript at all, and because the browser drives it on the
compositor it stays smooth even on busy pages. The animation-range line says which part of the
element's journey through the viewport maps to the animation: entry 0% is the moment its top
edge appears at the bottom of the screen, and entry 100% is when the whole element has entered.
The trigger point slider shortens that range so the reveal finishes sooner. Support is still
growing, so the output includes a @supports guard that turns the animation off where the
timeline property is unknown, leaving elements plainly visible rather than stuck hidden.
The trigger point means slightly different things in each mode. For the observer it is the
threshold, the fraction of the element that must be on screen before it plays; 30% is a good
default because it fires while the element is still low on the page, so the motion is noticed.
For the scrubbed version it is the point of entry at which the animation reaches its end state.
Keep travel distances modest, around 20 to 60 pixels, and durations under a second. Large
movements on every section make a page feel slow to read. The once-only snippet also respects
prefers-reduced-motion by showing everything immediately for users who have asked for less
animation, and the scrubbed version can be wrapped in the same media query if you want the same
courtesy there.
FAQ
Which mode should I use?
Play once for content sections, cards and feature lists: it is predictable and works everywhere. Scrub for hero graphics and decorative elements where following the scrollbar is the point.
Does the scrub version work in Firefox?
Scroll-driven animations shipped in Firefox 144 and have been in Chrome and Edge since 115
and Safari since 26. Where the property is unknown, the @supports guard leaves the element
visible rather than hidden.
Why do elements near the top of the page never animate?
They are already in view when the page loads, so the observer fires immediately and the animation plays before anyone looks. That is usually fine; if not, exclude above-the-fold elements from the selector.
Can I animate several children with a stagger?
Yes. Add the trigger class to the parent and give each child a transition-delay based on
its position, or use --i and calc() as the
text animation generator does.
See also: all Shadows & Motion tools, Layout & Spacing, Shapes & SVG, UI Components, Forms & Inputs, Colour.
Related tools
Text Animation
Animate a headline letter by letter and copy the CSS.
Easing Comparison
Run two CSS easings side by side and copy the winner.
Keyframe Animator
Build and preview a CSS @keyframes animation from three stops.
CSS Transform Generator
Compose translate, rotate, scale and skew into one transform value.
Fade-In Generator
Generate a CSS fade-in animation with delay, easing and blur.