@biunow/agent-biutalk 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/server.js +355 -0
- package/engine/AGENTS.md +1414 -0
- package/engine/CLAUDE.md +1 -0
- package/engine/LICENSE +21 -0
- package/engine/README.md +216 -0
- package/engine/bin/explainroo.js +19 -0
- package/engine/dev/audio-lab.mjs +268 -0
- package/engine/docs/media/contact-sheet.jpg +0 -0
- package/engine/docs/media/dns-poster.jpg +0 -0
- package/engine/docs/media/intro-poster.jpg +0 -0
- package/engine/docs/media/logo-dark.png +0 -0
- package/engine/docs/media/logo-light.png +0 -0
- package/engine/docs/media/looks-dark.webp +0 -0
- package/engine/docs/media/looks-light.webp +0 -0
- package/engine/docs/media/product-demo.webp +0 -0
- package/engine/docs/media/rebase-poster.jpg +0 -0
- package/engine/docs/media/sizes-dark.webp +0 -0
- package/engine/docs/media/sizes-light.webp +0 -0
- package/engine/engine/audio/dsp.js +69 -0
- package/engine/engine/audio/instruments.js +147 -0
- package/engine/engine/audio/music.js +576 -0
- package/engine/engine/audio/pcm.js +93 -0
- package/engine/engine/audio/rng.js +40 -0
- package/engine/engine/audio/sfx.js +287 -0
- package/engine/engine/audio/soundtrack.js +201 -0
- package/engine/engine/audio/synth.js +721 -0
- package/engine/engine/audio/theory.js +105 -0
- package/engine/engine/audio/wav.js +47 -0
- package/engine/engine/captions.js +131 -0
- package/engine/engine/clips.js +107 -0
- package/engine/engine/code.js +179 -0
- package/engine/engine/director.js +475 -0
- package/engine/engine/frame.html +135 -0
- package/engine/engine/icons/LICENSE-lucide.txt +43 -0
- package/engine/engine/icons/lucide-tags.json +1 -0
- package/engine/engine/icons/lucide.json +1 -0
- package/engine/engine/layout.js +69 -0
- package/engine/engine/pathdata.js +234 -0
- package/engine/engine/pen.js +240 -0
- package/engine/engine/player.html +67 -0
- package/engine/engine/player.js +219 -0
- package/engine/engine/readability.js +9 -0
- package/engine/engine/runtime.js +690 -0
- package/engine/engine/stage.js +2247 -0
- package/engine/engine/studio.html +216 -0
- package/engine/engine/text.js +81 -0
- package/engine/engine/themes.js +360 -0
- package/engine/engine/transitions.js +161 -0
- package/engine/engine/ui.js +1042 -0
- package/engine/engine/upload.js +32 -0
- package/engine/engine/util.js +204 -0
- package/engine/examples/callbacks-to-async-await/code-versions.js +34 -0
- package/engine/examples/callbacks-to-async-await/scenes.js +106 -0
- package/engine/examples/callbacks-to-async-await/script.md +22 -0
- package/engine/examples/callbacks-to-async-await/video.json +16 -0
- package/engine/examples/circle-area/scenes.js +228 -0
- package/engine/examples/circle-area/script.md +37 -0
- package/engine/examples/circle-area/video.json +14 -0
- package/engine/examples/explainroo-intro/scenes.js +133 -0
- package/engine/examples/explainroo-intro/script.md +27 -0
- package/engine/examples/explainroo-intro/video.json +8 -0
- package/engine/examples/how-dns-works/scenes.js +130 -0
- package/engine/examples/how-dns-works/script.md +28 -0
- package/engine/examples/how-dns-works/video.json +8 -0
- package/engine/examples/leap-years/scenes.js +156 -0
- package/engine/examples/leap-years/script.md +25 -0
- package/engine/examples/leap-years/video.json +16 -0
- package/engine/examples/leap-years-ja/scenes.js +194 -0
- package/engine/examples/leap-years-ja/script.md +32 -0
- package/engine/examples/leap-years-ja/video.json +17 -0
- package/engine/examples/merge-vs-rebase/scenes.js +129 -0
- package/engine/examples/merge-vs-rebase/script.md +22 -0
- package/engine/examples/merge-vs-rebase/video.json +8 -0
- package/engine/examples/password-storage-zh/scenes.js +185 -0
- package/engine/examples/password-storage-zh/script.md +25 -0
- package/engine/examples/password-storage-zh/video.json +19 -0
- package/engine/examples/sqlite-demo/README.md +19 -0
- package/engine/examples/sqlite-demo/scenes.js +423 -0
- package/engine/examples/sqlite-demo/script.md +35 -0
- package/engine/examples/sqlite-demo/video.json +17 -0
- package/engine/examples/unspar-demo/assets/fonts/Figtree-400.woff2 +0 -0
- package/engine/examples/unspar-demo/assets/fonts/Figtree-500.woff2 +0 -0
- package/engine/examples/unspar-demo/assets/fonts/Figtree-600.woff2 +0 -0
- package/engine/examples/unspar-demo/assets/fonts/Figtree-700.woff2 +0 -0
- package/engine/examples/unspar-demo/assets/fonts/Figtree-OFL.txt +93 -0
- package/engine/examples/unspar-demo/assets/unspar-logo.svg +23 -0
- package/engine/examples/unspar-demo/scenes.js +367 -0
- package/engine/examples/unspar-demo/script.md +25 -0
- package/engine/examples/unspar-demo/video.json +21 -0
- package/engine/examples/why-is-the-sky-blue-es/scenes.js +160 -0
- package/engine/examples/why-is-the-sky-blue-es/script.md +22 -0
- package/engine/examples/why-is-the-sky-blue-es/video.json +15 -0
- package/engine/fonts/ArchitectsDaughter-400-latin-ext.woff2 +0 -0
- package/engine/fonts/ArchitectsDaughter-400-latin.woff2 +0 -0
- package/engine/fonts/CabinSketch-400-latin.woff2 +0 -0
- package/engine/fonts/CabinSketch-700-latin.woff2 +0 -0
- package/engine/fonts/InstrumentSerif-400-italic-latin-ext.woff2 +0 -0
- package/engine/fonts/InstrumentSerif-400-italic-latin.woff2 +0 -0
- package/engine/fonts/InstrumentSerif-400-normal-latin-ext.woff2 +0 -0
- package/engine/fonts/InstrumentSerif-400-normal-latin.woff2 +0 -0
- package/engine/fonts/Inter-400-latin-ext.woff2 +0 -0
- package/engine/fonts/Inter-400-latin.woff2 +0 -0
- package/engine/fonts/JetBrainsMono-400-latin-ext.woff2 +0 -0
- package/engine/fonts/JetBrainsMono-400-latin.woff2 +0 -0
- package/engine/fonts/Kalam-400-latin-ext.woff2 +0 -0
- package/engine/fonts/Kalam-400-latin.woff2 +0 -0
- package/engine/fonts/Kalam-700-latin-ext.woff2 +0 -0
- package/engine/fonts/Kalam-700-latin.woff2 +0 -0
- package/engine/fonts/NotoSansDevanagari-400.ttf +0 -0
- package/engine/fonts/NotoSansDevanagari-700.ttf +0 -0
- package/engine/fonts/PatrickHand-400-latin-ext.woff2 +0 -0
- package/engine/fonts/PatrickHand-400-latin.woff2 +0 -0
- package/engine/fonts/PlusJakartaSans-600-latin-ext.woff2 +0 -0
- package/engine/fonts/PlusJakartaSans-600-latin.woff2 +0 -0
- package/engine/fonts/SpaceGrotesk-500-latin-ext.woff2 +0 -0
- package/engine/fonts/SpaceGrotesk-500-latin.woff2 +0 -0
- package/engine/fonts/fonts.json +216 -0
- package/engine/fonts/licenses/ArchitectsDaughter-OFL.txt +93 -0
- package/engine/fonts/licenses/CabinSketch-OFL.txt +93 -0
- package/engine/fonts/licenses/InstrumentSerif-OFL.txt +93 -0
- package/engine/fonts/licenses/Inter-OFL.txt +93 -0
- package/engine/fonts/licenses/JetBrainsMono-OFL.txt +93 -0
- package/engine/fonts/licenses/Kalam-OFL.txt +93 -0
- package/engine/fonts/licenses/NotoSansDevanagari-OFL.txt +118 -0
- package/engine/fonts/licenses/PatrickHand-OFL.txt +93 -0
- package/engine/fonts/licenses/PlusJakartaSans-OFL.txt +93 -0
- package/engine/fonts/licenses/SpaceGrotesk-OFL.txt +93 -0
- package/engine/package-lock.json +1201 -0
- package/engine/package.json +67 -0
- package/engine/scripts/build-icons.mjs +74 -0
- package/engine/scripts/fetch-fonts.mjs +68 -0
- package/engine/skills/explainroo/SKILL.md +51 -0
- package/engine/src/align.js +357 -0
- package/engine/src/browser.js +121 -0
- package/engine/src/capture.js +315 -0
- package/engine/src/chapters.js +32 -0
- package/engine/src/cli.js +421 -0
- package/engine/src/clips.js +19 -0
- package/engine/src/elevenlabs.js +90 -0
- package/engine/src/env.js +16 -0
- package/engine/src/export.js +187 -0
- package/engine/src/ffmpeg.js +103 -0
- package/engine/src/fonts.js +86 -0
- package/engine/src/g2p.py +76 -0
- package/engine/src/images.js +151 -0
- package/engine/src/licenses/misaki-Apache-2.0.txt +201 -0
- package/engine/src/math.js +83 -0
- package/engine/src/models.js +161 -0
- package/engine/src/phonemes.js +162 -0
- package/engine/src/pipeline.js +63 -0
- package/engine/src/project.js +331 -0
- package/engine/src/qa.js +186 -0
- package/engine/src/recordings.js +89 -0
- package/engine/src/render.js +156 -0
- package/engine/src/script.js +266 -0
- package/engine/src/server.js +288 -0
- package/engine/src/subtitles.js +78 -0
- package/engine/src/timeline.js +55 -0
- package/engine/src/voice.js +240 -0
- package/engine/src/wav.js +98 -0
- package/engine/templates/starter/scenes.js +31 -0
- package/engine/templates/starter/script.md +14 -0
- package/engine/test/align.test.js +108 -0
- package/engine/test/brand.test.js +41 -0
- package/engine/test/browser.test.js +89 -0
- package/engine/test/camera-browser.test.js +225 -0
- package/engine/test/caption-phrases.test.js +35 -0
- package/engine/test/capture-browser.test.js +90 -0
- package/engine/test/capture-fixture.js +46 -0
- package/engine/test/capture.test.js +62 -0
- package/engine/test/chapters.test.js +41 -0
- package/engine/test/cjk-browser.test.js +101 -0
- package/engine/test/cjk.test.js +232 -0
- package/engine/test/cli-exit.test.js +25 -0
- package/engine/test/cli.test.js +116 -0
- package/engine/test/clips-browser.test.js +125 -0
- package/engine/test/clips.test.js +67 -0
- package/engine/test/code-morph-browser.test.js +99 -0
- package/engine/test/code-morph.test.js +110 -0
- package/engine/test/contrast-browser.test.js +63 -0
- package/engine/test/contrast.test.js +80 -0
- package/engine/test/director.test.js +316 -0
- package/engine/test/engine-pure.test.js +29 -0
- package/engine/test/export-browser.test.js +224 -0
- package/engine/test/export.test.js +96 -0
- package/engine/test/fixtures/capture.html +55 -0
- package/engine/test/formats-pace.test.js +104 -0
- package/engine/test/languages-browser.test.js +78 -0
- package/engine/test/languages.test.js +140 -0
- package/engine/test/looks-browser.test.js +109 -0
- package/engine/test/looks-preview.test.js +57 -0
- package/engine/test/looks.test.js +130 -0
- package/engine/test/math-browser.test.js +114 -0
- package/engine/test/math.test.js +54 -0
- package/engine/test/multi-size-browser.test.js +133 -0
- package/engine/test/multi-size.test.js +116 -0
- package/engine/test/phonemes.test.js +92 -0
- package/engine/test/readability-browser.test.js +36 -0
- package/engine/test/readability.test.js +20 -0
- package/engine/test/render-options.test.js +52 -0
- package/engine/test/script.test.js +67 -0
- package/engine/test/server.test.js +256 -0
- package/engine/test/stills-browser.test.js +70 -0
- package/engine/test/subtitles.test.js +83 -0
- package/engine/test/timeline.test.js +31 -0
- package/engine/test/transparent-browser.test.js +123 -0
- package/engine/test/ui-kit.test.js +96 -0
- package/engine/test/upload-browser.test.js +55 -0
- package/engine/test/voice-providers.test.js +338 -0
- package/lib/host.mjs +480 -0
- package/manifest.json +54 -0
- package/package.json +8 -4
- package/skills/biutalk/SKILL.md +21 -0
- package/studio/app.js +209 -0
- package/studio/assert-panel-permit.mjs +67 -0
- package/studio/composer.css +354 -0
- package/studio/composer.js +169 -0
- package/studio/index.html +82 -0
- package/studio/looks/blueprint.svg +21 -0
- package/studio/looks/chalk.svg +15 -0
- package/studio/looks/clean.svg +20 -0
- package/studio/looks/editorial.svg +18 -0
- package/studio/looks/midnight.svg +17 -0
- package/studio/looks/paper.svg +11 -0
- package/studio/select-menu.js +268 -0
- package/studio/styles.css +4 -0
- package/README.md +0 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Why a circle has area pi r squared
|
|
2
|
+
|
|
3
|
+
## intro {chapter="Cut and rearrange"}
|
|
4
|
+
[#question] Why does a circle's area equal {πr²|pi times r squared}?
|
|
5
|
+
[#idea] Cutting it into slices helps us see where the formula comes from.
|
|
6
|
+
|
|
7
|
+
## measure {transition=fade}
|
|
8
|
+
[#radius] The radius, called {r|R}, measures from the center to the edge.
|
|
9
|
+
[#around] The circumference is the distance around, equal to {2πr|two times pi times R}.
|
|
10
|
+
|
|
11
|
+
## slices {transition=fade}
|
|
12
|
+
[#cut] Cut the circle into equal slices, each meeting at the center.
|
|
13
|
+
[#halves] Color half the slices yellow, and the other half blue.
|
|
14
|
+
|
|
15
|
+
## arrange {transition=cut}
|
|
16
|
+
[#move] Lay the slices side by side, alternating their directions.
|
|
17
|
+
[#same] Moving these pieces keeps their total area the same.
|
|
18
|
+
|
|
19
|
+
## refine {chapter="Approach a rectangle" transition=fade}
|
|
20
|
+
[#more] With more, thinner slices, the curved edges become flatter.
|
|
21
|
+
[#limit] As the slices get arbitrarily thin, the shape approaches a rectangle.
|
|
22
|
+
|
|
23
|
+
## edges {transition=fade}
|
|
24
|
+
[#top] Half the circle's circumference runs along the top, and half along the bottom.
|
|
25
|
+
[#width] Each long side approaches {πr|pi times R}, half of {2πr|two times pi times R}.
|
|
26
|
+
|
|
27
|
+
## height {transition=fade}
|
|
28
|
+
[#radius] Each slice has straight sides of length {r|R}, the circle's radius.
|
|
29
|
+
[#height] As the slices narrow, the rectangle's height approaches {r|R}.
|
|
30
|
+
|
|
31
|
+
## example {chapter="Multiply the two sides"}
|
|
32
|
+
[#two] For a radius of two, the rectangle's width is {2π|two times pi}.
|
|
33
|
+
[#multiply] Its height is two, giving an area of {4π|four times pi} square units.
|
|
34
|
+
|
|
35
|
+
## conclusion {hold=1.8}
|
|
36
|
+
[#product] A rectangle's area is its width times its height.
|
|
37
|
+
[#answer] So the circle's area is {πr²|pi times r squared}.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Why a circle has area pi r squared",
|
|
3
|
+
"theme": "chalk",
|
|
4
|
+
"size": "youtube",
|
|
5
|
+
"fps": 30,
|
|
6
|
+
"voice": "af_heart",
|
|
7
|
+
"speed": 0.96,
|
|
8
|
+
"music": { "style": "calm", "volume": 0.12 },
|
|
9
|
+
"sfx": "minimal",
|
|
10
|
+
"captions": false,
|
|
11
|
+
"cover": "intro@end",
|
|
12
|
+
"transition": "fade",
|
|
13
|
+
"end": 1.4
|
|
14
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// The explainroo launch video. Every reveal is tied to a spoken word or a
|
|
2
|
+
// [#marker] from script.md.
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
hook(s) {
|
|
6
|
+
s.icon('bot', { y: 330, size: 210, color: 'ink', at: 0, enter: 'none', float: 4 });
|
|
7
|
+
s.note('a coding agent', { y: 480, size: 40, at: 'agent' });
|
|
8
|
+
const xs = s.row(3, { width: 1100 });
|
|
9
|
+
const items = [
|
|
10
|
+
['video model', 'clapperboard', '#nomodel'],
|
|
11
|
+
['API keys', 'key-round', '#nokeys'],
|
|
12
|
+
['editing', 'scissors', '#noedit'],
|
|
13
|
+
];
|
|
14
|
+
items.forEach(([label, icon, at], i) => {
|
|
15
|
+
s.box(label, { id: `no${i}`, x: xs[i], y: 700, icon, w: 330, at, out: '#code', outDur: 0.3, exit: 'pop', size: 46 });
|
|
16
|
+
s.annotate(`no${i}`, { type: 'cross', color: 'red', at: s.time(at) + 0.55, out: '#code', outDur: 0.3, dur: 0.45 });
|
|
17
|
+
});
|
|
18
|
+
s.icon('code-xml', { x: 560, y: 700, size: 150, color: 'accent', at: s.mark('code') + 0.35 });
|
|
19
|
+
s.text('drawn with *JavaScript*', { font: 'display', size: 84, x: 660, y: 700, align: 'left', at: s.mark('code') + 0.5 });
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
files(s) {
|
|
23
|
+
s.title('explainroo', { y: 140, size: 110, at: 0 });
|
|
24
|
+
s.note('free and open source', { y: 235, size: 38, at: 'open' });
|
|
25
|
+
s.icon('bot', { id: 'agent', x: 330, y: 610, size: 190, at: '#writes', label: 'your agent', labelSize: 40 });
|
|
26
|
+
s.code('## hook\nA coding agent made this video with explainroo.\n[#code] Everything you see is drawn with JavaScript.', {
|
|
27
|
+
id: 'script', lang: 'md', title: 'script.md', x: 1170, y: 440, w: 1120, size: 31, at: '#script', reveal: 'lines', lineDelay: 0.25,
|
|
28
|
+
});
|
|
29
|
+
s.code("hook(s) {\n s.icon('bot', { at: 0 });\n s.icon('code-xml', { at: '#code' });\n}", {
|
|
30
|
+
id: 'scenes', lang: 'js', title: 'scenes.js', x: 1170, y: 800, w: 1120, size: 31, at: '#scenes', reveal: 'lines', lineDelay: 0.25,
|
|
31
|
+
});
|
|
32
|
+
s.arrow('agent', 'script', { at: s.mark('script') - 0.2, bend: -0.15 });
|
|
33
|
+
s.arrow('agent', 'scenes', { at: s.mark('scenes') - 0.2, bend: 0.15 });
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
voice(s) {
|
|
37
|
+
const y = 330;
|
|
38
|
+
s.box('script.md', { id: 'file', x: 330, y, icon: 'file-text', w: 330, at: 0.2 });
|
|
39
|
+
s.box('Kokoro', { id: 'tts', x: 960, y, icon: 'audio-lines', color: 'blue', w: 330, at: 'Kokoro' });
|
|
40
|
+
s.arrow('file', 'tts', { at: s.cue('Kokoro') - 0.3 });
|
|
41
|
+
s.icon('laptop', { x: 960, y: 555, size: 70, color: 'blue', at: '#local', enter: 'pop' });
|
|
42
|
+
s.note('runs on your computer', { x: 960, y: 630, size: 36, at: s.mark('local') + 0.2 });
|
|
43
|
+
s.box('Whisper', { id: 'asr', x: 1590, y, icon: 'ear', color: 'purple', w: 330, at: 'Whisper' });
|
|
44
|
+
s.arrow('tts', 'asr', { at: s.cue('Whisper') - 0.3 });
|
|
45
|
+
|
|
46
|
+
// A real word timeline: the words of the last sentence, placed at the
|
|
47
|
+
// times Whisper measured for them.
|
|
48
|
+
const from = s.cue('writes');
|
|
49
|
+
const words = s.words.filter((w) => w.start >= from - 0.01);
|
|
50
|
+
const t0 = words[0].start;
|
|
51
|
+
const t1 = words[words.length - 1].end;
|
|
52
|
+
const x0 = 250;
|
|
53
|
+
const x1 = 1670;
|
|
54
|
+
const lineY = 860;
|
|
55
|
+
s.line([[x0 - 30, lineY], [x1 + 60, lineY]], { color: 'muted', at: s.mark('whisper') + 0.4, width: 3 });
|
|
56
|
+
words.forEach((w, i) => {
|
|
57
|
+
const x = x0 + ((w.start - t0) / (t1 - t0)) * (x1 - x0);
|
|
58
|
+
s.line([[x, lineY - 14], [x, lineY + 14]], { color: 'purple', at: w.start, width: 4, sfx: false });
|
|
59
|
+
s.text(w.text.replace(/[.,]$/, ''), { x, y: i % 2 ? lineY + 58 : lineY - 52, size: 36, align: 'left', at: w.start, enter: 'pop', sfx: false });
|
|
60
|
+
s.note(`${w.start.toFixed(2)}s`, { x, y: i % 2 ? lineY + 100 : lineY - 94, size: 24, align: 'left', at: w.start + 0.1, enter: 'fade', color: 'purple', sfx: false });
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
sync(s) {
|
|
65
|
+
s.text('Word cues', { font: 'display', size: 84, y: 160, at: 0.1 });
|
|
66
|
+
s.icon('image', { id: 'pic', x: 700, y: 540, size: 170, color: 'blue', at: 'picture', out: '#code', bg: 'circle' });
|
|
67
|
+
s.icon('speech', { id: 'said', x: 1220, y: 540, size: 170, color: 'accent', at: 'mentions', out: '#code', bg: 'circle' });
|
|
68
|
+
s.arrow('pic', 'said', { head: 'both', dashed: true, label: 'at the same time', at: s.cue('mentions') + 0.25, out: '#code', color: 'muted' });
|
|
69
|
+
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 });
|
|
70
|
+
const db = s.icon('database', { id: 'db', x: 1450, y: 560, size: 260, color: 'purple', at: 'database', enter: 'pop', bg: 'circle', bgScale: 1.45 });
|
|
71
|
+
s.note('appears when the voice says it', { x: db.x, y: db.bottom + 60, size: 38, at: 'appears' });
|
|
72
|
+
s.burst({ x: 1450, y: 560, at: 'database', count: 36, power: 900 });
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
draw(s) {
|
|
76
|
+
s.icon('app-window', { x: 420, y: 470, size: 300, color: 'ink', at: 0.2, label: 'headless Chrome', labelSize: 40 });
|
|
77
|
+
const looks = [
|
|
78
|
+
['paper', '#f7f3ea', '#26221d', '#df5a3f'],
|
|
79
|
+
['clean', '#ffffff', '#111827', '#3b6cf6'],
|
|
80
|
+
['chalk', '#233d31', '#f2f0e6', '#f6e27f'],
|
|
81
|
+
['blueprint', '#12508f', '#f1f7ff', '#ffd866'],
|
|
82
|
+
['midnight', '#0b1020', '#e8eef8', '#22d3ee'],
|
|
83
|
+
];
|
|
84
|
+
const xs = s.row(5, { x: 1310, width: 820 });
|
|
85
|
+
looks.forEach(([name, bg, ink, accent], i) => {
|
|
86
|
+
s.box(name, { x: xs[i], y: 400, w: 190, h: 130, fill: bg, stroke: accent, textColor: ink, size: 34, at: s.mark('looks') + i * 0.22, enter: 'pop', sfx: i ? 'blip' : 'pop' });
|
|
87
|
+
});
|
|
88
|
+
s.note('five looks', { x: 1310, y: 520, size: 36, at: s.mark('looks') + 1.2 });
|
|
89
|
+
s.icon('music', { x: 1110, y: 760, size: 120, color: 'accent', at: 'music', label: 'music' });
|
|
90
|
+
s.icon('audio-waveform', { x: 1510, y: 760, size: 120, color: 'blue', at: 'effects', label: 'sound effects' });
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
eyes(s) {
|
|
94
|
+
s.icon('bot', { id: 'agent', x: 300, y: 560, size: 190, at: 0.1 });
|
|
95
|
+
s.icon('eye-off', { x: 300, y: 340, size: 90, color: 'muted', at: 'watch', out: '#give', exit: 'pop' });
|
|
96
|
+
s.icon('eye', { x: 300, y: 340, size: 100, color: 'accent', at: s.mark('give') + 0.3, enter: 'pop' });
|
|
97
|
+
const x = 830;
|
|
98
|
+
s.box('Still pictures', { id: 'stills', x, y: 300, icon: 'image', w: 400, at: '#stills', color: 'blue' });
|
|
99
|
+
s.box('Contact sheets', { id: 'sheets', x, y: 540, icon: 'layout-grid', w: 400, at: '#sheets', color: 'green' });
|
|
100
|
+
s.box('A check', { id: 'check', x, y: 780, icon: 'list-checks', w: 400, at: '#check', color: 'red' });
|
|
101
|
+
s.arrow('agent', 'stills', { at: s.mark('stills') - 0.2, bend: -0.12 });
|
|
102
|
+
s.arrow('agent', 'sheets', { at: s.mark('sheets') - 0.2 });
|
|
103
|
+
s.arrow('agent', 'check', { at: s.mark('check') - 0.2, bend: 0.12 });
|
|
104
|
+
s.list(
|
|
105
|
+
[
|
|
106
|
+
{ text: 'cut off text', at: 'cut' },
|
|
107
|
+
{ text: 'bad timing', at: 'timing' },
|
|
108
|
+
{ text: 'misread words', at: 'wrong' },
|
|
109
|
+
],
|
|
110
|
+
{ x: 1160, y: 690, size: 44, bullet: 'x', bulletColor: 'red', gap: 18, width: 600 },
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
render(s) {
|
|
115
|
+
const v = s.video;
|
|
116
|
+
s.terminal(
|
|
117
|
+
[
|
|
118
|
+
{ cmd: 'explainroo render examples/explainroo-intro', at: 0.3 },
|
|
119
|
+
{ out: `rendering ${v.duration.toFixed(1)}s (${v.frames} frames at ${v.fps} fps, ${v.width}x${v.height})`, at: 2.0, color: 'muted' },
|
|
120
|
+
{ out: 'wrote examples/explainroo-intro/out/video.mp4', at: 3.1, color: 'green' },
|
|
121
|
+
],
|
|
122
|
+
{ y: 520, w: 1400, size: 38, rows: 4, cps: 30, at: 0 },
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
outro(s) {
|
|
127
|
+
const t = s.title('explainroo', { y: 390, size: 150, at: 0.1 });
|
|
128
|
+
s.annotate({ x: t.x, y: t.y, w: t.w, h: t.h }, { type: 'underline', color: 'accent', at: 'free' });
|
|
129
|
+
s.subtitle('free and open source', { y: 560, at: 'free' });
|
|
130
|
+
s.text('github.com/vincentsch/explainroo', { font: 'mono', size: 46, y: 760, bg: true, border: 'ink', at: '#try' });
|
|
131
|
+
s.burst({ x: 960, y: 390, at: 'free', count: 40 });
|
|
132
|
+
},
|
|
133
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# explainroo
|
|
2
|
+
|
|
3
|
+
> Launch video. Every claim here is true of the kit as built.
|
|
4
|
+
|
|
5
|
+
## hook
|
|
6
|
+
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.
|
|
7
|
+
|
|
8
|
+
## files
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## voice
|
|
12
|
+
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.
|
|
13
|
+
|
|
14
|
+
## sync
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
## draw
|
|
18
|
+
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.
|
|
19
|
+
|
|
20
|
+
## eyes
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
## render {min=5.5}
|
|
24
|
+
One command turns all of it into an MP4 file.
|
|
25
|
+
|
|
26
|
+
## outro {hold=2}
|
|
27
|
+
explainroo is free and open source. [#try] The code and these example videos are on GitHub.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// How DNS finds a website. One diagram grows from scene to scene; parts that
|
|
2
|
+
// were introduced earlier are drawn with at: -1 so they are simply there.
|
|
3
|
+
|
|
4
|
+
const P = {
|
|
5
|
+
you: { x: 250, y: 560 },
|
|
6
|
+
resolver: { x: 800, y: 560 },
|
|
7
|
+
root: { x: 1500, y: 290 },
|
|
8
|
+
tld: { x: 1500, y: 580 },
|
|
9
|
+
auth: { x: 1500, y: 870 },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function question(s, o = {}) {
|
|
13
|
+
return s.text('What is the address of *example.com*?', { id: 'q', y: 120, size: 50, bg: true, border: 'muted', ...o });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function you(s, o = {}) {
|
|
17
|
+
return s.icon('laptop', { id: 'you', ...P.you, size: 150, label: 'your browser', labelSize: 40, ...o });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function resolver(s, o = {}) {
|
|
21
|
+
return s.box('Resolver', { id: 'resolver', ...P.resolver, icon: 'server', color: 'yellow', w: 330, ...o });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function root(s, o = {}) {
|
|
25
|
+
return s.box('Root server', { id: 'root', ...P.root, icon: 'globe', color: 'blue', w: 360, ...o });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function tld(s, o = {}) {
|
|
29
|
+
return s.box('.com servers', { id: 'tld', ...P.tld, icon: 'server', color: 'green', w: 360, ...o });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function auth(s, o = {}) {
|
|
33
|
+
return s.box('Name server', { id: 'auth', ...P.auth, icon: 'server', color: 'pink', w: 360, ...o });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
hook(s) {
|
|
38
|
+
s.text('example.com', { id: 'url', font: 'mono', size: 76, y: 300, bg: true, border: 'ink', at: 'type', enter: 'type', dur: 0.8, out: '#numbers' });
|
|
39
|
+
s.icon('app-window', { y: 640, size: 220, at: 'appears', out: '#but' });
|
|
40
|
+
s.icon('laptop', { id: 'a', x: 620, y: 660, size: 170, at: s.mark('but') + 0.3 });
|
|
41
|
+
s.icon('server', { id: 'b', x: 1300, y: 660, size: 170, at: s.mark('but') + 0.5 });
|
|
42
|
+
s.arrow('a', 'b', { dashed: true, color: 'muted', label: 'by name?', at: 'name', head: 'both' });
|
|
43
|
+
s.annotate('url', { type: 'cross', color: 'red', at: s.cueEnd('name') - 0.1, out: '#numbers', outDur: 0.2 });
|
|
44
|
+
s.text('203.0.113.7', { font: 'mono', size: 76, y: 300, bg: true, border: 'accent', at: s.mark('numbers') + 0.25, enter: 'type', dur: 0.8 });
|
|
45
|
+
s.note('an IP address', { y: 400, size: 40, at: 'addresses', color: 'yellow' });
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
question(s) {
|
|
49
|
+
you(s, { at: 0.1 });
|
|
50
|
+
question(s, { at: '#ask' });
|
|
51
|
+
s.icon('help-circle', { x: 800, y: 560, size: 150, color: 'yellow', at: 'address' });
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
cache(s) {
|
|
55
|
+
question(s, { at: -1 });
|
|
56
|
+
you(s, { at: -1 });
|
|
57
|
+
s.box('Browser cache', { id: 'bc', x: 800, y: 420, icon: 'history', w: 400, at: '#browser', color: 'blue' });
|
|
58
|
+
s.box('Operating system cache', { id: 'oc', x: 800, y: 720, icon: 'cpu', w: 400, size: 40, at: '#os', color: 'purple' });
|
|
59
|
+
s.arrow('you', 'bc', { at: s.mark('browser') + 0.1, bend: -0.15 });
|
|
60
|
+
s.arrow('you', 'oc', { at: s.mark('os') + 0.1, bend: 0.15 });
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
resolver(s) {
|
|
64
|
+
question(s, { at: -1 });
|
|
65
|
+
you(s, { at: -1 });
|
|
66
|
+
resolver(s, { at: 'resolver' });
|
|
67
|
+
s.arrow('you', 'resolver', { at: 'asks' });
|
|
68
|
+
s.note('run by your internet provider', { x: P.resolver.x, y: 735, size: 40, at: '#isp' });
|
|
69
|
+
s.note('or a public one, like 1.1.1.1', { x: P.resolver.x, y: 800, size: 40, at: '#public', color: 'yellow' });
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
root(s) {
|
|
73
|
+
question(s, { at: -1 });
|
|
74
|
+
you(s, { at: -1 });
|
|
75
|
+
resolver(s, { at: -1 });
|
|
76
|
+
s.arrow('you', 'resolver', { at: -1 });
|
|
77
|
+
root(s, { at: '#root' });
|
|
78
|
+
s.arrow('resolver', 'root', { at: 'starts', bend: -0.1 });
|
|
79
|
+
s.note("doesn't know the address", { x: P.root.x, y: P.root.y + 125, size: 36, at: 'address' });
|
|
80
|
+
s.arrow('root', 'resolver', { at: '#tld', bend: 0.8, dashed: true, color: 'blue', label: 'ask the .com servers', labelColor: 'blue', labelOffset: 40 });
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
tld(s) {
|
|
84
|
+
question(s, { at: -1 });
|
|
85
|
+
you(s, { at: -1 });
|
|
86
|
+
resolver(s, { at: -1 });
|
|
87
|
+
root(s, { at: -1 });
|
|
88
|
+
s.arrow('you', 'resolver', { at: -1 });
|
|
89
|
+
s.arrow('resolver', 'root', { at: -1, bend: -0.1 });
|
|
90
|
+
tld(s, { at: 'servers' });
|
|
91
|
+
s.arrow('resolver', 'tld', { at: s.cue('servers') + 0.2 });
|
|
92
|
+
s.arrow('tld', 'resolver', { at: '#auth', bend: -0.8, dashed: true, color: 'green', label: 'ask the name server', labelColor: 'green', labelOffset: 40 });
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
answer(s) {
|
|
96
|
+
const q = question(s, { at: -1 });
|
|
97
|
+
you(s, { at: -1 });
|
|
98
|
+
resolver(s, { at: -1 });
|
|
99
|
+
root(s, { at: -1 });
|
|
100
|
+
tld(s, { at: -1 });
|
|
101
|
+
s.arrow('you', 'resolver', { at: -1 });
|
|
102
|
+
s.arrow('resolver', 'root', { at: -1, bend: -0.1 });
|
|
103
|
+
s.arrow('resolver', 'tld', { at: -1 });
|
|
104
|
+
auth(s, { at: 'name' });
|
|
105
|
+
s.arrow('resolver', 'auth', { at: s.cue('name') + 0.2, bend: 0.1 });
|
|
106
|
+
s.arrow('auth', 'resolver', { at: '#ip', bend: 0.6, color: 'accent', width: 6, label: 'the IP address', labelColor: 'yellow', labelOffset: 44 });
|
|
107
|
+
s.arrow('resolver', 'you', { at: s.mark('ip') + 0.9, bend: 0.25, color: 'accent', width: 6 });
|
|
108
|
+
s.annotate('q', { type: 'box', color: 'green', at: s.mark('ip') + 1.4 });
|
|
109
|
+
s.icon('check', { x: q.right + 60, y: q.y, size: 70, color: 'green', at: s.mark('ip') + 1.6, enter: 'pop' });
|
|
110
|
+
s.icon('database', { x: P.resolver.x, y: 780, size: 90, color: 'yellow', at: '#keep', label: 'saved for the next request', labelSize: 36 });
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
outro(s) {
|
|
114
|
+
s.number(4, { suffix: ' questions', y: 360, at: 0.15 });
|
|
115
|
+
const chain = [
|
|
116
|
+
['laptop', 'you'],
|
|
117
|
+
['server', 'resolver'],
|
|
118
|
+
['globe', 'root'],
|
|
119
|
+
['server', '.com'],
|
|
120
|
+
['server', 'name server'],
|
|
121
|
+
];
|
|
122
|
+
const xs = s.row(5, { width: 1400 });
|
|
123
|
+
chain.forEach(([icon, label], i) => {
|
|
124
|
+
s.icon(icon, { id: `c${i}`, x: xs[i], y: 700, size: 110, label, labelSize: 36, at: s.mark('blink') + i * 0.3, color: i === 0 ? 'ink' : ['yellow', 'blue', 'green', 'pink'][i - 1] });
|
|
125
|
+
});
|
|
126
|
+
for (let i = 0; i < 4; i++) {
|
|
127
|
+
s.arrow(`c${i}`, `c${i + 1}`, { at: s.mark('blink') + (i + 1) * 0.3 + 0.1, color: 'muted', gap: 20 });
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# How DNS finds a website
|
|
2
|
+
|
|
3
|
+
> A classic explainer in the chalk look. The diagram grows from scene to
|
|
4
|
+
> scene: earlier parts are carried over with at: -1.
|
|
5
|
+
|
|
6
|
+
## hook
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## question
|
|
10
|
+
So before the page can load, [#ask] your browser needs the IP address of {example.com|example dot com}.
|
|
11
|
+
|
|
12
|
+
## cache
|
|
13
|
+
First it checks if it already knows the answer. [#browser] The browser [#os] and your operating system both keep recent answers in a cache.
|
|
14
|
+
|
|
15
|
+
## resolver
|
|
16
|
+
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}.
|
|
17
|
+
|
|
18
|
+
## root
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## tld
|
|
22
|
+
The dot com servers don't know it either. [#auth] They send the resolver to the name server of {example.com|example dot com}.
|
|
23
|
+
|
|
24
|
+
## answer
|
|
25
|
+
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.
|
|
26
|
+
|
|
27
|
+
## outro {hold=1.5}
|
|
28
|
+
That makes four questions to find one address. [#blink] It usually takes a fraction of a second.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// All labels use s.text; custom canvas work is limited to geometry.
|
|
2
|
+
const INK = 'ink';
|
|
3
|
+
function text(s, str, x, y, size, o = {}) {
|
|
4
|
+
return s.text(str, { x, y, size, color: INK, sfx: false, ...o });
|
|
5
|
+
}
|
|
6
|
+
function frame(s, title, at = 0) {
|
|
7
|
+
text(s, 'CALENDARS & THE SEASONS', 170, 120, 32, { align: 'left', color: 'muted', at: -1, enter: 'none' });
|
|
8
|
+
text(s, title, 170, 222, 104, { align: 'left', font: 'display', at, enter: 'rise' });
|
|
9
|
+
s.line([[170, 308], [1750, 308]], { color: 'ink', width: 1, at: -1, enter: 'none', opacity: 0.3, sfx: false });
|
|
10
|
+
}
|
|
11
|
+
function orbit(s, x, y, r, at, o = {}) {
|
|
12
|
+
s.draw({ at, sfx: false, enter: 'fade', ...o }, (c, life) => {
|
|
13
|
+
c.strokeStyle = s.color('ink'); c.lineWidth = 2;
|
|
14
|
+
c.beginPath(); c.arc(x, y, r, 0, Math.PI * 2); c.stroke();
|
|
15
|
+
c.fillStyle = s.color('surface');
|
|
16
|
+
c.beginPath(); c.arc(x, y, 38, 0, Math.PI * 2); c.fill(); c.stroke();
|
|
17
|
+
for (let i = 0; i < 12; i++) {
|
|
18
|
+
const a = i * Math.PI / 6;
|
|
19
|
+
c.beginPath(); c.moveTo(x + Math.cos(a) * 51, y + Math.sin(a) * 51);
|
|
20
|
+
c.lineTo(x + Math.cos(a) * 64, y + Math.sin(a) * 64); c.stroke();
|
|
21
|
+
}
|
|
22
|
+
const a = -Math.PI / 2 + Math.min(1, life.local / Math.max(1, s.dur - s.time(at))) * Math.PI * 2;
|
|
23
|
+
const ex = x + Math.cos(a) * r, ey = y + Math.sin(a) * r;
|
|
24
|
+
c.fillStyle = s.color('ink'); c.beginPath(); c.arc(ex, ey, 19, 0, Math.PI * 2); c.fill();
|
|
25
|
+
c.strokeStyle = s.color('surface'); c.lineWidth = 1.5;
|
|
26
|
+
c.beginPath(); c.ellipse(ex, ey, 7, 15, 0.3, 0, Math.PI * 2); c.stroke();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function dateCard(s, x, y, w, h, at, o = {}) {
|
|
30
|
+
s.draw({ at, sfx: false, enter: 'fade', ...o }, (c) => {
|
|
31
|
+
c.fillStyle = s.color('surface'); c.strokeStyle = s.color('ink'); c.lineWidth = 2;
|
|
32
|
+
c.beginPath(); c.roundRect(x - w / 2, y - h / 2, w, h, 8); c.fill(); c.stroke();
|
|
33
|
+
c.beginPath(); c.moveTo(x - w / 2, y - h / 2 + 100); c.lineTo(x + w / 2, y - h / 2 + 100); c.stroke();
|
|
34
|
+
for (const dx of [-w * 0.25, w * 0.25]) {
|
|
35
|
+
c.beginPath(); c.moveTo(x + dx, y - h / 2 - 20); c.lineTo(x + dx, y - h / 2 + 20); c.stroke();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function fractions(s, at, x, y, gap = 180, size = 130, out, combineAt) {
|
|
40
|
+
s.draw({ at, out, sfx: false, enter: 'fade' }, (c, life) => {
|
|
41
|
+
const alpha = c.globalAlpha;
|
|
42
|
+
const q = combineAt ? s.p(combineAt, 0.85) : 0;
|
|
43
|
+
const targetX = x + gap * 1.5;
|
|
44
|
+
for (let i = 0; i < 4; i++) {
|
|
45
|
+
const p = s.clamp((life.local - i * 0.65) / 0.6, 0, 1);
|
|
46
|
+
c.strokeStyle = s.color('ink'); c.lineWidth = 1.5;
|
|
47
|
+
c.globalAlpha = alpha * (1 - q);
|
|
48
|
+
c.strokeRect(x + i * gap, y, size, size);
|
|
49
|
+
c.globalAlpha = alpha;
|
|
50
|
+
c.fillStyle = s.color('accent');
|
|
51
|
+
const h = (size - 10) * 0.2422 * p;
|
|
52
|
+
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);
|
|
53
|
+
}
|
|
54
|
+
c.globalAlpha = alpha * q;
|
|
55
|
+
c.strokeStyle = s.color('ink'); c.lineWidth = 1.5;
|
|
56
|
+
c.strokeRect(targetX, y, size, size);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export default {
|
|
60
|
+
hook(s) {
|
|
61
|
+
text(s, 'THE CALENDAR', 180, 180, 34, { align: 'left', color: 'muted', at: 0, enter: 'none' });
|
|
62
|
+
text(s, 'Why we have\nleap years', 180, 425, 110, { align: 'left', font: 'display', at: 0, enter: 'none', lineHeight: 1.12 });
|
|
63
|
+
s.line([[180, 618], [780, 618]], { color: 'ink', width: 1, at: '#question', sfx: false });
|
|
64
|
+
text(s, 'Keeping dates with the seasons', 180, 704, 42, { align: 'left', at: '#calendar', enter: 'fade' });
|
|
65
|
+
dateCard(s, 1360, 540, 430, 480, 0, { enter: 'none' });
|
|
66
|
+
text(s, 'February', 1360, 348, 46, { at: 0, enter: 'none' });
|
|
67
|
+
text(s, '29', 1360, 555, 190, { font: 'display', color: 'accent', at: 0, enter: 'none' });
|
|
68
|
+
s.line([[1260, 685], [1460, 685]], { color: 'accent', width: 3, at: '#calendar', sfx: false });
|
|
69
|
+
text(s, 'An extra day', 1360, 850, 44, { at: 'extra day', enter: 'fade' });
|
|
70
|
+
},
|
|
71
|
+
orbit(s) {
|
|
72
|
+
frame(s, 'A year has a fraction', '#orbit');
|
|
73
|
+
orbit(s, 520, 610, 215, '#orbit');
|
|
74
|
+
text(s, 'Earth around the Sun', 520, 900, 40, { at: '#orbit', color: 'muted' });
|
|
75
|
+
text(s, '365.2422', 1230, 520, 132, { font: 'display', at: '#orbit' });
|
|
76
|
+
text(s, 'days', 1230, 640, 48, { at: s.cueEnd('365.2422') });
|
|
77
|
+
s.line([[1188, 578], [1424, 578]], { color: 'accent', width: 4, at: '#fraction', sfx: false });
|
|
78
|
+
text(s, 'The fraction matters', 1230, 820, 46, { at: '#fraction', color: 'accent' });
|
|
79
|
+
},
|
|
80
|
+
drift(s) {
|
|
81
|
+
frame(s, 'The fraction adds up', '#regular');
|
|
82
|
+
text(s, 'Calendar year', 170, 438, 44, { at: '#regular', align: 'left' });
|
|
83
|
+
text(s, '365 days', 170, 545, 104, { font: 'display', at: '#regular', align: 'left' });
|
|
84
|
+
s.line([[700, 385], [700, 800]], { width: 1, opacity: 0.25, at: '#gap', sfx: false });
|
|
85
|
+
text(s, 'Almost a quarter day', 830, 438, 54, { font: 'display', color: 'accent', at: '#gap', align: 'left' });
|
|
86
|
+
fractions(s, '#gap', 830, 555, 205, 135);
|
|
87
|
+
text(s, 'more each year', 830, 735, 42, { align: 'left', at: '#gap' });
|
|
88
|
+
text(s, 'The difference accumulates', 830, 842, 42, { align: 'left', color: 'accent', at: '#build' });
|
|
89
|
+
text(s, 'Fractions enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#gap' });
|
|
90
|
+
},
|
|
91
|
+
leap(s) {
|
|
92
|
+
frame(s, 'An extra day in February', '#four');
|
|
93
|
+
fractions(s, '#four', 225, 515, 180, 130, undefined, '#date');
|
|
94
|
+
text(s, 'Every four years', 565, 760, 54, { font: 'display', at: '#four' });
|
|
95
|
+
s.arrow([960, 585], [1140, 585], { at: '#date', width: 2, color: 'ink', sfx: false });
|
|
96
|
+
dateCard(s, 1440, 600, 380, 450, '#date');
|
|
97
|
+
text(s, 'February', 1440, 424, 44, { at: '#date' });
|
|
98
|
+
text(s, '29', 1440, 625, 170, { font: 'display', color: 'accent', at: '#date' });
|
|
99
|
+
text(s, 'Fractions enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#four' });
|
|
100
|
+
s.sfx('chime', '#date', { gain: 0.18 });
|
|
101
|
+
},
|
|
102
|
+
correction(s) {
|
|
103
|
+
frame(s, 'A little too much', '#extra');
|
|
104
|
+
text(s, "Earth's cycle", 170, 458, 44, { align: 'left', at: '#extra' });
|
|
105
|
+
text(s, 'Calendar correction', 170, 633, 44, { align: 'left', at: '#extra' });
|
|
106
|
+
s.draw({ at: '#extra', enter: 'fade', sfx: false }, (c, life) => {
|
|
107
|
+
const x = 700, target = 1550, y1 = 458, y2 = 633;
|
|
108
|
+
c.strokeStyle = s.color('ink'); c.lineWidth = 2;
|
|
109
|
+
c.beginPath(); c.moveTo(x, y1); c.lineTo(target, y1); c.stroke();
|
|
110
|
+
c.beginPath(); c.moveTo(target, 395); c.lineTo(target, 735); c.stroke();
|
|
111
|
+
const p = s.clamp(life.local / 3.0, 0, 1);
|
|
112
|
+
c.beginPath(); c.moveTo(x, y2); c.lineTo(x + (target - x) * p, y2); c.stroke();
|
|
113
|
+
c.strokeStyle = s.color('accent'); c.lineWidth = 8;
|
|
114
|
+
const q = s.p('#over', 1.2);
|
|
115
|
+
c.beginPath(); c.moveTo(target, y2); c.lineTo(target + 110 * q, y2); c.stroke();
|
|
116
|
+
});
|
|
117
|
+
text(s, 'An occasional exception', 960, 825, 66, { font: 'display', color: 'accent', at: '#over' });
|
|
118
|
+
text(s, 'Difference enlarged', 170, 914, 32, { align: 'left', color: 'muted', at: '#extra' });
|
|
119
|
+
},
|
|
120
|
+
rule(s) {
|
|
121
|
+
frame(s, 'The century exception', '#gregorian');
|
|
122
|
+
text(s, 'Gregorian calendar', 170, 438, 68, { font: 'display', align: 'left', at: '#gregorian' });
|
|
123
|
+
text(s, 'Introduced in 1582', 170, 529, 42, { align: 'left', color: 'muted', at: 'introduced' });
|
|
124
|
+
text(s, 'Century year', 1110, 429, 58, { font: 'display', at: '#skip' });
|
|
125
|
+
text(s, 'Skip the leap day', 1110, 525, 44, { at: '#skip' });
|
|
126
|
+
s.line([[750, 632], [1470, 632]], { color: 'ink', width: 1, at: '#keep', opacity: 0.4, sfx: false });
|
|
127
|
+
text(s, 'Unless divisible by 400', 1110, 736, 62, { font: 'display', color: 'accent', at: '#keep' });
|
|
128
|
+
text(s, 'Keep the leap day', 1110, 837, 44, { at: '#keep' });
|
|
129
|
+
},
|
|
130
|
+
examples(s) {
|
|
131
|
+
frame(s, 'The rule in practice', '#no');
|
|
132
|
+
text(s, '1900', 520, 520, 144, { font: 'display', at: '#no' });
|
|
133
|
+
text(s, 'No leap day', 520, 685, 48, { at: '#no' });
|
|
134
|
+
s.draw({ at: '#no', enter: 'fade', sfx: false }, (c) => {
|
|
135
|
+
c.strokeStyle = s.color('ink'); c.lineWidth = 2;
|
|
136
|
+
c.beginPath(); c.moveTo(493, 783); c.lineTo(547, 837); c.moveTo(547, 783); c.lineTo(493, 837); c.stroke();
|
|
137
|
+
});
|
|
138
|
+
s.line([[960, 410], [960, 878]], { width: 1, opacity: 0.25, at: '#yes', sfx: false });
|
|
139
|
+
text(s, '2000', 1380, 520, 144, { font: 'display', color: 'accent', at: '#yes' });
|
|
140
|
+
text(s, 'February 29', 1380, 685, 48, { at: '#yes' });
|
|
141
|
+
s.draw({ at: '#yes', enter: 'fade', sfx: false }, (c) => {
|
|
142
|
+
c.strokeStyle = s.color('accent'); c.lineWidth = 3;
|
|
143
|
+
c.beginPath(); c.moveTo(1350, 810); c.lineTo(1372, 832); c.lineTo(1412, 786); c.stroke();
|
|
144
|
+
});
|
|
145
|
+
s.sfx('chime', '#yes', { gain: 0.16 });
|
|
146
|
+
},
|
|
147
|
+
close(s) {
|
|
148
|
+
frame(s, 'Keeping dates with the seasons', '#finish');
|
|
149
|
+
dateCard(s, 530, 612, 350, 420, '#finish');
|
|
150
|
+
text(s, 'February', 530, 451, 42, { at: '#finish' });
|
|
151
|
+
text(s, '29', 530, 638, 160, { font: 'display', color: 'accent', at: '#finish' });
|
|
152
|
+
s.line([[840, 615], [1040, 615]], { color: 'accent', width: 2, at: 'dates', sfx: false });
|
|
153
|
+
orbit(s, 1340, 615, 195, 'dates');
|
|
154
|
+
text(s, "Earth's yearly cycle", 1340, 901, 42, { at: 'seasons' });
|
|
155
|
+
},
|
|
156
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Why we have leap years
|
|
2
|
+
|
|
3
|
+
## hook {chapter="The extra fraction"}
|
|
4
|
+
[#question] Why does February sometimes get an extra day? [#calendar] Our calendar needs a small adjustment to follow Earth's year.
|
|
5
|
+
|
|
6
|
+
## orbit
|
|
7
|
+
[#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.
|
|
8
|
+
|
|
9
|
+
## drift
|
|
10
|
+
[#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.
|
|
11
|
+
|
|
12
|
+
## leap {chapter="February's extra day"}
|
|
13
|
+
[#four] Adding an extra day every four years fixes most of that drift. [#date] The extra day is February {29|twenty nine}.
|
|
14
|
+
|
|
15
|
+
## correction
|
|
16
|
+
[#extra] But this adds a little too much time. [#over] The calendar needs an occasional exception to keep that overcorrection small.
|
|
17
|
+
|
|
18
|
+
## rule {chapter="The century exception"}
|
|
19
|
+
[#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}.
|
|
20
|
+
|
|
21
|
+
## examples
|
|
22
|
+
[#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.
|
|
23
|
+
|
|
24
|
+
## close {hold=1.1}
|
|
25
|
+
[#finish] Leap years keep calendar dates close to Earth's yearly cycle through the seasons.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Why we have leap years",
|
|
3
|
+
"theme": "editorial",
|
|
4
|
+
"size": "youtube",
|
|
5
|
+
"voice": "af_heart",
|
|
6
|
+
"music": {
|
|
7
|
+
"style": "calm",
|
|
8
|
+
"volume": 0.1
|
|
9
|
+
},
|
|
10
|
+
"captions": false,
|
|
11
|
+
"speed": 1.0,
|
|
12
|
+
"sfx": "minimal",
|
|
13
|
+
"cover": "hook@end",
|
|
14
|
+
"transition": "fade",
|
|
15
|
+
"end": 1.0
|
|
16
|
+
}
|