Guide

Reveal

What @samline/reveal does, which elements it hides and when, and how effects, cascades, repeat and scrub fit together.

@samline/reveal reveals elements as they scroll into view. Mark them with data-reveal, load the stylesheet and call autoReveal() (or load the CDN script). The script only decides when; the stylesheet does the animation.

What is hidden, and when

Element on loadWithout repeatWith repeat
In viewShown, never hiddenShown, hidden after it leaves
Below the foldHidden, revealed on entryHidden, revealed on every entry
Above the viewportShownHidden, revealed on the way back
No box (display: none)ShownShown

Without JavaScript, without IntersectionObserver, with prefers-reduced-motion: reduce or when printing, every element is visible.

Pieces

JobHow
Pick effectsdata-reveal="up" (default), down, left, right, fade, zoom, blur, rotate, wipe-up, wipe-down, wipe-left or wipe-right, combined with spaces (up blur)
Time one elementdata-reveal-duration, data-reveal-delay, data-reveal-distance, data-reveal-easing
Cascade a groupdata-reveal-stagger="80" on the container, with -from, -grid, -ease and -max for patterns
Split textdata-reveal-split="words" or "chars"
Play every timedata-reveal-repeat
Follow the scrolldata-reveal-scrub (CSS only)
Theme everything--reveal-duration, --reveal-easing and the other CSS variables

Choose your next step