Selection Snap
A single word snaps into a design-tool selection box with handles, like a layer in Figma: it starts thin in a loose frame, gets bolder from Thin to Black, pops its resize handles and counts up a size badge. A free, MIT-licensed Remotion text animation.
In Remotion, Selection Snap makes a single word look like it is being designed: it starts thin in a loose frame, snaps into a selection box with handles, gets bolder and a W × H size badge counts up. Use it for a design tool, component library or typography feature beat.
$ pnpm dlx shadcn@latest add @remocn/selection-snapHow to animate a word snapping into a design selection box in Remotion
A word that starts thin inside loose corner brackets, snaps into a selection box with resize handles, turns bold and shows a counting size number is one component. You don't need fitText from @remotion/layout-utils or your own count-up interpolate(). Install it and pass your word:
npx shadcn@latest add @remocn/selection-snap- The frame snaps tight with a small overshoot while the weight runs from
fromWeighttotoWeight(Thin to Black by default) and the color turns toaccent. - The bracket arms close into a one-pixel box in
selectionColor, the eight handles pop in corners first, and thebadgecounts up to the box size. - The badge reads
W × H, the snapped box size in reference px at 720p, and counts up from 0 to it. Its text and target are not props;badge={false}hides it. Handles are white squares with aselectionColorborder; their size and fill are not props either, so edit the copied file to restyle them. - Snap timing: besides
speed, thetimingprop moves or stretches thesnap,weight,edges,tint,badge,countandhandle:0tohandle:7elements one by one, for exampletiming={{ snap: { stretch: 1.5 } }}. - The weight glides because Inter is a variable font and the component drives
font-variation-settings; with a static font it steps through the weights you load. - It paints no background and centers the word in its parent. One short word reads best.
If the word should enter with physical motion instead, use Stretch In.
Good to know
- Length: 38 frames of motion at 30 fps (76 at 60 fps) with the default props. That is the minimum for its
Sequence; add your own hold on top. The Usage example below is a 60 fps composition with a hold, so itsdurationInFramesis longer than twice the motion. The component's own props counted in frames stay in 30 fps frames at any frame rate, see Frame rate. - Installs:
remotion,@remotion/google-fontsfrom npm, plus the remocn helpersglide,frame-rate,timeline. The shadcn CLI copies the source into your project; nothing else is needed at runtime. - Font: loads Inter (variable) itself through
@remotion/google-fonts. PassfontFamilyto use your own face, and load that font in your project.
Usage
// 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={150}
fps={60}
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.
Props11
| 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 | |
| timing | Timing<"intro" | "snap" | "weight" | "edges" | "tint" | "badge" | "count" | `handle:${number}`>— Moves, trims or stretches the fade in, the snap, the weight change, the box edges, the color, each of the eight handles, the badge and its count-up, in 30 fps frames. | |
- 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
- timingTiming<"intro" | "snap" | "weight" | "edges" | "tint" | "badge" | "count" | `handle:${number}`>
Moves, trims or stretches the fade in, the snap, the weight change, the box edges, the color, each of the eight handles, the badge and its count-up, in 30 fps frames.