Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

3.4 KB
Raw Blame
---
title: Number Wheel
description: Odometer that rolls a number from one value to another with direction inferred from the values
component: number-wheel
vibe: data
length: 112
useWhen:
  - "A metric, stat, or count should animate to its value in a satisfying odometer roll."
  - "A data-driven scene needs a number to tick up (or down) to convey growth, reduction, or change."
  - "Dashboard-style video content requires a numeric reveal with clear direction and mechanical rhythm."
avoidWhen:
  - "The value is not an integer — this component is designed for whole numbers; format decimals upstream before passing them in."
  - "The number should appear all at once without rolling — use `micro-scale-fade` for a static entrance of a pre-formatted number string."
  - "The scene requires text alongside the number to animate together — compose `NumberWheel` with a static text node in a flex container rather than embedding units in the `to` value."
  - "The value carries a prefix or suffix like `$99` or `1.2M` — use `slot-machine-roll` (accepts arbitrary strings); for very large multi-digit metrics counting up, `rolling-number` is purpose-tuned."
askedAs:
  - "odometer number"
  - "I want a number rolling from one value to another"
  - "metric or stat animating to its final value"
  - "data scene with a satisfying rolling counter"
  - "rolling digits"
  - "odometer roll stat"
---

<ComponentPreview name="number-wheel" />

<InstallBlock name="number-wheel" />

## Usage

```tsx
// src/Root.tsx
import { Composition } from "remotion";
import { NumberWheel } from "@/components/remocn/number-wheel";

const NumberWheelScene = () => (
  <NumberWheel from={0} to={24813} fontSize={120} />
);

export const RemotionRoot = () => (
  <Composition
    id="NumberWheel"
    component={NumberWheelScene}
    durationInFrames={112}
    fps={30}
    width={1280}
    height={720}
  />
);
```

<PropsTable title="Props"
  rows={[
    {
      name: "from",
      type: "number",
      default: "0",
      description: "Starting value. Direction is inferred from whether to is greater or less than from.",
    },
    {
      name: "to",
      type: "number",
      default: "24813",
      description: "Target value the wheel settles on. If greater than from, counts up; if less, counts down.",
    },
    {
      name: "fontSize",
      type: "number",
      default: "120",
      description: "Font size in pixels",
    },
    {
      name: "color",
      type: "string",
      default: "\"#171717\"",
      description: "Text color",
    },
    {
      name: "speed",
      type: "number",
      default: "1",
      description: "Multiplier for animation speed",
    },
  ]}
/>

Direction is determined by the relationship between `from` and `to` — no separate direction prop is needed. All values must be integers and non-negative.

## Count Up

Rolls upward from 0 to 24813:

```tsx
import { Backdrop } from "@/components/remocn/backdrop";
import { NumberWheel } from "@/components/remocn/number-wheel";

<Backdrop fill={{ type: "color", value: "#ffffff" }}>
  <NumberWheel from={0} to={24813} fontSize={120} />
</Backdrop>
```

## Count Down

Rolls downward from 24813 to 0:

```tsx
import { Backdrop } from "@/components/remocn/backdrop";
import { NumberWheel } from "@/components/remocn/number-wheel";

<Backdrop fill={{ type: "color", value: "#ffffff" }}>
  <NumberWheel from={24813} to={0} fontSize={120} />
</Backdrop>
```