Pop
Spring entrances for Remotion: Pop slides or scales one block in, Stagger cascades a list, and Leave fades a block out.
Loading preview…
Install
npx shadcn@latest add @jbm/popNeeds the @jbm entry in components.json; see Install once.
Also installs @jbm/motion-hooks.
Needs Remotion: render inside a Remotion <Composition> or <Player>, not a plain React tree. Timing values are in seconds.
Usage
import { Stagger } from "@/jbm/motion/pop"import { Chip } from "@/jbm/ui/chip" // install @jbm/chip separately<Stagger at={0.2} step={0.35}> {["Idea", "Datos"].map(text => <Chip key={text}>{text}</Chip>)}</Stagger>import { Pop, Leave } from "@/jbm/motion/pop"<Leave at={3}> <Pop at={0.4} from="left" dist={60}> <h2>Primero esto.</h2> </Pop></Leave>// Render inside a Remotion <Composition> or <Player>.API
- Stage
fluidEach wrapper is a plain block div sized by its children; Pop, Stagger, and Leave add no box of their own. Translations and scale do not change layout size, so reserve room for
disttravel near the safe-area edge.
Popcomponent
Wraps children in a div whose opacity follows a useIn spring from at, while it translates in from one side by dist or scales from 0.6 to 1.
| Prop | Type | Default | Description |
|---|---|---|---|
at | number | required | Entrance start in seconds relative to the enclosing Sequence. |
children | React.ReactNode | required | Content to reveal. |
style | React.CSSProperties | none | Inline styles merged onto the wrapper (after opacity and transform, so a transform here replaces the motion). |
from | "up" | "down" | "left" | "right" | "scale" | "up" | Entrance direction: up rises from below, down drops from above, left/right slide in from that side, scale grows from 0.6×. |
dist | number | 40 | Travel distance in stage pixels for the directional entrances; ignored by scale. |
Staggercomponent
Wraps each child in a Pop; child i enters at at + i × step seconds.
| Prop | Type | Default | Description |
|---|---|---|---|
at | number | required | Start of the first child, in seconds relative to the enclosing Sequence. |
step | number | 0.3 | Seconds between consecutive children. |
from | "up" | "down" | "left" | "right" | "scale" | "up" | Entrance direction applied to every child (see Pop). |
dist | number | 14 | Travel distance in stage pixels for every child. |
children | React.ReactNode[] | required | Array of children to cascade; each becomes its own Pop wrapper. |
Leavecomponent
Exit: from at, the wrapper fades out with cubic-out easing and drifts up by dist over 0.4 s, keeping its layout space.
| Prop | Type | Default | Description |
|---|---|---|---|
at | number | required | Exit start in seconds relative to the enclosing Sequence. |
children | React.ReactNode | required | Content that leaves. |
style | React.CSSProperties | none | Inline styles merged onto the wrapper (after opacity and transform). |
dist | number | 30 | Upward drift in stage pixels at the end of the exit. |
QA checks
- Step through the first frame (children invisible), mid-cascade (earlier children settled, later ones entering), and the last frame (all fully opaque at rest).
- Try each
fromvalue: directional entrances move bydistand settle at 0 offset;scalegrows without translating. - Check the spring overshoot does not push content past the safe area, especially with large
distvalues in vertical. - For Leave, confirm the block is fully transparent 0.4 s after
atand its layout space remains.