Ruby Press

A word in a sentence is pushed out and replaced by the next one from a list: each next word appears as a tiny annotation above the slot, then presses down into the line. A free, MIT-licensed Remotion text animation.

In Remotion, Ruby Press swaps one word of a sentence through a list: the next word appears as a tiny annotation above the slot, like ruby text, then grows and presses down into the line, pushing the current word out. Use it for a claim whose time frame keeps shrinking, or a localization beat that cycles through markets.

Installation
$ pnpm dlx shadcn@latest add @remocn/ruby-press

How to replace a word in a sentence with a small annotation above it in Remotion

A word that gets pushed out of a sentence by the next one, which first shows as a small note above it, is one component. Install it and pass the sentence around the slot:

bash
npx shadcn@latest add @remocn/ruby-press
  • before is the lead text, words the values for the slot, after the text after it.
  • The small annotations are the words themselves: each next entry of words shows small above the slot, then presses down into the line. There is no separate gloss text prop.
  • The slot width animates from one word to the next, so the words after the slot slide over to make room. For a slot that keeps one width use Width Lock.
  • hold sets how long each word stays, press how long a gloss takes to press down, stagger the frames between words as the line rises in.
  • Word widths are measured on a canvas before the first frame, so you don't need @remotion/layout-utils.

Good to know

  • Length: 134 frames of motion at 30 fps with the three default words (268 at 60 fps). The Usage example runs 340 frames at 60 fps, which adds a hold.
  • Length for your own list, in 30 fps frames: each swap takes 24 + press + hold frames (60 by default), and the last one ends 14 frames sooner, so N words need 60 * (N - 1) + 14 frames with the default hold and press. The props counted in frames stay in 30 fps frames at any frame rate, see Frame rate.
  • Installs: remotion, @remotion/google-fonts from npm, plus the remocn helpers glide, frame-rate and timeline. The shadcn CLI copies the source into your project.
  • Font: loads Zen Kaku Gothic New itself through @remotion/google-fonts. Pass fontFamily to use your own face, and load that font in your project.

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { RubyPress } from "@/components/remocn/ruby-press";
 
const RubyPressScene = () => (
  <RubyPress before="Subtitles for every market in" words={["a fortnight", "a morning", "one render"]} after="." />
);
 
export const RemotionRoot = () => (
  <Composition
    id="RubyPress"
    component={RubyPressScene}
    durationInFrames={340}
    fps={60}
    width={1280}
    height={720}
  />
);

Each entry in words is pressed down and swapped for the next inside a sentence built from before and after, with a small gloss rising above each. Pass before, words and after. It ships in light and dark through the theme prop.

Props14

PropTypeDefault
before
string"Subtitles for every market in"

Text before the swapping word.

words
string[]—

Words pressed in order.

after
string"."

Text after the swapping word.

hold
number14

Frames each state stays on screen before the next one.

stagger
number3

Frames between words as the lead line rises in.

press
number22

Frames the gloss takes to press down into the line.

accent
string—

Accent color override; falls back to the theme accent.

ink
string—

Text color; overrides the theme ink.

background
string—

Background color override; falls back to the theme background.

fontFamily
string"Zen Kaku Gothic New"

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

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.

speed
number1

Playback speed multiplier for the whole timeline.

theme
"dark" | "light""dark"

Ships light and dark; picks the palette.

  • beforestring

    Text before the swapping word.

    Default"Subtitles for every market in"

  • wordsstring[]

    Words pressed in order.

  • afterstring

    Text after the swapping word.

    Default"."

  • holdnumber

    Frames each state stays on screen before the next one.

    Default14

  • staggernumber

    Frames between words as the lead line rises in.

    Default3

  • pressnumber

    Frames the gloss takes to press down into the line.

    Default22

  • accentstring

    Accent color override; falls back to the theme accent.

  • inkstring

    Text color; overrides the theme ink.

  • backgroundstring

    Background color override; falls back to the theme background.

  • fontFamilystring

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

    Default"Zen Kaku Gothic New"

  • 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

  • speednumber

    Playback speed multiplier for the whole timeline.

    Default1

  • theme"dark" | "light"

    Ships light and dark; picks the palette.

    Default"dark"