ScrollMask

Clip-path reveal scrubbed by scroll progress. The element starts hidden behind an inset clip and opens as you scroll past — five directions (left, right, top, bottom, center). Use it for image and video reveals where you want the viewer to "open" the media as they scroll.

Four tiles, four mask directions. The clip-path scrubs from from% to 0% with scroll progress.

center
left
right
top

Usage

import { ScrollMask } from '@bwo-ui/react';

<ScrollMask direction="center" from={50} scrub={0.5}>
  <img src="/hero.jpg" alt="" />
</ScrollMask>

<ScrollMask direction="left" from={40} scrub={true}>
  <video autoPlay loop muted src="/reel.mp4" />
</ScrollMask>

Props

PropTypeDefaultDescription
direction'left' | 'right' | 'top' | 'bottom' | 'center''center'Where the mask opens from.
triggerTargetScrollTrigger element. Defaults to the target itself. Useful when you want the mask scrub bound to a parent section.
startstring'top 80%'ScrollTrigger start value — when the scrub begins.
endstring'bottom 40%'ScrollTrigger end value — when the scrub is complete.
scrubboolean | number0.6Scrub lag. true = follow scroll instantly, a number = lag in seconds.
fromnumber50Initial inset percentage (0–50). 50 is fully closed (center direction), 0 fully open.
asElementType'div'HTML tag or component to render the wrapping element as.