Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

feat(site): add the Joke Collection, two short animated jokes

yzr685eb44573b8
diff --git a/site/assets/bookshelf.png b/site/assets/bookshelf.png
index b43ce50..ada3ee8 100644
Binary files a/site/assets/bookshelf.png and b/site/assets/bookshelf.png differ
diff --git a/site/index.html b/site/index.html
index a7beb25..ac18f9b 100644
--- a/site/index.html
+++ b/site/index.html
@@ -16,7 +16,7 @@
<p>Animated books · A growing collection</p>
</header>
<figure class="photo-shelf" aria-label="Three shelves: STEM, picture books for children, and curious books">
- <img class="shelf-photo" src="assets/bookshelf.png" width="1086" height="1448" alt="A wooden bookshelf. Algebra, mathematics and physics books on the top shelf marked STEM; picture books on the middle shelf: The Three Little Pigs, Little Red Riding Hood and Why Is It So Fun?; philosophy and history books on the bottom shelf; a GitHub emblem on the drawer." fetchpriority="high">
+ <img class="shelf-photo" src="assets/bookshelf.png" width="1086" height="1448" alt="A wooden bookshelf. Algebra, mathematics and physics books on the top shelf marked STEM; picture books on the middle shelf: The Three Little Pigs, Little Red Riding Hood and Joke Collection; philosophy and history books on the bottom shelf; a GitHub emblem on the drawer." fetchpriority="high">
<div id="shelf-books">
<section class="shelf-tier" aria-labelledby="stem-title">
<h2 class="visually-hidden" id="stem-title">STEM · Mathematics</h2>
@@ -31,13 +31,16 @@
</a>
</section>
<section class="shelf-tier" aria-labelledby="picture-title">
- <h2 class="visually-hidden" id="picture-title">Picture books for children · Two films, more coming soon</h2>
+ <h2 class="visually-hidden" id="picture-title">Picture books for children · Three series</h2>
<a class="book-hotspot pigs-book" data-book="three-little-pigs" href="three-little-pigs/" aria-label="Open The Three Little Pigs, an animated picture book experiment and how it was made">
<span class="book-caption"><strong>The Three Little Pigs <span aria-hidden="true">↗</span></strong><small>An experiment · how it was made</small></span>
</a>
<a class="book-hotspot red-book" data-book="little-red-riding-hood" href="little-red-riding-hood/" aria-label="Open Little Red Riding Hood, a paper-cutout stop-motion picture book and how it was made">
<span class="book-caption"><strong>Little Red Riding Hood <span aria-hidden="true">↗</span></strong><small>Paper-cutout stop motion · how it was made</small></span>
</a>
+ <a class="book-hotspot joke-book" data-book="joke-collection" href="joke-collection/" aria-label="Open Joke Collection, short animated jokes, two episodes">
+ <span class="book-caption"><strong>Joke Collection <span aria-hidden="true">↗</span></strong><small>2 episodes · how they were made</small></span>
+ </a>
</section>
<section class="shelf-tier" aria-labelledby="curious-title">
<h2 class="visually-hidden" id="curious-title">Curious books · Coming soon</h2>
diff --git a/site/joke-collection/ch01/audio/bgm/m1-home.mp3 b/site/joke-collection/ch01/audio/bgm/m1-home.mp3
new file mode 100644
index 0000000..acdbe77
Binary files /dev/null and b/site/joke-collection/ch01/audio/bgm/m1-home.mp3 differ
diff --git a/site/joke-collection/ch01/audio/bgm/m3-chimney.mp3 b/site/joke-collection/ch01/audio/bgm/m3-chimney.mp3
new file mode 100644
index 0000000..073bb94
Binary files /dev/null and b/site/joke-collection/ch01/audio/bgm/m3-chimney.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/mouths.js b/site/joke-collection/ch01/audio/en/mouths.js
new file mode 100644
index 0000000..aca7526
--- /dev/null
+++ b/site/joke-collection/ch01/audio/en/mouths.js
@@ -0,0 +1 @@
+window.MOUTHS = {"s01":[[0.102,"C"],[0.206,"B"],[0.31,"B"],[0.394,"C"],[0.477,"G"],[0.56,"C"],[0.644,"B"],[0.727,"B"],[0.865,"D"],[1.002,"B"],[1.14,"C"],[1.378,"A"],[1.476,"C"],[1.573,"B"],[1.652,"C"],[1.731,"B"],[1.809,"A"],[1.888,"D"],[1.966,"B"],[2.045,"C"],[2.211,"A"],[2.309,"E"],[2.407,"B"],[2.502,"D"],[2.598,"B"],[2.693,"B"],[2.767,"F"],[2.841,"E"],[2.915,"B"],[2.991,"F"],[3.067,"C"],[3.143,"B"],[3.22,"C"],[3.296,"E"],[3.372,"B"],[3.448,"G"],[3.501,"E"],[3.553,"B"],[3.605,"A"],[3.88,"C"],[4.155,"X"],[4.805,"C"],[4.872,"G"],[4.94,"C"],[5.008,"B"],[5.076,"C"],[5.143,"A"],[5.253,"E"],[5.363,"B"],[5.473,"C"],[5.583,"B"],[5.693,"X"],[5.833,"B"],[5.892,"C"],[5.951,"G"],[6.076,"C"],[6.202,"B"],[6.328,"E"],[6.511,"B"],[6.695,"C"],[6.878,"X"]],"s02":[[0.094,"A"],[0.172,"B"],[0.251,"C"],[0.33,"B"],[0.408,"G"],[0.487,"D"],[0.565,"B"],[0.644,"X"]],"s02b":[[0.095,"A"],[0.174,"B"],[0.253,"C"],[0.331,"B"],[0.41,"G"],[0.488,"D"],[0.567,"B"],[0.645,"X"]],"s02c":[[0.094,"A"],[0.172,"B"],[0.251,"C"],[0.33,"B"],[0.408,"G"],[0.487,"D"],[0.565,"B"],[0.644,"X"]],"s02d":[[0.095,"A"],[0.174,"B"],[0.253,"C"],[0.331,"B"],[0.41,"G"],[0.488,"D"],[0.567,"B"],[0.645,"X"]],"s02e":[[0.094,"A"],[0.172,"B"],[0.251,"C"],[0.33,"B"],[0.408,"G"],[0.487,"D"],[0.565,"B"],[0.644,"X"]],"s02f":[[0.095,"A"],[0.174,"B"],[0.253,"C"],[0.331,"B"],[0.41,"G"],[0.488,"D"],[0.567,"B"],[0.645,"X"]],"s03":[[0.102,"C"],[0.212,"G"],[0.322,"C"],[0.432,"B"],[0.542,"C"],[0.652,"X"],[1.51,"B"],[1.62,"C"],[1.73,"B"],[1.84,"H"],[1.95,"C"],[2.06,"X"],[3.151,"A"],[3.261,"E"],[3.371,"B"],[3.481,"C"],[3.591,"B"],[3.701,"X"]],"s04":[[0.102,"D"],[0.213,"B"],[0.323,"D"],[0.407,"G"],[0.49,"B"],[0.573,"C"],[0.657,"B"],[0.74,"C"],[0.792,"G"],[0.844,"C"],[0.896,"B"],[0.948,"C"],[1.001,"B"],[1.138,"H"],[1.276,"D"],[1.413,"B"],[1.551,"X"],[1.743,"B"],[1.814,"C"],[1.886,"B"],[1.969,"C"],[2.053,"B"],[2.136,"E"],[2.219,"B"],[2.303,"E"],[2.486,"B"],[2.669,"C"],[2.853,"X"]],"s04b":[[0.094,"A"],[0.204,"D"],[0.314,"B"],[0.424,"F"],[0.534,"A"],[0.644,"X"]],"s04c":[[0.095,"A"],[0.205,"D"],[0.315,"B"],[0.425,"F"],[0.535,"A"],[0.645,"X"]],"s04d":[[0.094,"A"],[0.204,"D"],[0.314,"B"],[0.424,"F"],[0.534,"A"],[0.644,"X"]],"s04e":[[0.095,"A"],[0.205,"D"],[0.315,"B"],[0.425,"F"],[0.535,"A"],[0.645,"X"]],"s05":[[0.102,"B"],[0.189,"F"],[0.276,"E"],[0.362,"B"],[0.441,"F"],[0.52,"C"],[0.598,"B"],[0.677,"C"],[0.755,"E"],[0.834,"B"],[0.913,"X"],[2.057,"B"],[2.133,"C"],[2.208,"G"],[2.284,"C"],[2.359,"B"],[2.435,"A"],[2.508,"C"],[2.581,"B"],[2.654,"C"],[2.727,"B"],[2.8,"F"],[3.075,"A"],[3.349,"X"],[4.01,"F"],[4.131,"B"],[4.251,"C"],[4.372,"H"],[4.492,"E"],[4.566,"B"],[4.64,"C"],[4.714,"A"],[4.824,"E"],[4.934,"B"],[5.044,"C"],[5.154,"B"],[5.264,"X"]],"s05b":[[0.102,"B"],[0.193,"D"],[0.284,"B"],[0.376,"A"],[0.486,"E"],[0.596,"B"],[0.706,"C"],[0.816,"B"],[1.027,"A"],[1.176,"E"],[1.326,"E"],[1.395,"G"],[1.464,"C"],[1.532,"B"],[1.601,"H"],[1.67,"C"],[1.739,"A"],[1.807,"B"],[1.876,"X"],[3.008,"B"],[3.151,"E"],[3.294,"B"],[3.385,"C"],[3.477,"A"],[3.568,"C"],[3.659,"G"],[3.715,"E"],[3.772,"B"],[3.828,"A"],[3.907,"B"],[3.985,"C"],[4.064,"B"],[4.142,"G"],[4.221,"D"],[4.3,"B"],[4.378,"X"]],"s06":[[0.094,"B"],[0.231,"F"],[0.369,"B"],[0.506,"C"],[0.644,"X"],[1.294,"F"],[1.36,"D"],[1.425,"B"],[1.491,"D"],[1.557,"B"],[1.65,"E"],[1.743,"C"],[1.82,"B"],[1.897,"A"],[1.975,"B"],[2.054,"C"],[2.133,"B"],[2.211,"G"],[2.29,"D"],[2.368,"B"],[2.566,"C"],[2.626,"B"],[2.686,"B"],[2.725,"C"],[2.763,"A"],[2.873,"D"],[2.983,"B"],[3.093,"F"],[3.203,"A"],[3.313,"X"]],"s07":[[0.095,"C"],[0.181,"F"],[0.266,"B"],[0.374,"E"],[0.482,"C"],[0.561,"B"],[0.641,"B"],[0.824,"C"],[1.008,"B"],[1.191,"X"]],"s08":[[0.094,"C"],[0.204,"F"],[0.313,"D"],[0.361,"B"],[0.408,"C"],[0.456,"B"],[0.639,"C"],[0.822,"B"],[1.006,"X"]],"s08b":[[0.095,"B"],[0.186,"C"],[0.277,"B"],[0.368,"B"],[0.444,"E"],[0.52,"B"],[0.595,"C"],[0.675,"B"],[0.755,"A"],[1.03,"C"],[1.305,"X"]],"s10":[[0.094,"A"],[0.172,"B"],[0.251,"C"],[0.33,"B"],[0.408,"G"],[0.487,"D"],[0.565,"B"],[0.644,"X"]],"s10b":[[0.095,"F"],[0.205,"B"],[0.315,"C"],[0.425,"B"],[0.535,"C"],[0.645,"X"]]};
diff --git a/site/joke-collection/ch01/audio/en/s01.mp3 b/site/joke-collection/ch01/audio/en/s01.mp3
new file mode 100644
index 0000000..82a1ba4
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s01.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02.mp3 b/site/joke-collection/ch01/audio/en/s02.mp3
new file mode 100644
index 0000000..58d53e6
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02b.mp3 b/site/joke-collection/ch01/audio/en/s02b.mp3
new file mode 100644
index 0000000..aaff688
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02b.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02c.mp3 b/site/joke-collection/ch01/audio/en/s02c.mp3
new file mode 100644
index 0000000..58d53e6
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02c.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02d.mp3 b/site/joke-collection/ch01/audio/en/s02d.mp3
new file mode 100644
index 0000000..aaff688
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02d.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02e.mp3 b/site/joke-collection/ch01/audio/en/s02e.mp3
new file mode 100644
index 0000000..58d53e6
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02e.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s02f.mp3 b/site/joke-collection/ch01/audio/en/s02f.mp3
new file mode 100644
index 0000000..aaff688
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s02f.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s03.mp3 b/site/joke-collection/ch01/audio/en/s03.mp3
new file mode 100644
index 0000000..ea9c56b
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s03.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s04.mp3 b/site/joke-collection/ch01/audio/en/s04.mp3
new file mode 100644
index 0000000..a824745
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s04.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s04b.mp3 b/site/joke-collection/ch01/audio/en/s04b.mp3
new file mode 100644
index 0000000..02f8788
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s04b.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s04c.mp3 b/site/joke-collection/ch01/audio/en/s04c.mp3
new file mode 100644
index 0000000..1b85acf
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s04c.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s04d.mp3 b/site/joke-collection/ch01/audio/en/s04d.mp3
new file mode 100644
index 0000000..f8c1f5f
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s04d.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s04e.mp3 b/site/joke-collection/ch01/audio/en/s04e.mp3
new file mode 100644
index 0000000..a527d23
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s04e.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s05.mp3 b/site/joke-collection/ch01/audio/en/s05.mp3
new file mode 100644
index 0000000..f8888dd
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s05.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s05b.mp3 b/site/joke-collection/ch01/audio/en/s05b.mp3
new file mode 100644
index 0000000..2e9c255
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s05b.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s06.mp3 b/site/joke-collection/ch01/audio/en/s06.mp3
new file mode 100644
index 0000000..166820d
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s06.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s07.mp3 b/site/joke-collection/ch01/audio/en/s07.mp3
new file mode 100644
index 0000000..3f409fe
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s07.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s08.mp3 b/site/joke-collection/ch01/audio/en/s08.mp3
new file mode 100644
index 0000000..96dd118
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s08.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s08b.mp3 b/site/joke-collection/ch01/audio/en/s08b.mp3
new file mode 100644
index 0000000..4f982ce
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s08b.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s10.mp3 b/site/joke-collection/ch01/audio/en/s10.mp3
new file mode 100644
index 0000000..7af5e92
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s10.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/s10b.mp3 b/site/joke-collection/ch01/audio/en/s10b.mp3
new file mode 100644
index 0000000..8a80a09
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/s10b.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/scene1.mp3 b/site/joke-collection/ch01/audio/en/scene1.mp3
new file mode 100644
index 0000000..c6e1ef9
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/scene1.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/scene2.mp3 b/site/joke-collection/ch01/audio/en/scene2.mp3
new file mode 100644
index 0000000..e15ec86
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/scene2.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/scene3.mp3 b/site/joke-collection/ch01/audio/en/scene3.mp3
new file mode 100644
index 0000000..2c6a2b1
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/scene3.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/scene4.mp3 b/site/joke-collection/ch01/audio/en/scene4.mp3
new file mode 100644
index 0000000..9ad40d8
Binary files /dev/null and b/site/joke-collection/ch01/audio/en/scene4.mp3 differ
diff --git a/site/joke-collection/ch01/audio/en/shots.js b/site/joke-collection/ch01/audio/en/shots.js
new file mode 100644
index 0000000..35aff6e
--- /dev/null
+++ b/site/joke-collection/ch01/audio/en/shots.js
@@ -0,0 +1,16 @@
+TIMINGS.scene1 = {"dur": 27.822, "marks": {}, "cues": [[0.102, "In seventh grade, my deskmate Bo had two questions for me."], [4.805, "Every morning, the first one:"], [8.052, "Breakfast?"], [10.275, "Breakfast."], [13.196, "Breakfast?"], [15.419, "Breakfast."], [18.34, "Breakfast?"], [20.563, "Breakfast."], [23.292, "Every."], [24.7, "Single."], [26.341, "Morning."]], "parts": {"s01": 0, "s02": 7.958, "s02b": 10.18, "s02c": 13.102, "s02d": 15.324, "s02e": 18.246, "s02f": 20.468, "s03": 23.19}};
+TIMINGS.scene2 = {"dur": 32.86, "marks": {}, "cues": [[0.102, "And after every class, the second one:"], [3.996, "Bathroom?"], [6.219, "Bathroom."], [9.84, "Bathroom?"], [12.063, "Bathroom."], [15.692, "Two questions."], [17.647, "Never mixed up."], [19.6, "Until one morning."], [24.538, "That morning, Bo overslept."], [27.444, "No time for breakfast."]], "parts": {"s04": 0, "s04b": 3.902, "s04c": 6.124, "s04d": 9.746, "s04e": 11.968, "s05": 15.59, "s05b": 24.436}};
+TIMINGS.scene3 = {"dur": 21.746, "marks": {}, "cues": [[0.094, "Dude."], [1.294, "Wanna go eat breakfast\u2026 in the bathroom?"], [10.525, "You go eat shit."], [14.746, "You are shit."], [18.969, "Then don't eat me."]], "parts": {"s06": 0, "s07": 10.43, "s08": 14.652, "s08b": 18.874}};
+TIMINGS.scene4 = {"dur": 7.094, "marks": {}, "cues": [[0.094, "Breakfast?"], [2.317, "Where?"]], "parts": {"s10": 0, "s10b": 2.222}};
+MOUTHS.s02b = [[0.095, "A"], [0.174, "B"], [0.253, "C"], [0.331, "B"], [0.41, "G"], [0.488, "D"], [0.567, "B"], [0.645, "X"], [1.599, "X"]];
+MOUTHS.s02d = [[0.095, "A"], [0.174, "B"], [0.253, "C"], [0.331, "B"], [0.41, "G"], [0.488, "D"], [0.567, "B"], [0.645, "X"], [1.599, "X"]];
+MOUTHS.s02f = [[0.095, "A"], [0.174, "B"], [0.253, "C"], [0.331, "B"], [0.41, "G"], [0.488, "D"], [0.567, "B"], [0.645, "X"], [1.599, "X"]];
+MOUTHS.s04c = [[0.095, "A"], [0.205, "D"], [0.315, "B"], [0.425, "F"], [0.535, "A"], [0.645, "X"], [1.599, "X"]];
+MOUTHS.s04e = [[0.095, "A"], [0.205, "D"], [0.315, "B"], [0.425, "F"], [0.535, "A"], [0.645, "X"], [1.599, "X"]];
+MOUTHS.s05 = [[0.102, "B"], [0.189, "F"], [0.276, "E"], [0.362, "B"], [0.441, "F"], [0.52, "C"], [0.598, "B"], [0.677, "C"], [0.755, "E"], [0.834, "B"], [0.913, "X"], [2.057, "B"], [2.133, "C"], [2.208, "G"], [2.284, "C"], [2.359, "B"], [2.435, "A"], [2.508, "C"], [2.581, "B"], [2.654, "C"], [2.727, "B"], [2.8, "F"], [3.075, "A"], [3.349, "X"], [4.01, "F"], [4.131, "B"], [4.251, "C"], [4.372, "H"], [4.492, "E"], [4.566, "B"], [4.64, "C"], [4.714, "A"], [4.824, "E"], [4.934, "B"], [5.044, "C"], [5.154, "B"], [5.264, "X"], [5.999, "X"]];
+MOUTHS.s05b = [[0.102, "B"], [0.193, "D"], [0.284, "B"], [0.376, "A"], [0.486, "E"], [0.596, "B"], [0.706, "C"], [0.816, "B"], [1.027, "A"], [1.176, "E"], [1.326, "E"], [1.395, "G"], [1.464, "C"], [1.532, "B"], [1.601, "H"], [1.67, "C"], [1.739, "A"], [1.807, "B"], [1.876, "X"], [3.008, "B"], [3.151, "E"], [3.294, "B"], [3.385, "C"], [3.477, "A"], [3.568, "C"], [3.659, "G"], [3.715, "E"], [3.772, "B"], [3.828, "A"], [3.907, "B"], [3.985, "C"], [4.064, "B"], [4.142, "G"], [4.221, "D"], [4.3, "B"], [4.378, "X"], [5.299, "X"]];
+MOUTHS.s06 = [[0.094, "B"], [0.231, "F"], [0.369, "B"], [0.506, "C"], [0.644, "X"], [1.294, "F"], [1.36, "D"], [1.425, "B"], [1.491, "D"], [1.557, "B"], [1.65, "E"], [1.743, "C"], [1.82, "B"], [1.897, "A"], [1.975, "B"], [2.054, "C"], [2.133, "B"], [2.211, "G"], [2.29, "D"], [2.368, "B"], [2.566, "C"], [2.626, "B"], [2.686, "B"], [2.725, "C"], [2.763, "A"], [2.873, "D"], [2.983, "B"], [3.093, "F"], [3.203, "A"], [3.313, "X"], [3.949, "X"]];
+MOUTHS.s07 = [[0.095, "C"], [0.181, "F"], [0.266, "B"], [0.374, "E"], [0.482, "C"], [0.561, "B"], [0.641, "B"], [0.824, "C"], [1.008, "B"], [1.191, "X"], [1.699, "X"]];
+MOUTHS.s08 = [[0.094, "C"], [0.204, "F"], [0.313, "D"], [0.361, "B"], [0.408, "C"], [0.456, "B"], [0.639, "C"], [0.822, "B"], [1.006, "X"], [1.699, "X"]];
+MOUTHS.s08b = [[0.095, "B"], [0.186, "C"], [0.277, "B"], [0.368, "B"], [0.444, "E"], [0.52, "B"], [0.595, "C"], [0.675, "B"], [0.755, "A"], [1.03, "C"], [1.305, "X"], [1.699, "X"]];
+MOUTHS.s10b = [[0.095, "F"], [0.205, "B"], [0.315, "C"], [0.425, "B"], [0.535, "C"], [0.645, "X"], [1.799, "X"]];
diff --git a/site/joke-collection/ch01/audio/en/timings.js b/site/joke-collection/ch01/audio/en/timings.js
new file mode 100644
index 0000000..1c08508
--- /dev/null
+++ b/site/joke-collection/ch01/audio/en/timings.js
@@ -0,0 +1,240 @@
+window.TIMINGS = {
+ "s01": {
+ "dur": 7.608,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "In seventh grade, my deskmate Bo had two questions for me."
+ ],
+ [
+ 4.805,
+ "Every morning, the first one:"
+ ]
+ ]
+ },
+ "s02": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Breakfast?"
+ ]
+ ]
+ },
+ "s02b": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Breakfast."
+ ]
+ ]
+ },
+ "s02c": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Breakfast?"
+ ]
+ ]
+ },
+ "s02d": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Breakfast."
+ ]
+ ]
+ },
+ "s02e": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Breakfast?"
+ ]
+ ]
+ },
+ "s02f": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Breakfast."
+ ]
+ ]
+ },
+ "s03": {
+ "dur": 4.632,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "Every."
+ ],
+ [
+ 1.51,
+ "Single."
+ ],
+ [
+ 3.151,
+ "Morning."
+ ]
+ ]
+ },
+ "s04": {
+ "dur": 3.552,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "And after every class, the second one:"
+ ]
+ ]
+ },
+ "s04b": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Bathroom?"
+ ]
+ ]
+ },
+ "s04c": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Bathroom."
+ ]
+ ]
+ },
+ "s04d": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Bathroom?"
+ ]
+ ]
+ },
+ "s04e": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Bathroom."
+ ]
+ ]
+ },
+ "s05": {
+ "dur": 6.096,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "Two questions."
+ ],
+ [
+ 2.057,
+ "Never mixed up."
+ ],
+ [
+ 4.01,
+ "Until one morning."
+ ]
+ ]
+ },
+ "s05b": {
+ "dur": 5.424,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "That morning, Bo overslept."
+ ],
+ [
+ 3.008,
+ "No time for breakfast."
+ ]
+ ]
+ },
+ "s06": {
+ "dur": 4.08,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Dude."
+ ],
+ [
+ 1.294,
+ "Wanna go eat breakfast\u2026 in the bathroom?"
+ ]
+ ]
+ },
+ "s07": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "You go eat shit."
+ ]
+ ]
+ },
+ "s08": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "You are shit."
+ ]
+ ]
+ },
+ "s08b": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Then don't eat me."
+ ]
+ ]
+ },
+ "s10": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.094,
+ "Breakfast?"
+ ]
+ ]
+ },
+ "s10b": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0.095,
+ "Where?"
+ ]
+ ]
+ }
+};
diff --git a/site/joke-collection/ch01/audio/sfx/bell.mp3 b/site/joke-collection/ch01/audio/sfx/bell.mp3
new file mode 100644
index 0000000..5009865
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/bell.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/chair.mp3 b/site/joke-collection/ch01/audio/sfx/chair.mp3
new file mode 100644
index 0000000..8a4d03b
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/chair.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/crickets.mp3 b/site/joke-collection/ch01/audio/sfx/crickets.mp3
new file mode 100644
index 0000000..bcf7ebb
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/crickets.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/door.mp3 b/site/joke-collection/ch01/audio/sfx/door.mp3
new file mode 100644
index 0000000..37bae91
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/door.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/fly.mp3 b/site/joke-collection/ch01/audio/sfx/fly.mp3
new file mode 100644
index 0000000..31b9666
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/fly.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/growl.mp3 b/site/joke-collection/ch01/audio/sfx/growl.mp3
new file mode 100644
index 0000000..9426861
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/growl.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/laugh.mp3 b/site/joke-collection/ch01/audio/sfx/laugh.mp3
new file mode 100644
index 0000000..43f2c76
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/laugh.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/rain-short.mp3 b/site/joke-collection/ch01/audio/sfx/rain-short.mp3
new file mode 100644
index 0000000..452a25b
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/rain-short.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/rain.mp3 b/site/joke-collection/ch01/audio/sfx/rain.mp3
new file mode 100644
index 0000000..867f67f
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/rain.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/sting.mp3 b/site/joke-collection/ch01/audio/sfx/sting.mp3
new file mode 100644
index 0000000..af1219c
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/sting.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/tick.mp3 b/site/joke-collection/ch01/audio/sfx/tick.mp3
new file mode 100644
index 0000000..473ca36
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/tick.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/violin.mp3 b/site/joke-collection/ch01/audio/sfx/violin.mp3
new file mode 100644
index 0000000..8eee69d
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/violin.mp3 differ
diff --git a/site/joke-collection/ch01/audio/sfx/whoosh.mp3 b/site/joke-collection/ch01/audio/sfx/whoosh.mp3
new file mode 100644
index 0000000..feb4d22
Binary files /dev/null and b/site/joke-collection/ch01/audio/sfx/whoosh.mp3 differ
diff --git a/site/joke-collection/ch01/index.html b/site/joke-collection/ch01/index.html
new file mode 100644
index 0000000..4a8938b
--- /dev/null
+++ b/site/joke-collection/ch01/index.html
@@ -0,0 +1,67 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Breakfast in the Bathroom</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render">
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../img/sets/sets.js"></script>
+<script src="../img/puppets/baked.js" onerror="0"></script>
+<script src="../lib/paper.js"></script>
+<script src="../lib/cast.js"></script>
+<script src="audio/en/timings.js"></script>
+<script src="audio/en/mouths.js"></script>
+<script src="audio/en/shots.js"></script>
+<script src="../lib/shared.js"></script>
+<script src="scene1.js"></script>
+<script src="scene2.js"></script>
+<script src="scene3.js"></script>
+<script src="scene4.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 1, title: 'Breakfast in the Bathroom', minutes: 2, language: 'en', next: '../ch02/' };
+try { if (localStorage.getItem('captions') === null) setCaptions(true); } catch {}
+
+/* ---------- beats: one per scene ---------- */
+const BEATS = [
+ ['scene1', 'Breakfast?', (m, D) => scene1(panel(0), D), { lead: false, pre: PRE1 }],
+ ['scene2', 'Bathroom?', (m, D) => scene2(panel(0), D), { lead: false, pre: PRE2 }],
+ ['scene3', 'The mix-up', (m, D) => scene3(panel(0), D), { lead: false, pre: PRE3 }],
+ ['scene4', 'The laugh', (m, D) => scene4(panel(0), D), { lead: false, pre: PRE4 }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+/* ---------- background music ----------
+ The Three Little Pigs' score (Lyria), reused: one track per listed scene, its position the time since the track's
+ first scene began, so pausing and seeking keep it in step; 0.8 s crossfades; lower under speech. Scene 3 is silent. */
+const BGM = [['m1-home', ['scene1'], .3], ['m3-chimney', ['scene2'], .22], ['m1-home', ['scene4'], .3]]
+ .map(([n, beats, gain]) => ({ n, beats, gain, a: Object.assign(new Audio(`audio/bgm/${n}.mp3`), { preload: 'auto', loop: true, volume: 0 }), v: 0 }));
+const beatLen = id => { const b = BEATS.find(x => x.id === id); return (b.pre || 0) + TIMINGS[id].dur + .6; };
+let lastTick = performance.now();
+function bgmTick(now) {
+ const dt = Math.min(.1, (now - lastTick) / 1000); lastTick = now;
+ const id = BEATS[P.i]?.id, on = P.started && P.playing && !P.waiting && !P.done;
+ const speaking = P.audio && !P.audio.paused && !P.audio.ended;
+ const vol = +(document.getElementById('volume')?.value ?? 1) * (speaking ? .3 : .7); // the music ducks well under the voices
+ for (const m of BGM) {
+ const k = m.beats.indexOf(id), current = on && k >= 0 && !(window.MUSIC_OFF?.[id]?.(P.t));
+ m.v = Math.max(0, Math.min(1, m.v + (current ? 1 : -1) * dt / .8));
+ m.a.volume = m.v * m.gain * vol;
+ if (current) {
+ const want = (m.beats.slice(0, k).reduce((s, b) => s + beatLen(b), 0) + P.t) % (m.a.duration || 1e9);
+ if (Math.abs(m.a.currentTime - want) > .5) m.a.currentTime = want;
+ if (m.a.paused) m.a.play().catch(() => {});
+ } else if (m.v === 0 && !m.a.paused) m.a.pause();
+ }
+ if (!on && !P.done) for (const m of BGM) m.a.pause();
+ requestAnimationFrame(bgmTick);
+}
+requestAnimationFrame(bgmTick);
+paperWarm(g => { mePuppet(g); boPuppet(g); auntPuppet(g); classmate(g, 'bowl', '#1c1a1a'); prop(g, deskSVG(0, 0, 1) + bunSVG() + soySVG); });
+boot();
+</script>
+</body>
+</html>
diff --git a/site/joke-collection/ch01/scene1.js b/site/joke-collection/ch01/scene1.js
new file mode 100644
index 0000000..eee194b
--- /dev/null
+++ b/site/joke-collection/ch01/scene1.js
@@ -0,0 +1,109 @@
+/* scene1.js — 起: the ritual. Wide town, then the bun stall three mornings running (sun, rain, snow) in one locked
+ framing, then the same three shots again, cut on "Every. Single. Morning." */
+'use strict';
+const PRE1 = 1.3;
+
+// piecewise-linear keyframes: s1kf(r, [[t, v], …])
+const s1kf = (r, k) => { if (r <= k[0][0]) return k[0][1]; for (let i = 1; i < k.length; i++) if (r < k[i][0]) { const [a, va] = k[i - 1], [b, vb] = k[i]; return va + (vb - va) * (r - a) / (b - a); } return k[k.length - 1][1]; };
+const s1h = (i, k) => (jit(i * 7919 + 13, k) + 1) / 2; // a stable 0…1 number per index
+
+// "Grade 7": a small paper label with a strip of tape
+const s1label = `<g filter="url(#paper)"><path d="M0,6 L330,0 L336,128 L4,134 Z" fill="#f6ecc9"/><path d="M0,6 L330,0" stroke="#d9c88f" stroke-width="3"/></g>
+ <g filter="url(#paper)"><rect x="118" y="-14" width="100" height="30" fill="#d8d0b4" opacity=".85" transform="rotate(-3 168 0)"/></g>
+ <text x="168" y="96" font-family="Chalkboard, Comic Sans MS, sans-serif" font-weight="700" font-size="82" text-anchor="middle" fill="#3a2f26">Grade 7</text>`;
+// a scarf round the neck (drawn over the chin line), w half-width of the body; one tail hangs down the chest
+const s1scarf = w => `<g filter="url(#paper)"><path d="M${-w},-170 Q0,-136 ${w},-170 L${w + 4},-146 Q0,-112 ${-w - 4},-146 Z" fill="#c94a3c"/>
+ <rect x="${w * .35}" y="-150" width="${w * .42}" height="76" rx="6" fill="#c94a3c"/><path d="M${w * .35},-124 h${w * .42} M${w * .35},-100 h${w * .42}" stroke="#f4f1ea" stroke-width="5"/></g>`;
+
+function scene1(p, D) {
+ const B = ['s02', 's02c', 's02e'].map(c => clipAt('scene1', PRE1, c)), IN = .45; // each day: Bo's line starts IN s after the cut
+ const cuts = [B[0] - IN, B[1] - IN, B[2] - IN];
+ const montage = [cueAt('scene1', PRE1, 7) - .04, cueAt('scene1', PRE1, 8) - .04, cueAt('scene1', PRE1, 9) - .04]; // Every. / Single. / Morning.
+ const WX = ['sun', 'rain', 'snow'];
+ const STALL_AT = cueAt('scene1', PRE1, 1) - .05; // cut to the stall on "Every morning, the first one:"
+
+ // 1 the town: wide, held, a slow push toward the school gate
+ const town = paperCam(p, 'town', { x: 800, y: 450, z: 1 });
+ town.to({ x: 800, y: 500, z: 1.14 }, .2, cuts[0]);
+ // 2 the stall: Me left, Bo right, the seller behind her cart — one framing for all six shots
+ const st = stallSet(p, { bun: bunSVG(), bite: bunSVG(true), umbM: umbrellaArt('red'), umbB: umbrellaArt('yellow') }); st.cam.cut(STALL_VIEW, 0);
+ const scarfMe = prop(st.cam.stage, s1scarf(70)), scarfBo = prop(st.cam.stage, s1scarf(48));
+ const tossBun = [prop(st.cam.stage, bunSVG()), prop(st.cam.stage, bunSVG())];
+
+ // weather in front of everything: tint, rain streaks, snowflakes
+ const tint = mk('rect', { width: 1600, height: 900, opacity: 0 }, p);
+ const rain = mk('path', { fill: 'none', stroke: '#6f93b4', 'stroke-width': 4, 'stroke-linecap': 'round', opacity: .8 }, p);
+ const flakes = Array.from({ length: 90 }, (_, i) => mk('circle', { r: 3 + 5 * s1h(i, 3), fill: '#fff', stroke: '#b3c6dc', 'stroke-width': 1.5 }, p));
+ const label = prop(p, s1label);
+ sfx('scene1', .05, 'sting');
+ sfx('scene1', cuts[1], 'rain', .6); sfx('scene1', montage[1], 'rain-short', .5);
+
+ stopClock(D, (q, f) => {
+ // which shot are we in?
+ let k = -1; for (let i = 0; i < 3; i++) if (q >= cuts[i]) k = i;
+ let m = -1; for (let i = 0; i < 3; i++) if (q >= montage[i]) m = i;
+ const isTown = q < STALL_AT, eating = m >= 0, wi = eating ? m : Math.max(k, 0);
+ const w = isTown ? 'sun' : WX[wi];
+ const t0 = eating ? montage[m] : cuts[Math.max(k, 0)];
+ const r = eating ? 4.4 + (q - t0) : q - t0, rainy = w === 'rain', snowy = w === 'snow';
+ vis(town.root, isTown); vis(st.cam.root, !isTown);
+
+ // title label: pops in on the sting, gone after about two seconds
+ const lt = q - 1.0, showLabel = lt >= 0 && lt < 2.1;
+ vis(label, showLabel); if (showLabel) tf(label, `translate(150,${90 + (lt < .17 ? 30 * (1 - lt / .17) : 0)}) rotate(-4) scale(${lt < .17 ? .88 : 1})`);
+ if (isTown) { town.apply(q, f); vis(tint, false); vis(rain, false); flakes.forEach(c => vis(c, false)); return; }
+ st.cam.apply(q, f); st.weather(w);
+
+ // weather
+ const fi = Math.floor(f / 2);
+ vis(tint, rainy || snowy); tint.setAttribute('fill', rainy ? '#3a4a63' : '#e4ecf6'); tint.setAttribute('opacity', rainy ? .1 : .06); // the painted street carries the weather; this only pulls the puppets into it
+ vis(rain, rainy);
+ if (rainy) { let d = ''; for (let i = 0; i < 80; i++) {
+ const x = ((s1h(i, 1) * 1800 - fi * 22 * (.6 + s1h(i, 2))) % 1800 + 1800) % 1800 - 100, y = ((s1h(i, 4) * 1000 + fi * (85 + 60 * s1h(i, 5))) % 1000) - 50;
+ d += `M${x.toFixed(0)},${y.toFixed(0)} l-10,44 `; } rain.setAttribute('d', d); }
+ flakes.forEach((c, i) => { vis(c, snowy); if (snowy) {
+ const sp = .5 + s1h(i, 6);
+ c.setAttribute('cx', (((s1h(i, 7) * 1800 + Math.sin(fi * .5 + i) * 14 - fi * 3) % 1800 + 1800) % 1800 - 100).toFixed(0));
+ c.setAttribute('cy', (((s1h(i, 8) * 1000 + fi * 15 * sp) % 1000) - 50).toFixed(0)); } });
+
+ // the lines: Bo asks, Me answers (silent in the closing montage)
+ const bo = eating ? 'X' : lips(q, 'scene1', PRE1, 's02', 's02c', 's02e'), me = eating ? 'X' : lips(q, 'scene1', PRE1, 's02b', 's02d', 's02f');
+ const speakBo = bo !== 'X', speakMe = me !== 'X';
+
+ // buns: arrive in flight, eaten with deadpan chewing
+ const landBo = 3.65, landMe = 4.05, tossBo = 3.35, tossMe = 3.55;
+ const gotBo = r >= landBo, gotMe = r >= landMe;
+ const chewing = (landAt, kk) => r >= landAt + .25 ? ((Math.floor((f + kk) / 2)) % 2 ? 'chew' : 'A') : 'flat';
+ const umb = rainy ? 150 : 0;
+
+ // the seller: arm up, two overarm tosses, arm down; her left (our left) hand holds the bun
+ const aArm = s1kf(r, [[2.9, 0], [3.2, 150], [3.35, 150], [3.45, 105], [3.5, 150], [3.55, 150], [3.65, 105], [3.8, 120], [4.2, 0]]);
+ const aBun = (r >= 3.2 && r < 3.38) || (r >= 3.5 && r < 3.58);
+ st.aunt.pose({ ...STALL.aunt, armL: aArm, holdL: aBun ? 'bun' : null, mouth: 'flat', lids: .25, shut: blinking(r, [1.4, 5.3]) }, f);
+
+ // flying buns (thrown on twos: the position changes every other frame)
+ const fly = (i, t, dur, from, to, h, spin) => {
+ const u = r >= t && r < t + dur ? Math.min(1, Math.floor((r - t) * FPS / 2) * 2 / FPS / dur) : -1;
+ vis(tossBun[i], u >= 0);
+ if (u >= 0) tf(tossBun[i], `translate(${from[0] + (to[0] - from[0]) * u},${from[1] + (to[1] - from[1]) * u - 4 * h * u * (1 - u)}) rotate(${spin * u}) scale(1.25)`);
+ };
+ const handA = [1232, 446], handBo = [STALL.bo + (48 + 69) * STALL.s, STALL.ground - 140 * STALL.s + 24], handMe = [STALL.me + (104 + 69) * STALL.s, STALL.ground - 135 * STALL.s + 24];
+ fly(0, tossBo, .3, handA, handBo, 150, -300); fly(1, tossMe, .5, handA, handMe, 200, 560);
+
+ const lidsDead = .3;
+ // Me: left. Listens to Bo's line (eyes toward him), answers, takes the bun, chews.
+ st.me.pose({ x: STALL.me, y: STALL.ground, s: STALL.s, mouth: speakMe ? me : gotMe ? chewing(landMe, 1) : 'flat', lids: lidsDead, shut: blinking(r, [.7, 4.6, 6.9]),
+ eyeX: s1kf(r, [[.4, 0], [.5, .7], [1.3, .7], [1.4, 0]]), headR: speakMe ? -2 : 0, bob: gotMe && chewing(landMe, 1) === 'chew' ? 1 : 0,
+ armR: eating || gotMe ? s1kf(r, [[landMe, 52], [landMe + .5, 100]]) : s1kf(r, [[tossMe, 0], [landMe - .1, 52]]), hold: gotMe ? (r >= landMe + .5 ? 'bite' : 'bun') : null,
+ armL: umb, holdL: rainy ? 'umbM' : null }, f);
+ // Bo: right. Asks, listens to Me (eyes toward him), takes the bun, chews (half a beat behind Me).
+ st.bo.pose({ x: STALL.bo, y: STALL.ground, s: STALL.s, mouth: speakBo ? bo : gotBo ? chewing(landBo, 3) : 'flat', lids: lidsDead, shut: blinking(r, [1.7, 3.1, 5.6]),
+ eyeX: s1kf(r, [[2.55, 0], [2.65, -.7], [3.4, -.7], [3.5, 0]]), headR: speakBo ? 2 : 0, bob: gotBo && chewing(landBo, 3) === 'chew' ? 1 : 0,
+ armR: eating || gotBo ? s1kf(r, [[landBo, 52], [landBo + .5, 100]]) : s1kf(r, [[tossBo, 0], [landBo - .1, 52]]), hold: gotBo ? (r >= landBo + .5 ? 'bite' : 'bun') : null,
+ armL: umb, holdL: rainy ? 'umbB' : null }, f);
+
+ // scarves in snow, riding the necks
+ vis(scarfMe, snowy); vis(scarfBo, snowy);
+ if (snowy) { tf(scarfMe, `translate(${STALL.me},${STALL.ground}) scale(${STALL.s})`); tf(scarfBo, `translate(${STALL.bo},${STALL.ground}) scale(${STALL.s})`); }
+ });
+}
diff --git a/site/joke-collection/ch01/scene2.js b/site/joke-collection/ch01/scene2.js
new file mode 100644
index 0000000..285fb6a
--- /dev/null
+++ b/site/joke-collection/ch01/scene2.js
@@ -0,0 +1,139 @@
+/* scene2.js — 承: the second catchphrase. Every class ends with the bell and "Bathroom?" / "Bathroom." and both walk out
+ together, twice, identically; then the next morning the two sit waiting. Ends on the TWO framing, both seated (scene 3's start). */
+'use strict';
+const PRE2 = 1.2;
+
+/* ---------- props (clock hands and the bell box, drawn at the origin) ---------- */
+// Clock hands (drawn at the origin, pointing up) and the bell box with its clapper.
+const s2hourH = `<g filter="url(#paper)"><path d="M-7,10 L0,-44 L7,10 Z" fill="#2a2a2a"/></g>`;
+const s2minH = `<g filter="url(#paper)"><path d="M-5,10 L0,-66 L5,10 Z" fill="#2a2a2a"/></g>`;
+const s2secH = `<g filter="url(#paper)"><path d="M0,18 V-72" stroke="#c0392b" stroke-width="3"/><circle r="6" fill="#c0392b"/></g>`;
+const s2pin = `<g filter="url(#paper)"><circle r="7" fill="#2a2a2a"/></g>`;
+const s2bellBox = `<g filter="url(#paper)"><rect x="-44" y="-34" width="88" height="68" rx="10" fill="#c94a3c"/><circle r="22" fill="#7a2a24"/></g>`;
+const s2clapper = `<g filter="url(#paper)"><circle r="8" fill="#e6c46a"/></g>`;
+
+/* ---------- times (beat clock) ---------- */
+const S2 = { BELL1: .4, A: clipAt('scene2', PRE2, 's04b'), B: clipAt('scene2', PRE2, 's04c'), C: clipAt('scene2', PRE2, 's04d'),
+ E: clipAt('scene2', PRE2, 's04e'), N: clipAt('scene2', PRE2, 's05') };
+// a round: Bo's line at tb, Me's at tm; both rise at tm+1.2, walk out left by tm+2.6, clock/bell insert, back seated at tm+3.4
+const S2R = [{ tb: S2.A, tm: S2.B, h: 10 + 50 / 60, bell: true }, { tb: S2.C, tm: S2.E, h: 7 + 50 / 60, bell: false }];
+const S2_WIDE = { x: 800, y: 450, z: 1 }, S2_CLOCK = { x: 800, y: 170, z: 3.3 }, S2_BELLBOX = { x: 1460, y: 180, z: 4 };
+const S2_SPEED = 680, S2_UPY = 64;
+// tail: next morning at the stall (A), Bo bursts in late (B), the two-shot, his stomach growls (C)
+const S2T = { A: S2.N + 6.0, B: clipAt('scene2', PRE2, 's05b', 3.0), IN: clipAt('scene2', PRE2, 's05b', 3.1), C: clipAt('scene2', PRE2, 's05b', 5.55) };
+// The door in the painted back wall (x 42–245, y 178–656): flung open, Bo panting in it; then a cut to him landing in his seat.
+const S2_DOOR = { x: 145, y: 656, s: .8 }, S2_DOORVIEW = { x: 250, y: 440, z: 2.5 }, S2_DOORSHOT = 1.3; // an insert on the door, then back to the class
+const s2doorway = `<rect x="50" y="186" width="188" height="470" fill="#b9ad97"/><rect x="50" y="560" width="188" height="96" fill="#9c8f78"/><g filter="url(#paper)"><path d="M42,178 L64,190 L64,662 L42,656 Z" fill="#8a5a32"/></g>`;
+sfx('scene2', S2T.IN, 'door');
+sfx('scene2', S2T.C + .5, 'growl');
+
+sfx('scene2', S2.BELL1, 'bell');
+sfx('scene2', S2R[0].tm + 3.0, 'bell', .6);
+for (const r of S2R) { sfx('scene2', r.tm + 2.7, 'tick'); sfx('scene2', r.tm + 1.2, 'chair', .8); }
+
+// Deterministic blink times, 2–5 s apart, different for each seed.
+const s2blinks = (seed, from = 0) => { const o = []; let t = from, r = seed; while (t < 31) { r = (r * 1103515245 + 12345) & 0x7fffffff; t += 2 + 3 * (r % 1000) / 1000; o.push(+t.toFixed(2)); } return o; };
+
+function scene2(p, D) {
+ const c = classroom(p), cam = c.cam, { ME, BO } = c;
+ // the front wall (clock and bell), a second camera on the other set
+ const fr = paperCam(p, 'classFront');
+ const hourH = prop(fr.stage, s2hourH), minH = prop(fr.stage, s2minH), secH = prop(fr.stage, s2secH), pin = prop(fr.stage, s2pin);
+ const bellBox = prop(fr.stage, s2bellBox), clap = prop(fr.stage, s2clapper);
+ const rings = mk('g', {}, fr.stage); rings.innerHTML = [-1, 1].map(s => `<path d="M${1460 + s * 62},160 q${s * 14},20 0,40 M${1460 + s * 80},150 q${s * 18},30 0,60" fill="none" stroke="#3a2a22" stroke-width="5" stroke-linecap="round"/>`).join('');
+ // insert windows: [from, to, clock hour]; the first also shows the bell box
+ const ins = S2R.map(r => ({ t0: r.tm + 2.7, t1: r.tm + 3.4, tb: r.tm + 3.05, h: r.h, bell: r.bell }));
+ ins[1].t1 = S2.E + 3.4;
+
+ /* cameras: 1 wide (bell, class), 2 two-shot, 3 clock inserts, back to the two-shot, ... ends on the two-shot */
+ cam.cut(S2_WIDE, 0).cut(TWO, S2.A - .4);
+ cam.cut(S2_WIDE, S2T.B).cut(TWO, S2T.C);
+ // the door insert: its own camera on the classroom set, tight on the door (the pupils sit far in front of it)
+ const dc = paperCam(p, 'classBack', S2_DOORVIEW);
+ const doorway = prop(dc.stage, s2doorway), doorway2 = prop(c.cam.stage, s2doorway), boDoor = boPuppet(dc.stage);
+ c.cam.stage.prepend(doorway2); // the open door in the wide, behind every pupil
+ const st = stallSet(p, { bun: bunSVG(), bite: bunSVG(true) }); st.cam.cut(STALL_VIEW, 0); st.weather('sun');
+ fr.cut(S2_CLOCK, ins[0].t0).cut(S2_BELLBOX, ins[0].tb).cut(S2_CLOCK, ins[1].t0);
+
+ const meBl = s2blinks(3), boBl = s2blinks(11, 1.3);
+ const lerp = (a, b, u) => a + (b - a) * u;
+
+ stopClock(D, (q, f) => {
+ const insert = ins.find(i => between(q, i.t0, i.t1)), showFront = !!insert, atStall = between(q, S2T.A, S2T.B);
+ const doorShot = q >= S2T.IN && q < S2T.IN + S2_DOORSHOT;
+ vis(dc.root, doorShot); if (doorShot) dc.apply(q, f);
+ vis(cam.root, !showFront && !atStall && !doorShot); vis(fr.root, showFront); vis(st.cam.root, atStall);
+
+ /* ---- A: the next morning at the stall: Me chews his bun, Bo's spot is empty, the seller blinks ---- */
+ if (atStall) {
+ st.cam.apply(q, f);
+ const u = q - S2T.A, glance = span(q, S2T.A + 1.0, S2T.A + 1.15) - span(q, S2T.A + 1.9, S2T.A + 2.05);
+ st.me.pose({ x: STALL.me, y: STALL.ground, s: STALL.s, mouth: chew(q), bob: onTwos(q) > 0 ? 1 : 0, lids: .3, shut: blinking(u, [.6, 3.4, 5.2]),
+ look: .5 * glance, eyeX: glance, armR: 100, hold: 'bite' }, f);
+ st.bo.pose({ x: STALL.bo, y: 2000, s: STALL.s }, f);
+ st.aunt.pose({ ...STALL.aunt, mouth: 'flat', lids: .4, shut: blinking(u, [1.1, 2.0, 4.1]) }, f);
+ return;
+ }
+
+ /* ---- clock / bell inserts ---- */
+ if (showFront) {
+ fr.apply(q, f);
+ const hr = insert.h, a = hr * 30, m = (hr % 1) * 360;
+ tf(hourH, `translate(800,170) rotate(${a.toFixed(1)})`); tf(minH, `translate(800,170) rotate(${m.toFixed(1)})`); tf(pin, 'translate(800,170)');
+ tf(secH, `translate(800,170) rotate(${(6 * Math.floor((q - insert.t0) * 2 + 3)).toFixed(1)})`);
+ const ringing = insert.bell && q >= insert.tb, ring = ringing ? onTwos(q) : 0;
+ tf(bellBox, `translate(1460,180) rotate(${4 * ring})`); tf(clap, `translate(${1460 + 4 * ring},${204 + 3 * ring})`);
+ vis(rings, ringing && ring > 0); vis(bellBox, ringing); vis(clap, ringing);
+ return;
+ }
+ cam.apply(q, f);
+
+ /* ---- Me and Bo: seated, deadpan; in a round they talk, rise, and walk out left together ---- */
+ const me = { ...ME, sit: true, look: 0, eyeX: 0, lids: .3, mouth: 'flat', shut: blinking(q, meBl) };
+ const bo = { ...BO, sit: true, look: 0, eyeX: 0, lids: .3, mouth: 'flat', shut: blinking(q, boBl) };
+ const talk = (...cl) => { const m = lips(q, 'scene2', PRE2, ...cl); return m === 'X' ? 'flat' : m; };
+ let lookAt = null, t0 = 0;
+ // wide: the bell rings, Bo glances at Me
+ if (q < S2.BELL1 + 4) { bo.look = -.5 * span(q, S2.BELL1 + .9, S2.BELL1 + 1.2) * (q < S2.A - .6 ? 1 : 0); bo.eyeX = bo.look < 0 ? -1 : 0; me.lids = .35; }
+ if (between(q, S2.BELL1, S2.BELL1 + 1.4)) { lookAt = 1700; t0 = S2.BELL1; }
+ for (const r of S2R) {
+ const { tb, tm } = r;
+ if (q < tb - .6 || q >= tm + 3.4) continue;
+ const turn = span(q, tb - .3, tb - .05) - span(q, tm + .9, tm + 1.1); // Bo's face toward Me and back
+ bo.look = -.7 * turn; bo.eyeX = turn > .5 ? -1 : 0; bo.mouth = talk('s04b', 's04d');
+ const meTurn = span(q, tb + .35, tb + .6) - span(q, tm + .9, tm + 1.1); // Me hears it, answers, turns back
+ me.look = .6 * meTurn; me.eyeX = q >= tb + .2 && q < tm + 1 ? 1 : 0; me.mouth = talk('s04c', 's04e'); me.lids = q >= tm - .1 && q < tm + 1 ? .15 : .3;
+ if (q >= tm + 1.2) { // both stand together and walk out of frame to the left
+ const up = span(q, tm + 1.2, tm + 1.45), w = Math.max(0, q - (tm + 1.45)), wk = spWalk(q), walking = w > 0;
+ for (const [o, base] of [[me, ME], [bo, BO]]) Object.assign(o, { x: base.x - S2_SPEED * w, y: base.y - S2_UPY * up, look: -.9, eyeX: -1, lids: 0, mouth: 'flat',
+ bob: walking ? wk.bob : 0, armL: walking ? 30 * wk.k : 0, armR: walking ? -30 * wk.k : 0, squash: up < 1 ? -.05 : 0, shut: false });
+ lookAt = ME.x - S2_SPEED * w; t0 = tm + 1.2;
+ }
+ }
+ // the last frames: the next morning, waiting; two quick sidelong glances
+ if (q >= S2.E + 3.4 && q < S2T.A) {
+ const g = span(q, S2.N + 2.6, S2.N + 2.8) - span(q, S2.N + 3.6, S2.N + 3.8), g2 = span(q, S2.N + 4.4, S2.N + 4.6) - span(q, S2.N + 5.2, S2.N + 5.4);
+ bo.eyeX = -g; me.eyeX = g2; me.lids = bo.lids = .35;
+ }
+ const atDoor = q >= S2T.IN && q < S2T.C;
+ vis(doorway2, atDoor);
+ if (doorShot) { // B: the door bangs open, Bo in it, out of breath; the class turns to look
+ const w = q - S2T.IN;
+ boDoor.pose({ ...S2_DOOR, bob: onTwos(q) > 0 ? -4 : 0, squash: w < .1 ? .08 : 0, armL: 40, armR: 40, look: 0, eyeX: 0, lids: 0, mouth: onTwos(q) > 0 ? 'D' : 'C',
+ shut: blinking(q, [S2T.IN + 1.4]) }, f);
+ }
+ if (atDoor) { lookAt = 150; t0 = S2T.IN; } // the whole class stares at the door until he is in his seat
+ if (q >= S2T.B && q < S2T.C) bo.y = 2000; // not in his seat yet
+ if (q >= S2T.C) { // C: he drops into his seat, squashes, settles; pants, his stomach growls, a hand to his belly
+ const d = q - S2T.C, c0 = d, belly = span(q, S2T.C + .7, S2T.C + 1.1), down = span(q, S2T.C + .6, S2T.C + .8);
+ Object.assign(bo, { y: BO.y - 40 * Math.max(0, 1 - d * 8), squash: d < .25 ? (d < .08 ? -.08 : .06) : 0, bob: onTwos(q) > 0 ? -3 : 0, lids: .4, mouth: q < S2T.C + .6 ? 'C' : (q < S2T.C + 1.8 ? 'wobble' : 'flat'),
+ eyeY: -down, armR: -70 * belly, look: 0, eyeX: 0, shut: blinking(q, [S2T.C + 2.3]) });
+ if (q >= S2T.C + .6) bo.bob = onTwos(q) > 0 && q < S2T.C + 1.9 ? -2 : 0;
+ me.look = .5 * span(q, S2T.C + .8, S2T.C + 1.0); me.eyeX = c0 > .8 ? 1 : 0; me.lids = .3;
+ }
+ c.me.pose(me, f); c.bo.pose(bo, f);
+
+ /* ---- the class: glancing about; looks up at the bell, follows the two out ---- */
+ c.matesPose(q, f, { lookAt, t0 });
+ });
+}
diff --git a/site/joke-collection/ch01/scene3.js b/site/joke-collection/ch01/scene3.js
new file mode 100644
index 0000000..ad0c22a
--- /dev/null
+++ b/site/joke-collection/ch01/scene3.js
@@ -0,0 +1,133 @@
+/* scene3.js — 转, the slip. Bo asks the question (thought bubbles merge), Me stares, the daydream of a breakfast on the
+ squat pan, "Go eat shit", Bo's slow realisation and his answer; ends on the two-shot scene 4 opens on. */
+'use strict';
+const PRE3 = 3.6; // scene 2 ends on this same two-shot; the pre-roll (bell, growl, two wants colliding) fills it
+
+/* ---------- scene-only props (drawn at (0, 0), baked like puppet pieces) ---------- */
+const S3INK = '#3a3430';
+const s3toiletSVG = `<g filter="url(#paper)"><rect x="-18" y="-42" width="36" height="26" rx="4" fill="#fafcfc" stroke="${S3INK}" stroke-width="3"/>
+ <circle cx="12" cy="-47" r="4" fill="#c9d3d3" stroke="${S3INK}" stroke-width="2"/>
+ <path d="M-28,-14 H28 Q28,10 9,16 L9,30 H-9 L-9,16 Q-28,10 -28,-14 Z" fill="#fafcfc" stroke="${S3INK}" stroke-width="3"/>
+ <ellipse cx="0" cy="-14" rx="28" ry="7" fill="#dfe7e7" stroke="${S3INK}" stroke-width="3"/></g>`;
+// a thought bubble: the cloud with `inner` in it and the little trailing circles toward the thinker (dx: which way they lean)
+const s3bubble = (inner, dx) => `<g filter="url(#paper)"><circle cx="${dx * 24}" cy="74" r="9" fill="#fff" stroke="${S3INK}" stroke-width="3"/>
+ <circle cx="${dx * 38}" cy="96" r="5.5" fill="#fff" stroke="${S3INK}" stroke-width="3"/>
+ <circle r="64" fill="#fff" stroke="${S3INK}" stroke-width="3.5"/></g>${inner}`;
+const s3bubbleToilet = s3bubble(`<g transform="translate(0,6) scale(1.15)">${s3toiletSVG}</g>`, 1);
+const s3bubbleBun = s3bubble(`<g transform="translate(0,6) scale(2.1)">${bunSVG()}</g>`, -1);
+const s3bubbleBoth = s3bubble(`<g transform="translate(0,12) scale(1.15)">${s3toiletSVG}</g><g transform="translate(0,-14) scale(1.15)">${bunSVG()}</g>`, 0);
+const s3placemat = `<g filter="url(#paper)"><rect x="-150" y="-12" width="300" height="24" rx="6" fill="url(#check)"/></g>`;
+const s3flySVG = `<ellipse cx="0" cy="0" rx="6" ry="4.5" fill="#1d1a1a"/><circle cx="-6" cy="-1" r="3.4" fill="#1d1a1a"/>
+ <g data-w="1"><ellipse cx="2" cy="-6" rx="8" ry="3.2" fill="#e4eef7" fill-opacity=".85" stroke="#8a9aa8" stroke-width=".8" transform="rotate(-20 2 -6)"/></g>`;
+
+// the dreamy cloud-edged border: a scalloped fog with a clear middle (evenodd), two layers of different size
+function s3cloud(cx, cy, rx, ry, n, ph, r) {
+ let d = '';
+ for (let i = 0; i <= n; i++) {
+ const a = ph + 2 * Math.PI * i / n, x = (cx + rx * Math.cos(a)).toFixed(1), y = (cy + ry * Math.sin(a)).toFixed(1);
+ d += i ? `A${r},${r} 0 0 0 ${x},${y} ` : `M${x},${y} `;
+ }
+ return d + 'Z';
+}
+const s3popBack = u => { u = Math.min(1, Math.max(0, u)); return u <= 0 ? 0 : 1 + 2.70158 * (u - 1) ** 3 + 1.70158 * (u - 1) ** 2; };
+
+/* ---------- audio cues ---------- */
+const A6 = clipAt('scene3', PRE3, 's06'), A7 = clipAt('scene3', PRE3, 's07'), A8 = clipAt('scene3', PRE3, 's08'), A8B = clipAt('scene3', PRE3, 's08b');
+// pre-roll (absolute q): bell, growl + bun bubble, glance at the door + toilet bubble, three shoves, merge, cut to Bo
+const S3 = { bell: .15, growl: .9, popB: 1.0, glance: 1.8, popT: 2.1, jost: 2.45, slide: 3.05, merge: 3.3, bo1: A6 - .1,
+ tilt: .5,
+ me1: A6 + 4.2, snap: A6 + 6.15, loo: A6 + 6.55, flyIn: A6 + 6.6, land: A6 + 7.65, me2: A6 + 9.9, // Me stares, daydream, back to Me
+ bo2: A7 + 2.2, me3: A8 + 2.3, two: A8B + 1.5 }; // Bo thinks (after s07), Me thinks (after s08), final two-shot
+sfx('scene3', S3.bell, 'bell');
+sfx('scene3', S3.growl, 'growl');
+sfx('scene3', S3.me1 + .3, 'crickets');
+sfx('scene3', S3.snap, 'whoosh');
+sfx('scene3', S3.flyIn, 'fly');
+sfx('scene3', S3.land, 'violin');
+
+function scene3(p, D) {
+ const c = classroom(p), cam = c.cam;
+ const BO_CU1 = { x: 920, y: 494, z: 2.1 }, BO_CU2 = { x: 920, y: 544, z: 2.8 }, ME_CU = { x: 680, y: 570, z: 2.8 }, EYES = { x: 703, y: 545, z: 6.5 };
+ // 3.1 two-shot, Bo desperate: "Dude." 3.2 close on Bo: the thought bubbles pop up and merge
+ cam.cut(TWO, 0).to({ ...TWO, y: 495 }, S3.tilt, .4).shake(S3.growl, .5, 2); // tilt up to give the bubbles room
+ cam.cut(BO_CU1, S3.bo1).soft(S3.bo1, true);
+ // 3.3 close on Me: the stare, then a snap zoom into his eyes
+ cam.cut(ME_CU, S3.me1).to(EYES, S3.snap, .22);
+ // 3.5 Me, deadpan: "Go eat shit." 3.6 reverse on Bo: the realisation 3.7 back to the two-shot
+ cam.cut(ME_CU, S3.me2).cut(BO_CU2, S3.bo2).cut(ME_CU, S3.me3).cut(TWO, S3.two).soft(S3.two, false);
+
+ // 3.4 the daydream: the squat pan laid like a breakfast place, a fly, a violin — on its own camera, in a cloud border
+ const loo = paperCam(p, 'loo');
+ loo.cut({ x: 800, y: 640, z: 2.9 }, 0);
+ prop(loo.stage, `<g transform="translate(800,668)">${s3placemat}</g>`);
+ prop(loo.stage, `<g transform="translate(735,664) scale(2.1)">${bunSVG()}</g>`);
+ prop(loo.stage, `<g transform="translate(880,654) scale(1.8)">${soySVG}</g>`);
+ const fly = mk('g', {}, loo.stage); fly.innerHTML = s3flySVG;
+ const wing = fly.querySelector('[data-w]');
+ const dream = mk('g', {}, p);
+ mk('rect', { width: 1600, height: 900, fill: '#ffe3f0', opacity: .12 }, dream);
+ mk('path', { 'fill-rule': 'evenodd', fill: '#fff', opacity: .5, d: `M-60,-60 H1660 V960 H-60 Z ${s3cloud(800, 450, 760, 450, 26, .1, 78)}` }, dream);
+ mk('path', { 'fill-rule': 'evenodd', fill: '#fff4f9', opacity: .92, d: `M-60,-60 H1660 V960 H-60 Z ${s3cloud(800, 450, 680, 390, 30, 0, 66)}` }, dream);
+ const haze = dream.children[2];
+
+ // the three bubbles live in the classroom's world so they follow the camera over Bo's head
+ const bT = prop(cam.world, `<g>${s3bubbleToilet}</g>`), bB = prop(cam.world, `<g>${s3bubbleBun}</g>`), bM = prop(cam.world, `<g>${s3bubbleBoth}</g>`);
+ const place = (g, q, x, y, s) => { vis(g, s > 0.01); if (s > .01) tf(g, `translate(${x.toFixed(1)},${(y + 3 * onTwos(q)).toFixed(1)}) scale(${s.toFixed(3)})`); };
+
+ const Y = 356, XT = 805, XB = 1045, XM = 925; // over seated Bo's head
+ stopClock(D, (q, f) => {
+ const two = q < S3.bo1 || q >= S3.two, pre = q < S3.bo1, boCU = (q >= S3.bo1 && q < S3.me1) || (q >= S3.bo2 && q < S3.me3);
+ const meCU = (q >= S3.me1 && q < S3.loo) || (q >= S3.me2 && q < S3.bo2) || (q >= S3.me3 && q < S3.two), dreaming = q >= S3.loo && q < S3.me2;
+ vis(cam.root, !dreaming); vis(loo.root, dreaming); vis(dream, dreaming);
+ cam.apply(q, f); loo.apply(q, f);
+ c.matesPose(q, f); // everyone stays in every classroom shot, blinking and glancing
+ const lipsOf = (...cl) => { const m = lips(q, 'scene3', PRE3, ...cl); return m === 'X' ? 'flat' : m; };
+ const fin = q >= S3.two; // the closing deadpan two-shot
+
+ // Bo: seated, asks casually; then (reverse) stares, blinks, eyes drift up, a beat, deadpan "You are shit."
+ const bo = { ...c.BO, sit: true, look: -.7, eyeX: -1, mouth: lipsOf('s06'), shut: blinking(q, [.5, 2.3, 3.9, S3.bo2 + .7, S3.bo2 + 1.9, A8 + 1.7, A8 + 3.2, A8B + 1.9]) };
+ if (pre) { // hungry (eyes down, hand on belly, growl), glances at the door, eyes up at the bubbles
+ const gl = q >= S3.glance && q < S3.popT + .3, up = q >= S3.popT + .3, g = q >= S3.growl && q < S3.growl + .5;
+ Object.assign(bo, { mouth: g ? 'wobble' : 'frown', look: gl ? -1 : up ? -.2 : 0, eyeX: gl ? -1 : up ? -.3 : 0, eyeY: gl ? 0 : up ? -.7 : .7, lids: .2, brow: -.4,
+ armR: -35, squash: g ? .03 * onTwos(q) : 0, headR: gl ? -3 : up ? 2 : -2 });
+ } else if (q < S3.bo2) {
+ Object.assign(bo, { headR: -1 }); // a casual question, seated: he hasn't noticed the slip
+ } else if (q < A8) {
+ const up = q >= S3.bo2 + 1.1; // after a stare, the eyes drift up and a beat is held
+ Object.assign(bo, { lids: up ? .15 : .25, eyeX: up ? -.3 : -1, eyeY: up ? -.8 : 0, brow: up ? -.3 : 0, headR: up ? 2 : 0, mouth: 'flat' });
+ } else {
+ Object.assign(bo, { lids: .5, mouth: lipsOf('s08'), eyeX: -.6, headR: 0 });
+ }
+ c.bo.pose(bo, f);
+
+ // Me: blank stare (blinks, a tiny glance), the deadpan answer, then thinks and answers flat
+ const me = { ...c.ME, sit: true, look: .7, eyeX: .8, lids: .12, mouth: lipsOf('s07', 's08b'), shut: blinking(q, [1.6, 3.0, A6 + 4.9, A6 + 5.8, S3.me2 + .2, A7 + 2.2, S3.me3 + .9, A8B + 2.3]) };
+ if (pre && q >= S3.growl) Object.assign(me, { lids: .3, headR: 2 }); // hears the growl
+ if (q >= S3.me1 && q < S3.loo) me.eyeX = q >= A6 + 6.0 ? .4 : .8;
+ if (q >= S3.me2) me.lids = .5;
+ if (q >= S3.me3 && q < A8B) { me.eyeX = q >= S3.me3 + 1.4 ? .2 : .8; me.eyeY = q >= S3.me3 + 1.4 ? -.5 : 0; }
+ c.me.pose(me, f);
+
+ // the bubbles over Bo's head
+ const sT = s3popBack((q - S3.popT) / .25), sB = s3popBack((q - S3.popB) / .25), u = span(q, S3.slide, S3.merge), shown = q < S3.me1;
+ const merged = q >= S3.merge, bump = 1 + .1 * Math.exp(-(q - S3.merge) * 14) * (merged);
+ // the shoves: each lunges the two bubbles together, then they settle a little closer
+ const qq = Math.floor(q * 6) / 6, n = Math.min(2, Math.max(0, Math.floor((qq - S3.jost) / .2))), ph = ((qq - S3.jost) % .2) / .2;
+ const jostling = qq >= S3.jost && q < S3.slide;
+ const hg = ([120, 86, 68][n + (jostling ? 0 : 0)] - (jostling ? 16 * Math.max(0, 1 - ph * 3) : 0)) * (qq < S3.jost ? 1 : 1) * (1 - u);
+ const hgS = q < S3.jost ? 120 * (1 - u) : q < S3.slide ? hg : 56 * (1 - u), sh = jostling && ph < .35 ? 5 * (n % 2 ? -1 : 1) : 0;
+ place(bT, q, XM - hgS, Y + sh, shown && !merged ? sT : 0);
+ place(bB, q, XM + hgS, Y - sh, shown && !merged ? sB : 0);
+ place(bM, q, XM, Y - 6, shown && merged ? bump : 0);
+
+ // the daydream: the fly circles the bun and lands
+ if (dreaming) {
+ const w = Math.min(1, Math.max(0, (q - S3.flyIn) / (S3.land - S3.flyIn))), R = 200 * (1 - w) ** 1.3, a = 2 * Math.PI * 2.3 * w;
+ const x = 735 + R * Math.cos(a), y = 622 - 70 * (1 - w) + R * .42 * Math.sin(a);
+ const flying = w < 1, twitch = q > 9.2 && q < 9.45;
+ tf(fly, `translate(${(x + (flying ? 3 * jit(f, 50) : 0)).toFixed(1)},${(y + (flying ? 3 * jit(f, 51) : 0)).toFixed(1)}) scale(${Math.cos(a) > 0 || !flying ? 1.7 : -1.7},1.7)`);
+ vis(wing, flying ? f % 2 === 0 : twitch);
+ tf(haze, `translate(800 450) scale(${(1 + .012 * Math.sin(q * 3)).toFixed(3)}) translate(-800 -450)`);
+ }
+ });
+}
diff --git a/site/joke-collection/ch01/scene4.js b/site/joke-collection/ch01/scene4.js
new file mode 100644
index 0000000..5bd4036
--- /dev/null
+++ b/site/joke-collection/ch01/scene4.js
@@ -0,0 +1,82 @@
+/* scene4.js — 合, the laugh. Two-shot in silence, the class turns and bursts out laughing (a sound effect, in the
+ pre-roll), the bun stall the next morning, and the title card. Speech (s10, s10b) starts PRE4 s in. */
+'use strict';
+const PRE4 = 5.9;
+const S4 = {
+ wide: .8, // cut to the class; everyone turns
+ laugh: 1.55, // dead silence, then the laughing (3.5 s of sound)
+ stall: PRE4 - .3, // next morning (music off from here)
+ card: PRE4 + 5.1, // title card
+};
+// the laugh plays on its own; the morning theme of scene 1 comes back with the stall and runs into the title card
+window.MUSIC_OFF = { ...(window.MUSIC_OFF || {}), scene4: t => t < S4.stall };
+sfx('scene4', S4.laugh, 'laugh');
+sfx('scene4', S4.card, 'sting');
+
+// the title card: cut-paper letters (each tilted a little, in turn) on a construction-paper card
+function s4cardSVG() {
+ const cols = ['#f4e9c8', '#f2c14e', '#e8715a', '#7cc08a', '#6aa6d8'], lines = [['Breakfast', 150], ['in the', 150], ['Bathroom', 150]];
+ let n = 0, out = '<g filter="url(#paper)"><rect width="1600" height="900" fill="#2e3b5a"/></g>' +
+ '<g filter="url(#paper)" transform="rotate(-1.2 800 450)"><rect x="140" y="90" width="1320" height="720" rx="14" fill="#e9b872"/><rect x="170" y="120" width="1260" height="660" rx="8" fill="#f3d79f"/></g>';
+ const ys = [320, 500, 700], sizes = [190, 110, 210];
+ lines.forEach(([txt], li) => {
+ const sz = sizes[li], w = sz * .62, x0 = 800 - (txt.length * w) / 2;
+ [...txt].forEach((ch, i) => {
+ if (ch === ' ') { n++; return; }
+ const rot = ((n * 37) % 11 - 5) * 1.3, dy = ((n * 53) % 7 - 3) * 4, c = cols[n % cols.length]; n++;
+ const x = x0 + i * w + w / 2, y = ys[li] + dy;
+ out += `<g filter="url(#paper)" transform="translate(${x},${y}) rotate(${rot})"><text text-anchor="middle" font-family="Arial Black, Impact, Helvetica, sans-serif" font-weight="900" font-size="${sz}" fill="${c}" stroke="#3a2a1c" stroke-width="9" stroke-linejoin="round" paint-order="stroke">${ch}</text></g>`;
+ });
+ });
+ return out;
+}
+
+function scene4(p, D) {
+ const room = classroom(p), cam = room.cam, { me, bo, mates } = room;
+ // 4.1 two-shot, silent beat; 4.2 wide: the class turns, a beat, then roars with laughter
+ cam.cut(TWO, 0).cut({ x: 800, y: 450, z: 1 }, S4.wide);
+ // 4.3 the bun stall, next morning
+ const st = stallSet(p), scam = st.cam; scam.cut(STALL_VIEW, 0);
+ // 4.4 title card
+ const card = mk('g', {}, p); prop(card, s4cardSVG());
+ const cardBun = prop(card, bunSVG());
+
+ stopClock(D, (q, f) => {
+ const inRoom = q < S4.stall, inStall = q >= S4.stall && q < S4.card, inCard = q >= S4.card;
+ vis(cam.root, inRoom); vis(scam.root, inStall); vis(card, inCard);
+ if (inCard) {
+ const k = Math.floor((q - S4.card) * FPS / 2) % 2; // the bun bounces on twos
+ tf(cardBun, `translate(1340,${k ? 520 : 548}) scale(1.9) rotate(${k ? -6 : 5})`);
+ tf(card, `translate(${(jit(f, 5) * .8).toFixed(1)},${(jit(f, 6) * .8).toFixed(1)})`);
+ return;
+ }
+ if (inStall) {
+ scam.apply(q, f);
+ const t = q - S4.stall, sh = q >= clipAt('scene4', PRE4, 's10b');
+ const glance = between(q, clipAt('scene4', PRE4, 's10') + .75, clipAt('scene4', PRE4, 's10b') - .1);
+ // Me left, Bo right, both facing us; the seller holds a bun up over her cart
+ st.me.pose({ x: STALL.me, y: STALL.ground, s: STALL.s, mouth: lips(q, 'scene4', PRE4, 's10b'), lids: sh ? .3 : .55, eyeX: glance ? 1 : 0, look: glance ? .5 : 0,
+ headR: glance ? -2 : 0, shut: blinking(q, [S4.stall + 2.3, S4.stall + 3.6]), bob: onTwos(q) > 0 ? -1 : 0 }, f);
+ st.bo.pose({ x: STALL.bo, y: STALL.ground, s: STALL.s, mouth: lips(q, 'scene4', PRE4, 's10'), lids: .1, headR: 2 * Math.sin(t * 1.4),
+ shut: blinking(q, [S4.stall + 1.4, S4.stall + 3.9]), bob: onTwos(q + .2) > 0 ? -1 : 0 }, f);
+ st.aunt.pose({ x: STALL.aunt.x, y: STALL.aunt.y, s: STALL.aunt.s, mouth: 'smile', hold: 'bun', armR: 62, look: -.4, eyeX: -1,
+ shut: blinking(q, [S4.stall + 2.1]), bob: onTwos(q + .5) > 0 ? -1 : 0 }, f);
+ return;
+ }
+ cam.apply(q, f);
+ const L = q - S4.laugh, laughing = L >= 0 && L < 3.7;
+ if (!laughing) room.matesPose(q, f, { lookAt: 800, t0: S4.wide + .12 });
+ else for (const m of mates) {
+ // everyone shakes on twos, each out of step; some clutch their belly, some tip the head back
+ const k = m.k, ph = onTwos(q + (k % 3) * .04 + (k % 2) * .08), env = Math.min(1, L / .15) * (1 - span(q, S4.laugh + 3.3, S4.laugh + 3.7) * .6);
+ const belly = k % 3 === 0, back = k % 2 === 0;
+ m.p.pose({ x: m.x, y: m.y, s: m.s, sit: true, look: Math.max(-1, Math.min(1, (800 - m.x) / 400)), eyeX: 0, lids: .6, shut: k % 4 === 1, mouth: 'grin',
+ bob: ph > 0 ? -12 * env * m.s : 0, squash: (ph > 0 ? .09 : 0) * env, headR: (back ? -14 : 8) * ph * env - (back ? 10 * env : 0),
+ armL: belly ? -34 : 8 * ph * env, armR: belly ? -34 : -8 * ph * env }, f);
+ }
+ // Me and Bo seated, deadpan through all of it, each blinking at their own time
+ const br = 1.5 * Math.sin(q * 1.3);
+ me.pose({ ...room.ME, sit: true, look: 0, lids: .5, mouth: 'X', bob: br * .3, shut: blinking(q, [1.1, 3.4, 5.0]) }, f);
+ bo.pose({ ...room.BO, sit: true, look: 0, lids: .5, mouth: 'X', bob: br * .3, headR: 0, shut: blinking(q, [.5, 2.6, 4.4]) }, f);
+ });
+}
diff --git a/site/joke-collection/ch02/audio/bgm/m1-home.mp3 b/site/joke-collection/ch02/audio/bgm/m1-home.mp3
new file mode 100644
index 0000000..acdbe77
Binary files /dev/null and b/site/joke-collection/ch02/audio/bgm/m1-home.mp3 differ
diff --git a/site/joke-collection/ch02/audio/bgm/m2-wolf.mp3 b/site/joke-collection/ch02/audio/bgm/m2-wolf.mp3
new file mode 100644
index 0000000..eca9045
Binary files /dev/null and b/site/joke-collection/ch02/audio/bgm/m2-wolf.mp3 differ
diff --git a/site/joke-collection/ch02/audio/bgm/m3-chimney.mp3 b/site/joke-collection/ch02/audio/bgm/m3-chimney.mp3
new file mode 100644
index 0000000..073bb94
Binary files /dev/null and b/site/joke-collection/ch02/audio/bgm/m3-chimney.mp3 differ
diff --git a/site/joke-collection/ch02/audio/bgm/m4-ending.mp3 b/site/joke-collection/ch02/audio/bgm/m4-ending.mp3
new file mode 100644
index 0000000..d50bf6a
Binary files /dev/null and b/site/joke-collection/ch02/audio/bgm/m4-ending.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/hush1.mp3 b/site/joke-collection/ch02/audio/en/hush1.mp3
new file mode 100644
index 0000000..04761d7
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/hush1.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/hush2.mp3 b/site/joke-collection/ch02/audio/en/hush2.mp3
new file mode 100644
index 0000000..69c1780
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/hush2.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/hush3.mp3 b/site/joke-collection/ch02/audio/en/hush3.mp3
new file mode 100644
index 0000000..06a4447
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/hush3.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/mouths.js b/site/joke-collection/ch02/audio/en/mouths.js
new file mode 100644
index 0000000..ca79c43
--- /dev/null
+++ b/site/joke-collection/ch02/audio/en/mouths.js
@@ -0,0 +1 @@
+window.MOUTHS = {"s01":[[0.102,"G"],[0.181,"F"],[0.259,"B"],[0.338,"F"],[0.416,"E"],[0.495,"B"],[0.574,"D"],[0.652,"X"],[1.914,"D"],[2.057,"B"],[2.118,"E"],[2.18,"B"],[2.241,"G"],[2.302,"C"],[2.363,"B"],[2.424,"C"],[2.485,"B"],[2.546,"C"],[2.607,"X"],[2.747,"B"],[2.885,"E"],[3.022,"B"],[3.16,"C"],[3.297,"X"],[4.141,"C"],[4.31,"F"],[4.379,"D"],[4.449,"B"],[4.518,"C"],[4.596,"B"],[4.675,"H"],[4.749,"C"],[4.824,"B"],[4.899,"C"],[4.974,"G"],[5.017,"E"],[5.061,"B"],[5.104,"A"],[5.163,"C"],[5.221,"F"],[5.331,"B"],[5.441,"F"],[5.551,"D"],[5.661,"H"],[5.771,"X"],[6.107,"D"],[6.146,"B"],[6.224,"F"],[6.303,"B"],[6.382,"C"],[6.46,"B"],[6.539,"C"],[6.617,"B"],[6.797,"B"],[6.934,"E"],[7.072,"G"],[7.209,"C"],[7.347,"X"]],"s02":[[0.102,"C"],[0.2,"B"],[0.297,"G"],[0.363,"B"],[0.428,"E"],[0.493,"B"],[0.558,"E"],[0.61,"G"],[0.662,"A"],[0.909,"C"],[1.157,"D"],[1.189,"B"],[1.222,"D"],[1.287,"A"],[1.352,"C"],[1.417,"B"],[1.482,"C"],[1.547,"B"],[1.612,"D"],[1.678,"B"],[1.743,"B"],[1.824,"C"],[1.905,"B"],[1.987,"H"],[2.068,"F"],[2.129,"D"],[2.19,"B"],[2.251,"A"],[2.348,"F"],[2.446,"C"],[2.544,"B"],[2.641,"D"],[2.706,"B"],[2.89,"C"],[3.073,"B"],[3.256,"X"],[4.089,"B"],[4.219,"C"],[4.349,"B"],[4.432,"A"],[4.516,"E"],[4.599,"B"],[4.682,"C"],[4.766,"B"],[4.876,"E"],[4.987,"B"],[5.056,"D"],[5.125,"A"],[5.193,"D"],[5.262,"B"],[5.331,"C"],[5.399,"B"],[5.468,"C"],[5.537,"X"],[6.771,"D"],[6.868,"B"],[6.966,"D"],[7.241,"H"],[7.516,"X"]],"s03":[[0.121,"D"],[0.256,"C"],[0.392,"D"],[0.734,"D"],[0.852,"D"],[0.993,"D"],[1.153,"C"],[1.312,"D"],[1.418,"C"],[1.524,"D"],[2.074,"X"]],"s04":[[0.098,"F"],[0.373,"A"],[0.648,"X"],[1.394,"C"],[1.502,"A"],[1.611,"B"],[1.691,"E"],[1.771,"B"],[1.851,"G"],[1.906,"C"],[1.961,"B"],[2.016,"C"],[2.071,"B"],[2.126,"D"],[2.181,"B"],[2.236,"C"],[2.291,"D"],[2.346,"B"],[2.401,"X"]],"s05":[[0.102,"C"],[0.284,"B"],[0.33,"F"],[0.376,"H"],[0.421,"B"],[0.467,"B"],[0.502,"D"],[0.538,"G"],[0.574,"C"],[0.61,"B"],[0.702,"C"],[0.793,"H"],[0.885,"A"],[0.977,"C"],[1.068,"B"],[1.16,"X"],[2.018,"A"],[2.083,"F"],[2.148,"B"],[2.214,"B"],[2.296,"C"],[2.378,"B"],[2.461,"F"],[2.526,"D"],[2.591,"B"],[2.656,"B"],[2.786,"F"],[2.917,"B"],[3.1,"F"],[3.283,"B"],[3.467,"X"]],"s06":[[0.121,"D"],[0.345,"C"],[0.569,"D"],[0.699,"D"],[0.828,"D"],[0.911,"D"],[1.029,"C"],[1.147,"D"],[1.282,"C"],[1.418,"D"],[1.968,"X"]],"s07":[[0.098,"C"],[0.2,"B"],[0.302,"H"],[0.35,"C"],[0.399,"B"],[0.447,"C"],[0.495,"B"],[0.543,"E"],[0.591,"A"],[0.699,"C"],[0.807,"A"],[0.891,"C"],[0.976,"B"],[1.043,"C"],[1.11,"B"],[1.177,"C"],[1.245,"B"],[1.312,"B"],[1.495,"D"],[1.679,"B"],[1.862,"X"]],"s08":[[0.156,"D"],[0.581,"D"],[0.856,"C"],[1.131,"X"]],"s09":[[0.156,"D"],[0.25,"C"],[0.345,"E"],[0.439,"B"],[0.533,"D"],[0.628,"D"],[0.734,"C"],[0.84,"E"],[0.946,"D"],[1.052,"C"],[1.159,"D"],[1.709,"X"]],"s10":[[0.098,"D"],[0.194,"B"],[0.29,"B"],[0.362,"C"],[0.435,"B"],[0.507,"C"],[0.579,"B"],[0.651,"G"],[0.707,"E"],[0.763,"B"],[0.819,"C"],[1.094,"F"],[1.369,"X"]],"s11":[[0.102,"C"],[0.2,"B"],[0.297,"B"],[0.407,"D"],[0.517,"A"],[0.627,"D"],[0.737,"B"],[0.847,"X"],[1.092,"B"],[1.159,"E"],[1.226,"A"],[1.293,"E"],[1.361,"B"],[1.428,"C"],[1.495,"B"],[1.633,"C"],[1.77,"A"],[1.908,"B"],[2.045,"X"],[2.995,"B"],[3.086,"E"],[3.178,"A"],[3.27,"E"],[3.361,"B"],[3.453,"C"],[3.545,"X"],[4.596,"B"],[4.727,"C"],[4.857,"B"],[4.931,"D"],[5.004,"B"],[5.078,"B"],[5.208,"E"],[5.339,"C"],[5.482,"B"],[5.625,"C"],[5.768,"F"],[5.807,"B"],[5.846,"D"],[5.885,"B"],[5.925,"B"],[5.994,"D"],[6.063,"B"],[6.133,"B"],[6.214,"E"],[6.296,"C"],[6.377,"B"],[6.458,"F"],[6.519,"D"],[6.58,"B"],[6.641,"G"],[6.824,"E"],[7.007,"B"],[7.191,"X"]],"s12":[[0.1,"D"],[0.65,"D"],[0.925,"C"],[1.2,"X"],[1.475,"D"],[1.712,"C"],[1.95,"D"],[2.044,"C"],[2.138,"D"],[2.413,"C"],[2.688,"X"],[3.375,"D"],[3.625,"D"],[3.75,"D"],[3.875,"C"],[4.0,"D"],[4.194,"C"],[4.388,"D"],[4.925,"D"],[5.225,"D"],[5.338,"D"],[5.442,"C"],[5.546,"E"],[5.65,"D"],[6.2,"X"],[6.763,"D"],[6.942,"C"],[7.121,"E"],[7.3,"D"],[7.575,"C"],[7.85,"X"]],"s13":[[0.156,"D"],[0.581,"D"],[0.71,"C"],[0.84,"D"],[0.952,"C"],[1.064,"D"],[1.159,"D"],[1.709,"X"],[2.252,"D"],[2.347,"C"],[2.441,"E"],[2.535,"B"],[2.63,"D"],[2.724,"D"],[2.83,"C"],[2.936,"E"],[3.042,"D"],[3.149,"C"],[3.255,"D"],[3.805,"X"]],"s14":[[0.102,"B"],[0.189,"E"],[0.276,"A"],[0.362,"E"],[0.449,"B"],[0.536,"C"],[0.623,"F"],[0.714,"B"],[0.805,"C"],[0.896,"B"],[0.987,"F"],[1.079,"B"],[1.17,"D"],[1.248,"B"],[1.327,"C"],[1.406,"A"],[1.484,"E"],[1.563,"B"],[1.641,"C"],[1.72,"X"],[2.682,"C"],[2.743,"G"],[2.804,"C"],[2.865,"B"],[2.925,"C"],[2.986,"A"],[3.047,"E"],[3.108,"B"],[3.168,"C"],[3.229,"F"],[3.294,"D"],[3.359,"B"],[3.425,"B"],[3.562,"D"],[3.7,"A"],[3.837,"C"],[3.974,"X"],[4.844,"D"],[4.922,"B"],[5.0,"A"],[5.085,"C"],[5.169,"B"],[5.28,"E"],[5.391,"G"],[5.501,"C"],[5.612,"F"],[5.686,"D"],[5.76,"B"],[5.833,"G"],[6.017,"B"],[6.2,"C"],[6.383,"X"]]};
diff --git a/site/joke-collection/ch02/audio/en/s01.mp3 b/site/joke-collection/ch02/audio/en/s01.mp3
new file mode 100644
index 0000000..667983e
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s01.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s02.mp3 b/site/joke-collection/ch02/audio/en/s02.mp3
new file mode 100644
index 0000000..99e5848
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s02.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s03.mp3 b/site/joke-collection/ch02/audio/en/s03.mp3
new file mode 100644
index 0000000..518868c
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s03.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s04.mp3 b/site/joke-collection/ch02/audio/en/s04.mp3
new file mode 100644
index 0000000..c91344e
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s04.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s05.mp3 b/site/joke-collection/ch02/audio/en/s05.mp3
new file mode 100644
index 0000000..17e6f57
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s05.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s06.mp3 b/site/joke-collection/ch02/audio/en/s06.mp3
new file mode 100644
index 0000000..23ac96a
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s06.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s07.mp3 b/site/joke-collection/ch02/audio/en/s07.mp3
new file mode 100644
index 0000000..86264dd
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s07.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s08.mp3 b/site/joke-collection/ch02/audio/en/s08.mp3
new file mode 100644
index 0000000..f3651dc
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s08.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s09.mp3 b/site/joke-collection/ch02/audio/en/s09.mp3
new file mode 100644
index 0000000..b8de7c7
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s09.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s10.mp3 b/site/joke-collection/ch02/audio/en/s10.mp3
new file mode 100644
index 0000000..abebf63
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s10.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s11.mp3 b/site/joke-collection/ch02/audio/en/s11.mp3
new file mode 100644
index 0000000..766b4f0
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s11.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s12.mp3 b/site/joke-collection/ch02/audio/en/s12.mp3
new file mode 100644
index 0000000..9e42e42
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s12.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s13.mp3 b/site/joke-collection/ch02/audio/en/s13.mp3
new file mode 100644
index 0000000..9251522
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s13.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/s14.mp3 b/site/joke-collection/ch02/audio/en/s14.mp3
new file mode 100644
index 0000000..8620d27
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/s14.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/scene1.mp3 b/site/joke-collection/ch02/audio/en/scene1.mp3
new file mode 100644
index 0000000..40ed9d8
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/scene1.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/scene2.mp3 b/site/joke-collection/ch02/audio/en/scene2.mp3
new file mode 100644
index 0000000..a6f9e85
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/scene2.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/scene3.mp3 b/site/joke-collection/ch02/audio/en/scene3.mp3
new file mode 100644
index 0000000..a8c30e6
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/scene3.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/scene4.mp3 b/site/joke-collection/ch02/audio/en/scene4.mp3
new file mode 100644
index 0000000..84392a9
Binary files /dev/null and b/site/joke-collection/ch02/audio/en/scene4.mp3 differ
diff --git a/site/joke-collection/ch02/audio/en/shots.js b/site/joke-collection/ch02/audio/en/shots.js
new file mode 100644
index 0000000..60470ac
--- /dev/null
+++ b/site/joke-collection/ch02/audio/en/shots.js
@@ -0,0 +1,16 @@
+TIMINGS.scene1 = {"dur": 33.376, "marks": {}, "cues": [[0.102, "Fukuoka."], [1.914, "A convenience store."], [4.141, "I was in line for my usual: a hundred-yen coffee."], [9.932, "In front of me, an American girl was buying a drink."], [13.919, "She spoke no Japanese."], [16.601, "At all."], [18.46, "Reji-bukuro wa go-riy\u014d desu ka? (Do you need a bag?)"], [24.1, "Um\u2026 I'm not vegetarian."], [29.23, "I could have helped."], [31.146, "But this was too good."]], "parts": {"s01": 0, "s02": 8.63, "s03": 18.46, "s04": 21.802, "s05": 27.928}};
+TIMINGS.scene2 = {"dur": 15.474, "marks": {}, "cues": [[0, "\u4e21\u66ff\u306f\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002 (We don't do currency exchange.)"], [6.048, "I'd like to pay by credit card."], [8.868, "\u3042\u3001\u306f\u3044\uff01 (Oh! Yes!)"], [11.09, "\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\uff01 (Thank you very much!)"]], "parts": {"s06": 0, "s07": 4.95, "s08": 8.868, "s09": 11.09}};
+TIMINGS.scene3 = {"dur": 34.548, "marks": {}, "cues": [[1.298, "And this is for you!"], [7.192, "In Japan, nobody tips."], [10.085, "Nobody."], [11.686, "She had no idea what that coin was for."], [15.456, "Ah, she's my friend. She's paying for my coffee too. It's fine."], [27.326, "\u3042\u3063\u3001\u305d\u3046\u3067\u3057\u305f\u304b\uff01 (Oh, I see! Thank you very much!)"]], "parts": {"s10": 0, "s11": 3.59, "s12": 15.456, "s13": 27.326, "hush2": 32.548}};
+TIMINGS.scene4 = {"dur": 13.05, "marks": {}, "cues": [[2.602, "Nobody understood anybody."], [5.182, "Everybody was happy."], [7.344, "And my coffee was free."]], "parts": {"s14": 0, "hush3": 10.05}};
+MOUTHS.s02 = [[0.049, "X"], [1.302, "C"], [1.4, "B"], [1.497, "G"], [1.563, "B"], [1.628, "E"], [1.693, "B"], [1.758, "E"], [1.81, "G"], [1.862, "A"], [2.109, "C"], [2.357, "D"], [2.389, "B"], [2.422, "D"], [2.487, "A"], [2.552, "C"], [2.617, "B"], [2.682, "C"], [2.747, "B"], [2.812, "D"], [2.878, "B"], [2.943, "B"], [3.024, "C"], [3.105, "B"], [3.187, "H"], [3.268, "F"], [3.329, "D"], [3.39, "B"], [3.451, "A"], [3.548, "F"], [3.646, "C"], [3.744, "B"], [3.841, "D"], [3.906, "B"], [4.09, "C"], [4.273, "B"], [4.456, "X"], [5.289, "B"], [5.419, "C"], [5.549, "B"], [5.632, "A"], [5.716, "E"], [5.799, "B"], [5.882, "C"], [5.966, "B"], [6.076, "E"], [6.187, "B"], [6.256, "D"], [6.325, "A"], [6.393, "D"], [6.462, "B"], [6.531, "C"], [6.599, "B"], [6.668, "C"], [6.737, "X"], [7.971, "D"], [8.068, "B"], [8.166, "D"], [8.441, "H"], [8.716, "X"]];
+MOUTHS.s03 = [[0.049, "X"], [0.521, "D"], [0.656, "C"], [0.792, "D"], [1.134, "D"], [1.252, "D"], [1.393, "D"], [1.553, "C"], [1.712, "D"], [1.818, "C"], [1.924, "D"], [2.474, "X"]];
+MOUTHS.s04 = [[0.049, "X"], [2.298, "F"], [2.573, "A"], [2.848, "X"], [3.594, "C"], [3.702, "A"], [3.811, "B"], [3.891, "E"], [3.971, "B"], [4.051, "G"], [4.106, "C"], [4.161, "B"], [4.216, "C"], [4.271, "B"], [4.326, "D"], [4.381, "B"], [4.436, "C"], [4.491, "D"], [4.546, "B"], [4.601, "X"]];
+MOUTHS.s05 = [[0.049, "X"], [1.302, "C"], [1.484, "B"], [1.53, "F"], [1.576, "H"], [1.621, "B"], [1.667, "B"], [1.702, "D"], [1.738, "G"], [1.774, "C"], [1.81, "B"], [1.902, "C"], [1.993, "H"], [2.085, "A"], [2.177, "C"], [2.268, "B"], [2.36, "X"], [3.218, "A"], [3.283, "F"], [3.348, "B"], [3.414, "B"], [3.496, "C"], [3.578, "B"], [3.661, "F"], [3.726, "D"], [3.791, "B"], [3.856, "B"], [3.986, "F"], [4.117, "B"], [4.3, "F"], [4.483, "B"], [4.667, "X"]];
+MOUTHS.s06 = [[0.049, "X"], [2.321, "D"], [2.545, "C"], [2.769, "D"], [2.899, "D"], [3.028, "D"], [3.111, "D"], [3.229, "C"], [3.347, "D"], [3.482, "C"], [3.618, "D"], [4.168, "X"]];
+MOUTHS.s07 = [[0.049, "X"], [1.098, "C"], [1.2, "B"], [1.302, "H"], [1.35, "C"], [1.399, "B"], [1.447, "C"], [1.495, "B"], [1.543, "E"], [1.591, "A"], [1.699, "C"], [1.807, "A"], [1.891, "C"], [1.976, "B"], [2.043, "C"], [2.11, "B"], [2.177, "C"], [2.245, "B"], [2.312, "B"], [2.495, "D"], [2.679, "B"], [2.862, "X"]];
+MOUTHS.s09 = [[0.049, "X"], [2.356, "D"], [2.45, "C"], [2.545, "E"], [2.639, "B"], [2.733, "D"], [2.828, "D"], [2.934, "C"], [3.04, "E"], [3.146, "D"], [3.252, "C"], [3.359, "D"], [3.909, "X"]];
+MOUTHS.s10 = [[0.049, "X"], [1.298, "D"], [1.394, "B"], [1.49, "B"], [1.562, "C"], [1.635, "B"], [1.707, "C"], [1.779, "B"], [1.851, "G"], [1.907, "E"], [1.963, "B"], [2.019, "C"], [2.294, "F"], [2.569, "X"]];
+MOUTHS.s11 = [[0.049, "X"], [3.602, "C"], [3.7, "B"], [3.797, "B"], [3.907, "D"], [4.017, "A"], [4.127, "D"], [4.237, "B"], [4.347, "X"], [4.592, "B"], [4.659, "E"], [4.726, "A"], [4.793, "E"], [4.861, "B"], [4.928, "C"], [4.995, "B"], [5.133, "C"], [5.27, "A"], [5.408, "B"], [5.545, "X"], [6.495, "B"], [6.586, "E"], [6.678, "A"], [6.77, "E"], [6.861, "B"], [6.953, "C"], [7.045, "X"], [8.096, "B"], [8.227, "C"], [8.357, "B"], [8.431, "D"], [8.504, "B"], [8.578, "B"], [8.708, "E"], [8.839, "C"], [8.982, "B"], [9.125, "C"], [9.268, "F"], [9.307, "B"], [9.346, "D"], [9.385, "B"], [9.425, "B"], [9.494, "D"], [9.563, "B"], [9.633, "B"], [9.714, "E"], [9.796, "C"], [9.877, "B"], [9.958, "F"], [10.019, "D"], [10.08, "B"], [10.141, "G"], [10.324, "E"], [10.507, "B"], [10.691, "X"]];
+MOUTHS.s12 = [[0.049, "X"], [3.1, "D"], [3.65, "D"], [3.925, "C"], [4.2, "X"], [4.475, "D"], [4.712, "C"], [4.95, "D"], [5.044, "C"], [5.138, "D"], [5.413, "C"], [5.688, "X"], [6.375, "D"], [6.625, "D"], [6.75, "D"], [6.875, "C"], [7.0, "D"], [7.194, "C"], [7.388, "D"], [7.925, "D"], [8.225, "D"], [8.338, "D"], [8.442, "C"], [8.546, "E"], [8.65, "D"], [9.2, "X"], [9.763, "D"], [9.942, "C"], [10.121, "E"], [10.3, "D"], [10.575, "C"], [10.85, "X"]];
+MOUTHS.s13 = [[0.049, "X"], [0.756, "D"], [1.181, "D"], [1.31, "C"], [1.44, "D"], [1.552, "C"], [1.664, "D"], [1.759, "D"], [2.309, "X"], [2.852, "D"], [2.947, "C"], [3.041, "E"], [3.135, "B"], [3.23, "D"], [3.324, "D"], [3.43, "C"], [3.536, "E"], [3.642, "D"], [3.749, "C"], [3.855, "D"], [4.405, "X"]];
+MOUTHS.s14 = [[0.049, "X"], [2.602, "B"], [2.689, "E"], [2.776, "A"], [2.862, "E"], [2.949, "B"], [3.036, "C"], [3.123, "F"], [3.214, "B"], [3.305, "C"], [3.396, "B"], [3.487, "F"], [3.579, "B"], [3.67, "D"], [3.748, "B"], [3.827, "C"], [3.906, "A"], [3.984, "E"], [4.063, "B"], [4.141, "C"], [4.22, "X"], [5.182, "C"], [5.243, "G"], [5.304, "C"], [5.365, "B"], [5.425, "C"], [5.486, "A"], [5.547, "E"], [5.608, "B"], [5.668, "C"], [5.729, "F"], [5.794, "D"], [5.859, "B"], [5.925, "B"], [6.062, "D"], [6.2, "A"], [6.337, "C"], [6.474, "X"], [7.344, "D"], [7.422, "B"], [7.5, "A"], [7.585, "C"], [7.669, "B"], [7.78, "E"], [7.891, "G"], [8.001, "C"], [8.112, "F"], [8.186, "D"], [8.26, "B"], [8.333, "G"], [8.517, "B"], [8.7, "C"], [8.883, "X"]];
diff --git a/site/joke-collection/ch02/audio/en/timings.js b/site/joke-collection/ch02/audio/en/timings.js
new file mode 100644
index 0000000..77a491f
--- /dev/null
+++ b/site/joke-collection/ch02/audio/en/timings.js
@@ -0,0 +1,193 @@
+window.TIMINGS = {
+ "s01": {
+ "dur": 8.28,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "Fukuoka."
+ ],
+ [
+ 1.914,
+ "A convenience store."
+ ],
+ [
+ 4.141,
+ "I was in line for my usual: a hundred-yen coffee."
+ ]
+ ]
+ },
+ "s02": {
+ "dur": 8.28,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "In front of me, an American girl was buying a drink."
+ ],
+ [
+ 4.089,
+ "She spoke no Japanese."
+ ],
+ [
+ 6.771,
+ "At all."
+ ]
+ ]
+ },
+ "s03": {
+ "dur": 2.592,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "Reji-bukuro wa go-riy\u014d desu ka? (Do you need a bag?)"
+ ]
+ ]
+ },
+ "s04": {
+ "dur": 3.576,
+ "marks": {},
+ "cues": [
+ [
+ 0.098,
+ "Um\u2026 I'm not vegetarian."
+ ]
+ ]
+ },
+ "s05": {
+ "dur": 4.248,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "I could have helped."
+ ],
+ [
+ 2.018,
+ "But this was too good."
+ ]
+ ]
+ },
+ "s06": {
+ "dur": 2.4,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "\u4e21\u66ff\u306f\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002 (We don't do currency exchange.)"
+ ]
+ ]
+ },
+ "s07": {
+ "dur": 2.568,
+ "marks": {},
+ "cues": [
+ [
+ 0.098,
+ "I'd like to pay by credit card."
+ ]
+ ]
+ },
+ "s08": {
+ "dur": 1.872,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "\u3042\u3001\u306f\u3044\uff01 (Oh! Yes!)"
+ ]
+ ]
+ },
+ "s09": {
+ "dur": 2.184,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\uff01 (Thank you very much!)"
+ ]
+ ]
+ },
+ "s10": {
+ "dur": 2.04,
+ "marks": {},
+ "cues": [
+ [
+ 0.098,
+ "And this is for you!"
+ ]
+ ]
+ },
+ "s11": {
+ "dur": 8.016,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "In Japan, nobody tips."
+ ],
+ [
+ 2.995,
+ "Nobody."
+ ],
+ [
+ 4.596,
+ "She had no idea what that coin was for."
+ ]
+ ]
+ },
+ "s12": {
+ "dur": 8.52,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "Ah, she's my friend. She's paying for my coffee too. It's fine."
+ ]
+ ]
+ },
+ "s13": {
+ "dur": 4.272,
+ "marks": {},
+ "cues": [
+ [
+ 0,
+ "\u3042\u3063\u3001\u305d\u3046\u3067\u3057\u305f\u304b\uff01 (Oh, I see! Thank you very much!)"
+ ]
+ ]
+ },
+ "s14": {
+ "dur": 7.2,
+ "marks": {},
+ "cues": [
+ [
+ 0.102,
+ "Nobody understood anybody."
+ ],
+ [
+ 2.682,
+ "Everybody was happy."
+ ],
+ [
+ 4.844,
+ "And my coffee was free."
+ ]
+ ]
+ },
+ "hush1": {
+ "dur": 1.0,
+ "marks": {},
+ "cues": []
+ },
+ "hush2": {
+ "dur": 2.0,
+ "marks": {},
+ "cues": []
+ },
+ "hush3": {
+ "dur": 3.0,
+ "marks": {},
+ "cues": []
+ }
+};
diff --git a/site/joke-collection/ch02/audio/sfx/beep.mp3 b/site/joke-collection/ch02/audio/sfx/beep.mp3
new file mode 100644
index 0000000..1421e4d
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/beep.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/card.mp3 b/site/joke-collection/ch02/audio/sfx/card.mp3
new file mode 100644
index 0000000..7336100
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/card.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/chime.mp3 b/site/joke-collection/ch02/audio/sfx/chime.mp3
new file mode 100644
index 0000000..9708ec9
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/chime.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/coin.mp3 b/site/joke-collection/ch02/audio/sfx/coin.mp3
new file mode 100644
index 0000000..f2073c2
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/coin.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/crickets.mp3 b/site/joke-collection/ch02/audio/sfx/crickets.mp3
new file mode 100644
index 0000000..bcf7ebb
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/crickets.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/door.mp3 b/site/joke-collection/ch02/audio/sfx/door.mp3
new file mode 100644
index 0000000..37bae91
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/door.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/sting.mp3 b/site/joke-collection/ch02/audio/sfx/sting.mp3
new file mode 100644
index 0000000..af1219c
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/sting.mp3 differ
diff --git a/site/joke-collection/ch02/audio/sfx/whoosh.mp3 b/site/joke-collection/ch02/audio/sfx/whoosh.mp3
new file mode 100644
index 0000000..feb4d22
Binary files /dev/null and b/site/joke-collection/ch02/audio/sfx/whoosh.mp3 differ
diff --git a/site/joke-collection/ch02/index.html b/site/joke-collection/ch02/index.html
new file mode 100644
index 0000000..9749f46
--- /dev/null
+++ b/site/joke-collection/ch02/index.html
@@ -0,0 +1,70 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Do You Need a Bag?</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render">
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../img/sets/sets.js"></script>
+<script src="../img/puppets/baked.js" onerror="0"></script>
+<script src="../lib/paper.js"></script>
+<script>window.SP_SHUT = .9; // a shut eye keeps its lid line (long bows read as empty eyes otherwise)</script>
+<script src="../lib/cast.js"></script>
+<script src="audio/en/timings.js"></script>
+<script src="audio/en/mouths.js"></script>
+<script src="audio/en/shots.js"></script>
+<script src="../lib/shared.js"></script>
+<script src="store.js"></script>
+<script src="scene1.js"></script>
+<script src="scene2.js"></script>
+<script src="scene3.js"></script>
+<script src="scene4.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 2, title: 'Do You Need a Bag?', minutes: 2, language: 'en' };
+// captions on the first time: half the film is Japanese
+try { if (localStorage.getItem('captions') === null) setCaptions(true); } catch {}
+
+/* ---------- beats: one per scene ---------- */
+const BEATS = [
+ ['scene1', 'Need a bag?', (m, D) => scene1(panel(0), D), { lead: false, pre: PRE1 }],
+ ['scene2', 'Currency exchange', (m, D) => scene2(panel(0), D), { lead: false, pre: PRE2 }],
+ ['scene3', 'The tip', (m, D) => scene3(panel(0), D), { lead: false, pre: PRE3 }],
+ ['scene4', 'Free coffee', (m, D) => scene4(panel(0), D), { lead: false, pre: PRE4 }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+/* ---------- background music ----------
+ The Three Little Pigs' score (Lyria), reused: one track per listed scene, its position the time since the track's
+ first scene began, so pausing and seeking keep it in step; 0.8 s crossfades; lower under speech. Scene 3 is silent. */
+const BGM = [['m1-home', ['scene1'], .3], ['m3-chimney', ['scene2'], .22], ['m4-ending', ['scene4'], .3]]
+ .map(([n, beats, gain]) => ({ n, beats, gain, a: Object.assign(new Audio(`audio/bgm/${n}.mp3`), { preload: 'auto', loop: true, volume: 0 }), v: 0 }));
+const beatLen = id => { const b = BEATS.find(x => x.id === id); return (b.pre || 0) + TIMINGS[id].dur + .6; };
+let lastTick = performance.now();
+function bgmTick(now) {
+ const dt = Math.min(.1, (now - lastTick) / 1000); lastTick = now;
+ const id = BEATS[P.i]?.id, on = P.started && P.playing && !P.waiting && !P.done;
+ const speaking = P.audio && !P.audio.paused && !P.audio.ended;
+ const vol = +(document.getElementById('volume')?.value ?? 1) * (speaking ? .3 : .7); // the music ducks well under the voices
+ for (const m of BGM) {
+ const k = m.beats.indexOf(id), current = on && k >= 0 && !(window.MUSIC_OFF?.[id]?.(P.t));
+ m.v = Math.max(0, Math.min(1, m.v + (current ? 1 : -1) * dt / .8));
+ m.a.volume = m.v * m.gain * vol;
+ if (current) {
+ const want = (m.beats.slice(0, k).reduce((s, b) => s + beatLen(b), 0) + P.t) % (m.a.duration || 1e9);
+ if (Math.abs(m.a.currentTime - want) > .5) m.a.currentTime = want;
+ if (m.a.paused) m.a.play().catch(() => {});
+ } else if (m.v === 0 && !m.a.paused) m.a.pause();
+ }
+ if (!on && !P.done) for (const m of BGM) m.a.pause();
+ requestAnimationFrame(bgmTick);
+}
+requestAnimationFrame(bgmTick);
+paperWarm(g => { meAdultPuppet(g, { holds: { coffee: coffeeSVG } }); amyPuppet(g); clerkPuppet(g); prop(g, coffeeSVG + drinkSVG + cardSVG + coinSVG); });
+boot();
+</script>
+</body>
+</html>
diff --git a/site/joke-collection/ch02/scene1.js b/site/joke-collection/ch02/scene1.js
new file mode 100644
index 0000000..9a6ef74
--- /dev/null
+++ b/site/joke-collection/ch02/scene1.js
@@ -0,0 +1,104 @@
+/* scene1.js — "Need a bag?". Street at dusk (chime, "Fukuoka" plate, slow push to the door), hard cut into the shop wide
+ (Amy's bottle is scanned), clerk close-up ("Reji-bukuro…"), Amy close-up (REJI? -> VEGGIE? bubble, "I'm not vegetarian"),
+ Me close-up holding in a laugh. Ends on Me's close-up; scene 2 opens on the clerk's close-up. */
+'use strict';
+const PRE1 = 2.5; // picture first: the street, the chime, the plate; the narrator starts at 2.5 s
+
+/* ---------- audio cues ---------- */
+const C1 = { s02: clipAt('scene1', PRE1, 's02'), s03: clipAt('scene1', PRE1, 's03'), s04: clipAt('scene1', PRE1, 's04'), s05: clipAt('scene1', PRE1, 's05') };
+const T1 = {
+ cutIn: C1.s02, // hard cut street -> shop wide, at the start of s02's hole
+ clerkCU: C1.s03 - .15, // clerk close-up just before her line (voice at +.45)
+ amyCU: C1.s03 + 2.592 + .15, // reaction after the line
+ tilt: C1.s04 + .15, // camera tilts up as the bubble pops
+ reji: C1.s04 + .35, veg: C1.s04 + 1.5, // "…REJI…?" then the snap to "VEGGIE?"
+ off: clipAt('scene1', PRE1, 's04', 2.25) + .4, // the bubble goes just after "Um…"
+ meCU: C1.s05, // Me's close-up for s05's hole + the line
+};
+sfx('scene1', 9.55, 'chime');
+sfx('scene1', T1.cutIn + 1.5, 'beep');
+sfx('scene1', T1.veg, 'whoosh', .5);
+
+// a bubble's contents: the word above, the broccoli below
+const s1veg = `<g transform="translate(0,-28)">${bubbleText('VEGGIE?', 36)}</g><g transform="translate(0,34) scale(.8)">${broccoliSVG}</g>`;
+// the paper title plate (taped strip with hand lettering)
+const s1plate = `<g filter="url(#paper)" transform="rotate(-2)"><rect x="0" y="0" width="236" height="64" rx="4" fill="#f4ecd8" stroke="#8a7a58" stroke-width="2"/>
+ <rect x="86" y="-10" width="64" height="20" fill="#e9dca6" opacity=".85"/>
+ <text x="118" y="44" font-family="Chalkboard SE, Comic Sans MS, sans-serif" font-size="36" font-weight="700" text-anchor="middle" fill="#2a2420">Fukuoka</text></g>`;
+
+function scene1(p, D) {
+ const st = streetSet(p), S = shopSet(p), plate = prop(p, s1plate);
+ vis(st.amy.g, false); // Me (empty-handed) walks in from the left along the pavement and goes through the door
+
+ // 1.1 street: slow push toward the door and the red coffee poster 1.2 shop wide 1.3 clerk 1.4 Amy 1.5 Me
+ st.cam.cut({ x: 800, y: 450, z: 1 }, 0).to({ x: 940, y: 520, z: 1.25 }, .4, T1.cutIn - .4);
+ S.cam.cut(SHOP_WIDE, 0).cut(CU.clerk, T1.clerkCU).soft(T1.clerkCU, true)
+ .cut({ x: 1095, y: 440, z: 2.1 }, T1.amyCU).to({ x: 1095, y: 410, z: 2 }, T1.tilt, .3).shake(T1.veg, .25, 3)
+ .cut({ x: 540, y: 480, z: 2 }, T1.meCU);
+ const b = bubble(S.cam.stage, { reji: bubbleText('…REJI…?', 38), veg: s1veg });
+
+ const W = T1.cutIn; // the wide begins
+ const drinkX = 1110; // where Amy sets it down; the clerk puts it back at SHOP.drink, out of Amy's way
+ stopClock(D, (q, f) => {
+ const inShop = q >= W;
+ vis(st.cam.root, !inShop); vis(S.cam.root, inShop);
+ st.cam.apply(q, f); S.cam.apply(q, f);
+ vis(plate, q > .3 && q < 3.6);
+ tf(plate, `translate(${(48 + 2 * onTwos(q) * 0).toFixed(1)},${(52 + (q < .6 ? (1 - span(q, .3, .6)) * -40 : 0)).toFixed(1)})`);
+ // Me walks to the door (x 800) during s01 and goes in; hidden once inside
+ const walkIn = !inShop && q < 9.55, wk = spWalk(q);
+ vis(st.me.g, walkIn);
+ if (walkIn) st.me.pose({ x: tween(q, 1, 8.55, -170, 800), y: 800, s: .9, look: .5, eyeX: 1, hold: null, armR: 0, ...wk, armR: wk.armR + 5,
+ shut: blinking(q, [3.1, 6.4]) }, f);
+ if (!inShop) return;
+
+ const lipsOf = (...c) => { const m = lips(q, 'scene1', PRE1, ...c); return m; };
+ const w = q - W; // seconds into the wide
+ const wide = q < T1.clerkCU, cuClerk = q >= T1.clerkCU && q < T1.amyCU, cuAmy = q >= T1.amyCU && q < T1.meCU, cuMe = q >= T1.meCU;
+
+ /* --- the bottle: Amy puts it down, the clerk takes it, scans (beep), puts it back --- */
+ const putDown = .45, pick = 1.25, scan = 1.5, back = 2.4;
+ const onCounter = w >= putDown && !(w >= pick && w < back);
+ const clerkHas = w >= pick && w < back;
+ vis(S.on.drink, onCounter); tf(S.on.drink, `translate(${w >= back ? SHOP.drink : drinkX},${SHOP.top})`);
+
+ /* --- Amy --- */
+ const amy = { x: SHOP.amy, y: SHOP.ground, s: SHOP.s, look: .6, eyeX: 1, hold: w < putDown ? 'drink' : null,
+ shut: blinking(q, [W + 3.1, W + 7.4, T1.amyCU + .4, T1.amyCU + .8, T1.amyCU + 3.9, T1.meCU + 1]) };
+ if (w < 1) amy.armR = tween(w, 0, putDown - .05, 30, 82);
+ else amy.armR = tween(w, 1, .4, 82, 22);
+ if (w < putDown) amy.armR = tween(w, 0, putDown - .05, 30, 82);
+ if (cuAmy || cuMe || q >= T1.amyCU) { // frozen: blink, blink, the eyes dart; then the answer
+ const t = q - T1.amyCU, ex = t < .9 ? 1 : t < 1.2 ? -1 : t < 1.5 ? 1 : t < 1.85 ? -.6 : q < T1.veg ? .9 : q < T1.off ? .2 : .8;
+ Object.assign(amy, { eyeX: ex, eyeY: q >= T1.reji && q < T1.off ? -.8 : t > 1.2 && t < 1.5 ? .5 : 0, look: q < T1.off ? .3 : .5, lids: .15, brow: 0,
+ mouth: q < C1.s04 + 2.25 - .05 ? 'flat' : lipsOf('s04') === 'X' ? 'smile' : lipsOf('s04'), headR: q >= C1.s04 + 2.25 ? 4 : t > 1 && q < T1.off ? -4 * onTwos(q) * 0 - 5 : 0, lids: .3 });
+ if (q >= T1.off + .6) Object.assign(amy, { lids: 0, brow: 0 });
+ }
+
+ /* --- the clerk: smiles politely, scans, then speaks --- */
+ const lean = clerkHas || (w >= pick - .3 && w < back + .5) ? ease(Math.min(1, (w - (pick - .3)) / .3)) * (1 - ease((w - back - .1) / .4)) : 0;
+ const clerk = { ...SHOP.clerk, x: SHOP.clerk.x - 50 * lean, mouth: 'smile', look: -.3, eyeX: -.7, holdL: clerkHas ? 'drink' : null,
+ shut: blinking(q, [W + 2.6, W + 6.2, T1.clerkCU + 1.2]) };
+ clerk.armL = w < pick - .3 ? 0 : w < pick ? tween(w, pick - .3, .3, 0, 58) : w < scan ? tween(w, pick, scan - pick, 58, 12)
+ : w < scan + .35 ? tween(w, scan, .35, 12, 24) : w < back ? tween(w, scan + .35, back - scan - .35, 24, 58) : tween(w, back, .35, 58, 0);
+ if (q >= T1.clerkCU) Object.assign(clerk, { x: SHOP.clerk.x, look: -.4, eyeX: -.8, holdL: null, armL: 0, mouth: lipsOf('s03') === 'X' ? 'smile' : lipsOf('s03'), headR: -2 });
+ if (q >= T1.clerkCU + 2.7) Object.assign(clerk, { headR: 3, mouth: 'smile' }); // a little nod once she has asked
+
+ /* --- Me: queues alive (blinks, glances, one sip), then holds the laugh --- */
+ const sip = w >= 4.6 && w < 6.0 ? Math.sin((w - 4.6) / 1.4 * Math.PI) : 0;
+ const me = { x: SHOP.me, y: SHOP.ground, s: SHOP.s, look: .5, eyeX: 1, hold: 'coffee', armR: 30 + 95 * Math.min(1, sip * 1.6), lids: .1,
+ shut: blinking(q, [W + 1.7, W + 4.4, W + 6.3, W + 8.2, T1.clerkCU + .9, T1.amyCU + 2.2, T1.meCU + 2.1]) };
+ if (w >= 7.2 && w < 7.9) Object.assign(me, { eyeX: -.8, look: -.3 }); // a glance at the shelves
+ if (cuMe) {
+ const t = q - T1.meCU, grow = Math.min(1, t / .7);
+ Object.assign(me, { lids: .35, eyeX: 1, look: .6, mouth: (Math.floor(q * 6) % 2) ? 'wobble' : 'flat', headR: grow * (-2 + 1.6 * onTwos(q)), bob: grow * 2.5 * onTwos(q),
+ squash: grow * (.03 + .015 * onTwos(q)), x: SHOP.me + grow * 2.2 * onTwos(q), armR: 30 + 3 * onTwos(q) * grow });
+ if (t > 3.3 && t < 3.9) me.mouth = 'wobble'; // "too good": the lips almost give way
+ }
+
+ S.clerk.pose(clerk, f); S.amy.pose(amy, f); S.me.pose(me, f);
+ // the bubble over Amy's head: first the word she heard, then it snaps to what she thinks it means
+ const show = q < T1.reji || q >= T1.off ? null : q < T1.veg ? 'reji' : 'veg';
+ b.pose({ x: SHOP.amy + 20, y: 392, s: .95, show, pop: show === 'reji' ? span(q, T1.reji, T1.reji + .25) : span(q, T1.veg, T1.veg + .15) }, f);
+ });
+}
diff --git a/site/joke-collection/ch02/scene2.js b/site/joke-collection/ch02/scene2.js
new file mode 100644
index 0000000..4efa2fd
--- /dev/null
+++ b/site/joke-collection/ch02/scene2.js
@@ -0,0 +1,81 @@
+/* scene2.js — the currency exchange. Clerk close-up (thought bubble "$ → ¥ ?", then 「両替はしておりません。」and a small bow),
+ wide: Amy fishes out her card, Amy close-up: "I'd like to pay by credit card.", clerk close-up lights up (「あ、はい!」),
+ wide: Amy taps the card reader (card), the clerk bows deeply (「ありがとうございました!」). Ends on the shop wide scene 3 opens on. */
+'use strict';
+const PRE2 = 1; // the clerk's blank stare before her thought; the s06 hole follows
+
+const S2 = { A6: clipAt('scene2', PRE2, 's06'), A7: clipAt('scene2', PRE2, 's07'), A8: clipAt('scene2', PRE2, 's08'), A9: clipAt('scene2', PRE2, 's09') };
+Object.assign(S2, {
+ bub0: 1.5, bub1: 3.05, // the thought bubble is up (the camera tilts up to it)
+ bow0: S2.A6 + 3.9, // the small bow ends s06
+ toWide: S2.A6 + 4.75, toAmy: S2.A7 + 1, // cut to the wide in the s07 hole; Amy close-up as she starts to speak
+ toClerk: S2.A7 + 3.35, toWide2: S2.A8 + 1.5, // 0.5 s after Amy; wide after the clerk has pointed
+ step: S2.A8 + 1.55, tap: S2.A9 + .05, // Amy steps right; card touches the reader
+ bow1: S2.A9 + 2.1, // the deep bow, down as the voice starts
+});
+sfx('scene2', S2.tap, 'card');
+
+// A value that eases through [time, value] keys.
+function s2k(q, pts) {
+ if (q <= pts[0][0]) return pts[0][1];
+ for (let i = 1; i < pts.length; i++) if (q < pts[i][0]) return pts[i - 1][1] + (pts[i][1] - pts[i - 1][1]) * ease((q - pts[i - 1][0]) / (pts[i][0] - pts[i - 1][0]));
+ return pts[pts.length - 1][1];
+}
+
+function scene2(p, D) {
+ const S = shopSet(p), T = S2, cam = S.cam;
+ const bub = bubble(cam.stage, { fx: bubbleText('$ → ¥ ?', 50) });
+ const CLERK_UP = { x: 1330, y: 335, z: 2.2 }; // tilted up to give the bubble room
+ // 6 clerk close-up (tilts up to the bubble and back) 7 wide, then Amy close-up 8 clerk close-up 9 wide to the end
+ cam.cut(CU.clerk, 0).soft(0, true).to(CLERK_UP, T.bub0 - .2, .5).to(CU.clerk, T.bub1 - .1, .35)
+ .cut(SHOP_WIDE, T.toWide).soft(T.toWide, false)
+ .cut(CU.amy, T.toAmy).soft(T.toAmy, true)
+ .cut(CU.clerk, T.toClerk)
+ .cut(SHOP_WIDE, T.toWide2).soft(T.toWide2, false);
+
+ stopClock(D, (q, f) => {
+ cam.apply(q, f);
+ vis(S.on.drink, true); tf(S.on.drink, `translate(${SHOP.drink},${SHOP.top})`);
+ const say6 = between(q, T.A6 + 2.2, T.A6 + 4.3), say7 = between(q, T.A7 + 1, T.A7 + 3), say8 = between(q, T.A8, T.A8 + 1.3), say9 = between(q, T.A9 + 2.2, T.A9 + 4.1);
+
+ /* ---- clerk ---- */
+ const up = between(q, T.bub0 + .15, T.bub1); // eyes on her own thought
+ const lit = q >= T.A8 - .4; // the penny drops
+ const bow0 = s2k(q, [[T.bow0 - .1, 0], [T.bow0 + .3, 1], [T.bow0 + .6, 1], [T.bow0 + 1.0, 0]]);
+ const bow1 = s2k(q, [[T.bow1 - .15, 0], [T.bow1 + .3, 1], [T.bow1 + .55, 1], [T.bow1 + 1.0, 0]]);
+ const point = s2k(q, [[T.A8 + .15, 0], [T.A8 + .45, 1], [T.toWide2 + .9, 1], [T.toWide2 + 1.4, 0]]);
+ let cm = 'A';
+ if (say6) cm = lips(q, 'scene2', PRE2, 's06'); else if (say8) cm = lips(q, 'scene2', PRE2, 's08'); else if (say9) cm = lips(q, 'scene2', PRE2, 's09');
+ else if (lit) cm = q < T.A8 ? 'grin' : 'smile'; else if (up) cm = 'frown';
+ if (say6 && cm === 'X') cm = 'A';
+ S.clerk.pose({ ...SHOP.clerk, mouth: cm,
+ look: lit ? -.5 : -.3, eyeX: up ? 0 : lit ? -1 : -.6, eyeY: up ? -1 : lit ? -.3 : 0,
+ lids: lit ? 0 : .25, shut: bow0 > .5 || bow1 > .5 || blinking(q, [.55, 1.25, 2.45, 6.6, 8.2, 11.9, 13.2, 15.6]),
+ brow: lit ? s2k(q, [[T.A8 - .4, -.4], [T.A8 - .1, 0]]) : s2k(q, [[0, 0], [T.bub0, 0], [T.bub0 + .3, -.5], [T.bow0 + .5, -.5], [T.toWide + 1, -.35]]),
+ bob: 10 * bow0 + 40 * bow1, headR: 3 * bow0 + 6 * bow1,
+ armL: 70 * point }, f);
+
+ /* ---- Amy: empty hands, fishes out her card, holds it up, then taps the reader ---- */
+ const walking = between(q, T.step, T.step + .55) || between(q, T.tap + .9, T.tap + 1.25), w = walking ? spWalk(q) : {};
+ const fish = between(q, T.toWide + .1, T.toWide + .75);
+ const armR = fish ? 18 + 8 * onTwos(q)
+ : s2k(q, [[T.toWide + .75, 18], [T.A7 + .1, 105], [T.A7 + 3, 105], [T.A8 + .3, 85], [T.tap - .2, 85], [T.tap, 86], [T.tap + .9, 86], [T.tap + 1.4, 8]]);
+ S.amy.pose({ x: s2k(q, [[T.step, SHOP.amy], [T.step + .55, 1116], [T.tap + .9, 1116], [T.tap + 1.25, SHOP.amy]]), y: SHOP.ground, s: SHOP.s,
+ ...w, bob: w.bob || 0, legL: w.legL || 0, legR: w.legR || 0,
+ look: .6, eyeX: 1, eyeY: fish ? .9 : between(q, T.tap, T.tap + .9) ? .5 : 0, headR: fish ? 7 : 0,
+ shut: blinking(q, [6.1, 8.1, 10.4, 13.0, 15.4]),
+ mouth: say7 ? lips(q, 'scene2', PRE2, 's07') : q > T.tap + 1.4 ? 'smile' : fish ? 'A' : 'X',
+ armL: 0, armR: w.armR !== undefined && armR < 20 ? armR : armR,
+ hold: q >= T.toWide + .75 && q < T.tap + 1.3 ? 'card' : null }, f);
+
+ /* ---- Me in the queue: blinks, glances between the two, one sip while Amy taps ---- */
+ const sip = s2k(q, [[T.tap + .3, 0], [T.tap + .6, 1], [T.tap + 1.2, 1], [T.tap + 1.5, 0]]);
+ const toClerk = between(q, T.A7 + 1.4, T.A7 + 2.2) || between(q, T.bow1 - .2, T.bow1 + 1.2);
+ S.me.pose({ x: SHOP.me, y: SHOP.ground, s: SHOP.s, hold: 'coffee', armR: 30 + 112 * sip, headR: 6 * sip,
+ look: toClerk ? .9 : .4, eyeX: 1, eyeY: sip > .5 ? -.6 : 0, lids: sip > .5 ? .5 : 0,
+ mouth: q > T.bow1 + .8 ? 'smile' : 'X', shut: blinking(q, [6.3, 9.0, 11.6, 14.0, 15.8]) }, f);
+
+ /* ---- the thought bubble over the clerk's head ---- */
+ bub.pose({ x: 1330, y: 718 - 450 * .9 + 8, s: .8, show: between(q, T.bub0, T.bub1) ? 'fx' : null, pop: Math.min(1, (q - T.bub0) / .17) }, f);
+ });
+}
diff --git a/site/joke-collection/ch02/scene3.js b/site/joke-collection/ch02/scene3.js
new file mode 100644
index 0000000..b7b3dd8
--- /dev/null
+++ b/site/joke-collection/ch02/scene3.js
@@ -0,0 +1,122 @@
+/* scene3.js — the tip. Amy digs out a 100-yen coin and leaves it on the counter ("And this is for you!"); the clerk
+ is frozen (nobody tips in Japan); Me walks up, says in Japanese that she is his friend and is paying for his coffee
+ too, puts the coffee on the counter; the clerk is relieved and bows; last wide: Amy waves, Me takes his coffee back.
+ The coin stays on the counter (paid); the tea stays too (Amy collects it as they leave; scene 4 opens outside). */
+'use strict';
+const PRE3 = 0.8; // the end of scene 2 held a moment, then the hole of s10 (1.25 s) for the pocket dig
+const s3v = (clip, t = 0) => clipAt('scene3', PRE3, clip, t);
+
+/* ---------- timeline (beat time, s) ---------- */
+const S3 = {
+ dig: .9, up: 1.45, put: 1.9, slideEnd: 2.45, // Amy: hand in the pocket, coin up, coin on the counter
+ coinCU: 4.3, clerkCU: 5.4, wide1: 10.8, clerkCU2: 12.5, amyCU: 14.85, wide2: s3v('s12'), // s11: coin, clerk, wide, clerk, Amy
+ walk0: s3v('s12') + .25, walk1: s3v('s12') + 1.75, // Me crosses during the hole of s12
+ meCU: s3v('s12', 3.05), meMed: s3v('s12', 6.3), // his close-up, then the medium with the counter
+ setCoffee: s3v('s12', 7.15), takeBack: 34.35, // coffee reaches the counter on コーヒー; he takes it back at the end
+ clerkCU3: s3v('s12', 11.6), wide3: s3v('s13', 4.7), // relief close-up, final wide
+ grab: s3v('s13', .65 + 0.6), bow: s3v('s13', .65 + 2.25),
+};
+sfx('scene3', S3.put, 'coin');
+sfx('scene3', s3v('s11'), 'crickets');
+sfx('scene3', S3.bow + 1.5, 'beep');
+
+/* ---------- small helpers ---------- */
+// Piecewise eased keyframes [[t, v], …].
+const s3k = (q, pts) => {
+ if (q <= pts[0][0]) return pts[0][1];
+ for (let i = 0; i < pts.length - 1; i++) if (q < pts[i + 1][0]) return pts[i][1] + (pts[i + 1][1] - pts[i][1]) * ease((q - pts[i][0]) / (pts[i + 1][0] - pts[i][0]));
+ return pts[pts.length - 1][1];
+};
+// Where somebody is looking: [[t, {look, eyeX, eyeY}], …]; each change takes 0.2 s.
+const s3gaze = (q, list) => {
+ let i = 0; while (i + 1 < list.length && q >= list[i + 1][0]) i++;
+ const a = (list[i - 1] || list[i])[1], b = list[i][1], u = span(q, list[i][0], list[i][0] + .2), o = {};
+ for (const k of ['look', 'eyeX', 'eyeY']) o[k] = (a[k] || 0) + ((b[k] || 0) - (a[k] || 0)) * u;
+ return o;
+};
+const s3flick = (q, k, amp = .12) => amp * jit(Math.floor(q * 2.5), k); // tiny eye moves
+const FRONT = {}, TO_COIN = { look: -.2, eyeX: -.5, eyeY: .9 }, TO_AMY = { look: -.6, eyeX: -1 }, TO_ME = { look: -.7, eyeX: -1, eyeY: .1 };
+const DOWN_LEFT = { look: -.6, eyeX: -1, eyeY: .85 }; // at the cup and the coin on the counter
+const TO_CLERK = { look: .6, eyeX: 1 }, TO_ME_A = { look: -.5, eyeX: -1 }, TO_AMY_M = { look: .5, eyeX: 1 };
+
+function scene3(p, D) {
+ const S = shopSet(p), cam = S.cam, ME_MED = { x: 960, y: 560, z: 1.8 }, COIN_CU = { x: 895, y: 540, z: 8 }, TOP_CU = { x: 940, y: 575, z: 3.3 };
+ const COF_X = 957, COIN_X = 920; // Amy's left hand reaches the counter at ~920, just left of where Me's cup goes
+ // 10 wide: the dig and the coin 11 the coin alone, then the clerk's close-up, a wide of all three, the clerk again, Amy waiting
+ cam.cut(SHOP_WIDE, 0).cut(COIN_CU, S3.coinCU).soft(S3.coinCU, true)
+ .cut(CU.clerk, S3.clerkCU).cut(SHOP_WIDE, S3.wide1).soft(S3.wide1, false)
+ .cut(CU.clerk, S3.clerkCU2).soft(S3.clerkCU2, true).cut(CU.amy, S3.amyCU)
+ // 12 wide: Me walks up 13 Me's close-up, then the medium (counter in view) for the coffee
+ .cut(SHOP_WIDE, S3.wide2).soft(S3.wide2, false).cut(CU.meUp, S3.meCU).soft(S3.meCU, true)
+ .cut(ME_MED, S3.meMed).soft(S3.meMed, false)
+ .cut(TOP_CU, S3.setCoffee + .45).soft(S3.setCoffee + .45, true).cut(ME_MED, S3.setCoffee + 1.5).soft(S3.setCoffee + 1.5, false) // the cup and the coin side by side
+ // 14 clerk, relieved 15 last wide
+ .cut(CU.clerk, S3.clerkCU3).soft(S3.clerkCU3, true).cut(SHOP_WIDE, S3.wide3).soft(S3.wide3, false);
+
+ stopClock(D, (q, f) => {
+ cam.apply(q, f);
+ const mouth = (rest, ...clips) => { const m = lips(q, 'scene3', PRE3, ...clips); return m === 'X' ? rest : m; };
+
+ /* ---------- Amy ---------- */
+ const dig = between(q, S3.dig, S3.up), up = between(q, S3.up, S3.put);
+ const lean = s3k(q, [[S3.up, 0], [S3.put, -20], [S3.slideEnd, -20], [S3.slideEnd + .5, 0]]); // steps toward Me to reach
+ let lArm = 0, aArm = 0; // her screen-left hand does the pocket and the coin
+ if (q >= S3.dig) lArm = dig ? 3 + 7 * onTwos(q) : s3k(q, [[S3.up, 5], [S3.up + .25, 50], [S3.put - .1, 62], [S3.put, 77], [S3.slideEnd, 77], [S3.slideEnd + .5, 16]]);
+ if (q >= S3.slideEnd + .5) lArm = 16 + 2 * s3flick(q, 3, 1);
+ const wave = q >= S3.wide3 + .35 ? 1 : 0;
+ if (wave) aArm = s3k(q, [[S3.wide3 + .35, 6], [S3.wide3 + .75, 108]]) + (q > S3.wide3 + .75 ? 18 * onTwos(q) : 0);
+ // her gaze: down at the pocket, the clerk, the coin, Me while he walks and talks, the clerk; Me again for the wave
+ const aGaze = s3gaze(q, [[0, TO_CLERK], [S3.dig, { look: .2, eyeX: .3, eyeY: .9 }], [S3.up + .3, TO_CLERK], [S3.coinCU + 1, TO_CLERK],
+ [S3.wide2 + .8, TO_ME_A], [S3.meCU + 3.6, TO_CLERK], [s3v('s12', 6.2), TO_ME_A], [S3.clerkCU3, TO_CLERK], [S3.wide3, TO_ME_A]]);
+ const tidy = q > S3.put + 1.5;
+ S.amy.pose({ x: SHOP.amy + lean, y: SHOP.ground, s: SHOP.s, ...aGaze, eyeY: aGaze.eyeY + (q > S3.up + .3 ? s3flick(q, 5) : 0),
+ shut: blinking(q, [.35, 3.5, 3.58, 6.9, 11.8, 15.3, 20.6, 25.4, 30.2, 34.0]) && !(q > 3.4 && q < 3.8 && false),
+ mouth: q > S3.put && q < s3v('s10', 3.2) ? mouth('smile', 's10') : (q > s3v('s10', 3.2) && q < S3.wide2 ? 'grin' : (q >= S3.wide2 && q < S3.wide3 ? (q > S3.wide2 + .8 ? 'smile' : 'grin') : 'smile')),
+ lids: 0, brow: 0,
+ headR: dig ? -6 : tidy ? 4 * (q > S3.wide3 ? -1 : 1) * (q < S3.meCU ? 1 : .3) : 0,
+ holdL: up ? 'coin' : null, armR: aArm, armL: lArm }, f);
+
+ /* ---------- the coin and the tea on the counter ---------- */
+ vis(S.on.coin, q >= S3.put); // stays there to the end: paid
+ tf(S.on.coin, `translate(${(COIN_X + s3k(q, [[S3.put + .05, 0], [S3.slideEnd, 5]])).toFixed(1)},${SHOP.top})`);
+ vis(S.on.drink, true); tf(S.on.drink, `translate(${SHOP.drink},${SHOP.top})`);
+
+ /* ---------- Me ---------- */
+ const walking = between(q, S3.walk0, S3.walk1);
+ const mx = SHOP.me + (SHOP.meUp - SHOP.me) * Math.min(1, Math.max(0, (q - S3.walk0) / (S3.walk1 - S3.walk0)));
+ const w = walking ? spWalk(q - S3.walk0) : {};
+ const V12 = s3v('s12', 3.05), wd = t => V12 + t; // word times of s12
+ const havePut = q >= S3.setCoffee, haveBack = q >= S3.takeBack + .12;
+ const mArm = s3k(q, [
+ [0, 30], [S3.walk0 - .2, 30], [11.7, 30], [12.5, 124], [13.5, 124], [14.2, 30], // sips once in the queue
+ [wd(.4), 30], [wd(.75), 124], [wd(2.0), 128], [wd(2.8), 126], [wd(3.05), 134], // points at Amy with the cup
+ [S3.setCoffee, 80], [S3.setCoffee + .4, 42], [wd(5.0), 42], [wd(5.3), 48], [wd(5.8), 48], [wd(6.4), 30], // sets it down, an open hand
+ [wd(6.85), 58], [wd(7.1), 44], [wd(7.35), 58], [wd(7.8), 20], [S3.wide3 + 1.2, 22], [S3.takeBack, 80], [S3.takeBack + .12, 80], [S3.takeBack + .7, 22]]);
+ const wob = between(q, wd(6.9), wd(7.5)) ? 8 * onTwos(q) : 0;
+ const speaking = q >= V12 && q < V12 + 8.6;
+ const meGaze = s3gaze(q, [[0, TO_AMY_M], [S3.walk0, TO_AMY_M], [S3.walk1, TO_AMY_M], [wd(.4), { look: .55, eyeX: 1 }], [wd(1.7), { look: .55, eyeX: 1, eyeY: .1 }],
+ [wd(3.2), { look: .1, eyeX: .3, eyeY: .8 }], [wd(4.6), { look: .6, eyeX: 1 }], [wd(5.6), { look: .45, eyeX: 1 }], [wd(6.8), { look: .5, eyeX: .9 }], [S3.wide3, TO_AMY_M]]);
+ const nod = between(q, wd(1.35), wd(1.75)) ? 6 : between(q, S3.wide3 + .6, S3.wide3 + 1.0) ? 8 * onTwos(q) : 0;
+ S.me.pose({ x: mx, y: SHOP.ground, s: SHOP.s, ...meGaze, ...(walking ? { legL: w.legL, legR: w.legR, bob: w.bob, armL: w.armL } : {}),
+ armR: mArm + wob, hold: havePut && !haveBack ? null : 'coffee', headR: nod,
+ shut: blinking(q, [1.7, 5.6, 9.9, 13.9, 17.8, 21.6, 25.9, 29.3, 34.9]),
+ mouth: speaking ? mouth('smile', 's12') : (q > wd(6.8) ? 'smile' : 'flat'), lids: .12 }, f);
+ vis(S.on.coffee, havePut && !haveBack); tf(S.on.coffee, `translate(${COF_X},${SHOP.top})`);
+
+ /* ---------- the clerk ---------- */
+ const stun = q >= 4.3 && q < s3v('s12', 8.7);
+ const cGaze = s3gaze(q, [[0, TO_AMY], [S3.put + .3, DOWN_LEFT], [6.5, TO_AMY], [7.8, DOWN_LEFT], [9.3, TO_AMY], [10.1, DOWN_LEFT], [12.6, TO_AMY], [13.5, DOWN_LEFT], [14.4, TO_AMY],
+ [S3.walk0 + .4, TO_ME], [S3.meCU, TO_ME], [wd(1.6), TO_AMY], [wd(3.3), DOWN_LEFT], [wd(5.0), TO_ME], [wd(6.4), TO_AMY],
+ [S3.clerkCU3, TO_ME], [s3v('s13', .55), TO_AMY], [s3v('s13', 1.2), DOWN_LEFT], [S3.bow + 1.4, TO_AMY], [S3.wide3, TO_AMY]]);
+ const bowing = between(q, S3.bow, S3.bow + 1.45);
+ const bob = s3k(q, [[S3.bow, 0], [S3.bow + .45, 40], [S3.bow + 1.0, 40], [S3.bow + 1.45, 0]]);
+ const cMouth = q >= s3v('s13') + .6 && q < s3v('s13', 4.6) ? mouth('grin', 's13')
+ : stun ? (between(q, 6.45, 7.0) || between(q, 13.4, 13.9) ? 'O' : 'flat')
+ : q >= wd(6.2) ? 'smile' : 'flat';
+ S.clerk.pose({ ...SHOP.clerk, ...cGaze, eyeY: (cGaze.eyeY || 0) + (stun ? s3flick(q, 8) : 0), eyeX: (cGaze.eyeX || 0) + (stun ? s3flick(q, 9, .1) : 0),
+ shut: bowing || blinking(q, [3.1, 7.2, 8.9, 11.3, 15.1, 20.2, 24.1, 33.4]), bob,
+ mouth: cMouth, lids: stun ? .3 : s3k(q, [[wd(6.0), 0], [wd(7.2), .12]]), brow: stun ? -.35 : 0,
+ headR: bowing ? 12 * Math.sin(Math.PI * span(q, S3.bow, S3.bow + 1.45)) : stun ? -6 * (between(q, 8.5, 10.8) || between(q, 13.7, 14.8) || between(q, wd(2), wd(4)) ? 1 : 0) : 0,
+ armL: 0, armR: 0 }, f);
+ });
+}
diff --git a/site/joke-collection/ch02/scene4.js b/site/joke-collection/ch02/scene4.js
new file mode 100644
index 0000000..26aff5e
--- /dev/null
+++ b/site/joke-collection/ch02/scene4.js
@@ -0,0 +1,42 @@
+/* scene4.js — Free coffee. Outside the store at dusk: Me comes out with his coffee, sips, Amy waves goodbye and walks
+ off; "...my coffee was free" (a toast); hard cut to the title card. */
+'use strict';
+const PRE4 = 0.5;
+const S4 = { out: .35, sip: 2.7, sipEnd: 4.4, amy: 1.2, wave: 3.5, toast: clipAt('scene4', PRE4, 's14', 5.75), cut: PRE4 + 9.8 };
+sfx('scene4', .1, 'chime');
+sfx('scene4', S4.cut, 'sting');
+
+function scene4(p, D) {
+ const S = streetSet(p);
+ S.cam.cut({ x: 800, y: 480, z: 1.15 }, 0);
+ // title card on top of the camera: black, a torn paper strip with the title, a small line under it
+ const card = mk('g', {}, p);
+ card.innerHTML = `<rect width="1600" height="900" fill="#0d0b0a"/>
+ <g transform="translate(800,450) scale(1) translate(-800,-450)"><g filter="url(#paper)"><path d="M180,330 L260,318 L420,334 L600,316 L800,332 L1000,317 L1200,333 L1380,318 L1430,330 L1420,430 L1370,444 L1180,428 L1000,444 L800,430 L600,446 L400,430 L240,446 L176,432 Z" fill="#f3ead6"/></g></g>
+ <text x="800" y="418" font-family="Chalkboard SE, Avenir Next Heavy, sans-serif" font-size="92" font-weight="800" text-anchor="middle" fill="#1d1a1a">Do You Need a Bag?</text>
+ <text x="800" y="510" font-family="Avenir Next, sans-serif" font-size="38" letter-spacing="4" text-anchor="middle" fill="#cfc6b4">Joke Collection · Episode 2</text>`;
+ bakeAll(card);
+ const sipT = (q, a, b) => Math.sin(Math.PI * span(q, a, b)); // 0 → 1 → 0 over a..b
+ stopClock(D, (q, f) => {
+ S.cam.apply(q, f);
+ const title = q >= S4.cut; vis(card, title);
+ // Me: steps out of the door, walks left to x 520, sips, sighs, toasts on "free"
+ const wm = span(q, S4.out, 2.0), walkingM = q >= S4.out && q < 2.0, w = spWalk(q);
+ const sip = sipT(q, S4.sip, S4.sipEnd), toast = sipT(q, S4.toast - .3, S4.toast + 1.2);
+ const sigh = between(q, S4.sipEnd, S4.sipEnd + 1.1);
+ S.me.pose({ x: 800 - 280 * wm, y: 800 - 6 * (1 - wm) * 0, s: SHOP.s, look: walkingM ? -.4 : 0, eyeX: walkingM ? -.5 : 0,
+ ...(walkingM ? { legL: w.legL, legR: w.legR, bob: w.bob, armL: w.armL } : {}),
+ hold: 'coffee', armR: walkingM ? 35 : 35 + 125 * sip + 70 * toast,
+ mouth: sip > .5 ? 'chew' : toast > .5 ? 'smile' : sigh ? 'O' : 'X',
+ lids: sigh ? .5 : 0, squash: sigh ? .03 * Math.sin(Math.PI * span(q, S4.sipEnd, S4.sipEnd + 1.1)) : 0,
+ shut: blinking(q, [1.6, 5.1, 7.3, 10.2]) }, f);
+ vis(S.me.g, q >= S4.out);
+ // Amy: out of the door a moment later, walks right and off the frame, one wave back at him
+ const wa = span(q, S4.amy, 7.2), walkingA = q >= S4.amy && q < 7.2, waving = between(q, S4.wave, S4.wave + 1.3);
+ vis(S.amy.g, q >= S4.amy && q < 7.3);
+ S.amy.pose({ x: 800 + 760 * wa, y: 800, s: SHOP.s, look: waving ? -.5 : .2, eyeX: waving ? -1 : .6,
+ ...(walkingA ? { legL: w.legL, legR: w.legR, bob: w.bob, armL: w.armL } : {}),
+ ...(waving ? { armL: 105 + 15 * onTwos(q) } : {}),
+ hold: 'drink', armR: 30 - w.armR * 0, mouth: waving ? 'smile' : 'X', shut: blinking(q, [2.4, 4.9, 6.1]) }, f);
+ });
+}
diff --git a/site/joke-collection/ch02/store.js b/site/joke-collection/ch02/store.js
new file mode 100644
index 0000000..d1474dc
--- /dev/null
+++ b/site/joke-collection/ch02/store.js
@@ -0,0 +1,61 @@
+/* store.js — episode 2's props and places (the store inside and out), thought bubbles; the series helpers are in
+ ../lib/shared.js. */
+'use strict';
+// Painted props, held at the hand (0, 0) or stood on a surface at (0, 0) when drawn on their own.
+const coffeeSVG = artSVG('coffee', -22, -50, 44, 62); // the hundred-yen coffee: paper cup, sleeve, lid
+const drinkSVG = artSVG('drink', -14, -64, 28, 92); // Amy's bottle of green tea
+const broccoliSVG = artSVG('broccoli', -40, -44, 80, 88);
+// A credit card held up by its lower edge; a 100-yen coin (r 13) lying flat or held.
+const cardSVG = `<g filter="url(#paper)"><rect x="-30" y="-40" width="60" height="38" rx="5" fill="#2f6fb8"/><rect x="-30" y="-32" width="60" height="7" fill="#1d1a1a"/><rect x="-22" y="-18" width="12" height="9" rx="2" fill="#e8c460"/></g>`;
+const coinSVG = `<g filter="url(#paper)"><circle r="13" fill="#d8d8d2"/><circle r="10" fill="none" stroke="#a9a9a2" stroke-width="1.5"/><text y="4" font-family="Avenir Next, sans-serif" font-size="10" font-weight="700" text-anchor="middle" fill="#7a7a74">100</text></g>`;
+
+/* ---------- the store (every scene but the last) ----------
+ Seen from the customers' side. The till counter is a painted cut-out (x 760…1570, its top at y 550): the clerk
+ stands behind it (only her top half shows), the customers on the floor in front of it, all facing us. Amy at the
+ counter, Me queuing behind her on the left; he steps up to SHOP.meUp. Things put on the counter sit at y SHOP.top. */
+const SHOP = { ground: 800, s: .9, top: 552, me: 520, meUp: 800, amy: 1060, clerk: { x: 1330, y: 720, s: .9 },
+ card: 1230, coin: 1160, coffee: 957, drink: 1290 };
+// the locked wide: all three and the counter
+const SHOP_WIDE = { x: 900, y: 500, z: 1.12 };
+// close-ups (z 2.4) on each face, and on the counter top
+const CU = { clerk: { x: 1330, y: 400, z: 2.4 }, amy: { x: 1060, y: 470, z: 2.4 }, me: { x: 520, y: 470, z: 2.4 }, meUp: { x: 800, y: 470, z: 2.4 },
+ coin: { x: 1150, y: 520, z: 3.2 } };
+function shopSet(p, { meHolds = {}, amyHolds = {}, clerkHolds = {} } = {}) {
+ const cam = paperCam(p, 'shop', {}, { after: 'counter', stages: ['wall'] });
+ const clerk = clerkPuppet(cam.stageAt.wall, { holds: { drink: drinkSVG, coffee: coffeeSVG, coin: coinSVG, ...clerkHolds } });
+ // things lying on the counter top (behind the customers): each a piece you show with vis() and place with tf()
+ const on = {};
+ for (const [k, svg] of [['drink', drinkSVG], ['coffee', coffeeSVG], ['coin', `<g transform="scale(1,.45)">${coinSVG}</g>`]]) { on[k] = prop(cam.stage, svg); vis(on[k], false); }
+ const me = meAdultPuppet(cam.stage, { holds: { coffee: coffeeSVG, ...meHolds } });
+ const amy = amyPuppet(cam.stage, { holds: { drink: drinkSVG, card: cardSVG, coin: coinSVG, ...amyHolds } });
+ return { cam, clerk, me, amy, on };
+}
+
+/* ---------- outside the store (first and last shots) ----------
+ The store front at dusk, its automatic door at x 700…900 (people come out at x 800, y 800). */
+function streetSet(p) {
+ const cam = paperCam(p, 'street');
+ return { cam, me: meAdultPuppet(cam.stage, { holds: { coffee: coffeeSVG } }), amy: amyPuppet(cam.stage, { holds: { drink: drinkSVG } }) };
+}
+
+/* ---------- thought bubbles ----------
+ A paper cloud over a head with small puffs leading down to it. bubble(parent, { key: svg … }) → pose({ x, y, s,
+ show: key | null, pop }) where (x, y) is the head top it rises from and pop 0…1 grows it in (a frame or two). The
+ contents are drawn centred on (0, -130) inside a cloud about 260 × 150. */
+function bubble(parent, contents) {
+ const g = mk('g', {}, parent);
+ g.innerHTML = `<g filter="url(#paper)"><circle cx="-6" cy="-14" r="9" fill="#fbfbf6"/><circle cx="-18" cy="-40" r="14" fill="#fbfbf6"/>
+ <path d="M-120,-100 C-150,-150 -100,-200 -50,-190 C-30,-226 40,-226 60,-192 C110,-204 150,-160 126,-116 C150,-76 100,-50 60,-62 C30,-36 -30,-38 -50,-62 C-100,-50 -146,-70 -120,-100 Z" fill="#fbfbf6"/></g>
+ ${Object.entries(contents).map(([k, svg]) => `<g data-p="c_${k}" transform="translate(0,-130)">${svg}</g>`).join('')}`;
+ bakeAll(g);
+ const P = pieces(g), keys = Object.keys(contents);
+ return { g, pose({ x = 0, y = 0, s = 1, show = null, pop = 1 } = {}, f = 0) {
+ vis(g, !!show);
+ const k = s * (.4 + .6 * Math.min(1, pop)), j = .35 * jit(f >> 1, 41);
+ tf(g, `translate(${(x + j).toFixed(1)},${y.toFixed(1)}) scale(${k.toFixed(3)})`);
+ for (const c of keys) vis(P['c_' + c], show === c);
+ } };
+}
+// Words in a bubble, in the show's hand-lettered style.
+const bubbleText = (text, size = 44, fill = '#1d1a1a') => `<text y="${size * .35}" font-family="Chalkboard SE, Comic Sans MS, sans-serif" font-size="${size}" font-weight="700" text-anchor="middle" fill="${fill}">${text}</text>`;
+
diff --git a/site/joke-collection/img/props/broccoli.webp b/site/joke-collection/img/props/broccoli.webp
new file mode 100644
index 0000000..071b304
Binary files /dev/null and b/site/joke-collection/img/props/broccoli.webp differ
diff --git a/site/joke-collection/img/props/bun-bite.webp b/site/joke-collection/img/props/bun-bite.webp
new file mode 100644
index 0000000..ed33ce7
Binary files /dev/null and b/site/joke-collection/img/props/bun-bite.webp differ
diff --git a/site/joke-collection/img/props/bun.webp b/site/joke-collection/img/props/bun.webp
new file mode 100644
index 0000000..9586859
Binary files /dev/null and b/site/joke-collection/img/props/bun.webp differ
diff --git a/site/joke-collection/img/props/coffee.webp b/site/joke-collection/img/props/coffee.webp
new file mode 100644
index 0000000..a6ef010
Binary files /dev/null and b/site/joke-collection/img/props/coffee.webp differ
diff --git a/site/joke-collection/img/props/desk.webp b/site/joke-collection/img/props/desk.webp
new file mode 100644
index 0000000..c1a9827
Binary files /dev/null and b/site/joke-collection/img/props/desk.webp differ
diff --git a/site/joke-collection/img/props/drink.webp b/site/joke-collection/img/props/drink.webp
new file mode 100644
index 0000000..cf93b5e
Binary files /dev/null and b/site/joke-collection/img/props/drink.webp differ
diff --git a/site/joke-collection/img/props/hw-blank.webp b/site/joke-collection/img/props/hw-blank.webp
new file mode 100644
index 0000000..06c6b99
Binary files /dev/null and b/site/joke-collection/img/props/hw-blank.webp differ
diff --git a/site/joke-collection/img/props/hw.webp b/site/joke-collection/img/props/hw.webp
new file mode 100644
index 0000000..69d48b1
Binary files /dev/null and b/site/joke-collection/img/props/hw.webp differ
diff --git a/site/joke-collection/img/props/soy.webp b/site/joke-collection/img/props/soy.webp
new file mode 100644
index 0000000..15cb1e3
Binary files /dev/null and b/site/joke-collection/img/props/soy.webp differ
diff --git a/site/joke-collection/img/props/umb-red.webp b/site/joke-collection/img/props/umb-red.webp
new file mode 100644
index 0000000..9cea38d
Binary files /dev/null and b/site/joke-collection/img/props/umb-red.webp differ
diff --git a/site/joke-collection/img/props/umb-yellow.webp b/site/joke-collection/img/props/umb-yellow.webp
new file mode 100644
index 0000000..ec51012
Binary files /dev/null and b/site/joke-collection/img/props/umb-yellow.webp differ
diff --git a/site/joke-collection/img/puppets/0104ccb2.webp b/site/joke-collection/img/puppets/0104ccb2.webp
new file mode 100644
index 0000000..6cea1b6
Binary files /dev/null and b/site/joke-collection/img/puppets/0104ccb2.webp differ
diff --git a/site/joke-collection/img/puppets/0350b307.webp b/site/joke-collection/img/puppets/0350b307.webp
new file mode 100644
index 0000000..3d8fd45
Binary files /dev/null and b/site/joke-collection/img/puppets/0350b307.webp differ
diff --git a/site/joke-collection/img/puppets/03c68b5a.webp b/site/joke-collection/img/puppets/03c68b5a.webp
new file mode 100644
index 0000000..a7773dd
Binary files /dev/null and b/site/joke-collection/img/puppets/03c68b5a.webp differ
diff --git a/site/joke-collection/img/puppets/0c1d51d0.webp b/site/joke-collection/img/puppets/0c1d51d0.webp
new file mode 100644
index 0000000..38a721f
Binary files /dev/null and b/site/joke-collection/img/puppets/0c1d51d0.webp differ
diff --git a/site/joke-collection/img/puppets/0d6134f9.webp b/site/joke-collection/img/puppets/0d6134f9.webp
new file mode 100644
index 0000000..791041f
Binary files /dev/null and b/site/joke-collection/img/puppets/0d6134f9.webp differ
diff --git a/site/joke-collection/img/puppets/101c8d3e.webp b/site/joke-collection/img/puppets/101c8d3e.webp
new file mode 100644
index 0000000..a80cde3
Binary files /dev/null and b/site/joke-collection/img/puppets/101c8d3e.webp differ
diff --git a/site/joke-collection/img/puppets/124b5f31.webp b/site/joke-collection/img/puppets/124b5f31.webp
new file mode 100644
index 0000000..ee73d6a
Binary files /dev/null and b/site/joke-collection/img/puppets/124b5f31.webp differ
diff --git a/site/joke-collection/img/puppets/13be1416.webp b/site/joke-collection/img/puppets/13be1416.webp
new file mode 100644
index 0000000..ae9b0d7
Binary files /dev/null and b/site/joke-collection/img/puppets/13be1416.webp differ
diff --git a/site/joke-collection/img/puppets/1741e580.webp b/site/joke-collection/img/puppets/1741e580.webp
new file mode 100644
index 0000000..670831e
Binary files /dev/null and b/site/joke-collection/img/puppets/1741e580.webp differ
diff --git a/site/joke-collection/img/puppets/17f77aa8.webp b/site/joke-collection/img/puppets/17f77aa8.webp
new file mode 100644
index 0000000..e8a0b11
Binary files /dev/null and b/site/joke-collection/img/puppets/17f77aa8.webp differ
diff --git a/site/joke-collection/img/puppets/1a5c60bb.webp b/site/joke-collection/img/puppets/1a5c60bb.webp
new file mode 100644
index 0000000..c69583c
Binary files /dev/null and b/site/joke-collection/img/puppets/1a5c60bb.webp differ
diff --git a/site/joke-collection/img/puppets/1acc237c.webp b/site/joke-collection/img/puppets/1acc237c.webp
new file mode 100644
index 0000000..086aa2d
Binary files /dev/null and b/site/joke-collection/img/puppets/1acc237c.webp differ
diff --git a/site/joke-collection/img/puppets/21e90356.webp b/site/joke-collection/img/puppets/21e90356.webp
new file mode 100644
index 0000000..2644377
Binary files /dev/null and b/site/joke-collection/img/puppets/21e90356.webp differ
diff --git a/site/joke-collection/img/puppets/2905b9e3.webp b/site/joke-collection/img/puppets/2905b9e3.webp
new file mode 100644
index 0000000..b9c7b51
Binary files /dev/null and b/site/joke-collection/img/puppets/2905b9e3.webp differ
diff --git a/site/joke-collection/img/puppets/2c8bb592.webp b/site/joke-collection/img/puppets/2c8bb592.webp
new file mode 100644
index 0000000..a75a299
Binary files /dev/null and b/site/joke-collection/img/puppets/2c8bb592.webp differ
diff --git a/site/joke-collection/img/puppets/2dbe309c.webp b/site/joke-collection/img/puppets/2dbe309c.webp
new file mode 100644
index 0000000..e477575
Binary files /dev/null and b/site/joke-collection/img/puppets/2dbe309c.webp differ
diff --git a/site/joke-collection/img/puppets/2f5d3cf3.webp b/site/joke-collection/img/puppets/2f5d3cf3.webp
new file mode 100644
index 0000000..29a3d5a
Binary files /dev/null and b/site/joke-collection/img/puppets/2f5d3cf3.webp differ
diff --git a/site/joke-collection/img/puppets/2f966492.webp b/site/joke-collection/img/puppets/2f966492.webp
new file mode 100644
index 0000000..be0b35e
Binary files /dev/null and b/site/joke-collection/img/puppets/2f966492.webp differ
diff --git a/site/joke-collection/img/puppets/31da6bc7.webp b/site/joke-collection/img/puppets/31da6bc7.webp
new file mode 100644
index 0000000..a2dd25c
Binary files /dev/null and b/site/joke-collection/img/puppets/31da6bc7.webp differ
diff --git a/site/joke-collection/img/puppets/38ce736c.webp b/site/joke-collection/img/puppets/38ce736c.webp
new file mode 100644
index 0000000..abca456
Binary files /dev/null and b/site/joke-collection/img/puppets/38ce736c.webp differ
diff --git a/site/joke-collection/img/puppets/3efa3000.webp b/site/joke-collection/img/puppets/3efa3000.webp
new file mode 100644
index 0000000..77ccea4
Binary files /dev/null and b/site/joke-collection/img/puppets/3efa3000.webp differ
diff --git a/site/joke-collection/img/puppets/419ba86b.webp b/site/joke-collection/img/puppets/419ba86b.webp
new file mode 100644
index 0000000..b0aad4a
Binary files /dev/null and b/site/joke-collection/img/puppets/419ba86b.webp differ
diff --git a/site/joke-collection/img/puppets/42025885.webp b/site/joke-collection/img/puppets/42025885.webp
new file mode 100644
index 0000000..95e57cf
Binary files /dev/null and b/site/joke-collection/img/puppets/42025885.webp differ
diff --git a/site/joke-collection/img/puppets/429b48d1.webp b/site/joke-collection/img/puppets/429b48d1.webp
new file mode 100644
index 0000000..2f773d1
Binary files /dev/null and b/site/joke-collection/img/puppets/429b48d1.webp differ
diff --git a/site/joke-collection/img/puppets/46d33b12.webp b/site/joke-collection/img/puppets/46d33b12.webp
new file mode 100644
index 0000000..ddb625c
Binary files /dev/null and b/site/joke-collection/img/puppets/46d33b12.webp differ
diff --git a/site/joke-collection/img/puppets/4c43f571.webp b/site/joke-collection/img/puppets/4c43f571.webp
new file mode 100644
index 0000000..df7b764
Binary files /dev/null and b/site/joke-collection/img/puppets/4c43f571.webp differ
diff --git a/site/joke-collection/img/puppets/4c7beb8d.webp b/site/joke-collection/img/puppets/4c7beb8d.webp
new file mode 100644
index 0000000..d3782ac
Binary files /dev/null and b/site/joke-collection/img/puppets/4c7beb8d.webp differ
diff --git a/site/joke-collection/img/puppets/4d0ca735.webp b/site/joke-collection/img/puppets/4d0ca735.webp
new file mode 100644
index 0000000..6ec837d
Binary files /dev/null and b/site/joke-collection/img/puppets/4d0ca735.webp differ
diff --git a/site/joke-collection/img/puppets/523ca076.webp b/site/joke-collection/img/puppets/523ca076.webp
new file mode 100644
index 0000000..88a4df7
Binary files /dev/null and b/site/joke-collection/img/puppets/523ca076.webp differ
diff --git a/site/joke-collection/img/puppets/52999469.webp b/site/joke-collection/img/puppets/52999469.webp
new file mode 100644
index 0000000..40f83db
Binary files /dev/null and b/site/joke-collection/img/puppets/52999469.webp differ
diff --git a/site/joke-collection/img/puppets/5622e8b6.webp b/site/joke-collection/img/puppets/5622e8b6.webp
new file mode 100644
index 0000000..f3bc164
Binary files /dev/null and b/site/joke-collection/img/puppets/5622e8b6.webp differ
diff --git a/site/joke-collection/img/puppets/57f5857f.webp b/site/joke-collection/img/puppets/57f5857f.webp
new file mode 100644
index 0000000..b75e638
Binary files /dev/null and b/site/joke-collection/img/puppets/57f5857f.webp differ
diff --git a/site/joke-collection/img/puppets/5814fc79.webp b/site/joke-collection/img/puppets/5814fc79.webp
new file mode 100644
index 0000000..44a663c
Binary files /dev/null and b/site/joke-collection/img/puppets/5814fc79.webp differ
diff --git a/site/joke-collection/img/puppets/5a381261.webp b/site/joke-collection/img/puppets/5a381261.webp
new file mode 100644
index 0000000..ae333bf
Binary files /dev/null and b/site/joke-collection/img/puppets/5a381261.webp differ
diff --git a/site/joke-collection/img/puppets/5b8192de.webp b/site/joke-collection/img/puppets/5b8192de.webp
new file mode 100644
index 0000000..550c996
Binary files /dev/null and b/site/joke-collection/img/puppets/5b8192de.webp differ
diff --git a/site/joke-collection/img/puppets/5d270884.webp b/site/joke-collection/img/puppets/5d270884.webp
new file mode 100644
index 0000000..105e405
Binary files /dev/null and b/site/joke-collection/img/puppets/5d270884.webp differ
diff --git a/site/joke-collection/img/puppets/5e6a1ad9.webp b/site/joke-collection/img/puppets/5e6a1ad9.webp
new file mode 100644
index 0000000..208ec17
Binary files /dev/null and b/site/joke-collection/img/puppets/5e6a1ad9.webp differ
diff --git a/site/joke-collection/img/puppets/60d9342c.webp b/site/joke-collection/img/puppets/60d9342c.webp
new file mode 100644
index 0000000..be1d6a3
Binary files /dev/null and b/site/joke-collection/img/puppets/60d9342c.webp differ
diff --git a/site/joke-collection/img/puppets/60dc68f7.webp b/site/joke-collection/img/puppets/60dc68f7.webp
new file mode 100644
index 0000000..acab5ef
Binary files /dev/null and b/site/joke-collection/img/puppets/60dc68f7.webp differ
diff --git a/site/joke-collection/img/puppets/62b75d9c.webp b/site/joke-collection/img/puppets/62b75d9c.webp
new file mode 100644
index 0000000..8ed9dc2
Binary files /dev/null and b/site/joke-collection/img/puppets/62b75d9c.webp differ
diff --git a/site/joke-collection/img/puppets/666f08a0.webp b/site/joke-collection/img/puppets/666f08a0.webp
new file mode 100644
index 0000000..b585714
Binary files /dev/null and b/site/joke-collection/img/puppets/666f08a0.webp differ
diff --git a/site/joke-collection/img/puppets/670aff5c.webp b/site/joke-collection/img/puppets/670aff5c.webp
new file mode 100644
index 0000000..316b0ba
Binary files /dev/null and b/site/joke-collection/img/puppets/670aff5c.webp differ
diff --git a/site/joke-collection/img/puppets/69e4ff32.webp b/site/joke-collection/img/puppets/69e4ff32.webp
new file mode 100644
index 0000000..041ecdc
Binary files /dev/null and b/site/joke-collection/img/puppets/69e4ff32.webp differ
diff --git a/site/joke-collection/img/puppets/6aa24676.webp b/site/joke-collection/img/puppets/6aa24676.webp
new file mode 100644
index 0000000..10d648c
Binary files /dev/null and b/site/joke-collection/img/puppets/6aa24676.webp differ
diff --git a/site/joke-collection/img/puppets/6aa2c9f0.webp b/site/joke-collection/img/puppets/6aa2c9f0.webp
new file mode 100644
index 0000000..37116db
Binary files /dev/null and b/site/joke-collection/img/puppets/6aa2c9f0.webp differ
diff --git a/site/joke-collection/img/puppets/7727d770.webp b/site/joke-collection/img/puppets/7727d770.webp
new file mode 100644
index 0000000..6f25ba9
Binary files /dev/null and b/site/joke-collection/img/puppets/7727d770.webp differ
diff --git a/site/joke-collection/img/puppets/7a172edc.webp b/site/joke-collection/img/puppets/7a172edc.webp
new file mode 100644
index 0000000..a6103e3
Binary files /dev/null and b/site/joke-collection/img/puppets/7a172edc.webp differ
diff --git a/site/joke-collection/img/puppets/7ffe606e.webp b/site/joke-collection/img/puppets/7ffe606e.webp
new file mode 100644
index 0000000..faf55e4
Binary files /dev/null and b/site/joke-collection/img/puppets/7ffe606e.webp differ
diff --git a/site/joke-collection/img/puppets/85c7ab4d.webp b/site/joke-collection/img/puppets/85c7ab4d.webp
new file mode 100644
index 0000000..7aedab5
Binary files /dev/null and b/site/joke-collection/img/puppets/85c7ab4d.webp differ
diff --git a/site/joke-collection/img/puppets/8aba41ce.webp b/site/joke-collection/img/puppets/8aba41ce.webp
new file mode 100644
index 0000000..43db727
Binary files /dev/null and b/site/joke-collection/img/puppets/8aba41ce.webp differ
diff --git a/site/joke-collection/img/puppets/8fc29343.webp b/site/joke-collection/img/puppets/8fc29343.webp
new file mode 100644
index 0000000..694dd62
Binary files /dev/null and b/site/joke-collection/img/puppets/8fc29343.webp differ
diff --git a/site/joke-collection/img/puppets/94308d71.webp b/site/joke-collection/img/puppets/94308d71.webp
new file mode 100644
index 0000000..bbddbd3
Binary files /dev/null and b/site/joke-collection/img/puppets/94308d71.webp differ
diff --git a/site/joke-collection/img/puppets/96b31089.webp b/site/joke-collection/img/puppets/96b31089.webp
new file mode 100644
index 0000000..8efe2c2
Binary files /dev/null and b/site/joke-collection/img/puppets/96b31089.webp differ
diff --git a/site/joke-collection/img/puppets/96cfe19e.webp b/site/joke-collection/img/puppets/96cfe19e.webp
new file mode 100644
index 0000000..dd35910
Binary files /dev/null and b/site/joke-collection/img/puppets/96cfe19e.webp differ
diff --git a/site/joke-collection/img/puppets/98c1d29b.webp b/site/joke-collection/img/puppets/98c1d29b.webp
new file mode 100644
index 0000000..c1b4e03
Binary files /dev/null and b/site/joke-collection/img/puppets/98c1d29b.webp differ
diff --git a/site/joke-collection/img/puppets/99012789.webp b/site/joke-collection/img/puppets/99012789.webp
new file mode 100644
index 0000000..81cc9f2
Binary files /dev/null and b/site/joke-collection/img/puppets/99012789.webp differ
diff --git a/site/joke-collection/img/puppets/9a4f7476.webp b/site/joke-collection/img/puppets/9a4f7476.webp
new file mode 100644
index 0000000..ee6172b
Binary files /dev/null and b/site/joke-collection/img/puppets/9a4f7476.webp differ
diff --git a/site/joke-collection/img/puppets/9b806969.webp b/site/joke-collection/img/puppets/9b806969.webp
new file mode 100644
index 0000000..16e8fb5
Binary files /dev/null and b/site/joke-collection/img/puppets/9b806969.webp differ
diff --git a/site/joke-collection/img/puppets/a3c3fd04.webp b/site/joke-collection/img/puppets/a3c3fd04.webp
new file mode 100644
index 0000000..3661107
Binary files /dev/null and b/site/joke-collection/img/puppets/a3c3fd04.webp differ
diff --git a/site/joke-collection/img/puppets/a3e8b09b.webp b/site/joke-collection/img/puppets/a3e8b09b.webp
new file mode 100644
index 0000000..3191693
Binary files /dev/null and b/site/joke-collection/img/puppets/a3e8b09b.webp differ
diff --git a/site/joke-collection/img/puppets/a45377e3.webp b/site/joke-collection/img/puppets/a45377e3.webp
new file mode 100644
index 0000000..a89f747
Binary files /dev/null and b/site/joke-collection/img/puppets/a45377e3.webp differ
diff --git a/site/joke-collection/img/puppets/a457f521.webp b/site/joke-collection/img/puppets/a457f521.webp
new file mode 100644
index 0000000..c7bc00e
Binary files /dev/null and b/site/joke-collection/img/puppets/a457f521.webp differ
diff --git a/site/joke-collection/img/puppets/a8a1631f.webp b/site/joke-collection/img/puppets/a8a1631f.webp
new file mode 100644
index 0000000..0781094
Binary files /dev/null and b/site/joke-collection/img/puppets/a8a1631f.webp differ
diff --git a/site/joke-collection/img/puppets/a8faa710.webp b/site/joke-collection/img/puppets/a8faa710.webp
new file mode 100644
index 0000000..03ed32f
Binary files /dev/null and b/site/joke-collection/img/puppets/a8faa710.webp differ
diff --git a/site/joke-collection/img/puppets/ab2a4457.webp b/site/joke-collection/img/puppets/ab2a4457.webp
new file mode 100644
index 0000000..5bba252
Binary files /dev/null and b/site/joke-collection/img/puppets/ab2a4457.webp differ
diff --git a/site/joke-collection/img/puppets/ab40532c.webp b/site/joke-collection/img/puppets/ab40532c.webp
new file mode 100644
index 0000000..c6e9e24
Binary files /dev/null and b/site/joke-collection/img/puppets/ab40532c.webp differ
diff --git a/site/joke-collection/img/puppets/abee4c66.webp b/site/joke-collection/img/puppets/abee4c66.webp
new file mode 100644
index 0000000..efc36dd
Binary files /dev/null and b/site/joke-collection/img/puppets/abee4c66.webp differ
diff --git a/site/joke-collection/img/puppets/b15d03b3.webp b/site/joke-collection/img/puppets/b15d03b3.webp
new file mode 100644
index 0000000..bc6f70d
Binary files /dev/null and b/site/joke-collection/img/puppets/b15d03b3.webp differ
diff --git a/site/joke-collection/img/puppets/b1676e6c.webp b/site/joke-collection/img/puppets/b1676e6c.webp
new file mode 100644
index 0000000..fe2186a
Binary files /dev/null and b/site/joke-collection/img/puppets/b1676e6c.webp differ
diff --git a/site/joke-collection/img/puppets/b1bba1ca.webp b/site/joke-collection/img/puppets/b1bba1ca.webp
new file mode 100644
index 0000000..86e1a08
Binary files /dev/null and b/site/joke-collection/img/puppets/b1bba1ca.webp differ
diff --git a/site/joke-collection/img/puppets/b445b18f.webp b/site/joke-collection/img/puppets/b445b18f.webp
new file mode 100644
index 0000000..9a780d8
Binary files /dev/null and b/site/joke-collection/img/puppets/b445b18f.webp differ
diff --git a/site/joke-collection/img/puppets/b7a25c1a.webp b/site/joke-collection/img/puppets/b7a25c1a.webp
new file mode 100644
index 0000000..612740a
Binary files /dev/null and b/site/joke-collection/img/puppets/b7a25c1a.webp differ
diff --git a/site/joke-collection/img/puppets/b8df4825.webp b/site/joke-collection/img/puppets/b8df4825.webp
new file mode 100644
index 0000000..1ffd23e
Binary files /dev/null and b/site/joke-collection/img/puppets/b8df4825.webp differ
diff --git a/site/joke-collection/img/puppets/baked.js b/site/joke-collection/img/puppets/baked.js
new file mode 100644
index 0000000..25872ca
--- /dev/null
+++ b/site/joke-collection/img/puppets/baked.js
@@ -0,0 +1 @@
+window.BAKED = {"f0e2b031": "f0e2b031.webp", "124b5f31": "124b5f31.webp", "0d6134f9": "0d6134f9.webp", "a457f521": "a457f521.webp", "d28ec985": "d28ec985.webp", "03c68b5a": "03c68b5a.webp", "ebb471fa": "ebb471fa.webp", "6aa2c9f0": "6aa2c9f0.webp", "7727d770": "7727d770.webp", "b1bba1ca": "b1bba1ca.webp", "b15d03b3": "b15d03b3.webp", "46d33b12": "46d33b12.webp", "ebc38456": "ebc38456.webp", "69e4ff32": "69e4ff32.webp", "a45377e3": "a45377e3.webp", "a3e8b09b": "a3e8b09b.webp", "94308d71": "94308d71.webp", "6aa24676": "6aa24676.webp", "c26aa82e": "c26aa82e.webp", "5814fc79": "5814fc79.webp", "f692b475": "f692b475.webp", "b1676e6c": "b1676e6c.webp", "1a5c60bb": "1a5c60bb.webp", "b445b18f": "b445b18f.webp", "52999469": "52999469.webp", "42025885": "42025885.webp", "5d270884": "5d270884.webp", "abee4c66": "abee4c66.webp", "a3c3fd04": "a3c3fd04.webp", "e9388cee": "e9388cee.webp", "b8df4825": "b8df4825.webp", "5e6a1ad9": "5e6a1ad9.webp", "99012789": "99012789.webp", "13be1416": "13be1416.webp", "0350b307": "0350b307.webp", "1acc237c": "1acc237c.webp", "2dbe309c": "2dbe309c.webp", "b7a25c1a": "b7a25c1a.webp", "f039a696": "f039a696.webp", "0c1d51d0": "0c1d51d0.webp", "5a381261": "5a381261.webp", "5b8192de": "5b8192de.webp", "a8a1631f": "a8a1631f.webp", "c867c2bc": "c867c2bc.webp", "60dc68f7": "60dc68f7.webp", "419ba86b": "419ba86b.webp", "d2f420e7": "d2f420e7.webp", "e1f413c7": "e1f413c7.webp", "ab40532c": "ab40532c.webp", "fb885bbf": "fb885bbf.webp", "85c7ab4d": "85c7ab4d.webp", "c4c607a6": "c4c607a6.webp", "8aba41ce": "8aba41ce.webp", "2f966492": "2f966492.webp", "f0fa69c1": "f0fa69c1.webp", "57f5857f": "57f5857f.webp", "17f77aa8": "17f77aa8.webp", "fc38e90e": "fc38e90e.webp", "bbcbf5cf": "bbcbf5cf.webp", "4c7beb8d": "4c7beb8d.webp", "3efa3000": "3efa3000.webp", "2905b9e3": "2905b9e3.webp", "2f5d3cf3": "2f5d3cf3.webp", "0104ccb2": "0104ccb2.webp", "8fc29343": "8fc29343.webp", "9a4f7476": "9a4f7476.webp", "2c8bb592": "2c8bb592.webp", "d4fbb7e0": "d4fbb7e0.webp", "670aff5c": "670aff5c.webp", "31da6bc7": "31da6bc7.webp", "60d9342c": "60d9342c.webp", "1741e580": "1741e580.webp", "429b48d1": "429b48d1.webp", "96cfe19e": "96cfe19e.webp", "62b75d9c": "62b75d9c.webp", "666f08a0": "666f08a0.webp", "7ffe606e": "7ffe606e.webp", "5622e8b6": "5622e8b6.webp", "7a172edc": "7a172edc.webp", "523ca076": "523ca076.webp", "4d0ca735": "4d0ca735.webp", "d0c32627": "d0c32627.webp", "eacc874b": "eacc874b.webp", "98c1d29b": "98c1d29b.webp", "bdc7df1e": "bdc7df1e.webp", "d820935e": "d820935e.webp", "101c8d3e": "101c8d3e.webp", "4c43f571": "4c43f571.webp", "bd535b5d": "bd535b5d.webp", "ccad6309": "ccad6309.webp", "fe16e4fb": "fe16e4fb.webp", "21e90356": "21e90356.webp", "38ce736c": "38ce736c.webp", "ab2a4457": "ab2a4457.webp", "96b31089": "96b31089.webp", "a8faa710": "a8faa710.webp", "da33b9dd": "da33b9dd.webp", "f892d758": "f892d758.webp", "9b806969": "9b806969.webp"};
diff --git a/site/joke-collection/img/puppets/bbcbf5cf.webp b/site/joke-collection/img/puppets/bbcbf5cf.webp
new file mode 100644
index 0000000..5c7da8c
Binary files /dev/null and b/site/joke-collection/img/puppets/bbcbf5cf.webp differ
diff --git a/site/joke-collection/img/puppets/bd535b5d.webp b/site/joke-collection/img/puppets/bd535b5d.webp
new file mode 100644
index 0000000..db4a0d2
Binary files /dev/null and b/site/joke-collection/img/puppets/bd535b5d.webp differ
diff --git a/site/joke-collection/img/puppets/bdc7df1e.webp b/site/joke-collection/img/puppets/bdc7df1e.webp
new file mode 100644
index 0000000..18e4d69
Binary files /dev/null and b/site/joke-collection/img/puppets/bdc7df1e.webp differ
diff --git a/site/joke-collection/img/puppets/c26aa82e.webp b/site/joke-collection/img/puppets/c26aa82e.webp
new file mode 100644
index 0000000..5fd17ce
Binary files /dev/null and b/site/joke-collection/img/puppets/c26aa82e.webp differ
diff --git a/site/joke-collection/img/puppets/c4c607a6.webp b/site/joke-collection/img/puppets/c4c607a6.webp
new file mode 100644
index 0000000..5e32854
Binary files /dev/null and b/site/joke-collection/img/puppets/c4c607a6.webp differ
diff --git a/site/joke-collection/img/puppets/c867c2bc.webp b/site/joke-collection/img/puppets/c867c2bc.webp
new file mode 100644
index 0000000..031bba2
Binary files /dev/null and b/site/joke-collection/img/puppets/c867c2bc.webp differ
diff --git a/site/joke-collection/img/puppets/ccad6309.webp b/site/joke-collection/img/puppets/ccad6309.webp
new file mode 100644
index 0000000..92ffcd3
Binary files /dev/null and b/site/joke-collection/img/puppets/ccad6309.webp differ
diff --git a/site/joke-collection/img/puppets/d0c32627.webp b/site/joke-collection/img/puppets/d0c32627.webp
new file mode 100644
index 0000000..d41ff4f
Binary files /dev/null and b/site/joke-collection/img/puppets/d0c32627.webp differ
diff --git a/site/joke-collection/img/puppets/d28ec985.webp b/site/joke-collection/img/puppets/d28ec985.webp
new file mode 100644
index 0000000..90c167f
Binary files /dev/null and b/site/joke-collection/img/puppets/d28ec985.webp differ
diff --git a/site/joke-collection/img/puppets/d2f420e7.webp b/site/joke-collection/img/puppets/d2f420e7.webp
new file mode 100644
index 0000000..0402c90
Binary files /dev/null and b/site/joke-collection/img/puppets/d2f420e7.webp differ
diff --git a/site/joke-collection/img/puppets/d4fbb7e0.webp b/site/joke-collection/img/puppets/d4fbb7e0.webp
new file mode 100644
index 0000000..07183a4
Binary files /dev/null and b/site/joke-collection/img/puppets/d4fbb7e0.webp differ
diff --git a/site/joke-collection/img/puppets/d820935e.webp b/site/joke-collection/img/puppets/d820935e.webp
new file mode 100644
index 0000000..b5ba673
Binary files /dev/null and b/site/joke-collection/img/puppets/d820935e.webp differ
diff --git a/site/joke-collection/img/puppets/da33b9dd.webp b/site/joke-collection/img/puppets/da33b9dd.webp
new file mode 100644
index 0000000..a82a8c2
Binary files /dev/null and b/site/joke-collection/img/puppets/da33b9dd.webp differ
diff --git a/site/joke-collection/img/puppets/e1f413c7.webp b/site/joke-collection/img/puppets/e1f413c7.webp
new file mode 100644
index 0000000..3c1979c
Binary files /dev/null and b/site/joke-collection/img/puppets/e1f413c7.webp differ
diff --git a/site/joke-collection/img/puppets/e9388cee.webp b/site/joke-collection/img/puppets/e9388cee.webp
new file mode 100644
index 0000000..9cafdc9
Binary files /dev/null and b/site/joke-collection/img/puppets/e9388cee.webp differ
diff --git a/site/joke-collection/img/puppets/eacc874b.webp b/site/joke-collection/img/puppets/eacc874b.webp
new file mode 100644
index 0000000..6a911f9
Binary files /dev/null and b/site/joke-collection/img/puppets/eacc874b.webp differ
diff --git a/site/joke-collection/img/puppets/ebb471fa.webp b/site/joke-collection/img/puppets/ebb471fa.webp
new file mode 100644
index 0000000..3097427
Binary files /dev/null and b/site/joke-collection/img/puppets/ebb471fa.webp differ
diff --git a/site/joke-collection/img/puppets/ebc38456.webp b/site/joke-collection/img/puppets/ebc38456.webp
new file mode 100644
index 0000000..2ba8f25
Binary files /dev/null and b/site/joke-collection/img/puppets/ebc38456.webp differ
diff --git a/site/joke-collection/img/puppets/f039a696.webp b/site/joke-collection/img/puppets/f039a696.webp
new file mode 100644
index 0000000..d36f1cc
Binary files /dev/null and b/site/joke-collection/img/puppets/f039a696.webp differ
diff --git a/site/joke-collection/img/puppets/f0e2b031.webp b/site/joke-collection/img/puppets/f0e2b031.webp
new file mode 100644
index 0000000..803b677
Binary files /dev/null and b/site/joke-collection/img/puppets/f0e2b031.webp differ
diff --git a/site/joke-collection/img/puppets/f0fa69c1.webp b/site/joke-collection/img/puppets/f0fa69c1.webp
new file mode 100644
index 0000000..29ab26a
Binary files /dev/null and b/site/joke-collection/img/puppets/f0fa69c1.webp differ
diff --git a/site/joke-collection/img/puppets/f692b475.webp b/site/joke-collection/img/puppets/f692b475.webp
new file mode 100644
index 0000000..b9bcb16
Binary files /dev/null and b/site/joke-collection/img/puppets/f692b475.webp differ
diff --git a/site/joke-collection/img/puppets/f892d758.webp b/site/joke-collection/img/puppets/f892d758.webp
new file mode 100644
index 0000000..4ba4c53
Binary files /dev/null and b/site/joke-collection/img/puppets/f892d758.webp differ
diff --git a/site/joke-collection/img/puppets/fb885bbf.webp b/site/joke-collection/img/puppets/fb885bbf.webp
new file mode 100644
index 0000000..45fef0b
Binary files /dev/null and b/site/joke-collection/img/puppets/fb885bbf.webp differ
diff --git a/site/joke-collection/img/puppets/fc38e90e.webp b/site/joke-collection/img/puppets/fc38e90e.webp
new file mode 100644
index 0000000..a639f4e
Binary files /dev/null and b/site/joke-collection/img/puppets/fc38e90e.webp differ
diff --git a/site/joke-collection/img/puppets/fe16e4fb.webp b/site/joke-collection/img/puppets/fe16e4fb.webp
new file mode 100644
index 0000000..b557a37
Binary files /dev/null and b/site/joke-collection/img/puppets/fe16e4fb.webp differ
diff --git a/site/joke-collection/img/sets/classBack/wall-soft.webp b/site/joke-collection/img/sets/classBack/wall-soft.webp
new file mode 100644
index 0000000..b9ded93
Binary files /dev/null and b/site/joke-collection/img/sets/classBack/wall-soft.webp differ
diff --git a/site/joke-collection/img/sets/classBack/wall.webp b/site/joke-collection/img/sets/classBack/wall.webp
new file mode 100644
index 0000000..a1c8731
Binary files /dev/null and b/site/joke-collection/img/sets/classBack/wall.webp differ
diff --git a/site/joke-collection/img/sets/classFront/desk-soft.webp b/site/joke-collection/img/sets/classFront/desk-soft.webp
new file mode 100644
index 0000000..7eecfcb
Binary files /dev/null and b/site/joke-collection/img/sets/classFront/desk-soft.webp differ
diff --git a/site/joke-collection/img/sets/classFront/desk.webp b/site/joke-collection/img/sets/classFront/desk.webp
new file mode 100644
index 0000000..2e4f663
Binary files /dev/null and b/site/joke-collection/img/sets/classFront/desk.webp differ
diff --git a/site/joke-collection/img/sets/classFront/wall-soft.webp b/site/joke-collection/img/sets/classFront/wall-soft.webp
new file mode 100644
index 0000000..28163f3
Binary files /dev/null and b/site/joke-collection/img/sets/classFront/wall-soft.webp differ
diff --git a/site/joke-collection/img/sets/classFront/wall.webp b/site/joke-collection/img/sets/classFront/wall.webp
new file mode 100644
index 0000000..90bb8cc
Binary files /dev/null and b/site/joke-collection/img/sets/classFront/wall.webp differ
diff --git a/site/joke-collection/img/sets/loo/wall-soft.webp b/site/joke-collection/img/sets/loo/wall-soft.webp
new file mode 100644
index 0000000..2de4e99
Binary files /dev/null and b/site/joke-collection/img/sets/loo/wall-soft.webp differ
diff --git a/site/joke-collection/img/sets/loo/wall.webp b/site/joke-collection/img/sets/loo/wall.webp
new file mode 100644
index 0000000..315b963
Binary files /dev/null and b/site/joke-collection/img/sets/loo/wall.webp differ
diff --git a/site/joke-collection/img/sets/sets.js b/site/joke-collection/img/sets/sets.js
new file mode 100644
index 0000000..f90c758
--- /dev/null
+++ b/site/joke-collection/img/sets/sets.js
@@ -0,0 +1 @@
+window.SETS = {"town": [{"name": "ground", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}], "stall": [{"name": "bg", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}, {"name": "rain", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}, {"name": "snow", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}, {"name": "cart", "k": 1, "box": [1010, 386, 470, 414], "soft": true}], "classBack": [{"name": "wall", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}], "classFront": [{"name": "wall", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}, {"name": "desk", "k": 1, "box": [1020, 568, 400, 337], "soft": true}], "loo": [{"name": "wall", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}], "street": [{"name": "bg", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}], "shop": [{"name": "wall", "k": 1, "box": [-60, -34, 1720, 968], "soft": true}, {"name": "counter", "k": 1, "box": [750, 406, 820, 394], "soft": true}]};
diff --git a/site/joke-collection/img/sets/shop/counter-soft.webp b/site/joke-collection/img/sets/shop/counter-soft.webp
new file mode 100644
index 0000000..dbd1886
Binary files /dev/null and b/site/joke-collection/img/sets/shop/counter-soft.webp differ
diff --git a/site/joke-collection/img/sets/shop/counter.webp b/site/joke-collection/img/sets/shop/counter.webp
new file mode 100644
index 0000000..7d8f1df
Binary files /dev/null and b/site/joke-collection/img/sets/shop/counter.webp differ
diff --git a/site/joke-collection/img/sets/shop/wall-soft.webp b/site/joke-collection/img/sets/shop/wall-soft.webp
new file mode 100644
index 0000000..8a15902
Binary files /dev/null and b/site/joke-collection/img/sets/shop/wall-soft.webp differ
diff --git a/site/joke-collection/img/sets/shop/wall.webp b/site/joke-collection/img/sets/shop/wall.webp
new file mode 100644
index 0000000..bc8ec61
Binary files /dev/null and b/site/joke-collection/img/sets/shop/wall.webp differ
diff --git a/site/joke-collection/img/sets/stall/bg-soft.webp b/site/joke-collection/img/sets/stall/bg-soft.webp
new file mode 100644
index 0000000..00a5faf
Binary files /dev/null and b/site/joke-collection/img/sets/stall/bg-soft.webp differ
diff --git a/site/joke-collection/img/sets/stall/bg.webp b/site/joke-collection/img/sets/stall/bg.webp
new file mode 100644
index 0000000..e1a2d0d
Binary files /dev/null and b/site/joke-collection/img/sets/stall/bg.webp differ
diff --git a/site/joke-collection/img/sets/stall/cart-soft.webp b/site/joke-collection/img/sets/stall/cart-soft.webp
new file mode 100644
index 0000000..5be32be
Binary files /dev/null and b/site/joke-collection/img/sets/stall/cart-soft.webp differ
diff --git a/site/joke-collection/img/sets/stall/cart.webp b/site/joke-collection/img/sets/stall/cart.webp
new file mode 100644
index 0000000..541117c
Binary files /dev/null and b/site/joke-collection/img/sets/stall/cart.webp differ
diff --git a/site/joke-collection/img/sets/stall/rain-soft.webp b/site/joke-collection/img/sets/stall/rain-soft.webp
new file mode 100644
index 0000000..94cbd61
Binary files /dev/null and b/site/joke-collection/img/sets/stall/rain-soft.webp differ
diff --git a/site/joke-collection/img/sets/stall/rain.webp b/site/joke-collection/img/sets/stall/rain.webp
new file mode 100644
index 0000000..9d1d2e4
Binary files /dev/null and b/site/joke-collection/img/sets/stall/rain.webp differ
diff --git a/site/joke-collection/img/sets/stall/snow-soft.webp b/site/joke-collection/img/sets/stall/snow-soft.webp
new file mode 100644
index 0000000..f7dd534
Binary files /dev/null and b/site/joke-collection/img/sets/stall/snow-soft.webp differ
diff --git a/site/joke-collection/img/sets/stall/snow.webp b/site/joke-collection/img/sets/stall/snow.webp
new file mode 100644
index 0000000..8f286b1
Binary files /dev/null and b/site/joke-collection/img/sets/stall/snow.webp differ
diff --git a/site/joke-collection/img/sets/street/bg-soft.webp b/site/joke-collection/img/sets/street/bg-soft.webp
new file mode 100644
index 0000000..a5d7d4c
Binary files /dev/null and b/site/joke-collection/img/sets/street/bg-soft.webp differ
diff --git a/site/joke-collection/img/sets/street/bg.webp b/site/joke-collection/img/sets/street/bg.webp
new file mode 100644
index 0000000..e9a9f6e
Binary files /dev/null and b/site/joke-collection/img/sets/street/bg.webp differ
diff --git a/site/joke-collection/img/sets/town/ground-soft.webp b/site/joke-collection/img/sets/town/ground-soft.webp
new file mode 100644
index 0000000..b7d2c9a
Binary files /dev/null and b/site/joke-collection/img/sets/town/ground-soft.webp differ
diff --git a/site/joke-collection/img/sets/town/ground.webp b/site/joke-collection/img/sets/town/ground.webp
new file mode 100644
index 0000000..0477f03
Binary files /dev/null and b/site/joke-collection/img/sets/town/ground.webp differ
diff --git a/site/joke-collection/index.html b/site/joke-collection/index.html
new file mode 100644
index 0000000..9caedb0
--- /dev/null
+++ b/site/joke-collection/index.html
@@ -0,0 +1,123 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Joke Collection</title>
+<meta name="description" content="Short animated jokes: painted sets from an image model, paper puppets moved by code. Two episodes so far, and how they were made.">
+<style>
+ :root { --ink: #2f2418; --soft: #6b5a46; --paper: #fbf5e8; --card: #fffaf0; --line: #e4d6bb; --accent: #2f5aa8; --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif; --serif: "Iowan Old Style", Palatino, Georgia, serif; color-scheme: light; }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.65 var(--ui); }
+ a { color: var(--accent); }
+ header.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; max-width: 1180px; margin: 0 auto; padding: 48px 24px 24px; }
+ .hero img { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 14px 40px #4a33182e; }
+ .back { display: inline-block; margin-bottom: 18px; font-size: 15px; color: var(--soft); text-decoration: none; }
+ h1 { margin: 0 0 8px; font: 700 clamp(34px, 4.6vw, 56px)/1.05 var(--serif); }
+ .tag { display: inline-block; margin-bottom: 18px; padding: 2px 12px; border: 1.5px solid var(--accent); border-radius: 99px; color: var(--accent); font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
+ .lede { font-size: 20px; color: #4a3b2a; }
+ .watch { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 14px 26px; border-radius: 99px; background: var(--ink); color: #fff6e0; font-weight: 600; text-decoration: none; }
+ .watch:hover { background: #4a3826; }
+ .watch small { opacity: .75; font-weight: 500; }
+ main { max-width: 900px; margin: 0 auto; padding: 8px 24px 80px; }
+ h2 { margin: 64px 0 8px; font: 700 32px/1.2 var(--serif); }
+ h3 { margin: 32px 0 4px; font: 700 21px/1.3 var(--ui); }
+ figure { margin: 18px 0 26px; }
+ figure img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
+ figcaption { margin-top: 8px; font-size: 15px; color: var(--soft); }
+ .stills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
+ .stills img { width: 100%; height: auto; border-radius: 6px; display: block; }
+ .episodes { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
+ .episodes a { display: flex; gap: 18px; align-items: center; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
+ .episodes a:hover { border-color: var(--accent); }
+ .episodes b { flex: none; font: 700 22px/1.2 var(--serif); }
+ .episodes span { color: var(--soft); font-size: 15px; }
+ .episodes .soon { padding: 14px 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--soft); }
+ .verdict { margin: 18px 0; padding: 4px 22px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 8px 8px 0; }
+ .numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
+ .numbers div { padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-align: center; }
+ .numbers b { display: block; font: 700 28px/1.1 var(--serif); }
+ .numbers span { font-size: 14px; color: var(--soft); }
+ footer { max-width: 900px; margin: 0 auto; padding: 0 24px 60px; color: var(--soft); font-size: 15px; }
+ @media (max-width: 760px) {
+ header.hero { grid-template-columns: 1fr; padding-top: 28px; }
+ .numbers, .stills { grid-template-columns: 1fr 1fr; }
+ .episodes a { flex-direction: column; align-items: flex-start; gap: 4px; }
+ .watch { flex-wrap: wrap; row-gap: 2px; }
+ }
+</style>
+</head>
+<body>
+<header class="hero">
+ <img src="making/cover.webp" width="1400" height="788" alt="Bo, with a bun sitting on a toilet in his thought bubble, about to ask his question; Me beside him and the class behind.">
+ <div>
+ <a class="back" href="../">← Back to the bookshelf</a><br>
+ <span class="tag">Short animated jokes</span>
+ <h1>Joke Collection</h1>
+ <p class="lede">Little jokes, a couple of minutes each. The third way we've tried to make picture books, and the one we're keeping: an image model paints every set and everything that stays still, and paper puppets drawn in code do all the moving.</p>
+ <a class="watch" href="ch01/">▶ Episode 1 <small>Breakfast in the Bathroom · 2 minutes</small></a>
+ <a class="watch" href="ch02/">▶ Episode 2 <small>Do You Need a Bag? · 2 minutes</small></a>
+ </div>
+</header>
+
+<main>
+ <h2>Episodes</h2>
+ <ul class="episodes">
+ <li><a href="ch01/"><b>1 · Breakfast in the Bathroom</b><span>Seventh grade. My deskmate had two questions for me, and one morning he asked them both at once. A true story.</span></a></li>
+ <li><a href="ch02/"><b>2 · Do You Need a Bag?</b><span>A convenience store in Fukuoka. A clerk who speaks no English, a customer who speaks no Japanese, and me in line behind them with a hundred-yen coffee. Also true.</span></a></li>
+ <li class="soon">More jokes coming.</li>
+ </ul>
+
+ <div class="stills">
+ <img src="making/still-stall.webp" width="800" height="450" alt="Me and Bo at the bun stall, each with a bun." loading="lazy">
+ <img src="making/still-rain.webp" width="800" height="450" alt="The same stall in the rain, with umbrellas." loading="lazy">
+ <img src="making/still-door.webp" width="800" height="450" alt="Bo, late and out of breath, in the classroom door." loading="lazy">
+ <img src="making/still-dream.webp" width="800" height="450" alt="A daydream: a bun and soy milk laid out on a squat toilet." loading="lazy">
+ <img src="making/still-laugh.webp" width="800" height="450" alt="The whole class laughing." loading="lazy">
+ <img src="making/cover.webp" width="1400" height="788" alt="Bo's two thoughts merged into one." loading="lazy">
+ <img src="making/ep2-street.webp" width="800" height="450" alt="Episode 2: walking into the Happy Mart at dusk." loading="lazy">
+ <img src="making/ep2-veggie.webp" width="800" height="450" alt="Episode 2: the customer hears 'reji' as 'veggie'." loading="lazy">
+ <img src="making/ep2-exchange.webp" width="800" height="450" alt="Episode 2: the clerk wonders if she wants to change dollars into yen." loading="lazy">
+ </div>
+
+ <h2>Two ways, then a third</h2>
+ <p><a href="../three-little-pigs/">The Three Little Pigs</a> was painted by an image model, characters included. The world looked lovely, but every new action meant another round of drawings, and keeping a character the same from shot to shot was a fight. <a href="../little-red-riding-hood/">Little Red Riding Hood</a> went the other way: everything was paper drawn in code. Any movement was a few lines, but the world looked plain.</p>
+ <p>So we split the work by one question: <b>does it move?</b> Anything that stays put (streets, walls, blackboards, desks, the bun cart) is painted by the image model. Anything with joints, a face or a change of shape (the people, the falling rain, a bitten bun, the hands of the clock) is a paper puppet moved by code. A painting never has to act, and a puppet never has to look like a painting.</p>
+ <figure><img src="making/layers.webp" width="1400" height="879" alt="One frame taken apart: the painted street, the painted cart cut out on its own, the puppets drawn in code, and the finished frame." loading="lazy"><figcaption>One frame, taken apart. The cart is painted as a separate cut-out, so the bun seller can stand behind it.</figcaption></figure>
+
+ <h2>Finding the look</h2>
+ <p>Our puppets are flat paper with round heads, in the spirit of South Park. We tried three painted styles behind them: flat paper like the puppets (closest to that show), a warm gouache, and a richer torn-paper collage. We picked the collage. There was no reason to copy South Park exactly, and the point was to let the image model give the world as much texture and light as it could.</p>
+ <figure><img src="making/styles-stall.webp" width="1400" height="788" alt="The bun stall four ways: drawn in code, flat paper, gouache, and torn-paper collage." loading="lazy"><figcaption>Top left: the stall drawn in code. Then flat paper (A), gouache (B), and torn-paper collage (C), the one we chose. Each test picture cost under two cents.</figcaption></figure>
+ <p>Every set was painted by redrawing our own code-drawn version in that style. That way the composition stays the same, and the puppets still stand where the scenes expect them. Signs and blackboards were painted blank, and their words were written on afterwards: image models still garble Chinese characters.</p>
+ <figure><img src="making/batch-stall.webp" width="1400" height="551" alt="The stall street in sun, rain and snow, and the painted props: buns, soy milk, umbrellas, homework sheets." loading="lazy"><figcaption>The stall in three weathers, from one picture, edited, so a cut between them changes only the weather. Below them, props painted on transparent backgrounds.</figcaption></figure>
+ <figure><img src="making/batch-sets.webp" width="1400" height="1050" alt="The town, the classroom from the front, the blackboard wall, the toilet, a pupil's desk and the teacher's desk." loading="lazy"><figcaption>The rest of the sets. The desks are separate pieces, because pupils sit behind them, row behind row. The clock is painted without hands, so code can turn them.</figcaption></figure>
+
+ <h2>What the code still does</h2>
+ <ul>
+ <li><b>The acting.</b> Mouths timed to every word, blinks at each puppet's own moments, eyes that follow whoever is talking, a whole class turning its heads a frame or two apart.</li>
+ <li><b>The joke's machinery.</b> Two thought bubbles (a bun and a toilet) pushing each other and merging, before Bo opens his mouth.</li>
+ <li><b>Weather and small things.</b> Rain and snow falling over the painted street, umbrellas, a fly, the clock's hands.</li>
+ <li><b>The film.</b> Cuts, close-ups, a soft background in close-ups, a soft shadow under every puppet so it stands in the painted light, and a gentle hand-made wobble.</li>
+ </ul>
+
+ <h2>A joke needs its setup</h2>
+ <p>The first version didn't land. Bo's slip ("Wanna go eat breakfast… in the bathroom?") came out of nowhere, and he looked as if he really meant it. The fix was story, not animation. First we show his two everyday questions: "Breakfast?" every morning at the stall, "Bathroom?" after every class. Then, the one morning he oversleeps and comes in starving, we show both wants at once, as two bubbles that collide. Only then does he speak. Same lesson as Little Red Riding Hood: set up everything the punchline needs, before anyone animates a frame.</p>
+
+ <h3>Episode 2, made in one night</h3>
+ <p>For the second joke, the user told the story at bedtime and handed over: a fresh session read this method, wrote the script, painted two sets (the store outside and in), a counter to stand behind and three props, built three new puppets and four scenes, and checked them, all before morning. The clerk's Japanese is spoken in Japanese with English subtitles, so the audience understands both sides while neither character does. Its painting cost $0.13.</p>
+
+ <h2>The numbers</h2>
+ <div class="numbers">
+ <div><b>2</b><span>episodes, about 2 minutes each</span></div>
+ <div><b>~27</b><span>painted pictures</span></div>
+ <div><b>$0.53</b><span>for all the painting</span></div>
+ <div><b>7</b><span>painted sets</span></div>
+ </div>
+ <div class="verdict">
+ <p><b>Why we're keeping this one.</b> The paintings carry the look, the puppets carry the acting, and neither has to do the other's job. The sets and props carry over to the next joke. This is the method we're building the Papermorph Skill's picture books on.</p>
+ </div>
+ <p><a class="watch" href="ch01/">▶ Watch episode 1</a></p>
+</main>
+<footer>Both episodes are true stories, retold. Sets and props painted with OpenAI's gpt-image; puppets, weather and animation drawn in code; voices with Microsoft Edge text-to-speech; music from Google Lyria (made for The Three Little Pigs); sound effects synthesized. Part of <a href="../">Papermorph</a>.</footer>
+</body>
+</html>
diff --git a/site/joke-collection/lib/book.css b/site/joke-collection/lib/book.css
new file mode 100644
index 0000000..5d49bfb
--- /dev/null
+++ b/site/joke-collection/lib/book.css
@@ -0,0 +1,9 @@
+/* This book's own settings, imported by engine.css. The engine files next to this one are the same in every book
+ and are replaced when the engine is updated; this file is not.
+ Settings (uncomment to use):
+:root {
+ --math-font: "Avenir Next", Arial, sans-serif; face for numbers and formulas (default: a serif, see engine.js)
+ --progress-key: "progress"; localStorage key shared with the cover (default: one per book folder)
+}
+ Style overrides go here too. They come before the engine's rules, so make each selector more specific than the
+ engine's, e.g. ':root .card.band' for '.card.band'. */
diff --git a/site/joke-collection/lib/cast.js b/site/joke-collection/lib/cast.js
new file mode 100644
index 0000000..dae19be
--- /dev/null
+++ b/site/joke-collection/lib/cast.js
@@ -0,0 +1,224 @@
+/* cast.js — the kids, in the flat cut-paper style of South Park: a big round head straight on the body, two touching
+ eyes, a mouth low on the face, mitten hands. Built at the feet (0, 0) facing us. They turn by sliding the face to
+ one side (look -1 … 1), as that show does; the paper pieces never deform.
+ pose(o, f): x, y, s; look (face slide), eyeX/eyeY (pupils, -1 … 1), lids (0 open … 1 shut; .55 is deadpan), shut
+ (blink), mouth (a Rhubarb shape or an expression below), brow (0 none, >0 angry, <0 worried), headR, bob, squash,
+ armL/armR (degrees, + raises outward; 0 hangs at the side), legL/legR (degrees), sit (hide legs), hold (prop key). */
+'use strict';
+// Mouths, centred on the mouth point: Rhubarb shapes A–H and X, plus expressions. They open downward, like the show's.
+const SP_INK = '#1d1a1a';
+// How far a shut eye's lid comes down: 1 covers it; an episode may set window.SP_SHUT = .9 to leave the lid line showing.
+const SP_SHUT = window.SP_SHUT ?? 1;
+const SP_MOUTHS = {
+ X: `<path d="M-13,0 Q0,4 13,0" fill="none" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+ A: `<path d="M-11,1 L11,1" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+ B: `<path d="M-13,-1 L13,-1 Q11,8 0,9 Q-11,8 -13,-1 Z" fill="#5a1414"/><path d="M-10,0 h20" stroke="#fff" stroke-width="2.4"/>`,
+ C: `<path d="M-14,-2 L14,-2 Q12,12 0,13 Q-12,12 -14,-2 Z" fill="#5a1414"/><ellipse cy="9" rx="7" ry="3" fill="#d9606a"/>`,
+ D: `<path d="M-18,-3 L18,-3 Q16,18 0,19 Q-16,18 -18,-3 Z" fill="#5a1414"/><ellipse cy="13" rx="10" ry="4.5" fill="#d9606a"/>`,
+ E: `<ellipse cy="3" rx="8" ry="10" fill="#5a1414"/>`,
+ F: `<ellipse cy="1" rx="5" ry="5.5" fill="#5a1414"/>`,
+ G: `<path d="M-12,-1 L12,-1 Q10,6 0,7 Q-10,6 -12,-1 Z" fill="#5a1414"/><path d="M-9,1 h18" stroke="#fff" stroke-width="3"/>`,
+ H: `<path d="M-13,-2 L13,-2 Q11,10 0,11 Q-11,10 -13,-2 Z" fill="#5a1414"/><ellipse cy="2" rx="5" ry="3" fill="#d9606a"/>`,
+ flat: `<path d="M-12,1 L12,1" stroke="${SP_INK}" stroke-width="3.2" stroke-linecap="round"/>`,
+ frown: `<path d="M-13,4 Q0,-3 13,4" fill="none" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+ smile: `<path d="M-15,-2 Q0,9 15,-2" fill="none" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+ grin: `<path d="M-18,-3 L18,-3 Q15,15 0,16 Q-15,15 -18,-3 Z" fill="#5a1414"/><path d="M-16,-1 h32 v4 q-16,3 -32,0 z" fill="#fff"/>`,
+ O: `<ellipse cy="5" rx="11" ry="14" fill="#5a1414"/>`,
+ wobble: `<path d="M-14,2 q3.5,-4 7,0 t7,0 t7,0 t7,0" fill="none" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+ chew: `<path d="M-12,0 Q0,-5 12,0" fill="none" stroke="${SP_INK}" stroke-width="3" stroke-linecap="round"/>`,
+};
+document.body.insertAdjacentHTML('afterbegin', `<svg width="0" height="0" style="position:absolute" aria-hidden="true"><defs>${
+ Object.entries(SP_MOUTHS).map(([k, s]) => `<g id="sp${k}">${s}</g>`).join('')}
+ <radialGradient id="spShadow"><stop offset="0" stop-color="#2a1c10" stop-opacity=".42"/><stop offset=".6" stop-color="#2a1c10" stop-opacity=".22"/><stop offset="1" stop-color="#2a1c10" stop-opacity="0"/></radialGradient></defs></svg>`);
+
+const UNIFORM = { coat: '#3563c0', stripe: '#f4f1ea', pants: '#25356a' };
+const SHAPES = {
+ // the fat kid: round body, wide head, double chin, bowl of black hair
+ me: { sx: 104, sy: -142, hipX: 34, legW: 40, shoe: 29, body: 'M-66,-174 C-126,-156 -136,-72 -116,-46 Q-72,-28 0,-28 Q72,-28 116,-46 C136,-72 126,-156 66,-174 Z',
+ head: [0, -250, 106, 90], neck: -160, eyes: [22, -256, 23, 28], mouth: [0, -196], cheeks: [64, -216], slide: 30,
+ chin: 'M-52,-174 Q0,-152 52,-174',
+ hair: ['#211a17', 'M-104,-262 C-108,-334 -62,-350 0,-350 C62,-350 108,-334 104,-262 L88,-280 L70,-262 L50,-284 L26,-268 L4,-288 L-20,-268 L-44,-286 L-66,-264 L-86,-282 Z'] },
+ // the thin kid with glasses and a spiky top
+ bo: { sx: 54, sy: -146, hipX: 18, legW: 26, shoe: 20, body: 'M-44,-166 C-64,-150 -68,-78 -62,-50 Q-30,-36 0,-36 Q30,-36 62,-50 C68,-78 64,-150 44,-166 Z',
+ head: [0, -246, 92, 86], neck: -158, eyes: [24, -254, 20, 25], mouth: [0, -196], cheeks: null, slide: 28, glasses: 31,
+ hair: ['#2a1f1a', 'M-90,-262 C-96,-318 -60,-338 -10,-340 L-24,-366 L4,-346 L10,-374 L30,-346 L50,-366 L52,-338 C84,-326 96,-300 90,-262 L74,-286 L56,-270 L30,-292 L0,-276 L-30,-292 L-58,-270 Z'] },
+};
+// classmates: one body, a few heads of hair
+const KID_HAIR = {
+ bowl: c => [c, 'M-90,-258 C-94,-320 -56,-336 0,-336 C56,-336 94,-320 90,-258 L72,-280 Q0,-296 -72,-280 Z'],
+ pigtails: c => [c, 'M-90,-256 C-94,-320 -56,-336 0,-336 C56,-336 94,-320 90,-256 L78,-282 Q0,-300 -78,-282 Z M-96,-262 q-34,4 -36,40 q20,-6 36,-18 Z M96,-262 q34,4 36,40 q-20,-6 -36,-18 Z'],
+ part: c => [c, 'M-90,-258 C-94,-322 -50,-338 10,-336 C64,-332 94,-312 90,-258 L80,-290 Q30,-312 -20,-290 Q-60,-300 -84,-276 Z'],
+ buzz: c => [c, 'M-88,-266 C-90,-318 -52,-334 0,-334 C52,-334 90,-318 88,-266 Q0,-300 -88,-266 Z'],
+};
+const kidShape = (hair, col) => ({ ...SHAPES.bo, glasses: 0, hair: KID_HAIR[hair](col) });
+// the bun seller: a grown-up, so a long body on longer legs; white apron and cap. Coat colour is her top.
+SHAPES.aunt = { sx: 60, sy: -262, hipX: 20, legW: 30, shoe: 22, legH: 96, neck: -276,
+ body: 'M-46,-284 C-66,-270 -72,-140 -66,-96 Q-34,-84 0,-84 Q34,-84 66,-96 C72,-140 66,-270 46,-284 Z',
+ extra: '<path d="M-40,-230 L40,-230 L54,-92 Q0,-80 -54,-92 Z" fill="#f6f4ee"/><path d="M-40,-230 L-26,-276 M40,-230 L26,-276" stroke="#f6f4ee" stroke-width="6"/>',
+ head: [0, -360, 88, 82], eyes: [22, -366, 18, 22], mouth: [0, -312], cheeks: [56, -330], slide: 26,
+ hair: ['#2a2220', 'M-86,-372 C-92,-430 -50,-446 0,-446 C50,-446 92,-430 86,-372 Q60,-404 0,-406 Q-60,-404 -86,-372 Z'],
+ hat: '<path d="M-74,-414 C-80,-470 80,-470 74,-414 Q0,-430 -74,-414 Z" fill="#f6f4ee"/><rect x="-78" y="-424" width="156" height="18" rx="8" fill="#e8e4da"/>' };
+const auntPuppet = (p, o) => spKid(p, 'aunt', { coat: '#c94a3c', stripe: '#c94a3c', pants: '#3a3430', ...o });
+
+let spClip = 0;
+const REST_SP = { x: 0, y: 0, s: 1, look: 0, eyeX: 0, eyeY: 0, lids: 0, shut: false, mouth: 'X', brow: 0, headR: 0, bob: 0, squash: 0,
+ armL: 0, armR: 0, legL: 0, legR: 0, sit: false, hold: null, holdL: null };
+// holds: { key: svg } drawn in the hand of the screen-right arm (hold) or screen-left arm (holdL), at the mitten centre
+function spKid(parent, shape, { skin = '#f7d9bb', coat = UNIFORM.coat, stripe = UNIFORM.stripe, pants = UNIFORM.pants, holds = {} } = {}) {
+ const S = typeof shape === 'string' ? SHAPES[shape] : shape, g = mk('g', {}, parent), id = 'spc' + (++spClip);
+ const legH = S.legH || 46, [hx, hy, hrx, hry] = S.head, [ex, ey, erx, ery] = S.eyes, [mx, my] = S.mouth;
+ const arm = side => `<g data-p="arm${side}"><g filter="url(#paper)"><rect x="-14" y="-6" width="28" height="64" rx="13" fill="${coat}"/>
+ <path d="M${side === 'R' ? 7 : -7},-2 v56" stroke="${stripe}" stroke-width="5"/>
+ <circle cy="72" r="18" fill="#f2efe6"/><ellipse cx="${side === 'R' ? -14 : 14}" cy="62" rx="7" ry="10" fill="#f2efe6"/></g>
+ ${Object.entries(holds).map(([k, s]) => `<g data-p="hold${side}_${k}" transform="translate(0,72)">${s}</g>`).join('')}</g>`;
+ const leg = side => `<g data-p="leg${side}"><g filter="url(#paper)"><rect x="${-S.legW / 2}" y="0" width="${S.legW}" height="${legH}" rx="6" fill="${pants}"/>
+ <ellipse cx="${side === 'R' ? 6 : -6}" cy="${legH - 2}" rx="${S.shoe}" ry="11" fill="#1f1d1d"/></g></g>`;
+ const eye = sx => `<ellipse cx="${sx * ex}" cy="${ey}" rx="${erx}" ry="${ery}"`;
+ // a soft shadow on the ground, a little to the right: the painted sets are lit from the left
+ g.innerHTML = `<ellipse data-p="shadow" cx="${S.sx * .18}" cy="-2" rx="${S.sx + 34}" ry="16" fill="url(#spShadow)"/><g data-p="all"><g data-p="legs">${leg('L')}${leg('R')}</g>
+ <g data-p="body"><g filter="url(#paper)"><path d="${S.body}" fill="${coat}"/>
+ <path d="M-24,${S.sy - 22} L0,${S.sy + 8} L24,${S.sy - 22}" fill="none" stroke="${stripe}" stroke-width="7" stroke-linejoin="round"/>
+ ${S.extra || `<path d="M0,${S.sy + 8} V-40" stroke="#26478f" stroke-width="3"/>`}</g></g>
+ ${arm('L')}${arm('R')}
+ <g data-p="head"><g filter="url(#paper)"><ellipse cx="${hx}" cy="${hy}" rx="${hrx}" ry="${hry}" fill="${skin}"/>
+ ${S.chin ? `<path d="${S.chin}" fill="none" stroke="#d9a888" stroke-width="3" stroke-linecap="round"/>` : ''}</g>
+ <clipPath id="${id}"><ellipse cx="${hx}" cy="${hy}" rx="${hrx}" ry="${hry}"/></clipPath>
+ <g clip-path="url(#${id})"><g data-p="feat">
+ ${S.cheeks ? `<circle cx="${-S.cheeks[0]}" cy="${S.cheeks[1]}" r="13" fill="#ef9f98" opacity=".55"/><circle cx="${S.cheeks[0]}" cy="${S.cheeks[1]}" r="13" fill="#ef9f98" opacity=".55"/>` : ''}
+ <g data-p="whites" filter="url(#paper)">${eye(-1)} fill="#fff"/>${eye(1)} fill="#fff"/></g>
+ <g data-p="pupils"><circle cx="${-ex}" cy="${ey}" r="${erx * .22}" fill="${SP_INK}"/><circle cx="${ex}" cy="${ey}" r="${erx * .22}" fill="${SP_INK}"/></g>
+ <clipPath id="${id}e">${eye(-1)}/>${eye(1)}/></clipPath>
+ <g clip-path="url(#${id}e)"><g data-p="lids">
+ <rect x="${-ex - erx - 2}" y="${ey - ery * 3}" width="${2 * (ex + erx) + 4}" height="${ery * 2}" fill="${skin}"/>
+ <path d="M${-ex - erx - 2},${ey - ery} H${ex + erx + 2}" stroke="${SP_INK}" stroke-width="3"/></g></g>
+ ${eye(-1)} fill="none" stroke="${SP_INK}" stroke-width="2"/>${eye(1)} fill="none" stroke="${SP_INK}" stroke-width="2"/>
+ ${S.glasses ? `<g fill="none" stroke="${SP_INK}" stroke-width="4.5"><circle cx="${-ex}" cy="${ey}" r="${S.glasses}"/><circle cx="${ex}" cy="${ey}" r="${S.glasses}"/>
+ <path d="M${-ex + S.glasses},${ey - 4} Q0,${ey - 10} ${ex - S.glasses},${ey - 4}"/></g>` : ''}
+ <path data-p="browL" d="M${-ex - 16},${ey - ery - 12} L${-ex + 14},${ey - ery - 6}" stroke="${SP_INK}" stroke-width="4" stroke-linecap="round"/>
+ <path data-p="browR" d="M${ex + 16},${ey - ery - 12} L${ex - 14},${ey - ery - 6}" stroke="${SP_INK}" stroke-width="4" stroke-linecap="round"/>
+ <use class="mouth" href="#spX" transform="translate(${mx},${my})"/></g></g>
+ <g data-p="hair"><g filter="url(#paper)"><path d="${S.hair[1]}" fill="${S.hair[0]}"/>${S.hat || ''}</g></g></g></g>`;
+ bakeAll(g);
+ const P = pieces(g), holdKeys = Object.keys(holds);
+ const legY = -(legH + 6), ery2 = ery * 2;
+ return { g, S, pose(o, f) {
+ o = { ...REST_SP, ...o };
+ const j = k => .35 * jit(f >> 1, k); // the animator's hand: small, and held for two frames
+ tf(g, `translate(${(o.x + j(1) * .8).toFixed(1)},${(o.y + j(2) * .6).toFixed(1)}) scale(${o.s})`);
+ // squash > 0 flattens the figure on its feet (a landing, a sigh)
+ tf(P.all, `translate(0,${o.bob.toFixed(1)}) scale(${(1 + .5 * o.squash).toFixed(3)},${(1 - o.squash).toFixed(3)}) rotate(${(j(3) * .4).toFixed(2)})`);
+ vis(P.legs, !o.sit); vis(P.shadow, !o.sit);
+ tf(P.legL, `translate(${-S.hipX},${legY}) rotate(${(o.legL + j(4) * .5).toFixed(2)})`);
+ tf(P.legR, `translate(${S.hipX},${legY}) rotate(${(-o.legR + j(5) * .5).toFixed(2)})`);
+ tf(P.armL, `translate(${-S.sx},${S.sy}) rotate(${(24 + o.armL + j(6) * .6).toFixed(2)})`);
+ tf(P.armR, `translate(${S.sx},${S.sy}) rotate(${(-24 - o.armR + j(7) * .6).toFixed(2)})`);
+ for (const k of holdKeys) { vis(P[`holdR_${k}`], o.hold === k); vis(P[`holdL_${k}`], o.holdL === k);
+ // a held thing stays upright whatever the arm does
+ tf(P[`holdR_${k}`], `translate(0,72) rotate(${(24 + o.armR).toFixed(2)})`); tf(P[`holdL_${k}`], `translate(0,72) rotate(${(-24 - o.armL).toFixed(2)})`); }
+ tf(P.head, `rotate(${(o.headR + j(8) * .6).toFixed(2)},0,${S.neck})`);
+ const lx = o.look * S.slide;
+ tf(P.feat, `translate(${lx.toFixed(1)},0)`); tf(P.hair, `translate(${(lx * .25).toFixed(1)},0)`);
+ tf(P.pupils, `translate(${(o.eyeX * erx * .5).toFixed(1)},${(o.eyeY * ery * .45).toFixed(1)})`);
+ tf(P.lids, `translate(0,${((o.shut ? SP_SHUT : o.lids) * ery2).toFixed(1)})`);
+ const b = o.brow;
+ vis(P.browL, b !== 0); vis(P.browR, b !== 0);
+ tf(P.browL, `rotate(${(-14 * b).toFixed(1)},${-ex},${ey - ery - 9})`); tf(P.browR, `rotate(${(14 * b).toFixed(1)},${ex},${ey - ery - 9})`);
+ const m = g.querySelector('.mouth'), href = '#sp' + (o.mouth || 'X'); if (m._m !== href) m.setAttribute('href', m._m = href);
+ } };
+}
+const mePuppet = (p, o) => spKid(p, 'me', o), boPuppet = (p, o) => spKid(p, 'bo', o);
+const classmate = (p, hair, col, o) => spKid(p, kidShape(hair, col), o);
+
+// A walk in the show's manner: the figure bobs on twos and the stubby legs scissor; no compass needed at this size.
+function spWalk(q, rate = 2.4) { const k = Math.floor(q * FPS / 2) % 2 ? 1 : -1; return { legL: 16 * k, legR: -16 * k, bob: k > 0 ? -6 : 0, armL: 8 * k, armR: -8 * k, k }; }
+
+// The teacher (episode 2): a grown-up like the seller, a cardigan over a blouse, hair up in a tall bun.
+SHAPES.teacher = { ...SHAPES.aunt,
+ extra: '<path d="M-22,-282 L0,-236 L22,-282 Z" fill="#f2e6d0"/><path d="M-6,-232 V-96" stroke="#5e1c2c" stroke-width="4"/>' +
+ [-200, -160, -120].map(y => `<circle cx="6" cy="${y}" r="5" fill="#f2e6d0"/>`).join(''),
+ hat: '<circle cx="0" cy="-458" r="38" fill="#2a2220"/><path d="M-30,-436 Q0,-424 30,-436" stroke="#5a4a44" stroke-width="5" fill="none"/>' };
+const teacherPuppet = (p, o) => spKid(p, 'teacher', { coat: '#8c2f45', stripe: '#8c2f45', pants: '#4a4a52', ...o });
+
+/* The bun seller's dog (episode 2), side-on as the show draws its dogs. Built at its feet (0, 0) facing right, about
+ 190 long and 170 tall at s = 1. pose(o, f): x, y, s, dir (1 faces right, -1 left), headR (+ looks up), jaw (0 shut …
+ 1 open), tail (degrees, + up), wag (the tail swings on twos), ear (degrees), shut, lids, eyeX (-1 … 1 along its look),
+ sit (on its haunches), lie (flat on the ground, asleep), walk (legs scissor on twos), bob, glasses, tongue,
+ hold (prop key, carried crosswise in its mouth). */
+const DOG = { coat: '#ece5d6', dark: '#6b5444', far: '#cdc3b1', muzzle: '#fbf8f0' };
+const REST_DOG = { x: 0, y: 0, s: 1, dir: 1, headR: 0, jaw: 0, tail: 0, wag: false, ear: 0, shut: false, lids: 0, eyeX: 0,
+ sit: false, lie: false, walk: false, bob: 0, glasses: false, tongue: false, hold: null };
+function dogPuppet(parent, { holds = {} } = {}) {
+ const g = mk('g', {}, parent), id = 'dogc' + (++spClip), C = DOG;
+ const leg = (k, col) => `<g data-p="leg${k}"><g filter="url(#paper)"><rect x="-11" y="0" width="22" height="58" rx="8" fill="${col}"/><ellipse cx="6" cy="56" rx="13" ry="7" fill="${C.dark}"/></g></g>`;
+ const eye = '<ellipse cx="100" cy="-142" rx="11" ry="13"';
+ g.innerHTML = `<g data-p="all">${leg('B2', C.far)}${leg('F2', C.far)}
+ <g data-p="haunch"><g filter="url(#paper)"><ellipse cx="-44" cy="-34" rx="40" ry="34" fill="${C.coat}"/><ellipse cx="-24" cy="-5" rx="24" ry="7" fill="${C.dark}"/></g></g>
+ <g data-p="torso">
+ <g data-p="tail"><g filter="url(#paper)"><path d="M0,0 Q-34,-16 -40,-60 Q-28,-60 -24,-32 Q-16,-12 8,-8 Z" fill="${C.coat}"/></g></g>
+ <g filter="url(#paper)"><ellipse cx="0" cy="-86" rx="82" ry="40" fill="${C.coat}"/><ellipse cx="-14" cy="-100" rx="30" ry="15" fill="${C.dark}"/></g>
+ <g data-p="head">
+ <g filter="url(#paper)"><rect x="52" y="-116" width="28" height="12" rx="4" fill="#c8322f" transform="rotate(-20 66 -110)"/>
+ <circle cx="94" cy="-132" r="38" fill="${C.coat}"/><ellipse cx="128" cy="-106" rx="24" ry="9" fill="#4a1a14"/></g>
+ <g data-p="jaw"><g filter="url(#paper)"><path d="M100,-108 Q150,-106 150,-98 Q132,-86 100,-96 Z" fill="${C.muzzle}"/></g>
+ <ellipse data-p="tongue" cx="138" cy="-90" rx="9" ry="12" fill="#e06f7a"/></g>
+ <g filter="url(#paper)"><ellipse cx="128" cy="-116" rx="28" ry="15" fill="${C.muzzle}"/><ellipse cx="154" cy="-122" rx="8.5" ry="6.5" fill="${SP_INK}"/></g>
+ <clipPath id="${id}">${eye}/></clipPath>
+ <g data-p="whites" filter="url(#paper)">${eye} fill="#fff"/></g>
+ <circle data-p="pupil" cx="102" cy="-142" r="4.8" fill="${SP_INK}"/>
+ <g clip-path="url(#${id})"><g data-p="lids"><rect x="86" y="-182" width="28" height="26" fill="${C.coat}"/><path d="M86,-155 H114" stroke="${SP_INK}" stroke-width="3"/></g></g>
+ ${eye} fill="none" stroke="${SP_INK}" stroke-width="2"/>
+ <g data-p="ear"><g filter="url(#paper)"><path d="M0,0 C-22,4 -26,40 -12,62 C-2,52 10,28 8,0 Z" fill="${C.dark}"/></g></g>
+ <g data-p="glasses" fill="none" stroke="${SP_INK}" stroke-width="3.5"><circle cx="101" cy="-142" r="16"/><path d="M85,-144 L64,-150"/></g>
+ ${Object.entries(holds).map(([k, s]) => `<g data-p="hold_${k}" transform="translate(134,-100)">${s}</g>`).join('')}
+ </g></g>${leg('B1', C.coat)}${leg('F1', C.coat)}</g>`;
+ bakeAll(g);
+ const P = pieces(g), holdKeys = Object.keys(holds);
+ // a point of the torso turned by `a` degrees about the hip: where the shoulders go when it sits
+ const turn = (x, y, a) => { const r = a * Math.PI / 180, dx = x + 50, dy = y + 56; return [-50 + dx * Math.cos(r) - dy * Math.sin(r), -56 + dx * Math.sin(r) + dy * Math.cos(r)]; };
+ return { g, pose(o, f) {
+ o = { ...REST_DOG, ...o };
+ const j = k => .35 * jit(f >> 1, k), k2 = Math.floor(f / 2) % 2 ? 1 : -1;
+ tf(g, `translate(${(o.x + j(1) * .8).toFixed(1)},${(o.y + j(2) * .6).toFixed(1)}) scale(${(o.s * o.dir).toFixed(3)},${o.s})`);
+ tf(P.all, `translate(0,${(o.bob + (o.lie ? 50 : 0)).toFixed(1)})`);
+ const a = o.sit ? -16 : 0;
+ tf(P.torso, `rotate(${(a + j(3) * .4).toFixed(2)},-50,-56)`);
+ vis(P.haunch, o.sit); vis(P.legB1, !o.sit && !o.lie); vis(P.legB2, !o.sit && !o.lie); vis(P.legF1, !o.lie); vis(P.legF2, !o.lie);
+ const sw = o.walk ? 18 * k2 : 0, [fx, fy] = turn(o.sit ? 30 : 46, -60, a), fl = (-fy) / 60; // front legs reach the ground from the shoulder
+ tf(P.legB1, `translate(-50,-60) rotate(${(sw + j(4) * .5).toFixed(2)})`); tf(P.legB2, `translate(-34,-60) rotate(${(-sw + j(5) * .5).toFixed(2)})`);
+ tf(P.legF1, `translate(${fx.toFixed(1)},${fy.toFixed(1)}) rotate(${(-sw + j(6) * .5).toFixed(2)}) scale(1,${fl.toFixed(3)})`);
+ tf(P.legF2, `translate(${(fx + 14).toFixed(1)},${fy.toFixed(1)}) rotate(${(sw + j(7) * .5).toFixed(2)}) scale(1,${fl.toFixed(3)})`);
+ tf(P.tail, `translate(-78,-92) rotate(${(-o.tail - (o.wag ? 16 * k2 : 0) + j(8)).toFixed(2)})`);
+ tf(P.head, `rotate(${(-o.headR - a + j(9) * .6).toFixed(2)},62,-104)`);
+ tf(P.jaw, `rotate(${(o.jaw * 30).toFixed(1)},100,-102)`);
+ tf(P.ear, `translate(80,-158) rotate(${(o.ear + j(10) * 2).toFixed(2)})`);
+ tf(P.pupil, `translate(${(o.eyeX * 5).toFixed(1)},0)`);
+ tf(P.lids, `translate(0,${((o.shut || o.lie ? 1 : o.lids) * 26).toFixed(1)})`);
+ vis(P.glasses, o.glasses); vis(P.tongue, o.tongue);
+ for (const k of holdKeys) vis(P[`hold_${k}`], o.hold === k);
+ } };
+}
+
+/* ---------- episode "Do You Need a Bag?": three grown-ups at a convenience store ---------- */
+// Move every y of an absolute path (M/C/L/Q pairs) by dy: grown-ups reuse the kids' hair, higher up.
+const shiftY = (d, dy) => { let i = 0; return d.replace(/-?\d+(\.\d+)?/g, n => (i++ % 2 ? +n + dy : +n) + ''); };
+// Me, grown up: the same round face and bowl of black hair, on a big round body and grown-up legs; a grey hoodie.
+SHAPES.meAdult = { sx: 104, sy: -258, hipX: 34, legW: 40, shoe: 29, legH: 96, neck: -276,
+ body: 'M-70,-290 C-128,-272 -140,-150 -122,-104 Q-76,-86 0,-86 Q76,-86 122,-104 C140,-150 128,-272 70,-290 Z',
+ extra: '<path d="M-62,-176 L62,-176 L72,-118 L-72,-118 Z" fill="#7b808b"/><path d="M-16,-284 v46 M16,-284 v46" stroke="#f4f1ea" stroke-width="4" stroke-linecap="round"/>',
+ head: [0, -366, 106, 90], eyes: [22, -372, 23, 28], mouth: [0, -312], cheeks: [64, -332], slide: 30, chin: 'M-52,-290 Q0,-268 52,-290',
+ hair: ['#211a17', shiftY(SHAPES.me.hair[1], -116)] };
+const meAdultPuppet = (p, o) => spKid(p, 'meAdult', { coat: '#8f949e', stripe: '#8f949e', pants: '#34405e', ...o });
+// The American girl: blonde, a high ponytail swinging to her left, a pink T-shirt with a heart, backpack straps, denim shorts.
+SHAPES.amy = { ...SHAPES.aunt,
+ extra: '<path d="M-40,-282 L-36,-150 M40,-282 L36,-150" stroke="#3a5ab0" stroke-width="13" stroke-linecap="round"/><path d="M0,-186 c-14,-18 -38,-2 -20,16 l20,18 l20,-18 c18,-18 -6,-34 -20,-16 Z" fill="#e0405a"/>',
+ cheeks: [54, -330],
+ hair: ['#f0c45a', 'M-86,-366 C-94,-432 -50,-448 0,-448 C50,-448 94,-432 86,-366 Q74,-404 30,-412 Q-30,-420 -86,-366 Z M50,-438 q70,-34 84,22 q6,46 -26,84 q8,-52 -22,-80 Z'],
+ hat: '<circle cx="54" cy="-436" r="10" fill="#e0405a"/>' };
+const amyPuppet = (p, o) => spKid(p, 'amy', { skin: '#f9dcc6', coat: '#f39ab8', stripe: '#f39ab8', pants: '#5a7ab8', ...o });
+// The clerk: a young woman with a black bob, the store's blue-and-white striped shirt and a name badge.
+SHAPES.clerk = { ...SHAPES.aunt,
+ extra: [-44, -26, -8, 10, 28, 46].map(x => `<rect x="${x - 4}" y="-274" width="8" height="184" fill="#5b8fd0"/>`).join('') +
+ '<path d="M-22,-284 L0,-250 L22,-284" fill="none" stroke="#2f6fb8" stroke-width="7"/><rect x="18" y="-236" width="34" height="20" rx="3" fill="#fbfbf6" stroke="#3f9a5a" stroke-width="3"/>',
+ hair: ['#1d1716', 'M-92,-366 C-98,-434 -52,-450 0,-450 C52,-450 98,-434 92,-366 L94,-318 Q84,-326 72,-324 L74,-384 Q0,-408 -74,-384 L-72,-324 Q-84,-326 -94,-318 Z'] };
+SHAPES.clerk.hat = '';
+const clerkPuppet = (p, o) => spKid(p, 'clerk', { coat: '#eef2f8', stripe: '#eef2f8', pants: '#2c3446', ...o });
diff --git a/site/joke-collection/lib/contents.css b/site/joke-collection/lib/contents.css
new file mode 100644
index 0000000..3f59f10
--- /dev/null
+++ b/site/joke-collection/lib/contents.css
@@ -0,0 +1,115 @@
+/* The book's cover and contents (index.html): the chalkboard look, the cover, the guide, the chapter grid and the
+ page-to-page motion. A book's own <style> after this file sets its theme: the colour and font tokens below, and the
+ few rules a theme redraws (e.g. body::before for the paper). */
+:root {
+ --page: #0f1613; --board: #1d2b27; --panel: #22322d; --edge: #3a5047;
+ --chalk: #ece8dc; --dim: #9aaba3; --faint: #5d7068; --task: #f0b45a; --quiz: #86c9e8; --good: #8fd6b0;
+ --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
+ --book: "Iowan Old Style", Palatino, Georgia, serif;
+ --ease: cubic-bezier(.2, .8, .2, 1);
+ --top-bg: rgba(22, 33, 29, .86); --top-line: #2a3b35; /* the sticky contents header */
+ --lift: rgba(0, 0, 0, .3); /* a card's shadow on hover */
+ color-scheme: dark;
+}
+* { box-sizing: border-box; }
+html { scroll-padding-top: 90px; }
+body { margin: 0; min-height: 100svh; background: var(--board); color: var(--chalk); font: 18px/1.5 var(--ui); }
+/* Chalkboard: the same grain and vignette as the lesson stage. */
+body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
+ background: radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(0, 0, 0, .38)),
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .92 0 0 0 0 .95 0 0 0 0 .9 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E"); }
+a { color: inherit; }
+a:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }
+.kicker { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--quiz); }
+
+/* ---------- cover ---------- */
+#cover { position: relative; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
+ padding: 48px 16px 64px; text-align: center; overflow: hidden; }
+.open #cover, body:not(.open) #contents { display: none; }
+#cover > * { animation: rise .8s var(--ease) backwards; }
+#cover .mascot { animation: none; margin-bottom: 26px; view-transition-name: guide; }
+#cover .kicker { animation-delay: .9s; }
+#cover h1 { animation-delay: 1s; }
+#cover .lede { animation-delay: 1.12s; }
+#cover .acts { animation-delay: 1.24s; }
+#cover .meta { animation-delay: 1.36s; }
+h1 { margin: 14px 0 18px; font: 500 clamp(44px, 8.4vw, 92px)/1.02 var(--book); letter-spacing: -.01em; view-transition-name: book; }
+h1 i { color: var(--task); font-style: italic; }
+.lede { max-width: 34em; margin: 0 0 34px; color: var(--dim); font-size: clamp(17px, 2.2vw, 20px); text-wrap: balance; }
+.acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
+.btn { display: inline-flex; align-items: center; gap: 12px; padding: 14px 30px; border-radius: 999px; font-weight: 600; font-size: 19px; text-decoration: none;
+ transition: transform .25s var(--ease), background-color .25s, border-color .25s; }
+.btn[hidden] { display: none; }
+.btn:hover { transform: translateY(-2px); }
+.btn.go { background: var(--chalk); color: var(--board); }
+.btn.quiet { border: 1.5px solid var(--edge); color: var(--chalk); }
+.btn.quiet:hover { border-color: var(--dim); }
+.btn svg { width: 15px; height: 15px; fill: currentColor; }
+.meta { margin: 30px 0 0; color: var(--faint); font-size: 15px; letter-spacing: .04em; }
+/* Faint chalk notes around the edges of the board. */
+.chalk { position: absolute; inset: 0; z-index: -1; pointer-events: none; animation: none !important; }
+.chalk span { position: absolute; font: italic 400 clamp(22px, 3vw, 38px) var(--book); color: var(--chalk); opacity: 0; white-space: nowrap;
+ animation: chalk 1.6s ease-out forwards, drift 14s ease-in-out infinite alternate; animation-delay: calc(var(--d) * 1s), calc(var(--d) * 1s); }
+@keyframes chalk { to { opacity: .075; } }
+@keyframes drift { to { translate: 0 -10px; } }
+@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
+
+/* ---------- the guide: an infinity sign whose loops are its eyes ---------- */
+.mascot { display: block; overflow: visible; }
+.mascot .mbody { transform-box: view-box; transform-origin: 60px 46px; animation: bob 3.4s ease-in-out infinite; }
+.mascot .pupil { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
+.mascot .joy { display: none; }
+#cover:has(.go:hover, .go:focus-visible) .pupil { display: none; }
+#cover:has(.go:hover, .go:focus-visible) .joy { display: inline; }
+.draw .loop { stroke-dasharray: 1 1; animation: draw 1.3s cubic-bezier(.6, 0, .3, 1) .15s backwards; }
+.draw .face { animation: pop .45s var(--ease) 1.25s backwards; }
+@keyframes draw { from { stroke-dashoffset: 1; } }
+@keyframes pop { from { opacity: 0; transform: scale(.6); } }
+.draw .face { transform-box: view-box; transform-origin: 60px 44px; }
+@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }
+@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
+
+/* ---------- contents ---------- */
+.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 12px max(16px, calc(50% - 590px));
+ background: var(--top-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--top-line); }
+.home { display: flex; align-items: center; gap: 12px; text-decoration: none; border-radius: 10px; }
+.home .mascot { view-transition-name: guide; }
+.home strong { font: 500 22px/1.1 var(--book); view-transition-name: book; }
+.home strong i { color: var(--task); }
+.prog { margin-left: auto; color: var(--dim); font-size: 15px; white-space: nowrap; }
+.prog b { color: var(--good); font-weight: 600; }
+main#contents { padding-bottom: 80px; }
+.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; }
+.ch { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 16px; row-gap: 8px; min-height: 112px;
+ padding: 16px 18px 14px 16px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--edge); border-left: 6px solid var(--c);
+ text-decoration: none; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
+.ch:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 14px 34px var(--lift); }
+.ch b { grid-row: span 2; min-width: 1.15em; font: 500 42px/1 var(--book); color: var(--c); font-variant-numeric: lining-nums tabular-nums; }
+.ch span { font-size: 18px; line-height: 1.3; }
+.ch small { color: var(--dim); font-size: 14px; }
+.ch.done small::before { content: var(--done, "✓ Finished · "); color: var(--good); font-weight: 600; }
+.ch.last small::after { content: var(--last, " · Last opened"); color: var(--quiz); }
+.ch.here:focus-visible { outline-color: var(--c); }
+.ch.here { animation: here 1.8s ease-out .3s; }
+@keyframes here { 0% { box-shadow: 0 0 0 0 var(--c); } 25% { box-shadow: 0 0 0 5px var(--c); } 100% { box-shadow: 0 0 0 14px transparent; } }
+.stagger .top { animation: rise .6s var(--ease) backwards; }
+.stagger .unit h2, .stagger .ch { animation: rise .6s var(--ease) backwards; animation-delay: calc(min(var(--i), 14) * 32ms + 80ms); }
+
+/* ---------- page-to-page motion ---------- */
+@view-transition { navigation: auto; }
+/* Firefox flickers through view transitions (the header blinks for several frames): it switches without one, and the
+ contents still rise in. -moz-orient exists only in Firefox. */
+@supports (-moz-orient: inline) { @view-transition { navigation: none; } }
+::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease); }
+::view-transition-old(lesson), ::view-transition-new(lesson) { height: 100%; object-fit: cover; }
+::view-transition-old(lesson) { animation-duration: .18s; }
+@media (max-width: 560px) {
+ .home strong { font-size: 18px; }
+ #contents .top { flex-wrap: wrap; gap: 8px 12px; }
+ .ch { min-height: 0; }
+ .chalk span:not(:nth-child(3), :nth-child(4), :nth-child(7)) { display: none; }
+}
+@media (prefers-reduced-motion: reduce) {
+ *, *::before, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
+ .chalk span { opacity: .075; }
+}
diff --git a/site/joke-collection/lib/contents.js b/site/joke-collection/lib/contents.js
new file mode 100644
index 0000000..6b3272b
--- /dev/null
+++ b/site/joke-collection/lib/contents.js
@@ -0,0 +1,192 @@
+/* The book's cover and contents (index.html): interface text, the chapter list with reading progress, the guide,
+ and the cover ↔ contents ↔ lesson motion. Load it in <head>; after the markup, the page calls
+ Contents.book({ units, start, hues }) with its chapter list. */
+'use strict';
+// Observe aborted incoming transitions before the first rendering opportunity.
+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));
+
+const Contents = (() => {
+ // Interface text in the page's <html lang>, as in the lessons; missing keys fall back to English.
+ // A value is a string or plural forms { one, few, many, other } chosen by vars.n.
+ const TRANSLATIONS = {
+ en: {
+ open: 'Open the book', toCover: 'Back to the cover', resume: 'Continue · Chapter {n}', unit: 'Unit {n}', minutes: '{n} min',
+ meta: '{chapters}{samples} · {units} · with sound', metaChapters: { one: '{n} chapter', other: '{n} chapters' },
+ metaUnits: { one: '{n} unit', other: '{n} units' }, metaSamples: { one: ' + {n} sample', other: ' + {n} samples' }, samples: 'Sample chapters, another look',
+ chapterCount: { one: '{n} chapter', other: '{n} chapters' }, finished: '{done} of {n} finished',
+ doneMark: '✓ Finished · ', lastMark: ' · Last opened',
+ },
+ ru: {
+ open: 'Открыть книгу', toCover: 'К обложке', resume: 'Продолжить · Глава {n}', unit: 'Раздел {n}', minutes: '{n} мин',
+ meta: '{chapters}{samples} · {units} · со звуком',
+ metaChapters: { one: '{n} глава', few: '{n} главы', many: '{n} глав', other: '{n} главы' },
+ metaUnits: { one: '{n} раздел', few: '{n} раздела', many: '{n} разделов', other: '{n} раздела' },
+ metaSamples: { one: ' + {n} пробная', few: ' + {n} пробные', many: ' + {n} пробных', other: ' + {n} пробной' },
+ samples: 'Пробные главы в другом стиле',
+ chapterCount: { one: '{n} глава', few: '{n} главы', many: '{n} глав', other: '{n} главы' }, finished: 'Пройдено {done} из {n}',
+ doneMark: '✓ Пройдено · ', lastMark: ' · Открыта последней',
+ },
+ zh: {
+ open: '打开这本书', toCover: '返回封面', resume: '继续 · 第 {n} 章', unit: '第 {n} 单元', minutes: '{n} 分钟',
+ meta: '{chapters}{samples} · {units} · 有配音', metaChapters: '{n} 章', metaUnits: '{n} 个单元',
+ metaSamples: ' + {n} 个示例章', samples: '示例章,另一种风格',
+ chapterCount: '{n} 章', finished: '已完成 {done} / {n}',
+ doneMark: '✓ 已完成 · ', lastMark: ' · 上次打开',
+ },
+ ja: {
+ open: '本を開く', toCover: '表紙に戻る', resume: '続きから · 第{n}章', unit: '単元 {n}', minutes: '{n}分',
+ meta: '{chapters}{samples} · {units} · 音声つき', metaChapters: '{n}章', metaUnits: '{n}単元',
+ metaSamples: ' + サンプル{n}章', samples: 'サンプル章(別のスタイル)',
+ chapterCount: '{n}章', finished: '{n}章中 {done}章 完了',
+ doneMark: '✓ 完了 · ', lastMark: ' · 最後に開いた章',
+ },
+ };
+ const LANGUAGE = (document.documentElement.lang || 'en').toLowerCase().split('-')[0];
+ function translate(key, vars = {}) {
+ const language = TRANSLATIONS[LANGUAGE]?.[key] !== undefined ? LANGUAGE : 'en';
+ let text = TRANSLATIONS[language][key] ?? key;
+ if (typeof text === 'object') {
+ let rules;
+ try { rules = new Intl.PluralRules(language); } catch { rules = new Intl.PluralRules('en'); }
+ text = text[rules.select(vars.n)] ?? text.other;
+ }
+ return text.replace(/\{(\w+)\}/g, (placeholder, name) => name in vars ? vars[name] : placeholder);
+ }
+ const $ = id => document.getElementById(id);
+ const id = n => 'ch' + String(n).padStart(2, '0');
+ const esc = s => s.replace(/&/g, '&amp;').replace(/</g, '&lt;');
+ const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];
+
+ // Fixed interface text: data-t replaces an element's first text, data-t-label its aria-label.
+ function translatePage() {
+ for (const element of document.querySelectorAll('[data-t]')) element.firstChild.nodeValue = translate(element.dataset.t);
+ for (const element of document.querySelectorAll('[data-t-label]')) element.setAttribute('aria-label', translate(element.dataset.tLabel));
+ document.documentElement.style.setProperty('--done', JSON.stringify(translate('doneMark')));
+ document.documentElement.style.setProperty('--last', JSON.stringify(translate('lastMark')));
+ }
+
+ // Reading progress { done: [chapter numbers], last }, written by the lessons. The engine and this page derive the
+ // same key from the book's folder; a book that predates that passes its own key.
+ function progress(key) {
+ let P = {};
+ try {
+ const saved = JSON.parse(localStorage.getItem(key) || '{}');
+ if (saved && typeof saved === 'object' && !Array.isArray(saved)) P = saved;
+ } catch {}
+ return { last: P.last, done: new Set(Array.isArray(P.done) ? P.done.filter(n => Number.isInteger(n) && n > 0) : []) };
+ }
+
+ // The chapter cards, unit by unit, with progress, the header count, the cover's meta line and its resume button.
+ // A unit's optional third entry { unit, chapter, sample, href } numbers it from elsewhere in the book; a sample chapter,
+ // made to show another look, is not counted with the book's chapters, and a unit of samples has no unit number.
+ // With href, the sample lives in another book folder (its own progress): its card links there and leaves this book's
+ // numbering and progress alone. A chapter's own third entry { href, chapter } does the same for that chapter alone;
+ // without href, its chapter is only the number shown on the card.
+ // start.label is the number shown for start.chapter (folders keep the book's numbers; lessons set CHAPTER.label).
+ function contents(units, start, hues, P) {
+ let n = start.chapter - 1, total = 0, i = 0, away = 0; // i staggers the entrance, in reading order
+ const samples = new Set(), shown = k => k - start.chapter + (start.label ?? start.chapter);
+ $('units').innerHTML = units.map(([name, chs, o = {}], u) => {
+ if (o.chapter && !o.href) n = o.chapter - 1;
+ return `<section class="unit" style="--c:${hues[u % hues.length]};--i:${i++}">${Units.header(u, o.sample ? translate('samples') : translate('unit', { n: o.unit ?? u + start.unit }), name)}<div class="grid">` +
+ chs.map(([t, min, c = {}], k) => {
+ const href = c.href ?? o.href;
+ if (href) { away++; return `<a class="ch" href="${href}" style="--i:${i++}"><b>${c.chapter ?? (o.chapter ?? 1) + k}</b><span>${esc(t)}</span><small>${translate('minutes', { n: min })}</small></a>`; }
+ n++; if (o.sample) samples.add(n); else total++;
+ const cls = 'ch' + (P.done.has(n) ? ' done' : '') + (P.last === n ? ' last' : '');
+ return `<a class="${cls}" id="${id(n)}" href="${id(n)}/" style="--i:${i++}"><b>${c.chapter ?? shown(n)}</b><span>${esc(t)}</span><small>${translate('minutes', { n: min })}</small></a>`;
+ }).join('') + '</div></section>';
+ }).join('');
+ // A unit's sketch draws itself the first time the unit scrolls into view.
+ Units.watch();
+ const finished = [...P.done].filter(k => k >= start.chapter && k <= n && !samples.has(k)).length;
+ $('prog').innerHTML = finished ? translate('finished', { done: `<b>${finished}</b>`, n: total }) : translate('chapterCount', { n: total });
+ $('meta').textContent = translate('meta', {
+ chapters: translate('metaChapters', { n: total }),
+ samples: samples.size + away ? translate('metaSamples', { n: samples.size + away }) : '',
+ units: translate('metaUnits', { n: units.filter(x => !x[2]?.sample).length }) });
+ const last = Number.isInteger(P.last) && $(id(P.last));
+ if (last) {
+ const r = $('resume');
+ r.hidden = false;
+ r.href = last.getAttribute('href');
+ r.textContent = translate('resume', { n: last.querySelector('b').textContent });
+ }
+ }
+
+ // The guide, drawn the same way as in the lessons, in the page's chalk (ink) colour.
+ function lemniscate(cx, cy, a, k) {
+ let d = '';
+ for (let i = 0; i <= 96; i++) {
+ const t = i / 96 * 2 * Math.PI, sn = Math.sin(t), q = 1 + sn * sn;
+ d += (i ? 'L' : 'M') + (cx + a * Math.cos(t) / q).toFixed(1) + ' ' + (cy + k * a * sn * Math.cos(t) / q).toFixed(1);
+ }
+ return d + 'Z';
+ }
+ function guides(ink) {
+ for (const svg of document.querySelectorAll('svg.mascot')) {
+ svg.setAttribute('viewBox', '0 0 120 84');
+ svg.setAttribute('aria-hidden', 'true');
+ const ln = `fill="none" stroke="${ink}" stroke-linecap="round" stroke-linejoin="round"`;
+ svg.innerHTML = `<g class="mbody"><path class="loop" pathLength="1" d="${lemniscate(60, 40, 52, 1.5)}" ${ln} stroke-width="6"/><g class="face">` +
+ [33, 87].map(x => `<circle class="pupil" cx="${x}" cy="40" r="6.5" fill="${ink}"/><path class="joy" d="M${x - 7} 43Q${x} 32 ${x + 7} 43" ${ln} stroke-width="4"/>`).join('') +
+ `<path d="M55 62Q60 67 65 62" ${ln} stroke-width="3.5"/></g></g>`;
+ }
+ }
+
+ // The cover and the contents share this page: no hash or #book shows the cover, #contents or #chNN the contents.
+ // Lessons link back with #chNN, so the reader lands on the chapter they just left.
+ function views() {
+ const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
+ function show(animate) {
+ const open = location.hash.length > 1 && location.hash !== '#book';
+ const apply = () => {
+ document.body.classList.toggle('open', open);
+ document.body.classList.toggle('stagger', animate && open);
+ const here = open ? $(location.hash.slice(1)) : null;
+ document.querySelectorAll('.here').forEach(e => e.classList.remove('here'));
+ if (here?.classList.contains('ch')) { here.scrollIntoView({ block: 'center' }); here.classList.add('here'); }
+ else scrollTo(0, 0);
+ if (animate) {
+ const heading = document.querySelector(open ? '#contents .home' : '#cover h1');
+ heading?.setAttribute('tabindex', '-1');
+ heading?.focus({ preventScroll: true });
+ }
+ };
+ if (animate && document.startViewTransition && !reduced && !CSS.supports('-moz-orient', 'inline')) {
+ const transition = document.startViewTransition(apply);
+ // Navigation can interrupt either promise; the new view is already applied.
+ transition.ready.catch(() => {});
+ transition.finished.catch(() => {});
+ } else apply();
+ }
+ addEventListener('hashchange', () => show(true));
+ show(false);
+
+ // Between pages, the chosen card grows into the lesson frame and the frame shrinks back into its card.
+ let named = null;
+ const name = el => {
+ if (named) named.style.viewTransitionName = '';
+ named = el;
+ if (el) el.style.viewTransitionName = 'lesson';
+ };
+ document.addEventListener('click', e => { const a = e.target.closest('a[href^="ch"]'); if (a) name(a); });
+ addEventListener('pagereveal', e => {
+ const target = (location.hash.length > 1 && $(location.hash.slice(1))?.closest('.ch')) || (named?.offsetParent && named);
+ name(e.viewTransition && target ? target : null);
+ e.viewTransition?.finished.then(() => name(null), () => name(null));
+ });
+ }
+
+ // units: [[unit title, [[chapter title, minutes], ...], { unit, chapter, sample, href }?], ...]. Chapters are numbered in
+ // order from start (a book whose scope starts mid-way keeps the original numbers in its folders, and may show them
+ // from start.label). hues: one colour per unit, cycling.
+ function book({ units, start = { unit: 1, chapter: 1 }, hues = HUES, progressKey, ink } = {}) {
+ translatePage();
+ contents(units, start, hues, progress(progressKey ?? 'animebook:progress:' + new URL('.', location.href).pathname));
+ guides(ink || getComputedStyle(document.documentElement).getPropertyValue('--chalk').trim() || '#ece8dc');
+ views();
+ }
+
+ return { book, translate };
+})();
diff --git a/site/joke-collection/lib/engine.css b/site/joke-collection/lib/engine.css
new file mode 100644
index 0000000..9b9be00
--- /dev/null
+++ b/site/joke-collection/lib/engine.css
@@ -0,0 +1,235 @@
+@import url(volume.css);
+@import url(book.css); /* this book's own settings and overrides (not shared), before the rules below */
+:root {
+ --page: #0f1613; --board: #1d2b27; --panel: #22322d; --edge: #3a5047;
+ --chalk: #ece8dc; --dim: #9aaba3; --faint: #5d7068;
+ --task: #f0b45a; --quiz: #86c9e8; --good: #8fd6b0; --bad: #f08c7a;
+ --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
+ color-scheme: dark;
+}
+* { box-sizing: border-box; }
+html, body { height: 100%; margin: 0; overflow: hidden; background: var(--page); }
+body { color: var(--chalk); font: 26px/1.4 var(--ui); }
+button { font: inherit; color: inherit; cursor: pointer; }
+button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--task); outline-offset: 3px; }
+button[hidden] { display: none; }
+
+/* One fixed 1600×960 frame (900 stage + 60 controls), scaled to fit the window. */
+#frame { position: absolute; left: 50%; top: 50%; width: 1600px; height: 960px; transform: translate(-50%, -50%) scale(var(--k, .5));
+ border-radius: 20px; overflow: hidden; background: var(--board); box-shadow: 0 0 0 1px var(--edge), 0 30px 80px rgba(0, 0, 0, .45); }
+#stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: block;
+ background: radial-gradient(75% 75% at 50% 45%, rgba(0,0,0,0) 60%, rgba(0,0,0,.35)), var(--grain, none), #1d2b27; }
+#ui { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; pointer-events: none; }
+#ui > * { pointer-events: auto; }
+
+.cover { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: grid; place-items: center; background: rgba(15, 22, 19, .5); border: 0; }
+.cover[hidden] { display: none; }
+.cover > div { display: flex; flex-direction: column; align-items: center; }
+.cover-k { margin: 0 0 10px; text-align: center; font-size: 22px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }
+.cover-t { margin: 0 0 44px; max-width: 1200px; text-align: center; font: 500 64px/1.15 "Iowan Old Style", Palatino, Georgia, serif; color: var(--chalk); text-wrap: balance; }
+.cover > div > * { animation: rise .7s cubic-bezier(.2, .8, .2, 1) backwards; }
+.cover-t { animation-delay: .08s; }
+.cover .go { animation-delay: .18s; }
+.cover small { animation-delay: .26s; }
+@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
+.cover .go { display: inline-flex; align-items: center; gap: 16px; padding: 20px 40px; border-radius: 999px; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 32px; }
+.cover small { display: block; margin-top: 22px; font-size: 22px; text-align: center; color: var(--dim); }
+.paused-mark { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: none; place-items: center; pointer-events: none; }
+.paused .paused-mark { display: grid; }
+.paused-mark div { padding: 14px 30px; border-radius: 999px; background: rgba(15, 22, 19, .85); color: var(--dim); font-size: 22px; }
+
+/* Question cards inside the picture. */
+.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: rgba(34, 50, 45, .97); border: 1.5px solid var(--edge); border-left: 7px solid var(--quiz); box-shadow: 0 14px 44px rgba(0, 0, 0, .35); }
+.card.band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "pic head body acts" "pic fb body acts"; column-gap: 28px; align-items: center; align-content: center; min-height: 150px; }
+.band .mascot { grid-area: pic; }
+.band .head { grid-area: head; align-self: end; }
+.band .fb { grid-area: fb; align-self: start; }
+.band .body { grid-area: body; }
+.band .acts { grid-area: acts; }
+.side .mascot { float: right; margin: -2px -4px 6px 10px; }
+.kicker { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--quiz); }
+.prompt { margin: 0; font-size: 28px; line-height: 1.35; }
+.side .prompt { font-size: 24px; }
+.body:empty { display: none; }
+.side .body { margin-top: 14px; }
+.opts { display: flex; gap: 12px; flex-wrap: wrap; }
+.opt { padding: 8px 24px; border-radius: 999px; border: 2px solid var(--edge); background: transparent; color: var(--chalk); font-size: 24px; min-height: 58px; display: inline-flex; align-items: center; }
+.opt:hover:not(:disabled) { border-color: var(--dim); }
+.opt[aria-pressed="true"] { background: var(--c, var(--chalk)); border-color: var(--c, var(--chalk)); color: #1b2320; font-weight: 600; }
+.opt.good { border-color: var(--good); box-shadow: 0 0 0 3px rgba(143, 214, 176, .35); }
+.opt.bad { border-color: var(--bad); color: var(--bad); }
+.opt:disabled { cursor: default; }
+.fb { margin-top: 8px; font-size: 22px; line-height: 1.4; color: var(--chalk); }
+.fb:empty { display: none; }
+.fb.ok::before { content: "✓ "; color: var(--good); font-weight: 700; }
+.fb.no::before { content: "✗ "; color: var(--bad); font-weight: 700; }
+.fb ul { margin: 6px 0 0; padding-left: 22px; }
+.side .fb { max-height: 110px; overflow: auto; font-size: 20px; }
+.acts { display: flex; gap: 12px; align-items: center; }
+.side .acts { margin-top: 16px; }
+.side .acts { flex-wrap: wrap; gap: 10px; }
+.side .btn { padding: 8px 16px; font-size: 20px; }
+.card.side { padding: 18px 22px; }
+.btn { padding: 10px 28px; border-radius: 999px; border: 0; background: var(--chalk); color: var(--board); font-weight: 600; font-size: 22px; white-space: nowrap; }
+.btn.quiet { background: transparent; color: var(--dim); border: 1.5px solid var(--edge); }
+.btn.go { background: var(--quiz); color: #10242e; }
+.btn:disabled { background: var(--edge); color: var(--dim); cursor: default; }
+
+.grid .row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 34px; gap: 16px; align-items: center; padding: 5px 0 5px 12px; border-bottom: 1px solid #2e433b; }
+.grid .num { display: flex; justify-content: flex-end; align-items: center; font-size: 26px; }
+.grid.text .row { grid-template-columns: minmax(0, 1fr) auto 34px; }
+.grid.text .num { justify-content: flex-start; }
+.grid .opts { gap: 8px; }
+.grid .opt { padding: 3px 16px; min-height: 42px; font-size: 20px; }
+.grid .mark { font-weight: 700; text-align: center; }
+.grid .mark.good { color: var(--good); }
+.grid .mark.bad { color: var(--bad); }
+.grid .why { grid-column: 1 / -1; font-size: 19px; color: var(--dim); padding-left: 186px; }
+.grid.text .why { padding-left: 0; }
+.grid .why:empty { display: none; }
+
+.hit { cursor: pointer; }
+.hit .ring { fill: transparent; stroke: var(--chalk); stroke-width: 2.5; stroke-opacity: 0; }
+.hit:hover .ring, .hit:focus .ring { stroke-opacity: .7; }
+.hit.bad .ring { stroke: var(--bad); stroke-opacity: 1; }
+.hit.good .ring { stroke: var(--good); stroke-opacity: 1; stroke-width: 4; }
+.tok { cursor: grab; touch-action: none; } /* a finger drags the chip instead of scrolling the page */
+
+/* Controls strip, part of the frame. */
+#bar { position: absolute; left: 0; top: 900px; width: 1600px; height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: #16211d; border-top: 1px solid #2a3b35; }
+.icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); display: grid; place-items: center; flex: none; padding: 0; }
+.icon svg { width: 18px; height: 18px; fill: var(--chalk); }
+.icon .i-pause { display: none; }
+.is-playing .icon .i-play { display: none; }
+.is-playing .icon .i-pause { display: block; }
+.segs { flex: 1; display: flex; gap: 4px; height: 30px; align-items: center; min-width: 0; margin: 0 8px; }
+.seg { position: relative; display: block; min-width: 0; height: 8px; border-radius: 4px; background: #2f4640; border: 0; padding: 0; overflow: hidden; }
+.seg:hover { height: 12px; }
+.seg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--chalk); }
+.seg.ask { background: #2d4a57; }
+.seg.ask i { background: var(--quiz); }
+.step { width: 300px; flex: none; color: var(--dim); font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
+/* Keep the control strip usable without scaling down its touch targets. */
+@media (max-width: 700px) {
+ #frame { top: calc(50% - 50px); overflow: visible; }
+ #bar { width: calc(1600px * var(--k)); height: auto; flex-wrap: wrap; gap: 6px; padding: 8px;
+ transform: scale(calc(1 / var(--k))); transform-origin: left top; border-radius: 0 0 12px 12px; }
+ #bar .icon { width: 36px; height: 40px; }
+ .step { display: none; }
+ #bHelp { display: none; } /* keyboard shortcuts; room for the speed button on a phone */
+ #bar .icon.speed { width: 36px; min-width: 0; padding: 0; font-size: 12px; letter-spacing: -.3px; }
+ .segs { order: 1; }
+ .segs { min-width: 80px; margin: 0; }
+}
+.sound-note { position: absolute; left: 24px; top: 20px; margin: 0; padding: 8px 18px; border-radius: 12px; background: rgba(15, 22, 19, .85); color: var(--dim); font-size: 19px; }
+.sound-note[hidden] { display: none; }
+.blanks .brow { padding: 8px 0; border-bottom: 1px solid #2e433b; }
+.blanks .brow:last-child { border-bottom: 0; }
+.blanks .bline { line-height: 64px; white-space: nowrap; }
+.blanks .mark { display: inline-block; margin-left: 14px; font-weight: 700; }
+.blanks .mark.good { color: var(--good); animation: pop .35s ease-out; }
+.blanks .mark.bad { color: var(--bad); }
+.blanks .why { font-size: 19px; color: var(--dim); line-height: 1.35; }
+.blanks .why:empty { display: none; }
+.box { height: 52px; margin: 0 6px; padding: 0 6px; border: 0; border-bottom: 3px solid var(--quiz); border-radius: 8px 8px 0 0; background: rgba(236, 232, 220, .07); color: var(--chalk); font: 32px var(--math-font, "STIX Two Text", "Cambria Math", "Iowan Old Style", Palatino, Georgia, serif); text-align: center; vertical-align: -6px; }
+.box:focus { outline: none; background: rgba(134, 201, 232, .16); }
+.box.good { border-color: var(--good); }
+.box.bad { border-color: var(--bad); }
+.box:disabled { opacity: 1; }
+kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-left: .5em; border: 1.5px solid currentColor; border-radius: 6px; font: 600 .7em/1.5 var(--ui); text-align: center; vertical-align: .12em; opacity: .6; }
+.opt kbd { margin: 0 .6em 0 0; }
+.keys { margin: 6px 0 0; font-size: 18px; color: var(--dim); }
+.keys kbd { margin: 0 .15em; }
+.grid .row.cur { background: rgba(236, 232, 220, .05); box-shadow: inset 4px 0 var(--quiz); }
+.help { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: grid; place-items: center; background: rgba(10, 16, 14, .72); }
+.help[hidden] { display: none; }
+.help-box { width: 1120px; padding: 40px 50px; border-radius: 22px; background: var(--panel); border: 1.5px solid var(--edge); }
+.help h2 { margin: 0 0 22px; font-size: 32px; font-weight: 600; }
+.help h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; color: var(--quiz); }
+.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
+.help dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; font-size: 22px; }
+.help dt { text-align: right; padding-right: 18px; white-space: nowrap; }
+.help dt kbd { margin: 0 0 0 .3em; opacity: .9; }
+.help dd { margin: 0; color: var(--dim); }
+.help-close { margin: 26px 0 0; font-size: 18px; color: var(--dim); }
+.icon.txt { font-size: 20px; font-weight: 700; color: var(--dim); }
+/* Optional captions of the narration, one sentence at a time. Off by default: teaching text lives in the picture. */
+.caption { position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); width: max-content; max-width: 1180px; padding: 10px 24px; border-radius: 14px; background: rgba(10, 16, 14, .82); color: var(--chalk); font-size: 28px; line-height: 1.35; text-align: center; pointer-events: none; }
+.caption[hidden] { display: none; }
+.icon.cc { font-size: 15px; font-weight: 700; color: var(--dim); }
+.icon.cc[aria-pressed="true"] { background: var(--chalk); border-color: var(--chalk); color: var(--board); }
+.card.side { overflow: auto; }
+svg.m { display: inline-block; overflow: visible; }
+.card b { font-weight: 700; } /* not 'bolder' (900 under a 600 prompt) */
+.card { animation: card-in .45s cubic-bezier(.2, .9, .3, 1.15); }
+.fb:not(:empty) { animation: fb-in .3s ease-out; }
+.opt.bad, .grid .mark.bad { animation: shake .4s; }
+.grid .mark.good { animation: pop .35s ease-out; }
+@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
+@keyframes fb-in { from { opacity: 0; transform: translateY(8px); } }
+@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.3); } }
+@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
+/* Full-screen chapter practice. */
+.card.screen { height: 900px; padding: 50px 70px; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: screen-in .5s ease-out; max-height: none; overflow: visible; }
+.screen .kicker { font-size: 22px; }
+.screen .prompt { font-size: 40px; font-weight: 600; }
+.screen .body { margin-top: 30px; }
+.card.screen { display: flex; flex-direction: column; }
+.screen .head { order: 1; } .screen .body { order: 2; }
+.screen .fb { order: 3; max-width: 1080px; margin: 26px 0 0; font-size: 24px; } /* feedback right under the answers */
+/* Practice screens: the bottom 130 px hold the buttons. Long answers scroll inside the body, so the feedback under
+ them stays in view after a wrong answer adds a 'why' line to each row. */
+.card.screen:not(.sort):not(.fin) { padding-bottom: 130px; }
+.card.screen:not(.sort):not(.fin) > .head, .card.screen:not(.sort):not(.fin) > .fb { flex: none; }
+.card.screen:not(.sort):not(.fin) > .body { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
+.screen .acts { position: absolute; right: 70px; bottom: 48px; }
+.screen .grid .row { grid-template-columns: 200px minmax(0, 1fr) 40px; padding: 9px 0 9px 12px; }
+.screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }
+.screen .grid .opt { font-size: 22px; min-height: 50px; padding: 4px 20px; }
+.screen .grid .why { padding-left: 216px; font-size: 20px; }
+.screen .grid.text .why { padding-left: 0; }
+#ui > .screen.sort { pointer-events: none; }
+.screen.sort > * { pointer-events: auto; }
+.screen.sort .head { position: absolute; right: 34px; top: 40px; width: 330px; }
+.screen.sort .prompt { font-size: 28px; }
+.screen.sort .fb { position: absolute; margin: 0; left: auto; right: 34px; bottom: 116px; width: 330px; max-height: 240px; overflow: auto; font-size: 20px; }
+.screen.sort .acts { right: 34px; }
+.fin .finwrap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; padding-bottom: 60px; }
+.fin .mascot { margin-bottom: 28px; }
+.fin .fb, .fin .acts { position: static; }
+.fin .fb { order: 0; margin: 0; } /* result lines, not answer feedback: keep them above the buttons */
+.fin .acts { margin-top: 30px; }
+@keyframes screen-in { from { opacity: 0; } }
+
+/* The guide: an infinity sign whose loops are its eyes. */
+.mascot { display: block; flex: none; overflow: visible; }
+.mascot .mbody { transform-box: view-box; transform-origin: 60px 46px; animation: bob 3.4s ease-in-out infinite; }
+.mascot .eyes { transition: transform .3s; }
+.mascot .pupil { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
+.mascot .joy, .mascot .flat { display: none; }
+.mascot.happy .pupil { display: none; }
+.mascot.happy .joy { display: inline; }
+.mascot.happy .mbody { animation: hop .55s ease-out 2, bob 3.4s ease-in-out 1.1s infinite; }
+.mascot.oops .eyes { transform: translate(-3px, 4px); }
+.mascot.oops .smile { display: none; }
+.mascot.oops .flat { display: inline; }
+.mascot.oops .mbody { animation: wobble .5s ease-in-out, bob 3.4s ease-in-out .5s infinite; }
+@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }
+@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
+@keyframes hop { 40% { transform: translateY(-12px) rotate(4deg); } }
+@keyframes wobble { 25% { transform: rotate(-8deg); } 75% { transform: rotate(6deg); } }
+@media (prefers-reduced-motion: reduce) { .card, .fb, .opt, .grid .mark, .mascot * { animation: none !important; } }
+
+a.icon { text-decoration: none; }
+a.btn { text-decoration: none; display: inline-block; }
+/* Page-to-page motion: the contents card grows into this frame, and shrinks back on the way out. */
+@view-transition { navigation: auto; }
+#frame { view-transition-name: lesson; }
+::view-transition-group(lesson) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
+::view-transition-old(lesson), ::view-transition-new(lesson) { height: 100%; object-fit: cover; }
+::view-transition-old(lesson) { animation-duration: .18s; }
+@media (prefers-reduced-motion: reduce) { .cover > div > * { animation: none; } ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
+/* The finish screen speaks the same type as the chapter cover and the contents page. */
+.fin .kicker { font-size: 20px; letter-spacing: .14em; text-transform: uppercase; }
+.fin .prompt { margin: 6px 0 14px; font: 500 56px/1.15 "Iowan Old Style", Palatino, Georgia, serif; }
+.icon.speed { width: auto; min-width: 44px; padding: 0 10px; border-radius: 22px; font-size: 16px; }
diff --git a/site/joke-collection/lib/paper.js b/site/joke-collection/lib/paper.js
new file mode 100644
index 0000000..48619f9
--- /dev/null
+++ b/site/joke-collection/lib/paper.js
@@ -0,0 +1,211 @@
+/* paper.js — a paper-cutout stop-motion kit on top of the engine.
+ Sets are baked bitmaps (img/sets/, from tools/breakfast/bake.py); puppets are live SVG pieces with the
+ same paper filter. Everything moves on a 12 fps clock (on twos), each frame with its own small hand jitter, so
+ pause, seek and ?beat=N&t=S show exactly the frame a viewer would see. */
+'use strict';
+const FPS = 12;
+
+// Filters, mouths and patterns live in their own hidden SVG: the engine clears the scene at every beat.
+const PAPER_DEFS = `<defs>
+ <filter id="paper" x="-15%" y="-15%" width="130%" height="135%" color-interpolation-filters="sRGB">
+ <feTurbulence type="fractalNoise" baseFrequency="0.035" numOctaves="2" seed="3" result="warp"/>
+ <feDisplacementMap in="SourceGraphic" in2="warp" scale="3.5" xChannelSelector="R" yChannelSelector="G" result="cut"/>
+ <feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="3" seed="7" result="fib"/>
+ <feColorMatrix in="fib" type="matrix" values="0 0 0 0 .25 0 0 0 0 .17 0 0 0 0 .08 .5 0 0 0 -.14" result="tint"/>
+ <feComposite in="tint" in2="cut" operator="in" result="grain"/>
+ <feMerge result="tex"><feMergeNode in="cut"/><feMergeNode in="grain"/></feMerge>
+ <feDropShadow in="tex" dx="2.5" dy="3.5" stdDeviation="2.2" flood-color="#2a1608" flood-opacity=".38"/>
+ </filter>
+ <pattern id="check" width="10" height="10" patternUnits="userSpaceOnUse">
+ <rect width="10" height="10" fill="#f6efe0"/><rect width="5" height="5" fill="#c8322f"/><rect x="5" y="5" width="5" height="5" fill="#c8322f"/>
+ </pattern>
+ <g id="mX"><path d="M-8,-1 Q0,6 8,-1" fill="none" stroke="#5a2a1e" stroke-width="2.6" stroke-linecap="round"/></g>
+ <g id="mA"><path d="M-7,1 L7,1" fill="none" stroke="#5a2a1e" stroke-width="2.6" stroke-linecap="round"/></g>
+ <g id="mB"><ellipse rx="6.5" ry="2.6" fill="#6b1f1f"/></g>
+ <g id="mC"><ellipse rx="7" ry="4.6" fill="#6b1f1f"/><ellipse cy="2.6" rx="4" ry="1.8" fill="#e07a78"/></g>
+ <g id="mD"><path d="M-9,-3 Q0,-5 9,-3 Q8,9 0,10 Q-8,9 -9,-3Z" fill="#6b1f1f"/><ellipse cy="6.5" rx="5" ry="2.6" fill="#e07a78"/></g>
+ <g id="mE"><ellipse rx="5" ry="6" fill="#6b1f1f"/></g>
+ <g id="mF"><circle r="3.6" fill="#6b1f1f"/></g>
+ <g id="mG"><ellipse rx="6.5" ry="2.6" fill="#6b1f1f"/><path d="M-5,-1.5 h10" stroke="#f6efe0" stroke-width="2"/></g>
+ <g id="mH"><ellipse rx="6" ry="3.8" fill="#6b1f1f"/><ellipse cy="-1" rx="2.6" ry="1.6" fill="#e07a78"/></g>
+ <radialGradient id="vignette" cx="50%" cy="45%" r="75%"><stop offset="60%" stop-color="#1e0f05" stop-opacity="0"/><stop offset="100%" stop-color="#1e0f05" stop-opacity=".45"/></radialGradient>
+</defs>`;
+document.body.insertAdjacentHTML('afterbegin', `<svg width="0" height="0" style="position:absolute" aria-hidden="true">${PAPER_DEFS}</svg>`);
+// The exposure flicker is an HTML layer over the stage: changing it every frame inside the SVG would repaint the whole picture.
+const FLICKER = document.getElementById('stage').insertAdjacentElement('afterend', Object.assign(document.createElement('div'),
+ { style: 'position:absolute;left:0;top:0;width:1600px;height:900px;background:#000;opacity:0;pointer-events:none;will-change:opacity' }));
+
+// Seeded noise in [-1, 1]: the same frame always gets the same jitter.
+function jit(f, k) { let h = Math.imul(f * 374761393 + k * 668265263, 1274126177); h ^= h >>> 13; h = Math.imul(h, 1103515245); return ((h ^ (h >>> 16)) >>> 0) / 2147483648 - 1; }
+const ease = x => x <= 0 ? 0 : x >= 1 ? 1 : x * x * (3 - 2 * x);
+const span = (t, a, b) => ease((t - a) / (b - a));
+
+// draw(q, f) runs once per 12 fps frame with q the frame's time; a pure function of time, like every beat clock.
+function stopClock(D, draw) { let last = null; clockRun(t => { const f = Math.floor(t * FPS + 1e-6); if (f === last) return; last = f; draw(f / FPS, f); }, D); }
+
+/* ---------- camera over a baked set ----------
+ A view {x, y, z} is the world point at the frame's centre and the zoom. Moves: to(view, t0, dur) eases each given
+ key from where the camera is at t0 (zooms keep one world point still, as the engine's camera does); cut(view, t0).
+ Layers slide by their parallax factor k against the base view. soft(t0, on) swaps the far layers (k < 1) for their
+ blurred copies: shallow focus on close shots (on = 'all' blurs the puppets' plane too, for a set seen behind a close-up). Puppets go in cam.stage, on the k = 1 plane in front of `after`. */
+function paperCam(p, setName, v0 = {}, { after = null, stages = [] } = {}) {
+ const root = mk('g', {}, p), view = mk('g', {}, root), world = mk('g', {}, view), layers = [], ops = [], softs = [], shakes = [];
+ let stage = null; const stageAt = {};
+ for (const L of SETS[setName]) {
+ const g = mk('g', {}, world), [x, y, width, height] = L.box, img = { x, y, width, height, preserveAspectRatio: 'none' };
+ const sharp = mk('image', { href: `../img/sets/${setName}/${L.name}.webp`, ...img }, g);
+ const blur = L.soft ? mk('image', { href: `../img/sets/${setName}/${L.name}-soft.webp`, ...img, visibility: 'hidden' }, g) : null;
+ layers.push({ g, k: L.k, sharp, blur, name: L.name });
+ if (stages.includes(L.name)) layers.push({ g: stageAt[L.name] = mk('g', {}, world), k: L.k });
+ if (L.name === (after || 'house') || (!after && L.k === 1 && !stage)) layers.push({ g: stage = mk('g', {}, world), k: 1 });
+ }
+ mk('rect', { width: 1600, height: 900, fill: 'url(#vignette)' }, root);
+ // Parallax is measured from the set's own framing (base), wherever the beat's first view is.
+ const base = { x: 800, y: 450, z: 1 }, start = { ...base, ...v0 };
+ function at(t, n = ops.length) {
+ const s = { ...start };
+ for (let i = 0; i < n && ops[i].t0 <= t; i++) {
+ const o = ops[i], a = o.from || (o.from = at(o.t0, i)), q = o.dur ? ease(Math.min(1, (t - o.t0) / o.dur)) : 1;
+ const v = {}; for (const k in o.v) v[k] = typeof o.v[k] === 'function' ? o.v[k](t) : o.v[k]; // a key may follow
+ if ('z' in v) s.z = a.z * (v.z / a.z) ** q;
+ const u = 'z' in v && Math.abs(v.z - a.z) > 1e-6 ? (1 / s.z - 1 / a.z) / (1 / v.z - 1 / a.z) : q;
+ for (const k of ['x', 'y']) if (k in v) s[k] = a[k] + (v[k] - a[k]) * u;
+ }
+ return s;
+ }
+ const cam = { root, world, stage, stageAt, at,
+ to(v, t0, dur = 1) { ops.push({ v, t0, dur }); ops.sort((a, b) => a.t0 - b.t0); ops.forEach(o => delete o.from); return cam; },
+ cut: (v, t0) => cam.to(v, t0, 0),
+ show(name, on) { for (const L of layers) if (L.name === name) vis(L.g, on); return cam; }, // swap a set layer (weather)
+ soft(t0, on) { softs.push([t0, on]); softs.sort((a, b) => a[0] - b[0]); return cam; },
+ shake(t0, dur, amp = 10) { shakes.push([t0, dur, amp]); return cam; },
+ apply(q, f) {
+ const s = at(q);
+ let sx = 0, sy = 0;
+ for (const [t0, d, amp] of shakes) if (q >= t0 && q < t0 + d) { sx += jit(f, 91) * amp; sy += jit(f, 92) * amp; }
+ view.setAttribute('transform', `translate(${800 + sx} ${450 + sy}) scale(${s.z}) translate(${-s.x} ${-s.y})`);
+ const dx = s.x - base.x, dy = s.y - base.y;
+ let soft = false; for (const [t0, on] of softs) if (q >= t0) soft = on;
+ for (const L of layers) {
+ L.g.setAttribute('transform', `translate(${((1 - L.k) * dx).toFixed(1)} ${((1 - L.k) * dy).toFixed(1)})`);
+ if (L.blur) { const b = soft === 'all' || (soft && L.k < 1); vis(L.blur, b); vis(L.sharp, !b); } // never 'visible': it would show through a hidden camera
+ }
+ FLICKER.style.opacity = (.02 + .02 * jit(f, 30)).toFixed(3); // the exposure flicker of real frames
+ },
+ };
+ return cam;
+}
+
+/* ---------- small live pieces ---------- */
+// Chimney smoke: paper puffs that rise, drift and fade, one cycle every `every` seconds.
+function smoke(parent, x, y, n = 4, every = 3.2) {
+ const puffs = Array.from({ length: n }, () => { const g = mk('g', {}, parent); g.innerHTML = '<g filter="url(#paper)"><circle r="20" fill="#f4ecdc"/></g>'; return g; });
+ bakeAll(parent);
+ return q => puffs.forEach((g, i) => {
+ const u = ((q / every + i / n) % 1 + 1) % 1;
+ tf(g, `translate(${(x + 60 * u + 12 * Math.sin(u * 6)).toFixed(1)},${(y - 190 * u).toFixed(1)}) scale(${((14 + 30 * u) / 20).toFixed(3)})`);
+ g.setAttribute('opacity', (Math.min(1, u * 5) * (1 - u) * .95).toFixed(2));
+ });
+}
+
+// The mouth shape a clip's cues give `t` seconds into it ('X' rest before and after).
+const mouthAt = (clip, t) => { let m = 'X'; if (t < 0) return m; for (const [at, k] of MOUTHS[clip] || []) { if (at > t) break; m = k; } return m; };
+
+/* ---------- puppets ----------
+ A puppet is paper pieces on brass pins, built at its hip (0, 0) facing right, feet near y 166. pose(o, f) sets the
+ whole state for frame f; any key left out keeps its rest value. turn (1 … -1) squashes the flat figure to turn it
+ round: through the thin middle (|turn| < .55) the front head shows, past it the figure is the mirrored profile. */
+const pinAt = (x, y) => `<circle cx="${x}" cy="${y}" r="3.4" fill="#caa24c" stroke="#7d5f22" stroke-width="1.2"/>`;
+const tf = (el, s) => { if (el._t !== s) el.setAttribute('transform', el._t = s); };
+const vis = (el, on) => { const v = on ? 'inherit' : 'hidden'; if (el._v !== v) el.setAttribute('visibility', el._v = v); };
+
+function pieces(g) { const o = {}; g.querySelectorAll('[data-p]').forEach(e => o[e.dataset.p] = e); return o; }
+function face(h, o) { // eyes and mouth of one head
+ h.querySelectorAll('.eyeO').forEach(e => vis(e, !o.shut)); h.querySelectorAll('.eyeC').forEach(e => vis(e, !!o.shut));
+ h.querySelectorAll('.mouth').forEach(e => { const m = '#m' + (o.mouth || 'X'); if (e._m !== m) e.setAttribute('href', e._m = m); });
+}
+// Blinks: closed for two frames at each listed time.
+const blinking = (q, times) => times.some(b => q >= b && q < b + 2 / FPS);
+
+/* ---------- baking puppet pieces ----------
+ Running the paper filter live on every piece costs too much once a close-up enlarges them, so every filtered
+ piece is drawn once to a bitmap (at RES px per unit) and replaced by that image. Parts that change (eyes, mouths,
+ brows, pieces with data-p) stay live; a filtered live part is baked on its own. Identical pieces share one bitmap. */
+const RES = 4, bakedReady = new Map(), bakedJobs = new Map(), PAPER_EXTRA = []; // extra defs (patterns) other files add
+// Pieces baked ahead of time (tools/breakfast/bake_puppets.py): img/puppets/<hash>.webp, listed in
+// window.BAKED. A piece missing from it (just edited) is baked here in the browser; ?bake ignores the list.
+const BAKED = new URLSearchParams(location.search).has('bake') ? {} : (window.BAKED || {});
+const keyHash = k => { let h = 2166136261; for (let i = 0; i < k.length; i++) h = Math.imul(h ^ k.charCodeAt(i), 16777619); return (h >>> 0).toString(16).padStart(8, '0'); };
+const isLive = e => e.hasAttribute('data-p') || ['eyeO', 'eyeC', 'mouth'].some(c => e.classList.contains(c));
+function rasterize(svg, w, h) {
+ return new Promise((ok, no) => {
+ const img = new Image();
+ img.onload = () => { const c = document.createElement('canvas'); c.width = w; c.height = h; c.getContext('2d').drawImage(img, 0, 0, w, h); URL.revokeObjectURL(img.src); c.toBlob(b => ok(URL.createObjectURL(b))); };
+ img.onerror = no;
+ img.src = URL.createObjectURL(new Blob([svg], { type: 'image/svg+xml' }));
+ });
+}
+function bakeAll(root) {
+ // Measure everything first, then change the DOM: a getBBox after each change would lay the page out again every time.
+ const covered = el => { for (let c = el, a = el.parentNode; a && a !== root; c = a, a = a.parentNode) if (isLive(c)) return false; else if (a.hasAttribute?.('filter')) return true; return false; };
+ const items = [];
+ for (const el of root.querySelectorAll('[filter]')) {
+ if (covered(el)) continue; // drawn into a filtered ancestor's bitmap
+ const bb = el.getBBox(), x = Math.floor(bb.x - 10), y = Math.floor(bb.y - 10), w = Math.ceil(bb.width + 22), h = Math.ceil(bb.height + 24);
+ const clone = el.cloneNode(true);
+ ['transform', 'visibility', 'data-p', 'opacity'].forEach(a => clone.removeAttribute(a));
+ [...clone.children].forEach((c, i) => { if (isLive(el.children[i])) c.remove(); });
+ items.push({ el, x, y, w, h, html: clone.outerHTML });
+ }
+ const jobs = [];
+ for (const { el, x, y, w, h, html } of items) {
+ const key = `${x} ${y} ${w} ${h}|${html}`;
+ const apply = url => {
+ if (!el.hasAttribute('filter')) return;
+ el.removeAttribute('filter');
+ [...el.children].forEach(c => { if (!isLive(c)) c.remove(); });
+ el.insertBefore(mk('image', { href: url, x, y, width: w, height: h }), el.firstChild);
+ };
+ const file = BAKED[keyHash(key)];
+ if (file) { apply(`../img/puppets/${file}`); continue; }
+ if (bakedReady.has(key)) { apply(bakedReady.get(key)); continue; }
+ if (!bakedJobs.has(key)) bakedJobs.set(key, rasterize(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${w * RES}" height="${h * RES}" viewBox="${x} ${y} ${w} ${h}">${PAPER_DEFS}<defs>${PAPER_EXTRA.join('')}</defs>${html}</svg>`, w * RES, h * RES)
+ .then(url => (bakedReady.set(key, url), url)));
+ jobs.push(bakedJobs.get(key).then(apply));
+ }
+ return Promise.all(jobs);
+}
+// Build the book's pieces once at load, off screen, so their bitmaps are ready before the first beat needs them.
+function paperWarm(build) {
+ const svg = mk('svg', { width: 1, height: 1, style: 'position:absolute;left:-10px;top:-10px' });
+ document.body.appendChild(svg);
+ build(mk('g', {}, svg));
+ return bakeAll(svg).then(() => svg.remove());
+}
+
+/* ---------- walking ----------
+ A compass walk: the stance foot stays planted while the hip rides over it, so feet never slide. tau seconds into
+ the walk, `period` s per two steps; returns leg angles and knee bends (degrees), how far the hip has travelled (d)
+ and how far it has dropped from standing (drop), both in the puppet's own units. */
+function walk(tau, { L = 166, A = 22, period = 1, knee = 38 } = {}) {
+ tau = Math.max(0, tau);
+ const a = A * Math.PI / 180, ph = 2 * Math.PI * tau / period, j = Math.floor((ph + Math.PI / 2) / Math.PI);
+ const ts = (j % 2 ? 1 : -1) * a * Math.sin(ph), near = a * Math.sin(ph) * 180 / Math.PI;
+ const swing = knee * Math.max(0, Math.cos(ph - j * Math.PI)), nearStance = j % 2 === 1;
+ return { ph, d: j * 2 * L * Math.sin(a) - L * Math.sin(ts), drop: L * (1 - Math.cos(ts)),
+ near, far: -near, kNear: nearStance ? 0 : swing, kFar: nearStance ? swing : 0 };
+}
+
+// A piece of the set that sits in front of puppets (a trunk, a bush, a blanket): drawn like a puppet piece, baked.
+function prop(parent, svg, attrs = {}) { const g = mk('g', attrs, parent); g.innerHTML = svg; bakeAll(g); return g; }
+
+// The iris closing on (cx, cy) between t0 and t0 + dur, as in old films; then black.
+function iris(p, t0, dur, cx, cy) {
+ const e = mk('path', { fill: '#120a05', 'fill-rule': 'evenodd' }, p);
+ return q => {
+ const u = (q - t0) / dur; vis(e, u > 0);
+ if (u <= 0) return;
+ const r = Math.max(0, 1900 * (1 - ease(Math.min(1, u))));
+ e.setAttribute('d', `M-50,-50 H1650 V950 H-50 Z M${cx - r},${cy} a${r},${r} 0 1 0 ${2 * r},0 a${r},${r} 0 1 0 ${-2 * r},0 Z`);
+ };
+}
diff --git a/site/joke-collection/lib/shared.js b/site/joke-collection/lib/shared.js
new file mode 100644
index 0000000..b495f49
--- /dev/null
+++ b/site/joke-collection/lib/shared.js
@@ -0,0 +1,141 @@
+/* shared.js — what every scene of the series uses: timing helpers, props, the two places (the bun stall and the
+ classroom, built the same way whenever they appear so the staging matches across cuts) and the sound effects. */
+'use strict';
+// Beat-clock time of `t` seconds into clip `clip` of a joined scene whose speech starts `pre` s in.
+const clipAt = (scene, pre, clip, t = 0) => pre + TIMINGS[scene].parts[clip] + t;
+// Beat-clock time of the n-th caption cue (one per sentence) of a joined scene: for cutting on sentences.
+const cueAt = (scene, pre, n) => pre + TIMINGS[scene].cues[n][0];
+const onTwos = q => Math.floor(q * FPS / 2) % 2 ? 1 : -1;
+const between = (q, a, b) => q >= a && q < b;
+const tween = (q, t0, d, a, b) => a + (b - a) * span(q, t0, t0 + d);
+// Who is speaking: the mouth for this frame from the listed clips of a joined scene, or 'X'.
+const lips = (q, scene, pre, ...clips) => { for (const c of clips) { const m = mouthAt(c, q - clipAt(scene, pre, c)); if (m !== 'X') return m; } return 'X'; };
+// Chewing on twos: the mouth alternates between two shapes.
+const chew = q => onTwos(q) > 0 ? 'chew' : 'A';
+
+/* ---------- props (puppet pieces, baked like them) ---------- */
+// Painted props (img/props, from tools/breakfast/painted.py): a picture at (x, y), w by h.
+const artSVG = (name, x, y, w, h) => `<image href="../img/props/${name}.webp" x="${x}" y="${y}" width="${w}" height="${h}"/>`;
+// A steamed bun, centred on (0, 0), about 48 wide; `bite`: with a bite out of its right side.
+const bunSVG = (bite = false) => bite ? artSVG('bun-bite', -24, -36, 48, 44) : artSVG('bun', -24, -34, 48, 42);
+// A one-litre bottle of soy milk, held by its middle.
+const soySVG = artSVG('soy', -15, -64, 31, 100); // painted
+// A painted umbrella ('red' | 'yellow') held by the crook of its handle, the canopy above the hand.
+const umbrellaArt = c => artSVG('umb-' + c, -150, -312, 300, 335);
+// An umbrella held up by its handle (the canopy above the hand).
+// `len` is the shaft: long enough that the canopy clears the holder's head.
+const umbrellaSVG = (c, len = 150) => `<g filter="url(#paper)"><path d="M0,0 V${-len}" stroke="#3a3430" stroke-width="5"/><path transform="translate(0,${150 - len})" d="M-120,-140 Q0,-250 120,-140 Q90,-160 60,-140 Q30,-160 0,-140 Q-30,-160 -60,-140 Q-90,-160 -120,-140 Z" fill="${c}"/></g>`;
+// A double desk: the pupils behind it show from the chest up. (cx, top) is the middle of its top edge, s its scale.
+const deskSVG = (cx, top, s) => artSVG('desk', cx - 240 * s, top - 10 * s, 480 * s, 233 * s); // painted (800 x 388)
+
+/* ---------- the bun stall (scenes 1 and 4) ----------
+ The cart is on the right; the seller stands behind it (only her top half shows over the counter). The two boys stand
+ on the pavement facing us, Me on the left, Bo on the right — they keep those sides in every scene. */
+const STALL = { ground: 800, s: .95, me: 480, bo: 760, aunt: { x: 1300, y: 780, s: 1 } };
+// the stall's locked framing: the boys and the seller, a little closer than the whole set
+const STALL_VIEW = { x: 860, y: 560, z: 1.3 };
+// The stall is painted (tools/breakfast/painted.py): three weathers of the street, and the cart as its own cut-out so
+// the seller stands behind it. weather('sun'|'rain'|'snow').
+function stallSet(p, holds = {}) {
+ const cam = paperCam(p, 'stall', {}, { after: 'cart', stages: ['snow'] });
+ const aunt = auntPuppet(cam.stageAt.snow, { holds: { bun: bunSVG() } });
+ const me = mePuppet(cam.stage, { holds }), bo = boPuppet(cam.stage, { holds });
+ const weather = w => { cam.show('rain', w === 'rain'); cam.show('snow', w === 'snow'); };
+ weather('sun');
+ return { cam, me, bo, aunt, weather };
+}
+
+/* ---------- the classroom (scenes 2, 3 and 4) ----------
+ Seen from the teacher's desk: three rows of double desks going back toward the wall, every pupil facing us. Me and
+ Bo share the middle desk of the front row (Me left, Bo right). Rows are built back to front so nearer desks cover
+ farther pupils. classroom(p) → { cam, me, bo, mates, seat, matesPose }. */
+const ROWS = [
+ { s: .6, top: 520, desks: [400, 800, 1200], gap: 70 },
+ { s: .78, top: 612, desks: [300, 800, 1300], gap: 92 },
+ { s: 1, top: 722, desks: [250, 800, 1350], gap: 120 },
+];
+// where a pupil sits: x and the y of their feet (hidden under the desk) for desk d, side -1 (left) / 1 (right)
+const seat = (r, d, side) => ({ x: ROWS[r].desks[d] + side * ROWS[r].gap, y: ROWS[r].top + 74 * ROWS[r].s, s: ROWS[r].s });
+// The desk right behind Me and Bo stays empty: heads there would peek over theirs in every two-shot.
+const MATES = [ // [row, desk, side, hair, hair colour]
+ [0, 0, -1, 'bowl', '#1c1a1a'], [0, 0, 1, 'pigtails', '#2a1d14'], [0, 1, -1, 'part', '#3a2618'], [0, 1, 1, 'buzz', '#1c1a1a'], [0, 2, -1, 'pigtails', '#1c1a1a'], [0, 2, 1, 'bowl', '#4a3020'],
+ [1, 0, -1, 'buzz', '#2a1d14'], [1, 0, 1, 'pigtails', '#3a2618'], [1, 2, -1, 'pigtails', '#4a3020'], [1, 2, 1, 'buzz', '#1c1a1a'],
+ [2, 0, -1, 'part', '#2a1d14'], [2, 0, 1, 'pigtails', '#1c1a1a'], [2, 2, -1, 'bowl', '#3a2618'], [2, 2, 1, 'buzz', '#2a1d14'],
+];
+// The two-shot of Me and Bo at their desk (Bo standing or sitting): the framing scenes 3 and 4 meet on.
+const TWO = { x: 800, y: 600, z: 1.8 };
+function classroom(p, holds = {}) {
+ const cam = paperCam(p, 'classBack');
+ const mates = [], out = { cam, seat };
+ for (let r = 0; r < ROWS.length; r++) {
+ for (const [mr, d, side, hair, col] of MATES) if (mr === r) mates.push({ ...seat(r, d, side), k: mates.length, p: classmate(cam.stage, hair, col) });
+ if (r === 2) { out.me = mePuppet(cam.stage, { holds }); out.bo = boPuppet(cam.stage, { holds }); }
+ prop(cam.stage, ROWS[r].desks.map(cx => deskSVG(cx, ROWS[r].top, ROWS[r].s)).join(''));
+ }
+ out.mates = mates;
+ out.ME = seat(2, 1, -1); out.BO = seat(2, 1, 1);
+ // Bo on his feet behind the desk (scene 2 ends and scene 3 starts this way)
+ out.BO_UP = { ...out.BO, y: out.BO.y - 64 };
+ // The class at rest: each pupil blinks on their own and glances about now and then. lookAt (an x, or null) turns
+ // every face toward that point from time `t0` (a staggered snap, a frame or two apart, the way a class turns).
+ out.matesPose = (q, f, { lookAt = null, t0 = 0, extra = {} } = {}) => {
+ for (const m of mates) {
+ const own = (q * .23 + m.k * .37) % 1, blinkAt = Math.floor(q / 3.1 + m.k * .29);
+ const shut = ((q / 3.1 + m.k * .29) % 1) < .05 && blinkAt >= 0;
+ let look = own < .12 ? (m.k % 2 ? .5 : -.5) : 0, eyeX = look;
+ if (lookAt !== null && q >= t0 + (m.k % 4) / FPS) { look = Math.max(-1, Math.min(1, (lookAt - m.x) / 400)); eyeX = Math.sign(lookAt - m.x); }
+ m.p.pose({ x: m.x, y: m.y, s: m.s, sit: true, look, eyeX, shut, ...extra }, f);
+ }
+ };
+ return out;
+}
+
+/* ---------- episode 2: the homework, the teacher, the dog ---------- */
+// A sheet of homework held up by its bottom edge (the hand at (0, 0)). grease: the oil stain from a bun; bite 0–2: how
+// much of it a dog has eaten from the top; blank: nothing written; perfect: a red 100 in the corner.
+function hwSVG({ grease = false, bite = 0, blank = false, perfect = false } = {}) {
+ const top = [-92, -92, -50][bite];
+ const sheet = ['M-34,-92 H34 V-4 H-34 Z', 'M-34,-92 H2 a14,14 0 0 0 16,14 a12,12 0 0 0 16,10 V-4 H-34 Z',
+ 'M-34,-50 a12,12 0 0 0 18,-6 a14,14 0 0 0 22,4 a14,14 0 0 0 28,-6 V-4 H-34 Z'][bite];
+ const lines = blank ? '' : [-78, -66, -54, -42, -30, -18].filter(y => y > top + 6)
+ .map((y, i) => `<path d="M-26,${y} q6,-4 12,0 t12,0 t12,0 ${i % 2 ? 't12,0' : 't12,0 t8,0'}" fill="none" stroke="#3a4f86" stroke-width="2.2"/>`).join('');
+ return `<g filter="url(#paper)"><path d="${sheet}" fill="#fbfaf4"/><path d="M-34,${top + 2} V-4" stroke="#e89a9a" stroke-width="2"/>${lines}
+ ${grease ? '<ellipse cx="10" cy="-34" rx="15" ry="11" fill="#e0b25a" opacity=".55"/>' : ''}
+ ${perfect ? '<text x="16" y="-70" font-family="Chalkboard, Comic Sans MS, sans-serif" font-size="22" font-weight="700" fill="#d8322c" text-anchor="middle">100</text><ellipse cx="16" cy="-77" rx="19" ry="13" fill="none" stroke="#d8322c" stroke-width="2.5"/>' : ''}</g>`;
+}
+// A pencil, centred, lying crosswise (as the dog carries it).
+const pencilSVG = `<g filter="url(#paper)"><rect x="-34" y="-5" width="60" height="10" fill="#f2c230"/><path d="M26,-5 L40,0 L26,5 Z" fill="#e8c9a0"/><path d="M36,-1.5 L40,0 L36,1.5 Z" fill="#3a3430"/><rect x="-42" y="-5" width="9" height="10" rx="2" fill="#e88a9a"/></g>`;
+
+/* The front of the classroom, seen by the pupils: the teacher behind her desk on the right of the blackboard, only
+ her top half over it. teacherSet(p, holds) → { cam, t }; TEACHER is where she stands (pose her there every frame),
+ TEACH_CU her close-up. The dog on Me and Bo's desk stands at DOG_DESK (in classroom(), facing either of them). */
+const TEACHER = { x: 1220, y: 800, s: 1 };
+const TEACH_CU = { x: 1200, y: 470, z: 2.3 };
+function teacherSet(p, holds = {}) {
+ const cam = paperCam(p, 'classFront', {}, { after: 'wall' });
+ return { cam, t: teacherPuppet(cam.stage, { holds }) };
+}
+// Facing Me (dir -1) its body sits in front of Bo's chest and its head in the gap between the boys' faces; facing Bo,
+// mirror it (x 1600 - 860).
+const DOG_DESK = { x: 860, y: 724, s: .7 };
+// Late afternoon light for the detention: a warm wash over the whole frame (draw it last, over the camera).
+const dusk = p => mk('rect', { width: 1600, height: 900, fill: '#ff9a3c', opacity: .2, 'pointer-events': 'none' }, p);
+
+/* ---------- sound effects ----------
+ sfx(beat, at, name, vol): play audio/sfx/<name>.mp3 when the clock of beat `beat` passes `at` in normal playback
+ (seeking past it does not fire it). Pausing stops them. */
+const SFX = [], sfxOn = [];
+const sfx = (beat, at, name, vol = 1) => SFX.push({ beat, at, name, vol });
+let sfxLast = { i: -1, t: 0 };
+function sfxTick() {
+ const id = BEATS[P.i]?.id, on = P.started && P.playing && !P.waiting && !P.done;
+ if (on && sfxLast.i === P.i && P.t > sfxLast.t && P.t - sfxLast.t < .5)
+ for (const e of SFX) if (e.beat === id && e.at > sfxLast.t && e.at <= P.t) {
+ const a = new Audio(`audio/sfx/${e.name}.mp3`); a.volume = .5 * e.vol * +(document.getElementById('volume')?.value ?? 1); // effects sit under the voices a.playbackRate = P.rate || 1;
+ a.play().catch(() => {}); sfxOn.push(a); a.onended = () => sfxOn.splice(sfxOn.indexOf(a), 1);
+ }
+ if (!on) while (sfxOn.length) sfxOn.pop().pause();
+ sfxLast = { i: P.i, t: P.t };
+ requestAnimationFrame(sfxTick);
+}
+requestAnimationFrame(sfxTick);
diff --git a/site/joke-collection/lib/units.css b/site/joke-collection/lib/units.css
new file mode 100644
index 0000000..e9c62cb
--- /dev/null
+++ b/site/joke-collection/lib/units.css
@@ -0,0 +1,79 @@
+/* The unit headers of a book's contents page, the same in every book: a strip of chalkboard per unit, with the unit's
+ label and title and a sketch of its ideas (UNIT_ART, from the book's own unit-art.js) drawn in the unit colour --c.
+ Markup and the scroll observer are in units.js. Uses the contents page's --book, --ui, --chalk and --ease. */
+.unit { position: relative; max-width: 1212px; margin: 0 auto; padding: 28px 16px 0; }
+.unit h2 { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-height: 168px; margin: 0 0 16px; padding-top: 130px; font: 500 28px/1.2 var(--book); }
+.unit .grid { position: relative; }
+.unit::before { content: ""; position: absolute; inset: 0 16px auto; height: 208px; border-radius: 22px; pointer-events: none;
+ background: radial-gradient(ellipse 46% 90% at 74% 55%, color-mix(in srgb, var(--c) 11%, transparent), transparent 70%); }
+.unit-art { position: absolute; top: 20px; right: 28px; width: min(580px, 56%); height: auto; overflow: visible; pointer-events: none;
+ color: var(--c); fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: .78; }
+.unit-art text { fill: currentColor; stroke: none; font-family: var(--book); font-style: italic; }
+.unit-art .a { color: var(--chalk); opacity: .55; }
+.unit-art .faint { opacity: .22; }
+.unit-art .d { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
+.unit-art .t { opacity: 0; }
+.seen .unit-art .d { animation: art-draw 1.1s cubic-bezier(.5, 0, .3, 1) forwards; animation-delay: calc(var(--k) * 55ms + 120ms); }
+.seen .unit-art .t { animation: art-fade .6s ease-out forwards; animation-delay: calc(var(--k) * 55ms + 300ms); }
+.seen .unit-art .a.t { animation-name: art-fade-a; }
+@keyframes art-draw { to { stroke-dashoffset: 0; } }
+@keyframes art-fade { to { opacity: 1; } }
+@keyframes art-fade-a { to { opacity: .55; } }
+/* After the drawing, each sketch keeps one small motion that belongs to its topic. */
+.unit-art g { transform-box: fill-box; }
+.seen .unit-art .swap-a { animation: swap-a 6s var(--ease) 2.4s infinite; }
+.seen .unit-art .swap-b { animation: swap-b 6s var(--ease) 2.4s infinite; }
+@keyframes swap-a { 0%, 30%, 100% { transform: none; } 45%, 80% { transform: translate(80px, 0); } 37% { transform: translate(40px, -30px); } 88% { transform: translate(40px, 30px); } }
+@keyframes swap-b { 0%, 30%, 100% { transform: none; } 45%, 80% { transform: translate(-80px, 0); } 37% { transform: translate(-40px, 30px); } 88% { transform: translate(-40px, -30px); } }
+.seen .unit-art .step { animation: art-fade .6s ease-out forwards, step 4s ease-in-out infinite; animation-delay: calc(var(--k) * 55ms + 300ms), calc(var(--k) * 300ms + 2s); }
+@keyframes step { 0%, 20%, 100% { fill-opacity: 1; } 10% { fill-opacity: .3; } }
+.unit-art .hop, .unit-art .ride { offset-rotate: 0deg; }
+.seen .unit-art .hop { animation: art-fade .4s ease-out 2s forwards, along 3.4s linear 2s infinite; }
+.unit-art .orbit { offset-rotate: 0deg; }
+.seen .unit-art .orbit { animation: art-fade .4s ease-out 2s forwards, along 9s linear 2s infinite; }
+.seen .unit-art .ride { animation: art-fade .4s ease-out 2s forwards, along 4s ease-in-out 2s infinite alternate; }
+@keyframes along { from { offset-distance: 0%; } to { offset-distance: 100%; } }
+.unit-art .pie { stroke: currentColor; stroke-linecap: butt; stroke-dasharray: 0 100; }
+.seen .unit-art .pie { animation: art-fade .4s ease-out 1.6s forwards, pie 5s var(--ease) 1.6s infinite; }
+@keyframes pie { 0% { stroke-dasharray: 0 100; } 35%, 85% { stroke-dasharray: 25 100; } 100% { stroke-dasharray: 0 100; } }
+.seen .unit-art .tilt { transform-box: view-box; transform-origin: 300px 72px; animation: tilt 4.8s ease-in-out 2s infinite; }
+@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-4deg); } 60% { transform: rotate(2deg); } }
+.seen .unit-art .spin { transform-box: view-box; transform-origin: 320px 95px; animation: spin 5s cubic-bezier(.2, .7, .2, 1) 2s infinite; }
+@keyframes spin { from { transform: rotate(0); } 70%, to { transform: rotate(1530deg); } }
+.seen .unit-art .feed-in { animation: feed-in 4s ease-in-out 2s infinite; }
+.seen .unit-art .feed-out { opacity: 0; animation: feed-out 4s ease-in-out 2s infinite; }
+@keyframes feed-in { 0% { transform: none; opacity: 1; } 40% { transform: translate(100px, 0); opacity: 0; } 41%, 100% { transform: none; opacity: 0; } 95% { opacity: 1; } }
+@keyframes feed-out { 0%, 45% { transform: translate(-40px, 0); opacity: 0; } 70%, 90% { transform: none; opacity: 1; } 100% { opacity: 0; } }
+.unit-art .cell { opacity: .25; }
+.seen .unit-art .cell { animation: cell 5s ease-in-out infinite; animation-delay: calc(var(--j) * .5s + 2s); }
+@keyframes cell { 0%, 100% { opacity: .25; } 15%, 60% { opacity: 1; } }
+.unit-art .cut, .unit-art .shade { opacity: 0; }
+.seen .unit-art .cut { animation: cut 4s ease-in-out 2s infinite; }
+@keyframes cut { 0%, 100% { opacity: 0; } 30%, 70% { opacity: .5; } }
+.seen .unit-art .shade { animation: shade 1s ease-out 1.6s forwards; }
+@keyframes shade { to { opacity: .14; } }
+.seen .unit-art .diag { animation: art-draw 1.1s cubic-bezier(.5, 0, .3, 1) forwards, redraw 4s ease-in-out 2.5s infinite; }
+@keyframes redraw { 0%, 15% { stroke-dashoffset: 1; } 50%, 100% { stroke-dashoffset: 0; } }
+.seen .unit-art .root { animation: art-fade .4s ease-out 1.8s forwards, root 2.4s ease-in-out 2.2s infinite; }
+@keyframes root { 0%, 100% { r: 7px; } 50% { r: 11px; } }
+.seen .unit-art .breathe { transform-box: view-box; transform-origin: 380px 140px; animation: breathe 4s ease-in-out 2s infinite alternate; }
+@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(.35); } }
+/* The label and the title share a line when they fit; a long title wraps below the label instead of running off. */
+.unit h2 .title { min-width: 0; text-wrap: balance; }
+.unit h2 .label { font: 600 14px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--c); white-space: nowrap; }
+/* Keep the sketches cheap: each is its own layer, so its loop repaints only itself, and loops pause while their unit is
+ off screen or under the sticky bar (units.js toggles .live), so the bar's blur is not redrawn every frame. */
+.unit-art { will-change: transform; contain: layout style; }
+.unit:not(.live) .unit-art, .unit:not(.live) .unit-art * { animation-play-state: paused; }
+@media (max-width: 560px) {
+ .unit-art { width: calc(100% - 32px); right: 16px; opacity: .32; }
+ .unit h2 { min-height: 0; padding-top: 104px; font-size: 24px; }
+}
+@media (prefers-reduced-motion: reduce) {
+ .unit-art * { animation: none !important; }
+ .unit-art .d { stroke-dashoffset: 0; }
+ .unit-art .t, .unit-art .cell { opacity: 1; }
+ .unit-art .a.t { opacity: .55; }
+ .unit-art .shade { opacity: .14; }
+ .unit-art .pie { stroke-dasharray: 25 100; }
+}
diff --git a/site/joke-collection/lib/units.js b/site/joke-collection/lib/units.js
new file mode 100644
index 0000000..e9e8c27
--- /dev/null
+++ b/site/joke-collection/lib/units.js
@@ -0,0 +1,26 @@
+// The unit headers of a book's contents page, the same in every book; styled by units.css. The sketches come from
+// the book's own unit-art.js (window.UNIT_ART, one SVG body per unit, viewBox 0 0 600 180).
+// Units.header(u, label, title) the sketch and heading for unit u, as HTML to put first in its <section class="unit">
+// Units.watch() draw each sketch the first time its unit scrolls into view, and run its loop only
+// while the unit is on screen
+'use strict';
+(() => {
+ const esc = s => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;');
+ const header = (u, label, title) =>
+ `<svg class="unit-art" viewBox="0 0 600 180" aria-hidden="true">${window.UNIT_ART?.[u] || ''}</svg>` +
+ `<h2><span class="label">${esc(label)}</span><span class="title">${esc(title)}</span></h2>`;
+
+ function watch(root = document) {
+ const units = root.querySelectorAll('.unit');
+ if (!('IntersectionObserver' in window)) return units.forEach(u => u.classList.add('seen', 'live'));
+ // The first sight draws the sketch; leaving the screen (or sliding under the sticky bar) pauses it.
+ const first = new IntersectionObserver(es => es.forEach(e => {
+ if (e.isIntersecting) { e.target.classList.add('seen'); first.unobserve(e.target); }
+ }), { threshold: .25 });
+ const live = new IntersectionObserver(es => es.forEach(e => e.target.classList.toggle('live', e.isIntersecting)),
+ { rootMargin: '-64px 0px 0px 0px' });
+ units.forEach(u => { first.observe(u); live.observe(u); });
+ }
+
+ window.Units = { header, watch };
+})();
diff --git a/site/joke-collection/lib/volume.css b/site/joke-collection/lib/volume.css
new file mode 100644
index 0000000..195fe1f
--- /dev/null
+++ b/site/joke-collection/lib/volume.css
@@ -0,0 +1,24 @@
+/* Volume control for the player bar (volume.js); imported by engine.css. */
+.volume { display: flex; align-items: center; flex: none; width: 44px; height: 44px; overflow: hidden;
+ border: 1px solid var(--edge); border-radius: 999px; background: var(--panel); color: var(--chalk); transition: width .18s ease; }
+.volume .icon { width: 42px; height: 42px; border: 0; background: transparent; }
+.volume:hover, .volume:focus-within { width: 166px; gap: 10px; padding-right: 12px; }
+.volume:hover { background: #2b3f36; border-color: var(--faint); }
+.volume:has(:focus-visible) { outline: 2px solid var(--task); outline-offset: 3px; }
+.volume .icon:focus-visible { outline: none; }
+.volume input { appearance: none; flex: none; width: 0; height: 42px; margin: 0; opacity: 0; background: transparent; cursor: pointer; }
+.volume:hover input, .volume:focus-within input { width: 100px; opacity: 1; }
+.volume input:focus-visible { outline: none; }
+.volume input::-webkit-slider-runnable-track { height: 4px; border-radius: 999px;
+ background: linear-gradient(to right, var(--chalk) var(--volume, 100%), var(--faint) var(--volume, 100%)); }
+.volume input::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--chalk); }
+.volume input::-moz-range-track { height: 4px; border-radius: 999px; background: var(--faint); }
+.volume input::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--chalk); }
+.volume input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--chalk); }
+@media (max-width: 700px) {
+ .volume { width: 36px; height: 40px; }
+ #bar .volume .icon { width: 34px; height: 38px; }
+ .volume:hover, .volume:focus-within { width: 158px; }
+ .volume input { height: 38px; }
+}
+@media (prefers-reduced-motion: reduce) { .volume { transition: none; } }
diff --git a/site/joke-collection/lib/volume.js b/site/joke-collection/lib/volume.js
new file mode 100644
index 0000000..8616688
--- /dev/null
+++ b/site/joke-collection/lib/volume.js
@@ -0,0 +1,20 @@
+/* Volume control for the player bar: a speaker button that opens a slider. engine.js loads this file and reads
+ #volume when it starts each beat's audio, so the control is the same in every book. */
+'use strict';
+{
+ document.getElementById('bHelp').insertAdjacentHTML('beforebegin', `<div class="volume">
+ <button class="icon" id="bVolume" aria-label="${translate('volumeLabel')}" aria-controls="volume" title="${translate('volumeTitle')}">
+ <svg viewBox="0 0 24 24" aria-hidden="true">
+ <path d="M3 9v6h4l5 4V5L7 9z" fill="currentColor"/>
+ <path d="M16 8a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
+ </svg>
+ </button>
+ <input id="volume" type="range" min="0" max="1" step="0.05" value="1" aria-label="${translate('volumeSlider')}">
+ </div>`);
+ const input = document.getElementById('volume');
+ document.getElementById('bVolume').onclick = () => input.focus();
+ input.oninput = () => {
+ input.style.setProperty('--volume', +input.value * 100 + '%');
+ if (P.audio) P.audio.volume = +input.value;
+ };
+}
diff --git a/site/joke-collection/making/batch-sets.webp b/site/joke-collection/making/batch-sets.webp
new file mode 100644
index 0000000..021be15
Binary files /dev/null and b/site/joke-collection/making/batch-sets.webp differ
diff --git a/site/joke-collection/making/batch-stall.webp b/site/joke-collection/making/batch-stall.webp
new file mode 100644
index 0000000..a216ea4
Binary files /dev/null and b/site/joke-collection/making/batch-stall.webp differ
diff --git a/site/joke-collection/making/cover.webp b/site/joke-collection/making/cover.webp
new file mode 100644
index 0000000..d1c46f5
Binary files /dev/null and b/site/joke-collection/making/cover.webp differ
diff --git a/site/joke-collection/making/ep2-exchange.webp b/site/joke-collection/making/ep2-exchange.webp
new file mode 100644
index 0000000..214f366
Binary files /dev/null and b/site/joke-collection/making/ep2-exchange.webp differ
diff --git a/site/joke-collection/making/ep2-street.webp b/site/joke-collection/making/ep2-street.webp
new file mode 100644
index 0000000..a2911ff
Binary files /dev/null and b/site/joke-collection/making/ep2-street.webp differ
diff --git a/site/joke-collection/making/ep2-veggie.webp b/site/joke-collection/making/ep2-veggie.webp
new file mode 100644
index 0000000..395a636
Binary files /dev/null and b/site/joke-collection/making/ep2-veggie.webp differ
diff --git a/site/joke-collection/making/layers.webp b/site/joke-collection/making/layers.webp
new file mode 100644
index 0000000..c422645
Binary files /dev/null and b/site/joke-collection/making/layers.webp differ
diff --git a/site/joke-collection/making/still-door.webp b/site/joke-collection/making/still-door.webp
new file mode 100644
index 0000000..34639fc
Binary files /dev/null and b/site/joke-collection/making/still-door.webp differ
diff --git a/site/joke-collection/making/still-dream.webp b/site/joke-collection/making/still-dream.webp
new file mode 100644
index 0000000..9979cdc
Binary files /dev/null and b/site/joke-collection/making/still-dream.webp differ
diff --git a/site/joke-collection/making/still-laugh.webp b/site/joke-collection/making/still-laugh.webp
new file mode 100644
index 0000000..3ba0d56
Binary files /dev/null and b/site/joke-collection/making/still-laugh.webp differ
diff --git a/site/joke-collection/making/still-rain.webp b/site/joke-collection/making/still-rain.webp
new file mode 100644
index 0000000..5455adf
Binary files /dev/null and b/site/joke-collection/making/still-rain.webp differ
diff --git a/site/joke-collection/making/still-stall.webp b/site/joke-collection/making/still-stall.webp
new file mode 100644
index 0000000..bed7295
Binary files /dev/null and b/site/joke-collection/making/still-stall.webp differ
diff --git a/site/joke-collection/making/styles-stall.webp b/site/joke-collection/making/styles-stall.webp
new file mode 100644
index 0000000..f01eab1
Binary files /dev/null and b/site/joke-collection/making/styles-stall.webp differ
diff --git a/site/lib/bookshelf.css b/site/lib/bookshelf.css
index 1c90ebc..dbeb089 100644
--- a/site/lib/bookshelf.css
+++ b/site/lib/bookshelf.css
@@ -27,8 +27,10 @@ a { color: inherit; }
/* The middle shelf: the photographed covers of our picture books. */
.pigs-book { left: 8.1%; width: 25.8%; top: 34.5%; height: 19.6%; }
.red-book { left: 37.2%; width: 26%; top: 34.4%; height: 19.6%; }
+.joke-book { left: 65.6%; width: 26.4%; top: 34.2%; height: 19.9%; }
.pigs-book .book-caption { background: linear-gradient(110deg, #7a4a1ef5, #5a3414f0); }
.red-book .book-caption { background: linear-gradient(110deg, #8a2a22f5, #5e1a16f0); }
+.joke-book .book-caption { background: linear-gradient(110deg, #2f5aa8f5, #1f3d78f0); }
.book-hotspot:hover { box-shadow: 0 0 0 2px #f7d998b3, 0 0 28px #edc97833; }
#shelf a:focus-visible { outline: 3px solid #f4d786; outline-offset: 5px; }
.book-caption { position: absolute; bottom: 0; left: 0; right: 0; display: flex; flex-direction: column; justify-content: center; gap: .35cqw; min-height: 6.45cqw; padding: 1.1cqw 1.2cqw .9cqw; color: #faf7e9; background: linear-gradient(110deg, #263d32f5, #182a23f0); box-shadow: 0 -2px 8px #0003; font: 1.4cqw/1.25 var(--ui); transition: background .2s; }