Morphiq

Components / Animations / Scroll Expand

Scroll Expand

A framed panel that opens to full bleed as you scroll past it. JS writes two custom properties and CSS does the rest, so children can join the animation without any wiring.

Model

p = clamp((scroll − start) / (travel·vh), 0, 1)

p is written to two CSS variables anything inside can read

Props

PropertyTypeDefaultDescription
mediaReactNode—Whatever sits inside the frame — an image, a video, a canvas.
widthnumber42Starting frame width, as a percentage of the viewport.
heightnumber58Starting frame height, as a percentage of the viewport.
radiusnumber24Corner radius at rest, in px.
endRadiusnumber0Corner radius once fully open, in px.
zoomnumber1.35Scale the media starts pushed in at.
scrimnumber0.45Peak darkening over the media, 0..1.
travelnumber1.2Scroll budget, as a multiple of the pinned panel's height.
holdnumber0.35Fraction of that budget spent held fully open.
smoothingnumber0.09Per-frame approach rate for the eased value.
easeScrollEase'inOut'Easing of the scroll progress: inOut (cubic), out or linear, or your own function from 0..1 to 0..1.
onProgress(progress: number) => void—Called with raw progress, 0..1, on every frame it changes.
childrenReactNode—Laid over the panel in the same pinned box, for a heading or caption. The layer lets the pointer through everywhere except on the content itself.