Modern Web Motion

Compositor-friendly animations, discrete top-layer transitions, view transitions, scroll-driven animations, and accessible reduced-motion controls.

1. Discrete Entry & Exit (allow-discrete & @starting-style)

Animate top-layer elements ([popover] and <dialog>) on and off screen using transition-behavior: allow-discrete, @starting-style, overlay, and clip-path.

Notification Popover

This popover animates opacity, translate, clip-path, display, and overlay.

Animated Dialog

Both the dialog and its ::backdrop smoothly transition into and out of the top layer.

2. Seamless Layout Changes (View Transitions)

Switch between grid and list layouts using document.startViewTransition() and individual transform properties.

Compositor First

Animates opacity and individual transforms.

Discrete States

Smoothly enters and exits the top layer.

Reduced Motion

Dampens heavy spin and movement when requested.

3. Scroll-Driven Progress & mask-image Fade

Scroll the container below to drive the progress bar on the compositor thread via animation-timeline: scroll().

1. Scroll-Driven Animations: Bind animation progress directly to a scroll container using scroll-timeline-name and animation-timeline without JavaScript scroll listeners.

2. Compositor Performance: Animating scale on the progress bar ensures the scroll indicator runs entirely on the compositor thread.

3. Soft Edge Masking: Using mask-image with a linear gradient softens the top and bottom edges as content scrolls underneath.

4. Timeline Scope: Lifting the timeline with timeline-scope: --box-scroll on the wrapper lets a sibling element track the scroller's progress.

5. Discrete Transitions: Combine transition-behavior: allow-discrete and @starting-style to animate elements to and from display: none.

6. Top Layer Overlay: Include overlay in the transition list so <dialog> and [popover] elements remain in the top layer until their exit transition completes.

7. End of Scroll Area: The progress indicator above reaches 100% when you reach this final item.

4. Accessible Persistent Motion & Pause Control

Persistent animations provide an explicit pause control and nest @media (prefers-reduced-motion: reduce) rules on a case-by-case basis instead of a global 0.01ms duration hack.