Clip Reveal
`<pura-clip-reveal>` reveals its slotted content with an animating `clip-path` wipe, the awwwards image-wipe done natively. `direction="up"|"down"|"left"|"right"` slides an `inset()` open from one edge; `direction="circle"` irises a `circle()` out from the center. Both forms interpolate natively, so the default `trigger="scrub"` ties the wipe 1:1 to a scroll-driven timeline (`animation-timeline: view()` or `scroll()`) with no per-frame JS. `trigger="view"` wipes open once when scrolled into view (eased by the spring primitive); `trigger="load"` wipes open once on connect. SSR and reduced motion are safe: before JS the content sits fully revealed (the hide only engages once a trigger applies), the scrub block is gated behind `prefers-reduced-motion: no-preference`, and reduced motion shows the content revealed. Each instance registers in `window.__puraClipReveals` by `data-pura-id` with `{ direction, replay }`.
Preview
<!-- default: wipes open bottom-to-top as you scroll -->
<pura-clip-reveal>
<img src="/hero.jpg" alt="" style="display:block;width:100%" />
</pura-clip-reveal>
<!-- iris out from the center, once on view -->
<pura-clip-reveal direction="circle" trigger="view" preset="snappy">
<div class="card">Surprise</div>
</pura-clip-reveal>
<!-- left-to-right wipe scrubbed against the page scroll -->
<pura-clip-reveal direction="right" timeline="scroll" range="cover 0% cover 100%">
<h2>Headline</h2>
</pura-clip-reveal> Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
direction | "up" | "down" | "left" | "right" | "circle" | up | Which way the wipe opens. up reveals bottom-to-top edge first; circle irises out from the center. |
trigger | "scrub" | "view" | "load" | scrub | scrub ties the wipe 1:1 to a scroll-driven timeline; view wipes once when scrolled into view; load wipes once on connect. |
timeline | "view" | "scroll" | view | Scrub only. view maps the element's own view progress; scroll maps the nearest scroll container. |
range | string | cover 0% cover 50% | animation-range for the scrub timeline. Default completes the wipe as the element reaches viewport center, then holds. |
preset | "default" | "gentle" | "wobbly" | "stiff" | "slow" | "snappy" | default | Spring easing for view/load triggers. Or set stiffness/damping/mass directly. |
Installation
pura is copy-paste and dependency-free. Load the whole library, or just this component.
<link rel="stylesheet" href="/pura/tokens.css">
<script type="module" src="/pura/lib/clip-reveal.js"></script> import "./pura/lib/clip-reveal.js";