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.

Add the editorial look (#25)

Vincent Schmalbach8fa2da52b4e3
diff --git a/AGENTS.md b/AGENTS.md
index 8e65d17..84a0de5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -67,8 +67,9 @@ When you ask, put everything you need in one message. Typical reasons to ask:
Projects go in `videos/`. Git ignores that folder. Pick the look that fits
the audience: `paper` (friendly, hand drawn, the default), `clean`
- (products and business), `chalk` (teaching), `blueprint` (engineering) or
- `midnight` (developer tools). Pick the size for the place the video goes,
+ (products and business), `chalk` (teaching), `blueprint` (engineering),
+ `midnight` (developer tools) or `editorial` (essays, history, money and
+ other thoughtful topics). Pick the size for the place the video goes,
for example `--size tiktok` or `--size linkedin`. The sizes are listed in
"Sizes for each platform" below. Add `--pace 1.2` when the user wants a
quicker video.
@@ -704,6 +705,7 @@ The looks:
| `chalk` | chalk on a green board | brush | calm |
| `blueprint` | white drawings on blueprint blue | wipe | tech |
| `midnight` | dark background with glowing colors | zoom | tech |
+| `editorial` | serif headlines and fine lines on warm paper, like a magazine | fade | calm |
### Custom looks
@@ -920,7 +922,8 @@ one `exit: 'none'` and the new one the same time as its `at`.
| `sfx` | the sound on entrance, or `false` |
In `paper`, `chalk` and `blueprint`, shapes are drawn line by line and text
-is written out. In `clean` and `midnight`, shapes pop and text rises. Use
+is written out. In `clean` and `midnight`, shapes pop and text rises. In
+`editorial`, shapes fade in and text rises. Use
`at: -1` for things that were already on screen in the previous scene. They
are there from the start and make no sound.
diff --git a/README.md b/README.md
index e6eacec..b3f7768 100644
--- a/README.md
+++ b/README.md
@@ -81,15 +81,15 @@ for each image.
## Looks
-There are five looks: paper, clean, chalk, blueprint and midnight. You change
-a video's look with one setting in `video.json`. A project can also bring its
-own look, a small JSON file with its colors, fonts and background. Here is one
-frame in each built-in look, from the example videos.
+There are six looks: paper, clean, chalk, blueprint, midnight and editorial.
+You change a video's look with one setting in `video.json`. A project can also
+bring its own look, a small JSON file with its colors, fonts and background.
+Here is one frame in each built-in look, from the example videos.
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/media/looks-dark.webp">
- <img src="docs/media/looks-light.webp" alt="Frames from five example videos, one in each look: paper, clean, chalk, blueprint and midnight" width="820">
+ <img src="docs/media/looks-light.webp" alt="Frames from six example videos, one in each look: paper, clean, chalk, blueprint, midnight and editorial" width="820">
</picture>
</p>
diff --git a/docs/media/looks-dark.webp b/docs/media/looks-dark.webp
index ce4ddc1..ac02a03 100644
Binary files a/docs/media/looks-dark.webp and b/docs/media/looks-dark.webp differ
diff --git a/docs/media/looks-light.webp b/docs/media/looks-light.webp
index 71da9cb..4c9e3bc 100644
Binary files a/docs/media/looks-light.webp and b/docs/media/looks-light.webp differ
diff --git a/engine/themes.js b/engine/themes.js
index 72532d4..dc9322f 100644
--- a/engine/themes.js
+++ b/engine/themes.js
@@ -1,4 +1,4 @@
-// The five looks. A theme decides colors, fonts, how strokes are drawn, how
+// The six looks. A theme decides colors, fonts, how strokes are drawn, how
// elements enter, the default transition, the sound palette and the music.
import { mulberry32, mixColor, withAlpha, parseColor, rgba, clamp } from './util.js';
@@ -162,7 +162,39 @@ const MIDNIGHT = {
caption: { bg: 'rgba(7,11,22,0.82)', fg: '#e8eef8', active: '#22d3ee' },
};
-export const THEMES = { paper: PAPER, clean: CLEAN, chalk: CHALK, blueprint: BLUEPRINT, midnight: MIDNIGHT };
+const EDITORIAL = {
+ name: 'editorial',
+ background: 'paper',
+ music: 'calm',
+ dark: false,
+ bg: '#f5f1ea',
+ ink: '#1c1a17',
+ muted: '#76706a',
+ surface: '#fffdf9',
+ accent: 'red',
+ colors: {
+ red: '#c2462b', orange: '#c7782a', yellow: '#b8932a', green: '#3d7a57', teal: '#2c7a74',
+ blue: '#2f5b88', purple: '#6a4e8c', pink: '#b04870', gray: '#8a847b', ink: '#1c1a17',
+ },
+ fonts: {
+ display: { family: 'Instrument Serif', weight: 400 },
+ body: { family: 'Inter', weight: 400 },
+ hand: { family: 'Instrument Serif', weight: 400 },
+ mono: { family: 'JetBrains Mono', weight: 400 },
+ },
+ stroke: { rough: false, width: 2.5 },
+ radius: 8,
+ tintStrength: 0.1,
+ shadow: { color: 'rgba(40,32,20,0.10)', blur: 24, y: 8 },
+ enter: { shape: 'fade', text: 'rise', title: 'rise', icon: 'fade', image: 'fade', list: 'rise', code: 'fade', chart: 'grow', number: 'rise', arrow: 'draw', line: 'draw' },
+ transition: 'fade',
+ sfx: { shape: 'pop', arrow: 'whoosh', line: 'whoosh', icon: 'pop', image: 'pop', text: null, title: null, list: 'blip', number: 'tick', annotate: 'whoosh', chart: 'whoosh', code: 'type', terminal: 'type', burst: 'sparkle', transition: 'swipe' },
+ code: { bg: '#1c1a17', fg: '#f3eee6', comment: '#8a847b', keyword: '#e0896f', string: '#a9c49a', number: '#e3b866', fn: '#9cc3dd', punct: '#bdb6aa', lineNo: '#6b655d', highlight: 'rgba(227,184,102,0.16)', border: '#1c1a17' },
+ terminal: { bg: '#1c1a17', fg: '#f3eee6', prompt: '#e3b866', muted: '#a49d92', bar: '#2c2925' },
+ caption: { bg: 'rgba(28,26,23,0.86)', fg: '#fffdf9', active: '#e3b866' },
+};
+
+export const THEMES = { paper: PAPER, clean: CLEAN, chalk: CHALK, blueprint: BLUEPRINT, midnight: MIDNIGHT, editorial: EDITORIAL };
export function getTheme(name, look = null) {
const t = THEMES[look ? look.extends : name];
diff --git a/examples/leap-years/.gitignore b/examples/leap-years/.gitignore
new file mode 100644
index 0000000..3c0160d
--- /dev/null
+++ b/examples/leap-years/.gitignore
@@ -0,0 +1,2 @@
+build/
+out/
diff --git a/examples/leap-years/scenes.js b/examples/leap-years/scenes.js
new file mode 100644
index 0000000..42deab0
--- /dev/null
+++ b/examples/leap-years/scenes.js
@@ -0,0 +1,156 @@
+// All labels use s.text; custom canvas work is limited to geometry.
+const INK = 'ink';
+function text(s, str, x, y, size, o = {}) {
+ return s.text(str, { x, y, size, color: INK, sfx: false, ...o });
+}
+function frame(s, title, at = 0) {
+ text(s, 'CALENDARS & THE SEASONS', 170, 120, 32, { align: 'left', color: 'muted', at: -1, enter: 'none' });
+ text(s, title, 170, 222, 104, { align: 'left', font: 'display', at, enter: 'rise' });
+ s.line([[170, 308], [1750, 308]], { color: 'ink', width: 1, at: -1, enter: 'none', opacity: 0.3, sfx: false });
+}
+function orbit(s, x, y, r, at, o = {}) {
+ s.draw({ at, sfx: false, enter: 'fade', ...o }, (c, life) => {
+ c.strokeStyle = s.color('ink'); c.lineWidth = 2;
+ c.beginPath(); c.arc(x, y, r, 0, Math.PI * 2); c.stroke();
+ c.fillStyle = s.color('surface');
+ c.beginPath(); c.arc(x, y, 38, 0, Math.PI * 2); c.fill(); c.stroke();
+ for (let i = 0; i < 12; i++) {
+ const a = i * Math.PI / 6;
+ c.beginPath(); c.moveTo(x + Math.cos(a) * 51, y + Math.sin(a) * 51);
+ c.lineTo(x + Math.cos(a) * 64, y + Math.sin(a) * 64); c.stroke();
+ }
+ const a = -Math.PI / 2 + Math.min(1, life.local / Math.max(1, s.dur - s.time(at))) * Math.PI * 2;
+ const ex = x + Math.cos(a) * r, ey = y + Math.sin(a) * r;
+ c.fillStyle = s.color('ink'); c.beginPath(); c.arc(ex, ey, 19, 0, Math.PI * 2); c.fill();
+ c.strokeStyle = s.color('surface'); c.lineWidth = 1.5;
+ c.beginPath(); c.ellipse(ex, ey, 7, 15, 0.3, 0, Math.PI * 2); c.stroke();
+ });
+}
+function dateCard(s, x, y, w, h, at, o = {}) {
+ s.draw({ at, sfx: false, enter: 'fade', ...o }, (c) => {
+ c.fillStyle = s.color('surface'); c.strokeStyle = s.color('ink'); c.lineWidth = 2;
+ c.beginPath(); c.roundRect(x - w / 2, y - h / 2, w, h, 8); c.fill(); c.stroke();
+ c.beginPath(); c.moveTo(x - w / 2, y - h / 2 + 100); c.lineTo(x + w / 2, y - h / 2 + 100); c.stroke();
+ for (const dx of [-w * 0.25, w * 0.25]) {
+ c.beginPath(); c.moveTo(x + dx, y - h / 2 - 20); c.lineTo(x + dx, y - h / 2 + 20); c.stroke();
+ }
+ });
+}
+function fractions(s, at, x, y, gap = 180, size = 130, out, combineAt) {
+ s.draw({ at, out, sfx: false, enter: 'fade' }, (c, life) => {
+ const alpha = c.globalAlpha;
+ const q = combineAt ? s.p(combineAt, 0.85) : 0;
+ const targetX = x + gap * 1.5;
+ for (let i = 0; i < 4; i++) {
+ const p = s.clamp((life.local - i * 0.65) / 0.6, 0, 1);
+ c.strokeStyle = s.color('ink'); c.lineWidth = 1.5;
+ c.globalAlpha = alpha * (1 - q);
+ c.strokeRect(x + i * gap, y, size, size);
+ c.globalAlpha = alpha;
+ c.fillStyle = s.color('accent');
+ const h = (size - 10) * 0.2422 * p;
+ c.fillRect(s.lerp(x + i * gap + 5, targetX + 5, q), s.lerp(y + size - 5 - h, y + size - 5 - h * (i + 1), q), size - 10, h);
+ }
+ c.globalAlpha = alpha * q;
+ c.strokeStyle = s.color('ink'); c.lineWidth = 1.5;
+ c.strokeRect(targetX, y, size, size);
+ });
+}
+export default {
+ hook(s) {
+ text(s, 'THE CALENDAR', 180, 180, 34, { align: 'left', color: 'muted', at: 0, enter: 'none' });
+ text(s, 'Why we have\nleap years', 180, 425, 110, { align: 'left', font: 'display', at: 0, enter: 'none', lineHeight: 1.12 });
+ s.line([[180, 618], [780, 618]], { color: 'ink', width: 1, at: '#question', sfx: false });
+ text(s, 'Keeping dates with the seasons', 180, 704, 42, { align: 'left', at: '#calendar', enter: 'fade' });
+ dateCard(s, 1360, 540, 430, 480, 0, { enter: 'none' });
+ text(s, 'February', 1360, 348, 46, { at: 0, enter: 'none' });
+ text(s, '29', 1360, 555, 190, { font: 'display', color: 'accent', at: 0, enter: 'none' });
+ s.line([[1260, 685], [1460, 685]], { color: 'accent', width: 3, at: '#calendar', sfx: false });
+ text(s, 'An extra day', 1360, 850, 44, { at: 'extra day', enter: 'fade' });
+ },
+ orbit(s) {
+ frame(s, 'A year has a fraction', '#orbit');
+ orbit(s, 520, 610, 215, '#orbit');
+ text(s, 'Earth around the Sun', 520, 900, 40, { at: '#orbit', color: 'muted' });
+ text(s, '365.2422', 1230, 520, 132, { font: 'display', at: '#orbit' });
+ text(s, 'days', 1230, 640, 48, { at: s.cueEnd('365.2422') });
+ s.line([[1188, 578], [1424, 578]], { color: 'accent', width: 4, at: '#fraction', sfx: false });
+ text(s, 'The fraction matters', 1230, 820, 46, { at: '#fraction', color: 'accent' });
+ },
+ drift(s) {
+ frame(s, 'The fraction adds up', '#regular');
+ text(s, 'Calendar year', 170, 438, 44, { at: '#regular', align: 'left' });
+ text(s, '365 days', 170, 545, 104, { font: 'display', at: '#regular', align: 'left' });
+ s.line([[700, 385], [700, 800]], { width: 1, opacity: 0.25, at: '#gap', sfx: false });
+ text(s, 'Almost a quarter day', 830, 438, 54, { font: 'display', color: 'accent', at: '#gap', align: 'left' });
+ fractions(s, '#gap', 830, 555, 205, 135);
+ text(s, 'more each year', 830, 735, 42, { align: 'left', at: '#gap' });
+ text(s, 'The difference accumulates', 830, 842, 42, { align: 'left', color: 'accent', at: '#build' });
+ text(s, 'Fractions enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#gap' });
+ },
+ leap(s) {
+ frame(s, 'An extra day in February', '#four');
+ fractions(s, '#four', 225, 515, 180, 130, undefined, '#date');
+ text(s, 'Every four years', 565, 760, 54, { font: 'display', at: '#four' });
+ s.arrow([960, 585], [1140, 585], { at: '#date', width: 2, color: 'ink', sfx: false });
+ dateCard(s, 1440, 600, 380, 450, '#date');
+ text(s, 'February', 1440, 424, 44, { at: '#date' });
+ text(s, '29', 1440, 625, 170, { font: 'display', color: 'accent', at: '#date' });
+ text(s, 'Fractions enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#four' });
+ s.sfx('chime', '#date', { gain: 0.18 });
+ },
+ correction(s) {
+ frame(s, 'A little too much', '#extra');
+ text(s, "Earth's cycle", 170, 458, 44, { align: 'left', at: '#extra' });
+ text(s, 'Calendar correction', 170, 633, 44, { align: 'left', at: '#extra' });
+ s.draw({ at: '#extra', enter: 'fade', sfx: false }, (c, life) => {
+ const x = 700, target = 1550, y1 = 458, y2 = 633;
+ c.strokeStyle = s.color('ink'); c.lineWidth = 2;
+ c.beginPath(); c.moveTo(x, y1); c.lineTo(target, y1); c.stroke();
+ c.beginPath(); c.moveTo(target, 395); c.lineTo(target, 735); c.stroke();
+ const p = s.clamp(life.local / 3.0, 0, 1);
+ c.beginPath(); c.moveTo(x, y2); c.lineTo(x + (target - x) * p, y2); c.stroke();
+ c.strokeStyle = s.color('accent'); c.lineWidth = 8;
+ const q = s.p('#over', 1.2);
+ c.beginPath(); c.moveTo(target, y2); c.lineTo(target + 110 * q, y2); c.stroke();
+ });
+ text(s, 'An occasional exception', 960, 825, 66, { font: 'display', color: 'accent', at: '#over' });
+ text(s, 'Difference enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#extra' });
+ },
+ rule(s) {
+ frame(s, 'The century exception', '#gregorian');
+ text(s, 'Gregorian calendar', 170, 438, 68, { font: 'display', align: 'left', at: '#gregorian' });
+ text(s, 'Introduced in 1582', 170, 529, 42, { align: 'left', color: 'muted', at: 'introduced' });
+ text(s, 'Century year', 1110, 429, 58, { font: 'display', at: '#skip' });
+ text(s, 'Skip the leap day', 1110, 525, 44, { at: '#skip' });
+ s.line([[750, 632], [1470, 632]], { color: 'ink', width: 1, at: '#keep', opacity: 0.4, sfx: false });
+ text(s, 'Unless divisible by 400', 1110, 736, 62, { font: 'display', color: 'accent', at: '#keep' });
+ text(s, 'Keep the leap day', 1110, 837, 44, { at: '#keep' });
+ },
+ examples(s) {
+ frame(s, 'The rule in practice', '#no');
+ text(s, '1900', 520, 520, 144, { font: 'display', at: '#no' });
+ text(s, 'No leap day', 520, 685, 48, { at: '#no' });
+ s.draw({ at: '#no', enter: 'fade', sfx: false }, (c) => {
+ c.strokeStyle = s.color('ink'); c.lineWidth = 2;
+ c.beginPath(); c.moveTo(493, 783); c.lineTo(547, 837); c.moveTo(547, 783); c.lineTo(493, 837); c.stroke();
+ });
+ s.line([[960, 410], [960, 878]], { width: 1, opacity: 0.25, at: '#yes', sfx: false });
+ text(s, '2000', 1380, 520, 144, { font: 'display', color: 'accent', at: '#yes' });
+ text(s, 'February 29', 1380, 685, 48, { at: '#yes' });
+ s.draw({ at: '#yes', enter: 'fade', sfx: false }, (c) => {
+ c.strokeStyle = s.color('accent'); c.lineWidth = 3;
+ c.beginPath(); c.moveTo(1350, 810); c.lineTo(1372, 832); c.lineTo(1412, 786); c.stroke();
+ });
+ s.sfx('chime', '#yes', { gain: 0.16 });
+ },
+ close(s) {
+ frame(s, 'Keeping dates with the seasons', '#finish');
+ dateCard(s, 530, 612, 350, 420, '#finish');
+ text(s, 'February', 530, 451, 42, { at: '#finish' });
+ text(s, '29', 530, 638, 160, { font: 'display', color: 'accent', at: '#finish' });
+ s.line([[840, 615], [1040, 615]], { color: 'accent', width: 2, at: 'dates', sfx: false });
+ orbit(s, 1340, 615, 195, 'dates');
+ text(s, "Earth's yearly cycle", 1340, 901, 42, { at: 'seasons' });
+ },
+};
diff --git a/examples/leap-years/script.md b/examples/leap-years/script.md
new file mode 100644
index 0000000..d69372d
--- /dev/null
+++ b/examples/leap-years/script.md
@@ -0,0 +1,25 @@
+# Why we have leap years
+
+## hook {chapter="The extra fraction"}
+[#question] Why does February sometimes get an extra day? [#calendar] Our calendar needs a small adjustment to follow Earth's year.
+
+## orbit
+[#orbit] Earth takes about {365.2422|three hundred sixty five point two four two two} days to go around the Sun. [#fraction] That fraction matters when we count whole days on a calendar.
+
+## drift
+[#regular] A regular calendar year has {365|three hundred sixty five} days. [#gap] So the calendar drifts by almost a quarter day each year. [#build] The difference keeps building up.
+
+## leap {chapter="February's extra day"}
+[#four] Adding an extra day every four years fixes most of that drift. [#date] The extra day is February {29|twenty nine}.
+
+## correction
+[#extra] But this adds a little too much time. [#over] The calendar needs an occasional exception to keep that overcorrection small.
+
+## rule {chapter="The century exception"}
+[#gregorian] The Gregorian calendar, introduced in 1582, makes that adjustment. [#skip] It skips leap days in century years, [#keep] unless the year divides evenly by {400|four hundred}.
+
+## examples
+[#no] That rule explains why 1900 was not a leap year. [#yes] But {2000|two thousand} divided evenly by {400|four hundred}, so it kept its leap day.
+
+## close {hold=1.1}
+[#finish] Leap years keep calendar dates close to Earth's yearly cycle through the seasons.
diff --git a/examples/leap-years/video.json b/examples/leap-years/video.json
new file mode 100644
index 0000000..8b9eb9a
--- /dev/null
+++ b/examples/leap-years/video.json
@@ -0,0 +1,16 @@
+{
+ "title": "Why we have leap years",
+ "theme": "editorial",
+ "size": "youtube",
+ "voice": "af_heart",
+ "music": {
+ "style": "calm",
+ "volume": 0.1
+ },
+ "captions": false,
+ "speed": 1.0,
+ "sfx": "minimal",
+ "cover": "hook@end",
+ "transition": "fade",
+ "end": 1.0
+}
diff --git a/src/cli.js b/src/cli.js
index fe82f9a..271a5e1 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -221,6 +221,7 @@ export async function main(argv) {
chalk: 'chalk on a green board with hatched fills; brush transitions; calm music',
blueprint: 'white technical drafting on blueprint blue with a grid; wipe transitions; tech music',
midnight: 'dark developer look with glowing accents; zoom transitions; tech music',
+ editorial: 'serif headlines and fine lines on warm paper, like a magazine; fade transitions; calm music',
};
print(THEMES.map((t) => `${t.padEnd(10)} ${desc[t]}`).join('\n') + `\n\nCustom looks: set theme in video.json to a relative .json file that extends a built-in look.\nmusic styles: ${MUSIC_STYLES.join(', ')}`, { themes: desc, music: MUSIC_STYLES });
return 0;
diff --git a/test/looks.test.js b/test/looks.test.js
index 5e92847..3708930 100644
--- a/test/looks.test.js
+++ b/test/looks.test.js
@@ -126,5 +126,5 @@ test('editing a look changes the state version and reloads its values', t => {
const next = makeState(loadProject(dir), {});
assert.notEqual(first.version, next.version);
assert.equal(next.config.look.bg, '#eeeeee');
- assert.deepEqual(THEMES, ['paper', 'clean', 'chalk', 'blueprint', 'midnight']);
+ assert.deepEqual(THEMES, ['paper', 'clean', 'chalk', 'blueprint', 'midnight', 'editorial']);
});