文字与标题
轮换关键词
句子里有一个词不断轮换:词槽向上滚过候选词,停在最后一个,换上强调色和下划线,词槽宽度随每个词平滑变化。
安装
npx @imgcli/cli add slot-in使用
import { SlotIn } from "@/components/imgcli/slot-in";
<SlotIn />默认参数下以 30 fps 渲染 117 帧(3.9 秒),预览画布为 960 × 540。
Use <SlotIn before="Launch videos for" words={["founders", "designers", "your team"]} /> for slotInSeconds(words.length) seconds at 30 fps (117 frames for four words). hold sets how long each word stays.
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
before | string | "Launch videos for" | |
words | readonly string[] | ["founders", "designers", "agencies", "your team"] | Rolled through in order; the last one stays. |
after | string | "" | |
hold | number | 0.55 | Seconds each word holds before the next rolls in. |
fontSize | number | 64 | Type size in pixels on a 540px-tall canvas. |
fontWeight | number | 600 | |
fontFamily | string | — | A face from the Imgcli font list, or any loaded CSS font stack. |
accentColor | string | — | |
theme | Partial<ImgcliTheme> | — | |
mode | "light" | "dark" | — | |
speed | number | 1 |
许可
MIT 许可,可免费用于个人及商业项目,保留版权和许可声明。
Copyright (c) 2026 Ricky (Imgcli) <https://imgcli.com>
常见问题
如何在 Remotion 项目中使用轮换关键词?
运行 npx @imgcli/cli add slot-in。CLI 会把组件源码复制到项目的 components/imgcli/ 目录并安装依赖,之后可以直接修改源码。
轮换关键词能做什么?
句子里有一个词不断轮换:词槽向上滚过候选词,停在最后一个,换上强调色和下划线,词槽宽度随每个词平滑变化。
使用轮换关键词前需要准备什么?
准备 Node.js 20.19 或更高版本,以及一个 Remotion 项目。新项目可以用 npx create-video@latest 创建。免费组件采用 MIT 许可证。