Speed Trap

A speedometer-style top-speed readout locks on 348 km/h over a segmented bar with last year's marker and the delta. A free, MIT-licensed Remotion number animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/speed-trap

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { SpeedTrap } from "@/components/remocn/speed-trap";
 
const SpeedTrapScene = () => (
  <SpeedTrap
    value={348}
    previous={300}
    unit="km/h"
    banner="Top speed"
  />
);
 
export const RemotionRoot = () => (
  <Composition
    id="SpeedTrap"
    component={SpeedTrapScene}
    durationInFrames={230}
    fps={60}
    width={1280}
    height={720}
  />
);

A three-sector bar track snaps out and the readout floods up to the final value while a gradient bar races with it. On lock the number kicks, a banner wipes in, last year's mark drops onto the bar and the delta slice and comparison line appear. Pass value, previous, max and unit. It ships light and dark through the theme prop.

Props19

PropTypeDefault
value
number348

Speed the readout locks on.

previous
number300

Last year's mark, drawn as a line on the bar. The delta is computed from it.

max
number360

Full scale of the bar.

unit
string"km/h"

Unit after the number.

banner
string"Top speed"

Banner that flashes when the readout locks.

previousLabel
string"2025"

Label on the previous mark.

comparison
string"vs last year"

Text after the delta, e.g. "vs last year".

label
string"Speed trap · Sector 3"

Small label at the top left.

lockAt
number42

Frame the readout locks on the value; the count runs up to it.

sectors
number3

Number of sectors the bar is split into.

accent
string"#3B5BFD"

The live dot next to the label.

ink
string—

Text color; overrides the theme ink.

background
string—

Background fill; pass "transparent" to drop it.

fontFamily
string"Sora"

Typeface for the copy. Load the font in your project first.

logo
React.ReactNode—

Replaces the remocn mark.

scale
number1

Size of the foreground around the frame's center; the background stays put.

delay
number0

Frames to hold the first frame before anything moves.

theme
"dark" | "light""dark"

Ships light and dark.

speed
number1

Playback speed multiplier; 1 is the designed pace.

  • valuenumber

    Speed the readout locks on.

    Default348

  • previousnumber

    Last year's mark, drawn as a line on the bar. The delta is computed from it.

    Default300

  • maxnumber

    Full scale of the bar.

    Default360

  • unitstring

    Unit after the number.

    Default"km/h"

  • bannerstring

    Banner that flashes when the readout locks.

    Default"Top speed"

  • previousLabelstring

    Label on the previous mark.

    Default"2025"

  • comparisonstring

    Text after the delta, e.g. "vs last year".

    Default"vs last year"

  • labelstring

    Small label at the top left.

    Default"Speed trap · Sector 3"

  • lockAtnumber

    Frame the readout locks on the value; the count runs up to it.

    Default42

  • sectorsnumber

    Number of sectors the bar is split into.

    Default3

  • accentstring

    The live dot next to the label.

    Default"#3B5BFD"

  • inkstring

    Text color; overrides the theme ink.

  • backgroundstring

    Background fill; pass "transparent" to drop it.

  • fontFamilystring

    Typeface for the copy. Load the font in your project first.

    Default"Sora"

  • logoReact.ReactNode

    Replaces the remocn mark.

  • scalenumber

    Size of the foreground around the frame's center; the background stays put.

    Default1

  • delaynumber

    Frames to hold the first frame before anything moves.

    Default0

  • theme"dark" | "light"

    Ships light and dark.

    Default"dark"

  • speednumber

    Playback speed multiplier; 1 is the designed pace.

    Default1

Common questions

How do I make a speedometer-style readout that locks on a number in Remotion?

Install Speed Trap with npx shadcn@latest add @remocn/speed-trap and pass value, previous, max and unit. The readout floods up to the value over a segmented bar, locks with a kick, then last year's marker drops onto the bar and the difference appears. It is built with interpolate() and plain HTML and SVG.

What are the defaults?

value 348, previous 300, max 360, unit "km/h", banner "Top speed", previousLabel "2025" and comparison "vs last year". Set previous to your own earlier figure; the defaults are only demo values.

How is the difference computed?

value - previous, rounded, with a sign and the unit: the defaults read +48 km/h followed by the comparison text. The bar also outlines the slice between the two marks.

Do I need to load the Sora font?

No. The component loads Sora itself through @remotion/google-fonts. Only a custom fontFamily needs loading in your project.

How long is it?

The readout locks at frame 42 at 30 fps (lockAt) and the comparison line finishes around frame 68, then the frame holds. The timing is the same at any frame rate: give a 60 fps composition at least 136 frames. The usage example's 230 frames at 60 fps includes a hold.