Crumpled Paper Reveal
An image that begins as a tight, faceted paper wad and unfolds into a flat print with its creases intact. Hover, click, scroll, or enter the viewport to reveal; the whole surface is procedural WebGL2 with a CSS print fallback.
Installation#
pnpm dlx shadcn@latest add @davinciui/crumpled-paper-revealUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
imageImage source. A string or an image object; the texture is uploaded with crossOrigin anonymous. | string | { src?: string; srcSet?: string; alt?: string; sizes?: string } | — |
altAccessible name for the reveal surface. Falls back to a generic label when empty. | string | "" |
triggerHow the sheet unfolds. Scroll maps progress to the viewport instead of playing a fixed animation. | "hover" | "click" | "inView" | "scroll" | "hover" |
replayCollapse again when the component leaves the viewport. | boolean | false |
durationReveal duration in seconds; collapse runs at 60% of it. | number | 1 |
easingSpring character. Springy adds the billow, overshoot, and settle. | "Smooth" | "Snappy" | "Springy" | "Springy" |
shapeSilhouette of the collapsed wad. | "Sphere" | "Tight Wad" | "Loose Wad" | "Egg" | "Pebble" | "Pillow" | "Cube" | "Shard" | "Cone" | "Disc" | "Twist" | "Burst" | "Tight Wad" |
aspectSheet aspect; the image is cover-fit and focal-pointed. | "1:1" | "4:5" | "3:4" | "4:3" | "3:2" | "16:9" | "4:5" |
focalXHorizontal focal point of the cover fit, 0–100. | number | 50 |
focalYVertical focal point of the cover fit, 0–100. | number | 50 |
paperColorUnprinted paper color around the image and on the reverse. | string | "#F4EFE4" |
backColorShaded reverse-side paper color. | string | "#EFE8D8" |
marginBaked print margin in pixels, up to 80. | number | 0 |
radiusCorner radius in pixels, up to 48. | number | 0 |
finishPaper specular response used by the pointer light. | "matte" | "satin" | "gloss" | "matte" |
creaseDepthStrength of the baked crease lines and facet shading. | number | 0.5 |
ballSizeCollapsed wad size relative to the sheet. | number | 0.45 |
shadowContact shadow opacity around the wad and print. | number | 0.5 |
curlCorner curl on the settled print. | number | 0.3 |
pointerLightFollow the pointer with a paper highlight and curl lift. | boolean | true |
linkOptional destination. The first activation reveals, the next opens the link. | string | { href?: string; target?: string } | — |
autoPlayIntervalCycle the reveal automatically every N milliseconds. Used by galleries; disabled for reduced motion. | number | 0 |
previewModeDecorative gallery mode: the overlay is inert, unfocusable, and hidden from assistive technology. | boolean | false |
classNameAdditional classes applied to the root wrapper. | string | — |
Accessibility#
The interactive sheet is a labelled role img with tabIndex 0, and Enter or Space toggles the reveal; the canvas and flat fallback are aria-hidden. When a link is supplied the overlay is a real anchor whose label is the alt text. previewMode removes the overlay from the tab order and pointer events, and reduced motion renders the finished print instead of animating.
Motion#
A hand-integrated spring with a time warp and settle blend drives the unfold, while eased out-of-plane billow and corner curl add paper memory; duration, easing, shape, creaseDepth, ballSize, shadow, and curl tune it. Pointer light eases toward the cursor. prefers-reduced-motion skips the RAF work and renders the finished sheet; autoPlayInterval also disables.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

