Inline Pill Takeover
Inline pill to CTA animation for Remotion: a pill inside a sentence expands, pushes the words apart and takes over the whole frame as a call to action, with no cut.
In Remotion, Inline Pill Takeover makes a pill shape inside a sentence expand, push the surrounding words apart and then take over the whole frame as a call to action, without cutting to a new title card. Use it to turn a line of copy into a CTA or an end card in one continuous move.
$ pnpm dlx shadcn@latest add @remocn/inline-pill-takeoverHow to build this in Remotion
You don't need measureText(), @remotion/shapes or a transition for this. Install the component and pass the sentence in three parts:
npx shadcn@latest add @remocn/inline-pill-takeoverThe pill opening, the words fading, the pill growing and the camera push are elements in timeline.ts, each driven by interpolate() over Easing curves. The words sit in a flex row on either side of the pill, so they move apart as it widens.
Good to know
- Length: 30 frames of motion at 30 fps (60 at 60 fps) with the default props; the demo plays 45 frames, which adds a hold. The takeover settles at frame 30: the pill opens over 12 frames, grows from frame 12, and the camera pushes and settles by 30. The demo holds the end for 15 more. The Usage example below is a 60 fps composition, so the numbers it hands to Remotion are doubled, see Frame rate.
- Installs:
remotionfrom npm, plus the remocn helpersglide,frame-rate,timeline. The shadcn CLI copies the source into your project. - Font: Geist Sans through the
--font-geist-sansCSS variable, with a system sans fallback, set inline; change it in the copied file. - Pill width does not fit the
inserttext: it opens topillWidth(260 px by default). TunepillWidthto your insert text. - The background is transparent; put your own scene behind it.
Usage
The line starts with a short pill between before and after. Its first animation changes explicit background width and height values, so the shape expands outward from center without scaling its contents. The full-size insert text appears through a hard opacity switch and is cropped by overflow: hidden until the pill opens around it. When that reveal finishes, a second local pill animation increases the background width and height through independent controls without changing the text's local font size. An independent camera wrapper begins its approach at the same time, cuts instantly to 86% of its final close-up, then settles to 100%. The pill and camera therefore move toward one another, and the pill keeps growing briefly after the camera settles. All timings were measured frame-by-frame from the reference footage.
// src/Root.tsx
import { Composition } from "remotion";
import { InlinePillTakeover } from "@/components/remocn/inline-pill-takeover";
const InlinePillTakeoverScene = () => (
<InlinePillTakeover
before="powering 20%"
insert="Start building"
after="of the Internet."
/>
);
export const RemotionRoot = () => (
<Composition
id="InlinePillTakeover"
component={InlinePillTakeoverScene}
durationInFrames={90}
fps={60}
width={1280}
height={720}
/>
);With Backdrop
The component paints no background. The reference pairs warm white type and pill with an orange radial glow.
import { Composition } from "remotion";
import { InlinePillTakeover } from "@/components/remocn/inline-pill-takeover";
import { Backdrop } from "@/components/remocn/backdrop";
const InlinePillTakeoverScene = () => (
<Backdrop
fill={{
type: "gradient",
value:
"radial-gradient(circle at 50% 108%, #ffd77a 0%, #ff6840 31%, #f13d21 78%)",
}}
>
<InlinePillTakeover
before="powering 20%"
insert="Start building"
after="of the Internet."
/>
</Backdrop>
);
export const RemotionRoot = () => (
<Composition
id="InlinePillTakeover"
component={InlinePillTakeoverScene}
durationInFrames={90}
fps={60}
width={1280}
height={720}
/>
);Props21
| Prop | Type | Default |
|---|---|---|
| beforerequired | string— Text rendered before the expanding pill | |
| insertrequired | string— Text centered inside the pill and revealed through its clip | |
| afterrequired | string— Text rendered after the expanding pill | |
| fontSize | number52 Base font size in pixels | |
| fontWeight | number400 CSS font-weight shared by the sentence and pill | |
| pillWidth | number260 Expanded pill width in pixels; tune this when changing insert text | |
| expandFrames | number12 Frames used for the initial width-and-height reveal | |
| pillRevealHeightScale | number0.35 Starting height as a fraction of the full pill height | |
| pillGrowAt | number12 Frame on which the local width-and-height growth begins | |
| pillGrowFrames | number24 Frames used for the local width-and-height growth | |
| pillGrowWidthScale | number1.08 Final local scale applied only to the pill width | |
| pillGrowHeightScale | number1.16 Final local scale applied only to the pill height | |
| outerExitFrames | number18 Frames used to blur and remove the outer copy | |
| takeoverAt | number12 Frame on which the camera approach begins | |
| takeoverScale | number2.15 Final scale held after the takeover settles | |
| blur | number12 Maximum blur applied to the disappearing outer text in pixels | |
| color | string"#fff3df" Outer text color | |
| pillColor | string"#fffaf0" Pill background color | |
| pillTextColor | string"#1c1210" Pill text color | |
| speed | number1 Playback speed multiplier | |
| className | string— Optional className passed to the component root | |
- beforerequiredstring
Text rendered before the expanding pill
- insertrequiredstring
Text centered inside the pill and revealed through its clip
- afterrequiredstring
Text rendered after the expanding pill
- fontSizenumber
Base font size in pixels
Default
52 - fontWeightnumber
CSS font-weight shared by the sentence and pill
Default
400 - pillWidthnumber
Expanded pill width in pixels; tune this when changing insert text
Default
260 - expandFramesnumber
Frames used for the initial width-and-height reveal
Default
12 - pillRevealHeightScalenumber
Starting height as a fraction of the full pill height
Default
0.35 - pillGrowAtnumber
Frame on which the local width-and-height growth begins
Default
12 - pillGrowFramesnumber
Frames used for the local width-and-height growth
Default
24 - pillGrowWidthScalenumber
Final local scale applied only to the pill width
Default
1.08 - pillGrowHeightScalenumber
Final local scale applied only to the pill height
Default
1.16 - outerExitFramesnumber
Frames used to blur and remove the outer copy
Default
18 - takeoverAtnumber
Frame on which the camera approach begins
Default
12 - takeoverScalenumber
Final scale held after the takeover settles
Default
2.15 - blurnumber
Maximum blur applied to the disappearing outer text in pixels
Default
12 - colorstring
Outer text color
Default
"#fff3df" - pillColorstring
Pill background color
Default
"#fffaf0" - pillTextColorstring
Pill text color
Default
"#1c1210" - speednumber
Playback speed multiplier
Default
1 - classNamestring
Optional className passed to the component root
Common questions
How do I make a pill inside a sentence expand and take over the frame in Remotion?
Install Inline Pill Takeover with npx shadcn@latest add @remocn/inline-pill-takeover and pass before, insert and after. The pill opens, the words move apart and fade, and the pill fills the frame.
Does the pill size itself to the text?
No. Set pillWidth so the insert text fits.
Related effects
- Inline Highlight: only one phrase changes color, with no layout change.
- Caret Swap: a caret swells into a block and types a new phrase.
- Zoom Words: huge words appear one at a time as the camera follows.
- Phrase List Bridge: a phrase splits open around a floating list.