Opus Motion ★ Star on GitHub

Type · typewriter-code

Typewriter code window

macOS-style code editor or terminal window that types syntax-coloured code with a block cursor; the panel grows upward line by line.

A free, MIT-licensed text animation from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

Typewriter code window: three frames of the text animation, start, middle and end
Typewriter code window — start, middle and end of the 6.0-second motion.

What Typewriter code window is for

Show the code behind a visual, a command being run, or a "made with code" credit beat.

  • code
  • typewriter
  • terminal
  • ide
  • hud
  • run
  • console
  • serial monitor
  • highlight
  • tutorial
  • paper theme
  • code sync

Details

Category
Text animations & kinetic typography
Length
6.0 s (180 frames at 30 fps)
Formats
16:9, 1:1, 9:16
Weight
light
Transparent overlay
yes
Seamless loop
no
Text props
lines title
Colour props
cursorColor
Image props
src
Mood
mid, paper, hud
Roles
type
Pairs with
Glitch image bursts, HUD chrome overlay, Radial blueprint plan

Use Typewriter code window in Remotion, React or HTML

Remotion project

terminal
# copy this motion into your Remotion project
node cli/mgl.mjs add typewriter-code --to ../my-app/src

# render an mp4 (run in the library folder)
node cli/mgl.mjs render typewriter-code --props '{"lines":["// fractal brownian motion","float fbm(vec2 p) {","  float v = 0.0, a = 0.5;","  for (int i = 0; i < 6; i++) {","    v += a * noise(p);","    p = p * 2.0 + vec2(1.7, 9.2);","    a *= 0.5;","  }","  return v;","}"],"title":"world.glsl","cursorColor":"#e6e6e6","src":""}'

# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export typewriter-code --as webm-alpha --props '{"lines":["// fractal brownian motion","float fbm(vec2 p) {","  float v = 0.0, a = 0.5;","  for (int i = 0; i < 6; i++) {","    v += a * noise(p);","    p = p * 2.0 + vec2(1.7, 9.2);","    a *= 0.5;","  }","  return v;","}"],"title":"world.glsl","cursorColor":"#e6e6e6","src":""}'

React / Next.js

tsx
import {MotionPlayer} from 'opus-motion-library/web';

<MotionPlayer
  motion="typewriter-code"
  props={{
    lines: [
      '// fractal brownian motion',
      'float fbm(vec2 p) {',
      '  float v = 0.0, a = 0.5;',
      '  for (int i = 0; i < 6; i++) {',
      '    v += a * noise(p);',
      '    p = p * 2.0 + vec2(1.7, 9.2);',
      '    a *= 0.5;',
      '  }',
      '  return v;',
      '}',
    ],
    title: 'world.glsl',
    cursorColor: '#e6e6e6',
    src: '',
  }}
  playOnView
  loop="auto"
/>

Plain HTML / WordPress

html
<script src="opus-motion.element.js" defer></script>

<opus-motion motion="typewriter-code"
  props='{"lines":["// fractal brownian motion","float fbm(vec2 p) {","  float v = 0.0, a = 0.5;","  for (int i = 0; i < 6; i++) {","    v += a * noise(p);","    p = p * 2.0 + vec2(1.7, 9.2);","    a *= 0.5;","  }","  return v;","}"],"title":"world.glsl","cursorColor":"#e6e6e6","src":""}'>
</opus-motion>

Compose spec (multi-scene video)

json
{
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "scenes": [
    {
      "motion": "typewriter-code",
      "props": {
        "lines": [
          "// fractal brownian motion",
          "float fbm(vec2 p) {",
          "  float v = 0.0, a = 0.5;",
          "  for (int i = 0; i < 6; i++) {",
          "    v += a * noise(p);",
          "    p = p * 2.0 + vec2(1.7, 9.2);",
          "    a *= 0.5;",
          "  }",
          "  return v;",
          "}"
        ],
        "title": "world.glsl",
        "cursorColor": "#e6e6e6",
        "src": ""
      }
    }
  ]
}

Typewriter code window props

22 parameters — change any of them to make the motion yours.

PropDefaultWhat it does
lines["// fractal brownian motion","float fbm(vec2 p) {"," float v = 0.0, a = 0.5;"," for …code lines (strings, or {text, color}); in terminal mode "$ " lines type, other lines are output
mode"editor"editor (line numbers, syntax colours) | terminal (bold, prompt/output colours)
title"world.glsl"filename centred in the title bar
charsPerSecond42typing speed (video17 ≈ 30, video8 time-boxes ≈ 150 chars in 1 s)
startFrame10frame the first character types (panel fades in 6 frames before)
outputDelay8terminal: frames between a command finishing and its output appearing
position"corner"corner (bottom-left panel) | center (bigger, centred)
fontSize28code size in px at 1080p
lineNumberstrue
colors{}override any of keyword, fn, number, string, comment, text, prompt, command, ok, warn, error, lineNo
panelColor""window body colour (empty = grey for editor, plum for terminal)
headerColor""title bar colour (empty = auto)
cursorColor"#e6e6e6"block cursor colour (video17 uses red #ED3821)
backdrop"auto"auto | dunes | warm | ink | cream | peaks | dusk | ocean | none — procedural scene behind the panel
src""optional public/ image behind the panel (overrides backdrop)
theme"dark"dark | paper (light editor card, teal accents)
highlightLines[]code-run-sync: 0-based lines a pale teal band steps through after typing ends, e.g. [4,5,6,7]
highlightEvery10frames the band rests on each line
consoleLines[]serial-monitor / console pane below the code, lines appended one by one while it runs; the play button turns into a red stop
runAt-1frame the Run is pressed (-1 = shortly after typing ends)
consoleEvery9frames between console lines
chipsfalsenumeric literals on small rounded chips

Notes & credits

Technique sources:

  • video8 0:05-0:30
  • video17 0:00-0:43 footer
  • video13 0:00-0:20