Skip to content

Explainer videos and product demos made by your AI agent. Free and open source: a local voice (Kokoro), word timing (Whisper) and a canvas renderer turn a script into a narrated MP4.

Rewrite example narration in plain spoken English, add a watermark setting, and catch code lines wider than their window

Vincent Schmalbach3e5bb393f32a
diff --git a/AGENTS.md b/AGENTS.md
index 1332edb..7eaff70 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -51,6 +51,12 @@ are your eyes and ears.
- One idea per scene, usually 1 to 3 sentences (4 to 15 seconds).
- Write for the ear: short sentences, plain words, no parentheses, no
lists read aloud as "A, B, C, D and E" unless each one appears on screen.
+ - Write the way you would explain it to someone at a table. Say who does
+ what ("Whisper listens to the recording"). Every sentence adds a fact.
+ - Leave out slogans and punchlines ("Just code."), "not X, but Y" twists,
+ colon lists, chains of three short sentences, metaphors, and filler words
+ like "just", "simply", "really" and "exactly". Cut half sentences that
+ repeat what was already said.
- Put `[#marker]` where a visual should change. Every sentence should
trigger at least one visual.
- Use `{shown|spoken}` for anything the voice might misread: acronyms
@@ -122,7 +128,8 @@ are your eyes and ears.
highlight, a camera move. `check` flags long static stretches.
- **Screen text summarizes.** Keep on-screen text to a few words (a label,
a number, a key phrase). Never put the whole narration on screen; turn on
- captions instead (`"captions": true`).
+ captions instead (`"captions": true`). With captions on, do not also show
+ the sentence the voice is saying.
- **Few things at once.** At most five or six elements on screen. Clear the
stage with `out` before building the next idea.
- **Big and readable.** Titles 80 to 110px, labels 40 to 56px, notes at least
@@ -176,6 +183,7 @@ videos/<slug>/
| `sentenceGap`, `paragraphGap` | 0.3, 0.55 | pauses in the narration |
| `loudness` | -14 | target LUFS |
| `boil` | 0 | redraws per second of hand-drawn lines (0 keeps lines still) |
+| `watermark` | `false` | small text in the bottom right corner of every frame, like `"example.com"` |
Scene attributes in `script.md`: `## id {hold=1.5 min=5 lead=0.2 transition=cut}`.
diff --git a/README.md b/README.md
index a567545..5c182c9 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ models download once (about 400 MB).
| | | |
|---|---|---|
| [![explainroo intro](docs/media/intro-poster.jpg)](https://github.com/vincentsch/explainroo/releases/download/v0.1.0/explainroo-intro.mp4) | [![How DNS finds a website](docs/media/dns-poster.jpg)](https://github.com/vincentsch/explainroo/releases/download/v0.1.0/how-dns-works.mp4) | [![git merge vs rebase](docs/media/rebase-poster.jpg)](https://github.com/vincentsch/explainroo/releases/download/v0.1.0/merge-vs-rebase.mp4) |
-| **explainroo in 71 seconds** (paper, 16:9) · [source](examples/explainroo-intro) | **How DNS finds a website** (chalk, 16:9) · [source](examples/how-dns-works) | **git merge vs rebase** (midnight, 9:16 with captions) · [source](examples/merge-vs-rebase) |
+| **explainroo in 86 seconds** (paper, 16:9) · [source](examples/explainroo-intro) | **How DNS finds a website** (chalk, 16:9) · [source](examples/how-dns-works) | **git merge vs rebase** (midnight, 9:16 with captions) · [source](examples/merge-vs-rebase) |
## Quick start
@@ -65,8 +65,9 @@ node bin/explainroo.js render videos/hello # writes videos/hello/out/video
```markdown
## sync
-So a picture can appear exactly when it is mentioned. [#code] Write one line,
-[#say] say the word database, and there it is.
+This way a picture can appear at the moment the voice mentions it. [#code] The
+agent writes one line of code, [#say] and when the voice says database, the
+database appears.
```
`[#code]` marks a moment to animate on. `{SQL|sequel}` shows "SQL" on screen
@@ -77,6 +78,7 @@ word, or a marker:
```js
sync(s) {
+ // shortened from examples/explainroo-intro/scenes.js
s.text('Word cues', { font: 'display', size: 84, y: 160, at: 0.1 });
s.code("s.icon('database', {\n at: 'database',\n});", { x: 640, y: 560, at: '#code' });
s.icon('database', { x: 1450, y: 560, size: 260, color: 'purple', at: 'database' });
@@ -130,7 +132,7 @@ calm?". If a word is mispronounced, write it as {shown|spoken} in script.md.
Writing `{example.com|example dot com}` in the script fixed it.
`verify` transcribes the final mix to confirm the narration is still
-understandable over the music. All three examples score 99 to 100%.
+understandable over the music. All three examples score 100%.
## Commands
@@ -153,7 +155,7 @@ Every command accepts `--json`.
## Speed and limits
On a laptop with an 8-core Intel i9-11950H, everything on the CPU, the
-67-second DNS example renders at 1080p in about 50 seconds once its voice is
+68-second DNS example renders at 1080p in about 50 seconds once its voice is
generated. Generating the voice takes a little less time than the narration
lasts, and only changed scenes are generated again.
diff --git a/docs/media/contact-sheet.jpg b/docs/media/contact-sheet.jpg
index 1bcf3a4..6ff073a 100644
Binary files a/docs/media/contact-sheet.jpg and b/docs/media/contact-sheet.jpg differ
diff --git a/docs/media/dns-poster.jpg b/docs/media/dns-poster.jpg
index 6f2090b..6ff4e66 100644
Binary files a/docs/media/dns-poster.jpg and b/docs/media/dns-poster.jpg differ
diff --git a/docs/media/intro-poster.jpg b/docs/media/intro-poster.jpg
index f68b729..c2db7ae 100644
Binary files a/docs/media/intro-poster.jpg and b/docs/media/intro-poster.jpg differ
diff --git a/docs/media/intro.gif b/docs/media/intro.gif
index 4dfb19f..547c449 100644
Binary files a/docs/media/intro.gif and b/docs/media/intro.gif differ
diff --git a/docs/media/rebase-poster.jpg b/docs/media/rebase-poster.jpg
index b7d1744..9b7442a 100644
Binary files a/docs/media/rebase-poster.jpg and b/docs/media/rebase-poster.jpg differ
diff --git a/engine/runtime.js b/engine/runtime.js
index f02da1b..b5df5b1 100644
--- a/engine/runtime.js
+++ b/engine/runtime.js
@@ -2,11 +2,11 @@
// and scenes, then exposes frame rendering, checks and the soundtrack.
import rough from '/vendor/rough.js';
import { Stage, SceneError } from './stage.js';
-import { getTheme, makeBackground } from './themes.js';
+import { getTheme, makeBackground, fontString } from './themes.js';
import { Pen } from './pen.js';
import { drawTransition } from './transitions.js';
import { buildPhrases, drawCaptions } from './captions.js';
-import { hashStr, mulberry32, suggest, contrast, opaque } from './util.js';
+import { hashStr, mulberry32, suggest, contrast, opaque, withAlpha } from './util.js';
const AUTO_TRANSITION = { paper: 'brush', clean: 'slide', chalk: 'brush', blueprint: 'wipe', midnight: 'zoom' };
@@ -156,6 +156,27 @@ export class Engine {
ctx.setTransform(this.scale, 0, 0, this.scale, 0, 0);
drawCaptions(ctx, this.phrases, T, this.theme, this.W, this.H);
}
+ if (this.config.watermark) {
+ ctx.setTransform(this.scale, 0, 0, this.scale, 0, 0);
+ this.drawWatermark(ctx, this.config.watermark);
+ }
+ }
+
+ // Small text in the bottom right corner, on every frame.
+ drawWatermark(ctx, text) {
+ const th = this.theme;
+ const m = Math.min(this.W, this.H);
+ const size = Math.round(m * 0.024);
+ const margin = Math.round(m * 0.03);
+ ctx.save();
+ ctx.globalAlpha = 1;
+ ctx.globalCompositeOperation = 'source-over';
+ ctx.font = fontString(th, 'body', size, th.fonts.body.family === 'Inter' ? 600 : undefined);
+ ctx.textAlign = 'right';
+ ctx.textBaseline = 'alphabetic';
+ ctx.fillStyle = withAlpha(th.ink, th.dark ? 0.6 : 0.5);
+ ctx.fillText(text, this.W - margin, this.H - margin);
+ ctx.restore();
}
// Runs every scene over its duration without keeping pixels, collecting the
@@ -267,7 +288,8 @@ export class Engine {
once(`err:${sc.id}:${e.message}`, () => add('error', sc.id, t, e.message));
break;
}
- const texts = this.textLog.filter((x) => x.alpha > 0.5);
+ for (const pr of this.textLog.filter((x) => x.problem)) once(`problem:${sc.id}:${pr.problem}`, () => add('error', sc.id, t, pr.problem));
+ const texts = this.textLog.filter((x) => !x.problem && x.alpha > 0.5);
for (const tx of texts) {
const label = tx.text.length > 40 ? tx.text.slice(0, 37) + '...' : tx.text;
if (tx.x0 < -1 || tx.y0 < -1 || tx.x1 > W + 1 || tx.y1 > H + 1) {
diff --git a/engine/stage.js b/engine/stage.js
index 41b8599..c516f39 100644
--- a/engine/stage.js
+++ b/engine/stage.js
@@ -334,6 +334,12 @@ export class Stage {
});
}
+ // Layout problems found while drawing, reported by `check`.
+ _overflow(message) {
+ const log = this.engine.textLog;
+ if (log) log.push({ scene: this.id, t: this.t, problem: message });
+ }
+
_autoTextColor(fill, fallback) {
if (!fill || fill === 'none') return fallback;
fill = opaque(fill, this.theme.bg);
@@ -1269,6 +1275,14 @@ export class Stage {
ctx.font = font;
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
+ const room = w / 2 - pad * 0.5 - (left + numW);
+ lines.forEach((line, i) => {
+ if (ctx.measureText(line).width > room) this._overflow(`code line ${i + 1} ("${line.trim().slice(0, 40)}") is wider than its window; shorten it, lower size or raise w`);
+ });
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect(-w / 2, -h / 2, w, h);
+ ctx.clip();
let budget = reveal === 'type' ? Math.floor((this.t - startText) * cps) : Infinity;
lines.forEach((line, i) => {
if (reveal === 'lines' && this.t < startText + i * lineDelay) return;
@@ -1294,6 +1308,7 @@ export class Stage {
}
if (reveal === 'type') budget -= 1;
});
+ ctx.restore();
this._logText({ text: 'code', x0: -w / 2, y0: -h / 2, x1: w / 2, y1: h / 2, size, fg: C.fg, bg: C.bg, block: true });
ctx.restore();
return geom(x, y, w, h);
@@ -1357,6 +1372,17 @@ export class Stage {
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
const left = -w / 2 + pad;
+ const promptW = ctx.measureText((o.prompt ?? '$') + ' ').width;
+ for (const it of timed) {
+ for (const part of String(it.cmd ?? it.out ?? '').split('\n')) {
+ const width = ctx.measureText(part).width + (it.cmd !== undefined ? promptW : 0);
+ if (width > w - pad * 2) this._overflow(`terminal line "${part.slice(0, 40)}" is wider than the terminal; shorten it, lower size or raise w`);
+ }
+ }
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect(-w / 2, -h / 2, w, h);
+ ctx.clip();
let row = 0;
const top = -h / 2 + barH + pad * 0.8;
let cursor = null;
@@ -1386,6 +1412,7 @@ export class Stage {
ctx.globalAlpha *= 0.85;
ctx.fillRect(cursor.x + 4, cursor.y + size * 0.08, size * 0.55, size * 1.05);
}
+ ctx.restore();
this._logText({ text: 'terminal', x0: -w / 2, y0: -h / 2, x1: w / 2, y1: h / 2, size, fg: T.fg, bg: T.bg, block: true });
ctx.restore();
return geom(x, y, w, h);
diff --git a/examples/explainroo-intro/scenes.js b/examples/explainroo-intro/scenes.js
index 982a852..19de569 100644
--- a/examples/explainroo-intro/scenes.js
+++ b/examples/explainroo-intro/scenes.js
@@ -15,18 +15,19 @@ export default {
s.box(label, { id: `no${i}`, x: xs[i], y: 700, icon, w: 330, at, out: '#code', outDur: 0.3, exit: 'pop', size: 46 });
s.annotate(`no${i}`, { type: 'cross', color: 'red', at: s.time(at) + 0.55, out: '#code', outDur: 0.3, dur: 0.45 });
});
- s.text('Just *code*.', { font: 'display', size: 150, y: 700, at: s.mark('code') + 0.35 });
+ s.icon('code-xml', { x: 560, y: 700, size: 150, color: 'accent', at: s.mark('code') + 0.35 });
+ s.text('drawn with *JavaScript*', { font: 'display', size: 84, x: 660, y: 700, align: 'left', at: s.mark('code') + 0.5 });
},
files(s) {
s.title('explainroo', { y: 140, size: 110, at: 0 });
- s.note('a small open source kit', { y: 235, size: 38, at: 'open' });
+ s.note('free and open source', { y: 235, size: 38, at: 'open' });
s.icon('bot', { id: 'agent', x: 330, y: 610, size: 190, at: '#writes', label: 'your agent', labelSize: 40 });
- s.code('## hook\nThis video was made by a coding agent.\n[#code] Just code.', {
- id: 'script', lang: 'md', title: 'script.md', x: 1170, y: 440, w: 1080, size: 34, at: '#script', reveal: 'lines', lineDelay: 0.25,
+ s.code('## hook\nA coding agent made this video with explainroo.\n[#code] Everything you see is drawn with JavaScript.', {
+ id: 'script', lang: 'md', title: 'script.md', x: 1170, y: 440, w: 1120, size: 31, at: '#script', reveal: 'lines', lineDelay: 0.25,
});
- s.code("hook(s) {\n s.icon('bot', { at: 0.2 });\n s.text('Just *code*.', { at: '#code' });\n}", {
- id: 'scenes', lang: 'js', title: 'scenes.js', x: 1170, y: 800, w: 1080, size: 34, at: '#scenes', reveal: 'lines', lineDelay: 0.25,
+ s.code("hook(s) {\n s.icon('bot', { at: 0 });\n s.icon('code-xml', { at: '#code' });\n}", {
+ id: 'scenes', lang: 'js', title: 'scenes.js', x: 1170, y: 800, w: 1120, size: 31, at: '#scenes', reveal: 'lines', lineDelay: 0.25,
});
s.arrow('agent', 'script', { at: s.mark('script') - 0.2, bend: -0.15 });
s.arrow('agent', 'scenes', { at: s.mark('scenes') - 0.2, bend: 0.15 });
@@ -44,14 +45,14 @@ export default {
// A real word timeline: the words of the last sentence, placed at the
// times Whisper measured for them.
- const from = s.mark('whisper');
+ const from = s.cue('writes');
const words = s.words.filter((w) => w.start >= from - 0.01);
const t0 = words[0].start;
const t1 = words[words.length - 1].end;
const x0 = 250;
const x1 = 1670;
const lineY = 860;
- s.line([[x0 - 30, lineY], [x1 + 60, lineY]], { color: 'muted', at: from, width: 3 });
+ s.line([[x0 - 30, lineY], [x1 + 60, lineY]], { color: 'muted', at: s.mark('whisper') + 0.4, width: 3 });
words.forEach((w, i) => {
const x = x0 + ((w.start - t0) / (t1 - t0)) * (x1 - x0);
s.line([[x, lineY - 14], [x, lineY + 14]], { color: 'purple', at: w.start, width: 4, sfx: false });
@@ -63,16 +64,16 @@ export default {
sync(s) {
s.text('Word cues', { font: 'display', size: 84, y: 160, at: 0.1 });
s.icon('image', { id: 'pic', x: 700, y: 540, size: 170, color: 'blue', at: 'picture', out: '#code', bg: 'circle' });
- s.icon('speech', { id: 'said', x: 1220, y: 540, size: 170, color: 'accent', at: 'mentioned', out: '#code', bg: 'circle' });
- s.arrow('pic', 'said', { head: 'both', dashed: true, label: 'same moment', at: s.cue('mentioned') + 0.25, out: '#code', color: 'muted' });
+ s.icon('speech', { id: 'said', x: 1220, y: 540, size: 170, color: 'accent', at: 'mentions', out: '#code', bg: 'circle' });
+ s.arrow('pic', 'said', { head: 'both', dashed: true, label: 'at the same time', at: s.cue('mentions') + 0.25, out: '#code', color: 'muted' });
s.code("s.icon('database', {\n at: 'database',\n});", { x: 640, y: 560, w: 860, size: 44, title: 'scenes.js', at: '#code', reveal: 'type', cps: 34 });
const db = s.icon('database', { id: 'db', x: 1450, y: 560, size: 260, color: 'purple', at: 'database', enter: 'pop', bg: 'circle', bgScale: 1.45 });
- s.note('shown the moment it is said', { x: db.x, y: db.bottom + 60, size: 38, at: s.cue('there') });
+ s.note('appears when the voice says it', { x: db.x, y: db.bottom + 60, size: 38, at: 'appears' });
s.burst({ x: 1450, y: 560, at: 'database', count: 36, power: 900 });
},
draw(s) {
- s.icon('app-window', { x: 420, y: 470, size: 300, color: 'ink', at: 0.2, label: 'headless browser', labelSize: 40 });
+ s.icon('app-window', { x: 420, y: 470, size: 300, color: 'ink', at: 0.2, label: 'headless Chrome', labelSize: 40 });
const looks = [
['paper', '#f7f3ea', '#26221d', '#df5a3f'],
['clean', '#ffffff', '#111827', '#3b6cf6'],
@@ -94,7 +95,7 @@ export default {
s.icon('eye-off', { x: 300, y: 340, size: 90, color: 'muted', at: 'watch', out: '#give', exit: 'pop' });
s.icon('eye', { x: 300, y: 340, size: 100, color: 'accent', at: s.mark('give') + 0.3, enter: 'pop' });
const x = 830;
- s.box('Still frames', { id: 'stills', x, y: 300, icon: 'image', w: 400, at: '#stills', color: 'blue' });
+ s.box('Still pictures', { id: 'stills', x, y: 300, icon: 'image', w: 400, at: '#stills', color: 'blue' });
s.box('Contact sheets', { id: 'sheets', x, y: 540, icon: 'layout-grid', w: 400, at: '#sheets', color: 'green' });
s.box('A check', { id: 'check', x, y: 780, icon: 'list-checks', w: 400, at: '#check', color: 'red' });
s.arrow('agent', 'stills', { at: s.mark('stills') - 0.2, bend: -0.12 });
@@ -104,7 +105,7 @@ export default {
[
{ text: 'cut off text', at: 'cut' },
{ text: 'bad timing', at: 'timing' },
- { text: 'mumbled words', at: 'mumbled' },
+ { text: 'misread words', at: 'wrong' },
],
{ x: 1160, y: 690, size: 44, bullet: 'x', bulletColor: 'red', gap: 18, width: 600 },
);
diff --git a/examples/explainroo-intro/script.md b/examples/explainroo-intro/script.md
index 7492d5d..ea8106f 100644
--- a/examples/explainroo-intro/script.md
+++ b/examples/explainroo-intro/script.md
@@ -3,25 +3,25 @@
> Launch video. Every claim here is true of the kit as built.
## hook
-This video was made by a coding agent. [#nomodel] No video model, [#nokeys] no API keys, [#noedit] and no editing. [#code] Just code.
+A coding agent made this video with explainroo. It didn't use [#nomodel] a video model, [#nokeys] an API key [#noedit] or a video editor. [#code] Everything you see is drawn with JavaScript.
## files
-explainroo is a small open source kit you point your agent at. [#writes] The agent writes two files: [#script] a script of what to say, [#scenes] and a few lines of JavaScript for what to show.
+explainroo is a free, open source kit for coding agents. [#writes] The agent writes two files. [#script] The first one is the script for the voice. [#scenes] The second one is a bit of JavaScript that draws the pictures.
## voice
-The narration is spoken by Kokoro, [#local] a voice model that runs on your own computer. [#whisper] Then Whisper listens back and times every word.
+A voice model called Kokoro reads the script. [#local] It runs on your own computer. [#whisper] Then Whisper listens to the recording and writes down the time of each word.
## sync
-So a picture can appear exactly when it is mentioned. [#code] Write one line, [#say] say the word database, and there it is.
+This way a picture can appear at the moment the voice mentions it. [#code] The agent writes one line of code, [#say] and when the voice says database, the database appears.
## draw
-The frames are drawn in a headless browser, [#looks] in one of five looks, [#sound] with music and sound effects made to fit.
+Chrome draws each frame in the background. [#looks] There are five looks to pick from, [#sound] and explainroo also makes the music and the sound effects.
## eyes
-Your agent cannot watch the video, [#give] so explainroo gives it eyes: [#stills] still frames, [#sheets] contact sheets, and a check [#check] that catches cut off text, bad timing and mumbled words.
+The agent can't watch the video, [#give] so explainroo turns it into things the agent can read. [#stills] It makes still pictures of each scene [#sheets] and contact sheets that show a scene over time. [#check] A check also finds text that is cut off, bad timing and words the voice got wrong.
## render {min=5.5}
-One command renders the finished video.
+One command turns all of it into an MP4 file.
## outro {hold=2}
-explainroo is free and open source. [#try] Point your agent at the repo, and ask for a video.
+explainroo is free and open source. [#try] The code and these example videos are on GitHub.
diff --git a/examples/explainroo-intro/video.json b/examples/explainroo-intro/video.json
index d9504b0..38b880a 100644
--- a/examples/explainroo-intro/video.json
+++ b/examples/explainroo-intro/video.json
@@ -4,5 +4,6 @@
"size": "16:9",
"voice": "af_heart",
"music": true,
- "captions": "auto"
+ "captions": "auto",
+ "watermark": "explainroo.com"
}
diff --git a/examples/how-dns-works/scenes.js b/examples/how-dns-works/scenes.js
index 0b31836..7499f6d 100644
--- a/examples/how-dns-works/scenes.js
+++ b/examples/how-dns-works/scenes.js
@@ -47,7 +47,7 @@ export default {
question(s) {
you(s, { at: 0.1 });
- question(s, { at: '#ask', enter: 'sync' });
+ question(s, { at: '#ask' });
s.icon('help-circle', { x: 800, y: 560, size: 150, color: 'yellow', at: 'address' });
},
@@ -58,16 +58,15 @@ export default {
s.box('Operating system cache', { id: 'oc', x: 800, y: 720, icon: 'cpu', w: 400, size: 40, at: '#os', color: 'purple' });
s.arrow('you', 'bc', { at: s.mark('browser') + 0.1, bend: -0.15 });
s.arrow('you', 'oc', { at: s.mark('os') + 0.1, bend: 0.15 });
- s.note('both keep recent answers', { x: 800, y: 880, size: 40, at: 'recent', color: 'yellow' });
},
resolver(s) {
question(s, { at: -1 });
you(s, { at: -1 });
resolver(s, { at: 'resolver' });
- s.arrow('you', 'resolver', { at: 'goes' });
- s.note('your internet provider', { x: P.resolver.x, y: 735, size: 40, at: '#isp' });
- s.note('or a public one: 1.1.1.1', { x: P.resolver.x, y: 800, size: 40, at: '#public', color: 'yellow' });
+ s.arrow('you', 'resolver', { at: 'asks' });
+ s.note('run by your internet provider', { x: P.resolver.x, y: 735, size: 40, at: '#isp' });
+ s.note('or a public one, like 1.1.1.1', { x: P.resolver.x, y: 800, size: 40, at: '#public', color: 'yellow' });
},
root(s) {
@@ -76,9 +75,9 @@ export default {
resolver(s, { at: -1 });
s.arrow('you', 'resolver', { at: -1 });
root(s, { at: '#root' });
- s.arrow('resolver', 'root', { at: 'top', bend: -0.1 });
- s.note("doesn't know", { x: P.root.x, y: P.root.y + 125, size: 36, at: 'answer' });
- s.arrow('root', 'resolver', { at: '#tld', bend: 0.8, dashed: true, color: 'blue', label: 'ask .com', labelColor: 'blue', labelOffset: 40 });
+ s.arrow('resolver', 'root', { at: 'starts', bend: -0.1 });
+ s.note("doesn't know the address", { x: P.root.x, y: P.root.y + 125, size: 36, at: 'address' });
+ s.arrow('root', 'resolver', { at: '#tld', bend: 0.8, dashed: true, color: 'blue', label: 'ask the .com servers', labelColor: 'blue', labelOffset: 40 });
},
tld(s) {
@@ -108,11 +107,11 @@ export default {
s.arrow('resolver', 'you', { at: s.mark('ip') + 0.9, bend: 0.25, color: 'accent', width: 6 });
s.annotate('q', { type: 'box', color: 'green', at: s.mark('ip') + 1.4 });
s.icon('check', { x: q.right + 60, y: q.y, size: 70, color: 'green', at: s.mark('ip') + 1.6, enter: 'pop' });
- s.icon('database', { x: P.resolver.x, y: 780, size: 90, color: 'yellow', at: '#keep', label: 'saved for next time', labelSize: 36 });
+ s.icon('database', { x: P.resolver.x, y: 780, size: 90, color: 'yellow', at: '#keep', label: 'saved for the next request', labelSize: 36 });
},
outro(s) {
- s.number(4, { suffix: ' hops', y: 360, at: 0.15 });
+ s.number(4, { suffix: ' questions', y: 360, at: 0.15 });
const chain = [
['laptop', 'you'],
['server', 'resolver'],
diff --git a/examples/how-dns-works/script.md b/examples/how-dns-works/script.md
index e02f2ce..c9efe1c 100644
--- a/examples/how-dns-works/script.md
+++ b/examples/how-dns-works/script.md
@@ -1,28 +1,28 @@
# How DNS finds a website
-> A classic explainer in the chalk look. The diagram grows scene by scene:
-> earlier parts are carried over with at: -1.
+> A classic explainer in the chalk look. The diagram grows from scene to
+> scene: earlier parts are carried over with at: -1.
## hook
-You type {example.com|example dot com}, and a page appears. [#but] But computers don't find each other by name. [#numbers] They use numbers, called IP addresses.
+You type {example.com|example dot com}, and a page appears. [#but] Computers don't find each other by name, though. [#numbers] They use numbers called IP addresses.
## question
-So before anything loads, your browser has to ask: [#ask] what is the address of {example.com|example dot com}?
+So before the page can load, [#ask] your browser needs the IP address of {example.com|example dot com}.
## cache
-First, it checks what it already knows. [#browser] The browser [#os] and your operating system both keep recent answers in a cache.
+First it checks if it already knows the answer. [#browser] The browser [#os] and your operating system both keep recent answers in a cache.
## resolver
-If neither one knows, the question goes to a resolver, [#isp] usually run by your internet provider, [#public] or a public one like {1.1.1.1|one dot one dot one dot one}.
+If neither of them knows it, the browser asks a resolver. [#isp] Your internet provider usually runs one, [#public] and there are public ones like {1.1.1.1|one dot one dot one dot one}.
## root
-The resolver starts at the top. [#root] A root server doesn't know the answer, [#tld] but it knows who runs dot com.
+The resolver starts with a root server. [#root] The root server doesn't know the address, [#tld] but it knows where the dot com servers are.
## tld
-The dot com servers don't know either, [#auth] but they know which name server is responsible for {example.com|example dot com}.
+The dot com servers don't know it either. [#auth] They send the resolver to the name server of {example.com|example dot com}.
## answer
-That name server has the answer. [#ip] It sends back the IP address, [#keep] and the resolver keeps a copy for next time.
+That name server has the answer. [#ip] It sends the IP address back, [#keep] and the resolver saves it for the next time someone asks.
## outro {hold=1.5}
-Four hops, [#blink] usually faster than a blink. [#next] Next time a page loads, you'll know who answered first.
+That makes four questions to find one address. [#blink] It usually takes a fraction of a second.
diff --git a/examples/how-dns-works/video.json b/examples/how-dns-works/video.json
index 20d2f61..a9aafa9 100644
--- a/examples/how-dns-works/video.json
+++ b/examples/how-dns-works/video.json
@@ -4,5 +4,6 @@
"size": "16:9",
"voice": "af_heart",
"music": true,
- "captions": "auto"
+ "captions": "auto",
+ "watermark": "explainroo.com"
}
diff --git a/examples/merge-vs-rebase/scenes.js b/examples/merge-vs-rebase/scenes.js
index 9750ecc..253dbf0 100644
--- a/examples/merge-vs-rebase/scenes.js
+++ b/examples/merge-vs-rebase/scenes.js
@@ -47,7 +47,7 @@ export default {
rebase(s) {
s.title('rebase', { y: 190, size: 88, at: -1 });
- history(s, { featureOut: 'lifts', ghost: false });
+ history(s, { featureOut: 'takes', ghost: false });
history(s, { main: false, ghost: true, at: s.cueEnd('off') - 0.8 });
const y1 = Y(5);
const y2 = Y(6);
@@ -56,7 +56,7 @@ export default {
s.line([[MAIN_X, y1 + R], [MAIN_X, y2 - R]], { color: 'accent', at: s.mark('replay') + 0.8 });
s.circle({ id: 'F2b', x: MAIN_X, y: y2, r: R, label: "F2'", size: 46, color: 'accent', at: s.mark('replay') + 1.0, enter: 'drop' });
s.arrow([FEAT_X - 20, Y(2) + 70], [MAIN_X + 90, y1 - 10], { bend: -0.3, dashed: true, color: 'muted', at: s.mark('replay') + 0.1, width: 3 });
- s.note('one straight line', { x: 420, y: y2, size: 48, color: 'accent', align: 'left', at: '#line' });
+ s.note('a straight line', { x: 420, y: y2, size: 48, color: 'accent', align: 'left', at: '#line' });
},
hashes(s) {
@@ -70,22 +70,22 @@ export default {
s.circle({ id: `o${i}`, x: 230, y, r: R, label: o, size: 46, color: 'green', at: -1, opacity: 0.55, dashed: true });
s.text(oh, { id: `oh${i}`, font: 'mono', x: 340, y, size: 60, align: 'left', color: 'muted', at: -1 });
s.annotate(`oh${i}`, { type: 'strike', color: 'red', at: s.mark('new') + i * 0.3 });
- s.circle({ id: `n${i}`, x: 230, y: y + 150, r: R, label: n, size: 46, color: 'accent', at: s.cue('replayed') + i * 0.25 });
+ s.circle({ id: `n${i}`, x: 230, y: y + 150, r: R, label: n, size: 46, color: 'accent', at: s.cue('new') + i * 0.25 });
s.text(nh, { font: 'mono', x: 340, y: y + 150, size: 60, align: 'left', color: 'accent', at: s.mark('new') + 0.2 + i * 0.3, enter: 'type', dur: 0.5 });
});
s.note('same changes, new commits', { y: 1230, size: 48, at: s.cue('commits') });
},
rule(s) {
- s.icon('triangle-alert', { y: 470, size: 210, color: 'yellow', at: 'rule', bg: 'circle', bgScale: 1.5 });
+ s.icon('triangle-alert', { y: 470, size: 210, color: 'yellow', at: 0.2, bg: 'circle', bgScale: 1.5 });
s.text("Don't rebase\n*shared* branches", { font: 'display', size: 84, y: 850, at: '#shared', lineHeight: 1.15, mark: 'yellow' });
s.icon('users', { y: 1150, size: 120, color: 'muted', at: 'people' });
},
outro(s) {
- s.box('merge', { x: 540, y: 520, w: 760, h: 250, icon: 'git-merge', color: 'purple', size: 56, at: 'Merge' });
- s.note('keeps history as it happened', { y: 710, size: 48, at: 'happened' });
+ s.box('merge', { x: 540, y: 520, w: 760, h: 250, icon: 'git-merge', color: 'purple', size: 56, at: 'merge' });
+ s.note('history as it happened', { y: 710, size: 48, at: 'happened' });
s.box('rebase', { x: 540, y: 960, w: 760, h: 250, icon: 'git-commit-vertical', color: 'accent', size: 56, at: '#clean' });
- s.note('keeps it clean', { y: 1150, size: 48, at: s.cue('clean') });
+ s.note('a straight line, easier to read', { y: 1150, size: 48, at: 'easier' });
},
};
diff --git a/examples/merge-vs-rebase/script.md b/examples/merge-vs-rebase/script.md
index e4f2aad..17457db 100644
--- a/examples/merge-vs-rebase/script.md
+++ b/examples/merge-vs-rebase/script.md
@@ -4,19 +4,19 @@
> video is vertical.
## hook
-Your branch is behind main. [#two] You can merge, [#or] or you can rebase.
+Your branch is behind main. [#two] You can merge it, [#or] or you can rebase it.
## merge
-A merge ties the two histories together [#knot] with one extra merge commit.
+A merge adds [#knot] one new commit that joins the two histories.
## rebase
-A rebase lifts your commits off, [#replay] and replays them on top of main, [#line] in one straight line.
+A rebase takes your commits off your branch [#replay] and adds them again on top of main, [#line] one after the other.
## hashes
-The replayed commits are new commits, [#new] with new hashes.
+These are new commits, [#new] so they get new hashes.
## rule
-So here is the rule: [#shared] never rebase a branch that other people already pulled.
+So don't rebase a branch [#shared] that other people have already pulled. [#why] Their copy still has the old commits.
## outro {hold=1.2}
-Merge keeps history exactly as it happened. [#clean] Rebase keeps it clean.
+A merge keeps the history the way it happened. [#clean] A rebase turns it into a straight line, which is easier to read.
diff --git a/examples/merge-vs-rebase/video.json b/examples/merge-vs-rebase/video.json
index 0a63da0..ed87ff1 100644
--- a/examples/merge-vs-rebase/video.json
+++ b/examples/merge-vs-rebase/video.json
@@ -4,5 +4,6 @@
"size": "9:16",
"voice": "am_michael",
"music": true,
- "captions": "auto"
+ "captions": "auto",
+ "watermark": "explainroo.com"
}
diff --git a/src/project.js b/src/project.js
index c04fb68..7374c42 100644
--- a/src/project.js
+++ b/src/project.js
@@ -33,6 +33,7 @@ export const DEFAULTS = {
loudness: -14,
seed: 1,
boil: 0,
+ watermark: false,
};
export class ProjectError extends Error {}
@@ -67,6 +68,9 @@ export function normalizeConfig(raw) {
}
if (!(cfg.loudness <= -8 && cfg.loudness >= -30)) fail('loudness must be between -30 and -8 LUFS');
if (!(cfg.boil >= 0 && cfg.boil <= 12)) fail('boil must be between 0 (off) and 12 redraws per second');
+ if (cfg.watermark !== false && !(typeof cfg.watermark === 'string' && cfg.watermark.trim() && cfg.watermark.length <= 40)) {
+ fail('watermark must be false or a short text of up to 40 characters, like "example.com"');
+ }
let music = cfg.music;
if (music === true) music = { style: THEME_MUSIC[cfg.theme] };