图表与数据
数字增长
一个数字讲完整个故事:数值以等宽数字向上计数、宽度不跳动,旁边出现涨幅标签,下方画出趋势小图。
安装
npx @imgcli/cli add number-up使用
import { NumberUp } from "@/components/imgcli/number-up";
<NumberUp />默认参数下以 30 fps 渲染 114 帧(3.8 秒),预览画布为 960 × 540。
Use <NumberUp label="Videos rendered this month" value={12480} delta="+212%" trend={[12, 18, 40, 61]} /> for 114 frames at 30 fps (NUMBER_UP_SECONDS). prefix, suffix and decimals format it.
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
label | string | "Videos rendered this month" | |
value | number | 12480 | |
prefix | string | "" | |
suffix | string | "" | |
decimals | number | 0 | Decimal places shown while counting and at rest. |
delta | string | "+212%" | |
trend | readonly number[] | [12, 14, 13, 18, 22, 21, 27, 33, 31, 40, 48, 61] | Points for the sparkline under the number, oldest first. Empty for none. |
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 number-up。CLI 会把组件源码复制到项目的 components/imgcli/ 目录并安装依赖,之后可以直接修改源码。
数字增长能做什么?
一个数字讲完整个故事:数值以等宽数字向上计数、宽度不跳动,旁边出现涨幅标签,下方画出趋势小图。
使用数字增长前需要准备什么?
准备 Node.js 20.19 或更高版本,以及一个 Remotion 项目。新项目可以用 npx create-video@latest 创建。免费组件采用 MIT 许可证。