So many ranges, so little time: A cheatsheet of animation-ranges for your next scroll-driven animation
CSS `animation-range` controls exactly when a `view()`-timeline scroll-driven animation starts and stops relative to an element's position in the viewport. The six timeline-range-name values are cover, contain, entry, entry-crossing, exit and exit-crossing, each illustrated with a sliding-image example. The crossing variants differ from entry and exit mainly when the element is taller than the viewport. Range names can be combined as start/end pairs (e.g. `contain exit`) and offset with length-percentage values; when omitted, the defaults are entry 0% to exit 100%.
Related posts
- A guide to Scroll-driven Animations with just CSS
WebKit mediumAdeptCSS scroll-driven animations, now supported in Safari 26 beta, tie keyframe animations to scroll position instead of time using the animation-timeline property, with no JavaScript required. A scroll-driven animation combines a target, keyframes and a timeline: scroll() advances with the scroller's position (shown with a footer progress bar), while view() advances as an element moves through the viewport (shown with images sliding in). animation-range limits when along the timeline the animation runs, for example 0% 50% so images settle halfway up the viewport. Note that animation-timeline must be declared after the animation shorthand, and larger motion effects should be wrapped in a prefers-reduced-motion media query.
- Two lines of Cross-Document View Transitions code you can use on every website today
WebKit mediumAdeptAdding `@view-transition { navigation: auto; }` to a site's CSS enables cross-document View Transitions, so elements shared between pages stay fixed and everything else crossfades instead of flashing blank between navigations. A simple crossfade doesn't introduce motion and generally needn't be disabled under `prefers-reduced-motion`. Support covers Safari 18.2, Chrome 126 and Edge 126 (about 85% of users), and unsupported browsers simply ignore the rule, making it a safe progressive enhancement.
- Release Notes for Safari Technology Preview 234
WebKit easyNoviceSafari Technology Preview 234 adds Threaded Scroll-driven Animations, which update opacity, transform, filter and Motion Path animations off the main thread as scrolling happens, for smoother results on ProMotion displays. New CSS layout features include `display: grid-lanes`, an automatic `grid-auto-flow` initial value and `item-tolerance` for masonry. Web API additions cover ReadableStream async iteration, readable byte streams as fetch bodies, the Keyboard Lock API, scoped custom element registries, the WebAuthn PRF extension, and multi-microphone getUserMedia capture. Fixes span table and grid layout, MathML, SVG parsing, Media Source Extensions, Intl and Web Inspector.
- Building Custom Animations in the Workflow Builder
Slack Engineering mediumAdeptSlack's Workflow Builder added drag-and-drop from a new steps sidebar into workflows by moving react-beautiful-dnd's DragDropContext to wrap the whole builder page, with two draggable/droppable lists. A custom context provider holds drag state fed by the library's responders. On top of that the team built several workarounds: custom transforms to re-center differently sized steps, DOM-measured dynamic placeholders the library doesn't support, and a velocity-based tilt effect driven by requestAnimationFrame. A key lesson was hiding hint boxes in onBeforeCapture rather than onBeforeDragStart, because only the former runs before the library measures the DOM.
- Making Your React Native Gestures Feel Natural
Shopify Engineering mediumAdeptDraggable UI in React Native feels more natural when gesture end-handling accounts for release velocity, not just finger position. Using the Shop app's bottom Sheet as an example, adding a multiplied `velocityY` to the final position lets quick flicks open or close the sheet. Replacing a fixed 600 ms timing animation with `withSpring` makes the settle animation respect distance and momentum. Dividing drag distance when pulling past the open position adds rubber-band resistance that signals the sheet can't go further.