Selection Snap
A thin word in a loose viewfinder snaps into a design-tool selection while it goes from Thin to Black, pops its handles and counts up a size badge
$ pnpm dlx shadcn@latest add @remocn/selection-snapUsage
// src/Root.tsx
import { AbsoluteFill, Composition } from "remotion";
import { SelectionSnap } from "@/components/remocn/selection-snap";
const Title = () => (
<AbsoluteFill style={{ backgroundColor: "#0a0a0a" }}>
<SelectionSnap text="Frame" accent="#ff4d1a" selectionColor="#3d5afe" />
</AbsoluteFill>
);
export const RemotionRoot = () => (
<Composition
id="SelectionSnap"
component={Title}
durationInFrames={75}
fps={30}
width={1280}
height={720}
/>
);The word starts at fromWeight inside four corner brackets. Around frame 14
the frame snaps tight with a small overshoot while the weight runs to
toWeight and the color turns to accent. The bracket arms grow along the
edges until they close into a one-pixel box, the eight handles pop in corners
first, and the badge counts up to the snapped box size in reference px.
The weight is continuous because Inter from @remotion/google-fonts is one
variable file: the component drives font-variation-settings. The box is a
wrapper around the text, so it follows the word as it widens. With a static
fontFamily the weight steps through the faces you load instead of gliding.
The component paints no background and centers the word in its parent. Sizes
are reference px at a 720px-tall composition and scale with height / 720.
Props10
| Prop | Type | Default |
|---|---|---|
| text | string"Frame" The word inside the selection. One short word reads best | |
| fontSize | number150 Font size in reference px at 720p | |
| fontFamily | stringInter Font family. Use a variable font for a continuous weight change | |
| fromWeight / toWeight | number100 / 900 Weight before and after the snap | |
| color | string"#fafafa" Text color before the snap | |
| accent | string"#D97757" Text color after the snap | |
| selectionColor | string"#0d99ff" Brackets, box, handle borders and badge | |
| badge | booleantrue Show the W × H badge under the box | |
| speed | number1 Timeline speed multiplier | |
| className | string— Optional className passed to the wrapper | |
- textstring
The word inside the selection. One short word reads best
Default
"Frame" - fontSizenumber
Font size in reference px at 720p
Default
150 - fontFamilystring
Font family. Use a variable font for a continuous weight change
Default
Inter - fromWeight / toWeightnumber
Weight before and after the snap
Default
100 / 900 - colorstring
Text color before the snap
Default
"#fafafa" - accentstring
Text color after the snap
Default
"#D97757" - selectionColorstring
Brackets, box, handle borders and badge
Default
"#0d99ff" - badgeboolean
Show the W × H badge under the box
Default
true - speednumber
Timeline speed multiplier
Default
1 - classNamestring
Optional className passed to the wrapper