Generate sticker animation videos with alpha transparency using Remotion. Each sticker is 1-2 seconds on a transparent background. Multiple stickers are packed into a single output video via Sequence concatenation. Exports ProRes 4444 with alpha by default; green screen (#00FF00) H.264 available as fallback.
When the user asks to create sticker videos, follow this sequence:
references/sticker-catalog.md. Confirm with the user if the mapping is ambiguous.src/components/: animations.tsx, stickers.tsx, greenscreen.tsx, effects.tsx, aspect.tsx, and optionally audio.tsx.EmojiSticker, TextSticker, or ComboSticker with the chosen animation preset. with running cursor offsets (see references/packing-guide.md).```bash
npx remotion render src/index.ts StickerPack out/stickers.mov --codec=prores --prores-profile=4444
```
Or switch to green screen mode if the user needs H.264 compatibility (see references/greenscreen-guide.md).
references/render-quality.md before considering the output done."4 个贴纸:爱心弹跳、'SALE'弹出、星星旋转、'NEW'滑入"
"生成一个点赞的脉冲贴纸和'关注我'的弹跳文字"
"一个警告符号抖动 + '限时优惠'弹出,打包成方形视频"
The AI should parse these into concrete sticker specs:
1. ❤️ bounce → EmojiSticker emoji="❤️" animation="bounce" duration=55
2. SALE pop → TextSticker text="SALE" animation="pop" duration=45
3. ⭐ spin → EmojiSticker emoji="⭐" animation="spin" duration=45
4. NEW slideRight → TextSticker text="NEW" animation="slideInRight" duration=45
src/
├── index.ts # Entry: calls registerRoot(Root)
├── Root.tsx # Composition definition (StickerPack)
├── StickerPack.tsx # Master composition: Sequence layout, transparent background
└── components/
├── animations.tsx # Animation preset engine (13 presets)
├── stickers.tsx # EmojiSticker, TextSticker, ComboSticker
├── greenscreen.tsx # GreenScreenBackground, export profiles
├── effects.tsx # getSpringConfig, ProgressBar
├── aspect.tsx # STICKER_PROFILE, responsiveFont
└── audio.tsx # Optional: BackgroundMusic for audio stings
public/
└── audio/ # Optional: short audio sting files
Default specs for sticker video:
Two mutually exclusive export modes. Alpha channel is the default — stickers render on a transparent background and can be placed directly over any content without keying.
Omit GreenScreenBackground. The composition background is transparent. Export with an alpha-supporting codec:
# ProRes 4444 — best quality, Mac/Adobe workflow, large files
npx remotion render src/index.ts StickerPack out/stickers.mov --codec=prores --prores-profile=4444
# VP9 WebM — smaller file, web/browser/OBS overlays
npx remotion render src/index.ts StickerPack out/stickers.webm --codec=vp9
# PNG sequence — frame-by-frame with alpha, universal compatibility
npx remotion render src/index.ts StickerPack out/stickers/ --sequence --image-format=png
When the user's pipeline requires standard H.264 with chroma key. Render with GreenScreenBackground as the root layer:
npx remotion render src/index.ts StickerPack out/stickers.mp4 --crf 10
The exact #00FF00 background is keyed out in editing software. Use lower CRF (5-10) to preserve color accuracy through H.264 chroma subsampling.
See references/greenscreen-guide.md for detailed export guidance, keying settings, and codec comparison.
Copy assets/templates/animations.tsx into the project. It exports getAnimationValues(frame, fps, config) — a pure function returning React.CSSProperties. Available animation types:
| Preset | Visual | Good for |
|---|---|---|
| -------- | -------- | ---------- |
bounce | Y-axis drop with 3 diminishing bounces | Fun, energetic stickers |
pop | Scale 0→1 with strong overshoot | Sale badges, emphasis |
slideInLeft | Slide from left with spring | Directional reveals |
slideInRight | Slide from right with spring | Directional reveals |
slideInUp | Slide from bottom with spring | Rising reveals |
slideInDown | Slide from top with spring | Dropping reveals |
spin | Scale-up + 360° rotation | Celebration, loading |
pulse | Continuous sin-scale oscillation | Notifications, heartbeat |
scaleUp | Smooth scale 0→1, no overshoot | Clean reveals |
shake | X-axis shake with decay envelope | Urgency, alerts |
flip | rotateY 3D flip from 180°→0° | Reveals, duality |
swing | Pendulum swing from top pivot | Playful, casual |
fadeIn | Pure opacity spring fade | Subtle, professional |
Each preset accepts delay (frames) and intensity (0-1 multiplier).
Refer to references/sticker-catalog.md for detailed descriptions, timing guidance, and usage recommendations.
Copy assets/templates/stickers.tsx into src/components/. Three component types:
<EmojiSticker
emoji="❤️"
animation="bounce"
size={200} // font-size in px
delay={0} // frames before animation starts
intensity={1} // 0-1 animation strength
/>
<TextSticker
text="SALE"
animation="pop"
fontSize={80}
color="#FFFFFF"
fontFamily="Inter, system-ui, sans-serif"
fontWeight={700}
delay={0}
intensity={1}
/>
<ComboSticker
emoji="🎉"
text="恭喜"
emojiAnimation="bounce"
textAnimation="pop"
layout="top" // "top" | "bottom" | "left" | "right"
emojiSize={140}
textProps={{ fontSize: 64, color: "#FFD700" }}
delay={0}
/>
The master composition packs stickers using with a running cursor. Defaults to alpha mode:
import { AbsoluteFill, Sequence } from "remotion";
import { GreenScreenBackground } from "./components/greenscreen";
import { type StickerSlot } from "./components/stickers";
type Props = {
stickers: StickerSlot[];
greenScreen?: boolean; // set true only for green screen fallback
};
export const StickerPack: React.FC<Props> = ({ stickers, greenScreen = false }) => (
<AbsoluteFill style={{ backgroundColor: greenScreen ? undefined : "transparent" }}>
{greenScreen && <GreenScreenBackground />}
{stickers.reduce<{ cursor: number; elements: React.ReactNode[] }>(
(acc, sticker, i) => {
const from = acc.cursor;
acc.cursor += sticker.durationInFrames;
acc.elements.push(
<Sequence key={i} from={from} durationInFrames={sticker.durationInFrames}>
{sticker.component}
</Sequence>
);
return acc;
},
{ cursor: 0, elements: [] }
).elements}
</AbsoluteFill>
);
import { Composition } from "remotion";
import { StickerPack } from "./StickerPack";
import { EmojiSticker, TextSticker, type StickerSlot } from "./components/stickers";
const exampleStickers: StickerSlot[] = [
{ component: <EmojiSticker emoji="❤️" animation="bounce" />, durationInFrames: 55 },
{ component: <TextSticker text="SALE" animation="pop" fontSize={100} />, durationInFrames: 45 },
{ component: <EmojiSticker emoji="⭐" animation="spin" />, durationInFrames: 45 },
{ component: <TextSticker text="NEW" animation="slideInRight" />, durationInFrames: 45 },
];
const totalDuration = exampleStickers.reduce((sum, s) => sum + s.durationInFrames, 0);
export const RemotionRoot = () => (
<Composition
id="StickerPack"
component={StickerPack}
durationInFrames={totalDuration}
fps={30}
width={1080}
height={1080}
defaultProps={{ stickers: exampleStickers }}
/>
);
const getSpringConfig = (type: "entrance" | "snappy" | "smooth") => {
switch (type) {
case "entrance": return { damping: 20, stiffness: 120, mass: 1 };
case "snappy": return { damping: 18, stiffness: 140, mass: 1 };
case "smooth": return { damping: 22, stiffness: 100, mass: 1 };
default: return { damping: 20, stiffness: 120, mass: 1 };
}
};
bounce: 50-60 frames (needs time for bounce sequence)pop: 35-50 framesspin: 40-55 framespulse: 45-60 frames (needs oscillation cycles)scaleUp: 30-45 framesshake: 35-50 framesflip: 40-55 framesswing: 40-55 framesfadeIn: 30-45 framesUse getDefaultDuration(type) from animations.tsx for sensible defaults.
Since the default output has a transparent background, sticker content can use any color freely — no need to avoid green or worry about chroma key bleed. For text stickers, default to white (#FFFFFF) and use bold, saturated colors (yellow #FFD700, cyan #06B6D4, magenta #EC4899, orange #F97316) for emphasis.
When switching to green screen mode, avoid green (#00FF00) and near-green colors in sticker content to prevent them from being keyed out.
{
"@remotion/cli": "^4.0.0",
"@remotion/google-fonts": "^4.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remotion": "^4.0.0"
}
Note: @remotion/transitions and zod from the original skill are not needed for sticker generation.
# Alpha channel ProRes 4444 (default, recommended)
npx remotion render src/index.ts StickerPack out/stickers.mov --codec=prores --prores-profile=4444
# Alpha channel VP9 WebM (web overlays)
npx remotion render src/index.ts StickerPack out/stickers.webm --codec=vp9
# Alpha channel PNG sequence (universal)
npx remotion render src/index.ts StickerPack out/stickers/ --sequence --image-format=png
# Green screen H.264 (fallback — set greenScreen={true} in props)
npx remotion render src/index.ts StickerPack out/stickers.mp4 --crf 10
After rendering, run quality checks:
# Verify alpha plane exists (ProRes)
ffprobe -v quiet -show_streams out/stickers.mov | grep -i alpha
For preview during development:
npx remotion studio
AbsoluteFill background to "transparent".GreenScreenBackground at the StickerPack root so it persists across all Sequences.from offset is computed via a running cursor.Default strategy is Remotion (see Composition Wiring above). See references/packing-guide.md for alternative FFmpeg concat approach.
共 1 个版本