Skip to content

Scroll Reveal

Content that moves from an offset into place while it scrolls into view.

$npx shadcn@latest add https://framebrick.co/r/scroll-reveal.json

From the Nitip template, see it in context.

1. Tied to scroll

Progress runs from the bottom of the viewport to the top of the block.

2. Reversible

Scroll back up and it plays backwards — no snapping, no easing.

Examples

First pixel, another spring

Springs into place once as soon as any of it shows, on Semono's spring (200 / 30 / 1) from 40 px lower.

Starts at the first pixel

amount={0}: it springs as soon as any of it shows, once.

On Semono's spring

spring 200 / 30 / 1, from 40px lower — the Semono reveal.

<ScrollReveal trigger="enter" amount={0} spring={{ stiffness: 200, damping: 30, mass: 1 }} from={{ y: 40, opacity: 0.001 }}>
  <Card />
</ScrollReveal>

Installation

$ npx shadcn@latest add https://framebrick.co/r/scroll-reveal.json

Usage

import { ScrollReveal } from "@/components/ui/scroll-reveal";

<ScrollReveal from={{ y: 60, opacity: 0 }}>
  <h2>Everything we make, in one place</h2>
</ScrollReveal>

Props

PropTypeDefaultDescription
childrenReactNode—What moves into place.
from{ x?, y?, scale?, opacity? }{ y: 60, opacity: 0 }Where it starts: pixels for x/y, a factor for scale, 0–1 for opacity.
trigger"scroll" | "enter""scroll""scroll" follows the scroll position; "enter" springs into place once, the first time half of it is in view.
delaynumber0.05Seconds before the spring starts, for "enter".
amountnumber0.5For "enter": how much of it must be in view before it starts, from 0 (its first pixel) to 1 (all of it).
spring{ stiffness?, damping?, mass? }{ 320, 55, 1 }For "enter": the spring. Titen's by default; Semono's is { stiffness: 200, damping: 30, mass: 1 }.
classNamestring—Classes for the frame, which never moves.
  • Tied directly to scroll, not to a timer: progress is 0 when the block's top reaches the bottom of the viewport and 1 when its bottom does, so scrolling back up plays it backwards.
  • With trigger="enter" it springs once instead (Titen: stiffness 320, damping 55, mass 1). The threshold is half the block, or half the screen for a block taller than the screen — Motion's `amount: 0.5` alone never fires for anything over twice the viewport. `amount` moves that share (the same rule holds for any share, and 1 means 99%, so a block that is a subpixel short of the screen's edge still fires) and `spring` sets the three numbers. Titen's spring is at rest in about 1 s; Semono starts at the first pixel (amount 0) or at half, on stiffness 200, damping 30, at rest in about 0.75 s — 320 / 55 is the more heavily damped of the two.
  • Static with reduced motion.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS component called ScrollReveal (no animation library).
- A frame that never moves, holding the content. The content starts at a given offset ({x, y, scale, opacity})
  and reaches its resting state as the block scrolls into view.
- In a passive scroll listener: progress = (innerHeight - rect.top) / rect.height, clamped 0–1, left = 1 - progress;
  write transform = translate3d(x*left, y*left, 0) scale(1 + (scale-1)*left) and opacity = 1 + (opacity-1)*left
  straight to the element's style. Linear, no easing, reversible.
- Re-measure on resize with a ResizeObserver on document.body (images load late).
- Render the starting transform inline so there is no flash before the first scroll event.
- Skip everything when prefers-reduced-motion is set.
- trigger "enter" instead springs the content into place once, with Motion's animate() driving the same transform and opacity
  from 0 to 1 progress (stiffness 320, damping 55, mass 1 by default), after `delay` seconds, the first time an
  IntersectionObserver reports the frame. Its threshold is share = amount (default 0.5, clamped to 0–0.99, because a ratio
  of exactly 1 is never reported when the block is a subpixel short of the edge), or
  share × innerHeight / height for a frame taller than the screen, so a tall block still fires. A `spring` prop overrides
  stiffness, damping and mass; amount 0 starts at the first pixel.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy