Skip to content

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

feat(site): Shooting an Elephant, an interactive documentary; new shelf

DozenTwelvef9033ca80eec
diff --git a/site/assets/bookshelf.webp b/site/assets/bookshelf.webp
index 842554a..2035524 100644
Binary files a/site/assets/bookshelf.webp and b/site/assets/bookshelf.webp differ
diff --git a/site/index.html b/site/index.html
index 12ec0ba..83b0021 100644
--- a/site/index.html
+++ b/site/index.html
@@ -24,8 +24,8 @@
<h1 id="shelf-title"><a class="shelf-brand" href="./"><span aria-hidden="true">∞</span> Papermorph</a></h1>
<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.webp" 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">
+ <figure class="photo-shelf" aria-label="Three shelves: STEM, picture books for children, and video essays">
+ <img class="shelf-photo" src="assets/bookshelf.webp" 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 marked Video Essay, among them Shooting an Elephant; two drawers below, marked GitHub and YouTube." fetchpriority="high">
<div id="shelf-books">
<section class="shelf-tier" aria-labelledby="stem-title">
<h2 class="visually-hidden" id="stem-title">STEM · Mathematics</h2>
@@ -52,13 +52,17 @@
</a>
</section>
<section class="shelf-tier" aria-labelledby="curious-title">
- <h2 class="visually-hidden" id="curious-title">Curious books · Documentaries</h2>
+ <h2 class="visually-hidden" id="curious-title">Video essays · Documentaries</h2>
<a class="book-hotspot foucault-book" data-book="madness" href="madness/" aria-label="Open Madness and Civilization, a ten-minute documentary on Michel Foucault's book">
<span class="book-caption"><strong>Madness and Civilization <span aria-hidden="true">↗</span></strong><small>A documentary · Michel Foucault</small></span>
</a>
+ <a class="book-hotspot elephant-book" data-book="shooting-an-elephant" href="shooting-an-elephant/" aria-label="Open Shooting an Elephant, an interactive documentary of George Orwell's essay">
+ <span class="book-caption"><strong>Shooting an Elephant <span aria-hidden="true">↗</span></strong><small>An interactive documentary · George Orwell</small></span>
+ </a>
</section>
</div>
<a class="github-drawer" href="https://github.com/DozenTwelve/Papermorph" target="_blank" rel="noopener noreferrer" aria-label="Papermorph on GitHub: source and Skills"></a>
+ <a class="youtube-drawer" href="https://www.youtube.com/@AnotherGameDoge" target="_blank" rel="noopener noreferrer" aria-label="The films on YouTube"></a>
<noscript><p class="shelf-noscript">Book links work without JavaScript. The animated lessons require JavaScript.</p></noscript>
</figure>
<footer class="shelf-footer">
diff --git a/site/lib/bookshelf.css b/site/lib/bookshelf.css
index 309ec66..f45a758 100644
--- a/site/lib/bookshelf.css
+++ b/site/lib/bookshelf.css
@@ -33,6 +33,8 @@ a { color: inherit; }
.joke-book .book-caption { background: linear-gradient(110deg, #2f5aa8f5, #1f3d78f0); }
.foucault-book { left: 8.5%; width: 25.8%; top: 58.4%; height: 20.3%; }
.foucault-book .book-caption { background: linear-gradient(110deg, #6a1420f5, #3e0a12f2); }
+.elephant-book { left: 37.1%; width: 25.6%; top: 58.4%; height: 19.9%; }
+.elephant-book .book-caption { background: linear-gradient(110deg, #1d3527f5, #0e1d14f2); }
.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; }
@@ -42,7 +44,9 @@ a { color: inherit; }
.book-caption strong > span { position: absolute; right: 1.2cqw; top: 1.1cqw; color: #e8c68b; }
.book-caption small { color: #e2dbca; font-size: 1.03cqw; letter-spacing: .03em; }
.resume-label { position: absolute; padding: .46cqw .74cqw; background: #fcf4df; color: #3c4336; box-shadow: 1px 2px 5px #0003; font: 1.03cqw var(--ui); transform: rotate(-3deg); }
-.github-drawer { position: absolute; left: 9%; top: 87.5%; width: 68%; height: 8.5%; text-decoration: none; }
+.github-drawer, .youtube-drawer { position: absolute; top: 83.6%; width: 46.1%; height: 14.6%; text-decoration: none; }
+.github-drawer { left: 4.1%; }
+.youtube-drawer { left: 50.7%; }
.shelf-noscript { position: absolute; bottom: 0; left: 24px; margin: 0; font: 11px var(--ui); color: #352c21; }
.shelf-footer { position: absolute; inset: auto 0 0; display: flex; justify-content: center; align-items: center; gap: 3%; height: 3%; padding: 0 3%; color: #594129; font: 500 clamp(10px, .85vw, 14px)/1.4 var(--ui); text-shadow: 0 1px #ffe6bd66; }
.shelf-footer button { padding: 2px 0; border: 0; border-bottom: 1px solid #59412966; background: transparent; color: inherit; font: inherit; cursor: pointer; text-shadow: inherit; }
diff --git a/site/shooting-an-elephant/ch01/audio/bgm/m1-crown-menuetto.mp3 b/site/shooting-an-elephant/ch01/audio/bgm/m1-crown-menuetto.mp3
new file mode 100644
index 0000000..68ae148
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/bgm/m1-crown-menuetto.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/bgm/m2-grieg-p2.mp3 b/site/shooting-an-elephant/ch01/audio/bgm/m2-grieg-p2.mp3
new file mode 100644
index 0000000..f318437
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/bgm/m2-grieg-p2.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/bgm/m3-grieg-morning.mp3 b/site/shooting-an-elephant/ch01/audio/bgm/m3-grieg-morning.mp3
new file mode 100644
index 0000000..bb49127
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/bgm/m3-grieg-morning.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/bgm/m4-grieg-aase.mp3 b/site/shooting-an-elephant/ch01/audio/bgm/m4-grieg-aase.mp3
new file mode 100644
index 0000000..fa4029f
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/bgm/m4-grieg-aase.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/bgm/m5-satie.mp3 b/site/shooting-an-elephant/ch01/audio/bgm/m5-satie.mp3
new file mode 100644
index 0000000..a2d5ce0
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/bgm/m5-satie.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/open.mp3 b/site/shooting-an-elephant/ch01/audio/en/open.mp3
new file mode 100644
index 0000000..c1a5269
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/open.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p2.mp3 b/site/shooting-an-elephant/ch01/audio/en/p2.mp3
new file mode 100644
index 0000000..b347b0f
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p2.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p3.mp3 b/site/shooting-an-elephant/ch01/audio/en/p3.mp3
new file mode 100644
index 0000000..1e1b09f
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p3.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p4.mp3 b/site/shooting-an-elephant/ch01/audio/en/p4.mp3
new file mode 100644
index 0000000..325f8e0
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p4.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5a.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5a.mp3
new file mode 100644
index 0000000..f627627
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5a.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5b.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5b.mp3
new file mode 100644
index 0000000..97badde
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5b.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5c.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5c.mp3
new file mode 100644
index 0000000..a7f8949
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5c.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5d.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5d.mp3
new file mode 100644
index 0000000..e3b2242
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5d.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5e.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5e.mp3
new file mode 100644
index 0000000..d224a78
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5e.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5f.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5f.mp3
new file mode 100644
index 0000000..f730df8
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5f.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p5g.mp3 b/site/shooting-an-elephant/ch01/audio/en/p5g.mp3
new file mode 100644
index 0000000..ef5799c
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p5g.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/p6.mp3 b/site/shooting-an-elephant/ch01/audio/en/p6.mp3
new file mode 100644
index 0000000..c4fa899
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/en/p6.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/en/timings.js b/site/shooting-an-elephant/ch01/audio/en/timings.js
new file mode 100644
index 0000000..78409c9
--- /dev/null
+++ b/site/shooting-an-elephant/ch01/audio/en/timings.js
@@ -0,0 +1,505 @@
+window.TIMINGS = {
+ "open": {
+ "dur": 55.12,
+ "marks": {
+ "moulmein": 0.51,
+ "hated": 2.64,
+ "only": 5.58,
+ "s2": 10.14,
+ "police": 11.28,
+ "s3": 13.44,
+ "field": 15.36,
+ "ref": 16.7,
+ "laugh": 20.48,
+ "s4": 23.28,
+ "priests": 23.86,
+ "s5": 26.16,
+ "imp": 28.04,
+ "evil": 29.28,
+ "theo": 30.9,
+ "secret": 32.0,
+ "for": 34.18,
+ "against": 36.08,
+ "british": 37.8,
+ "s7": 38.78,
+ "stuck": 40.58,
+ "empire": 42.34,
+ "beasts": 46.64,
+ "one": 50.56,
+ "enl": 54.1
+ },
+ "cues": [
+ [
+ 0.0,
+ "In Moulmein, in Lower Burma, I was hated by large numbers of people — the only time in my life that I have been important enough for this to happen to me."
+ ],
+ [
+ 10.14,
+ "I was sub-divisional police officer of the town."
+ ],
+ [
+ 13.44,
+ "When a nimble Burman tripped me up on the football field and the referee (another Burman) looked the other way, the crowd yelled with hideous laughter."
+ ],
+ [
+ 23.28,
+ "The young Buddhist priests were the worst of all."
+ ],
+ [
+ 26.16,
+ "I had already made up my mind that imperialism was an evil thing."
+ ],
+ [
+ 30.9,
+ "Theoretically — and secretly, of course — I was all for the Burmese and all against their oppressors, the British."
+ ],
+ [
+ 38.78,
+ "All I knew was that I was stuck between my hatred of the empire I served and my rage against the evil-spirited little beasts who tried to make my job impossible."
+ ],
+ [
+ 50.56,
+ "One day something happened which in a roundabout way was enlightening."
+ ]
+ ]
+ },
+ "p2": {
+ "dur": 56.4,
+ "marks": {
+ "p2": 0.0,
+ "phone": 5.32,
+ "eleph": 6.82,
+ "would": 9.66,
+ "q3": 12.28,
+ "w44": 13.78,
+ "small": 16.3,
+ "q4": 18.28,
+ "tame": 21.02,
+ "must": 22.46,
+ "q6": 23.14,
+ "hut": 25.72,
+ "cow": 27.28,
+ "fruit": 28.8,
+ "q7": 30.44,
+ "dead": 32.52,
+ "q8": 35.0,
+ "coolie": 37.4,
+ "never": 42.06,
+ "devil": 48.4,
+ "q10": 49.14,
+ "erifle": 55.16
+ },
+ "cues": [
+ [
+ 0.0,
+ "Early one morning the sub-inspector at a police station the other end of the town rang me up on the phone and said that an elephant was ravaging the bazaar."
+ ],
+ [
+ 9.66,
+ "Would I please come and do something about it?"
+ ],
+ [
+ 12.28,
+ "I took my rifle, an old .44 Winchester and much too small to kill an elephant."
+ ],
+ [
+ 18.28,
+ "It was not, of course, a wild elephant, but a tame one which had gone 'must'."
+ ],
+ [
+ 23.14,
+ "It had already destroyed somebody's bamboo hut, killed a cow and raided some fruit-stalls."
+ ],
+ [
+ 30.44,
+ "I rounded the hut and saw a man's dead body sprawling in the mud."
+ ],
+ [
+ 35.0,
+ "He was an Indian, a black Dravidian coolie, almost naked, and he could not have been dead many minutes."
+ ],
+ [
+ 42.06,
+ "Never tell me, by the way, that the dead look peaceful."
+ ],
+ [
+ 46.28,
+ "Most of the corpses I have seen looked devilish."
+ ],
+ [
+ 49.14,
+ "As soon as I saw the dead man I sent an orderly to a friend's house nearby to borrow an elephant rifle."
+ ]
+ ]
+ },
+ "p3": {
+ "dur": 56.8,
+ "marks": {
+ "p3": 0.0,
+ "five": 2.76,
+ "s2": 4.7,
+ "paddy": 8.64,
+ "s3": 13.0,
+ "pop": 15.4,
+ "followed": 18.56,
+ "s4": 19.82,
+ "ravaging": 22.92,
+ "shot": 26.78,
+ "s5": 27.08,
+ "fun": 28.46,
+ "meat": 33.34,
+ "s6": 34.62,
+ "eight": 35.68,
+ "left": 37.72,
+ "s7": 39.66,
+ "grass": 41.24,
+ "knees": 43.2,
+ "mouth": 45.86,
+ "s8": 47.14,
+ "cert": 50.02,
+ "s9": 53.24,
+ "want": 55.28
+ },
+ "cues": [
+ [
+ 0.0,
+ "The orderly came back in a few minutes with a rifle and five cartridges, and meanwhile some Burmans had arrived and told us that the elephant was in the paddy fields below, only a few hundred yards away."
+ ],
+ [
+ 13.0,
+ "As I started forward practically the whole population of the quarter flocked out of the houses and followed me."
+ ],
+ [
+ 19.82,
+ "They had not shown much interest in the elephant when he was merely ravaging their homes, but it was different now that he was going to be shot."
+ ],
+ [
+ 27.08,
+ "It was a bit of fun to them, as it would be to an English crowd; besides they wanted the meat."
+ ],
+ [
+ 34.62,
+ "The elephant was standing eight yards from the road, his left side towards us."
+ ],
+ [
+ 39.66,
+ "He was tearing up bunches of grass, beating them against his knees to clean them and stuffing them into his mouth."
+ ],
+ [
+ 47.14,
+ "As soon as I saw the elephant I knew with perfect certainty that I ought not to shoot him."
+ ],
+ [
+ 53.24,
+ "Moreover, I did not in the least want to shoot him."
+ ]
+ ]
+ },
+ "p4": {
+ "dur": 66.4,
+ "marks": {
+ "p4": 0.0,
+ "crowd": 2.24,
+ "s2": 4.18,
+ "two": 5.96,
+ "growing": 7.86,
+ "s3": 9.54,
+ "conjurer": 11.58,
+ "s4": 14.32,
+ "shoot": 17.12,
+ "s5": 19.34,
+ "wills": 24.98,
+ "irres": 26.56,
+ "s6": 28.45,
+ "gun": 30.76,
+ "actor": 35.92,
+ "puppet": 39.88,
+ "s7": 45.56,
+ "tyrant": 48.78,
+ "freedom": 50.64,
+ "s8": 52.84,
+ "mask": 53.5,
+ "grows": 54.94,
+ "s9": 56.54,
+ "laugh": 57.62,
+ "laughed": 65.5
+ },
+ "cues": [
+ [
+ 0.0,
+ "But at that moment I glanced round at the crowd that had followed me."
+ ],
+ [
+ 4.18,
+ "It was an immense crowd, two thousand at the least and growing every minute."
+ ],
+ [
+ 9.54,
+ "They were watching me as they would watch a conjurer about to perform a trick."
+ ],
+ [
+ 14.32,
+ "And suddenly I realized that I should have to shoot the elephant after all."
+ ],
+ [
+ 19.34,
+ "The people expected it of me and I had got to do it; I could feel their two thousand wills pressing me forward, irresistibly."
+ ],
+ [
+ 28.45,
+ "Here was I, the white man with his gun, standing in front of the unarmed native crowd — seemingly the leading actor of the piece; but in reality I was only an absurd puppet pushed to and fro by the will of those yellow faces behind."
+ ],
+ [
+ 45.56,
+ "I perceived in this moment that when the white man turns tyrant it is his own freedom that he destroys."
+ ],
+ [
+ 52.84,
+ "He wears a mask, and his face grows to fit it."
+ ],
+ [
+ 56.54,
+ "The crowd would laugh at me."
+ ],
+ [
+ 58.82,
+ "And my whole life, every white man's life in the East, was one long struggle not to be laughed at."
+ ]
+ ]
+ },
+ "p5a": {
+ "dur": 41.84,
+ "marks": {
+ "p5a": 0.0,
+ "cart": 0.6,
+ "lay": 2.58,
+ "s2": 5.44,
+ "sigh": 9.74,
+ "curtain": 12.34,
+ "s3": 17.04,
+ "cross": 19.58,
+ "s4": 21.5,
+ "bar": 25.9,
+ "s5": 29.62,
+ "ear": 34.7,
+ "inches": 37.6,
+ "forward": 40.94
+ },
+ "cues": [
+ [
+ 0.0,
+ "I shoved the cartridges into the magazine and lay down on the road to get a better aim."
+ ],
+ [
+ 5.44,
+ "The crowd grew very still, and a deep, low, happy sigh, as of people who see the theatre curtain go up at last, breathed from innumerable throats."
+ ],
+ [
+ 17.04,
+ "The rifle was a beautiful German thing with cross-hair sights."
+ ],
+ [
+ 21.5,
+ "I did not then know that in shooting an elephant one would shoot to cut an imaginary bar running from ear-hole to ear-hole."
+ ],
+ [
+ 29.62,
+ "I ought, therefore, as the elephant was sideways on, to have aimed straight at his ear-hole; actually I aimed several inches in front of this, thinking the brain would be further forward."
+ ]
+ ]
+ },
+ "p5b": {
+ "dur": 37.44,
+ "marks": {
+ "p5b": 0.0,
+ "bang": 2.24,
+ "roar": 8.34,
+ "s2": 11.54,
+ "change": 18.92,
+ "s3": 21.38,
+ "stricken": 22.24,
+ "old": 24.62,
+ "s4": 25.88,
+ "knees": 33.22,
+ "s5": 34.34,
+ "thousands": 35.48
+ },
+ "cues": [
+ [
+ 0.0,
+ "When I pulled the trigger I did not hear the bang or feel the kick — one never does when a shot goes home — but I heard the devilish roar of glee that went up from the crowd."
+ ],
+ [
+ 11.54,
+ "In that instant, in too short a time, one would have thought, even for the bullet to get there, a mysterious, terrible change had come over the elephant."
+ ],
+ [
+ 21.38,
+ "He looked suddenly stricken, shrunken, immensely old, At last, after what seemed a long time — it might have been five seconds, I dare say — he sagged flabbily to his knees."
+ ],
+ [
+ 34.34,
+ "One could have imagined him thousands of years old."
+ ]
+ ]
+ },
+ "p5c": {
+ "dur": 10.48,
+ "marks": {
+ "p5c": 0.0,
+ "climbed": 2.8,
+ "upright": 6.74
+ },
+ "cues": [
+ [
+ 0.0,
+ "At the second shot he did not collapse but climbed with desperate slowness to his feet and stood weakly upright, with legs sagging and head drooping."
+ ]
+ ]
+ },
+ "p5d": {
+ "dur": 26.8,
+ "marks": {
+ "p5d": 0.0,
+ "s2": 2.5,
+ "rise": 4.72,
+ "sky": 13.36,
+ "s3": 15.68,
+ "trumpet": 15.88,
+ "s4": 19.52,
+ "down": 19.9,
+ "crash": 23.2
+ },
+ "cues": [
+ [
+ 0.0,
+ "That was the shot that did for him."
+ ],
+ [
+ 2.5,
+ "But in falling he seemed for a moment to rise, for as his hind legs collapsed beneath him he seemed to tower upward like a huge rock toppling, his trunk reaching skyward like a tree."
+ ],
+ [
+ 15.68,
+ "He trumpeted, for the first and only time."
+ ],
+ [
+ 19.52,
+ "And then down he came, his belly towards me, with a crash that seemed to shake the ground even where I lay."
+ ]
+ ]
+ },
+ "p5e": {
+ "dur": 14.32,
+ "marks": {
+ "p5e": 0.0,
+ "dead": 4.3,
+ "s2": 5.32,
+ "gasps": 8.9
+ },
+ "cues": [
+ [
+ 0.0,
+ "It was obvious that the elephant would never rise again, but he was not dead."
+ ],
+ [
+ 5.32,
+ "He was breathing very rhythmically with long rattling gasps, his great mound of a side painfully rising and falling."
+ ]
+ ]
+ },
+ "p5f": {
+ "dur": 8.4,
+ "marks": {
+ "p5f": 0.0,
+ "blood": 0.4,
+ "velvet": 2.48,
+ "s2": 6.34,
+ "small": 7.22
+ },
+ "cues": [
+ [
+ 0.0,
+ "The thick blood welled out of him like red velvet, but still he did not die."
+ ],
+ [
+ 6.34,
+ "I sent back for my small rifle"
+ ]
+ ]
+ },
+ "p5g": {
+ "dur": 19.6,
+ "marks": {
+ "p5g": 0.0,
+ "s2": 5.06,
+ "impression": 5.92,
+ "s3": 7.34,
+ "clock": 10.84,
+ "s4": 11.88,
+ "away": 14.94,
+ "s5": 16.1,
+ "hour": 18.26
+ },
+ "cues": [
+ [
+ 0.0,
+ "and poured shot after shot into his heart and down his throat."
+ ],
+ [
+ 5.06,
+ "They seemed to make no impression."
+ ],
+ [
+ 7.34,
+ "The tortured gasps continued as steadily as the ticking of a clock."
+ ],
+ [
+ 11.88,
+ "In the end I could not stand it any longer and went away."
+ ],
+ [
+ 16.1,
+ "I heard later that it took him half an hour to die."
+ ]
+ ]
+ },
+ "p6": {
+ "dur": 35.84,
+ "marks": {
+ "p6": 0.0,
+ "disc": 2.32,
+ "s2": 5.32,
+ "s3": 8.68,
+ "older": 8.78,
+ "younger": 10.92,
+ "s4": 19.84,
+ "glad": 21.34,
+ "pretext": 26.96,
+ "s5": 29.3,
+ "fool": 34.96
+ },
+ "cues": [
+ [
+ 0.0,
+ "Afterwards, of course, there were endless discussions about the shooting of the elephant."
+ ],
+ [
+ 5.32,
+ "Among the Europeans opinion was divided."
+ ],
+ [
+ 8.68,
+ "The older men said I was right, the younger men said it was a damn shame to shoot an elephant for killing a coolie, because an elephant was worth more than any damn Coringhee coolie."
+ ],
+ [
+ 19.84,
+ "And afterwards I was very glad that the coolie had been killed; it put me legally in the right and it gave me a sufficient pretext for shooting the elephant."
+ ],
+ [
+ 29.3,
+ "I often wondered whether any of the others grasped that I had done it solely to avoid looking a fool."
+ ]
+ ]
+ }
+};
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/cheer.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/cheer.mp3
new file mode 100644
index 0000000..ff5c535
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/cheer.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/clack.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/clack.mp3
new file mode 100644
index 0000000..b9e0aec
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/clack.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/crash.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/crash.mp3
new file mode 100644
index 0000000..cb96d32
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/crash.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/flee.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/flee.mp3
new file mode 100644
index 0000000..13ade10
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/flee.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/gasps.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/gasps.mp3
new file mode 100644
index 0000000..c14ee51
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/gasps.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/jeer.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/jeer.mp3
new file mode 100644
index 0000000..4d66bd4
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/jeer.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/laugh.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/laugh.mp3
new file mode 100644
index 0000000..f5cbbcb
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/laugh.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/moulmein-amb.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/moulmein-amb.mp3
new file mode 100644
index 0000000..081394d
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/moulmein-amb.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/murmur.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/murmur.mp3
new file mode 100644
index 0000000..0957d92
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/murmur.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/phone-ring-long.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/phone-ring-long.mp3
new file mode 100644
index 0000000..687c8a8
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/phone-ring-long.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/phone-ring.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/phone-ring.mp3
new file mode 100644
index 0000000..8afc50e
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/phone-ring.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/rifle-small.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/rifle-small.mp3
new file mode 100644
index 0000000..88bc8a3
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/rifle-small.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/rifle.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/rifle.mp3
new file mode 100644
index 0000000..285e0ed
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/rifle.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/ring.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/ring.mp3
new file mode 100644
index 0000000..658134b
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/ring.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/roar.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/roar.mp3
new file mode 100644
index 0000000..49dbc0e
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/roar.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/sigh.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/sigh.mp3
new file mode 100644
index 0000000..80e3a3a
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/sigh.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/tear-long.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/tear-long.mp3
new file mode 100644
index 0000000..e5e8ebd
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/tear-long.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/tear.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/tear.mp3
new file mode 100644
index 0000000..8842967
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/tear.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/thud.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/thud.mp3
new file mode 100644
index 0000000..88ce578
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/thud.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/tick.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/tick.mp3
new file mode 100644
index 0000000..dd15264
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/tick.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/audio/sfx/trumpet.mp3 b/site/shooting-an-elephant/ch01/audio/sfx/trumpet.mp3
new file mode 100644
index 0000000..5c8c8f2
Binary files /dev/null and b/site/shooting-an-elephant/ch01/audio/sfx/trumpet.mp3 differ
diff --git a/site/shooting-an-elephant/ch01/index.html b/site/shooting-an-elephant/ch01/index.html
new file mode 100644
index 0000000..5ba6ab0
--- /dev/null
+++ b/site/shooting-an-elephant/ch01/index.html
@@ -0,0 +1,1489 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Shooting an Elephant</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render">
+<style>
+/* The film opens on the sight, not on a title card: the cover stays as the click target (it starts the film and the
+ sound), but shows nothing: the reticle is the cursor (the picture moves under it), and after a few idle seconds a
+ line says how to fire. */
+.cover { background: transparent; cursor: none; }
+.cover > div { display: none; }
+.cover::after { content: 'move to aim · click to fire · with sound'; position: absolute; left: 0; right: 0; bottom: 60px; text-align: center;
+ font: italic 400 38px "EB Garamond", Georgia, serif; letter-spacing: .04em; color: var(--chalk); opacity: 0; animation: hint 1s 1.5s forwards; }
+@keyframes hint { to { opacity: .95; } }
+@media (pointer: coarse) { .cover::after { content: 'tap to fire · with sound'; } }
+/* the sight drifts with the shooter's breath while it waits (wall clock: only before the first click) */
+body:has(.cover:not([hidden])) .breath { animation: breath 4.2s ease-in-out infinite; }
+@keyframes breath { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(5px, -7px); } 65% { transform: translate(-4px, 4px); } }
+</style>
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../lib/film.js"></script>
+<script src="audio/en/timings.js"></script>
+<script src="../img/art.js"></script>
+<script src="../lib/lines.js"></script>
+<script src="../lib/shapes.js"></script>
+<script src="../lib/puppets.js"></script>
+<script>
+'use strict';
+// lead: false — every opening is timed by hand, so the engine never pulls a beat's first reveal earlier
+const CHAPTER = { number: 1, title: 'Shooting an Elephant', minutes: 9, language: 'en', lead: false, film: true }; // film: its shots are question beats
+
+const OPEN_PRE = 5.5; // the shot, the trumpet and the title in the black, before Orwell's first sentence
+const SIGHT = { x: 800, y: 430, r: 330 };
+
+// the view through the rifle's sight: the elephant in a circle, black around it, a post-and-crosshair reticle
+function sight(p, name, id) {
+ const outer = G(p, {}), g = mk('g', { class: 'breath' }, outer);
+ const cp = mk('clipPath', { id }, mk('defs', {}, g));
+ mk('circle', { cx: SIGHT.x, cy: SIGHT.y, r: SIGHT.r }, cp);
+ const view = G(mk('g', { 'clip-path': `url(#${id})` }, g), {});
+ mk('rect', { x: 0, y: 0, width: 1600, height: 900, fill: '#7d8277' }, view);
+ pic(aimable(view), name, { x: SIGHT.x + 150, y: SIGHT.y + 70, h: 880 }).setAttribute('filter', 'grayscale(1) contrast(1.1)');
+ const { x, y, r } = SIGHT;
+ mk('path', { d: `M-200 -200H1800V1100H-200Z M${x - r} ${y}a${r} ${r} 0 1 0 ${2 * r} 0a${r} ${r} 0 1 0 ${-2 * r} 0Z`, fill: '#040805', 'fill-rule': 'evenodd' }, g);
+ const ink = { stroke: '#0b0b0b', fill: 'none' };
+ mk('path', { d: `M${x - r} ${y}H${x - 26}M${x + 26} ${y}H${x + r}M${x} ${y - r}V${y - 26}`, 'stroke-width': 2, ...ink }, g);
+ mk('path', { d: `M${x - r} ${y}H${x - 150}M${x + 150} ${y}H${x + r}M${x} ${y + r}V${y + 18}`, 'stroke-width': 9, ...ink }, g);
+ mk('circle', { cx: x, cy: y, r: r - 2, 'stroke-width': 6, stroke: '#000', fill: 'none' }, g);
+ return outer;
+}
+// a point (fx, fy, 0..1 of the picture inside its border) of a print placed by pic(), in stage coordinates
+const spot = (g, name, fx, fy) => { const [W, H] = ART[name], k = g._w / W; return [g._x + (fx - .5) * (W - 112) * k, g._y + (fy - .5) * (H - 112) * k]; };
+// a new picture for the next sentence: the old one fades as this one comes in, on the beat clock
+const cut = (t, dur = .35) => { if (S.panel) hide(S.panel, t - .1, .2, lin); const q = panel(t); put(q, { o: 0 }); show(q, t + .05, dur, lin); return q; }; // the old one (its words too) is gone before the new one is half in
+// a slow push toward (fx, fy) of a picture placed by pic(), never past its edges (closeups() without the label)
+function toward(g, name, fx, fy, Z, t0, dur) {
+ const b = 56 * g._w / ART[name][0]; // a print's border: the view stays on the picture inside it
+ const lim = (v, half, screen) => Math.max(-(half - screen / Z), Math.min(half - screen / Z, v));
+ const dx = lim((fx - .5) * g._w, g._w / 2 - b, 800), dy = lim((fy - .5) * g._h, g._h / 2 - b, 450);
+ tw(g, { s: Z, x: 800 - Z * dx, y: 450 - Z * dy }, t0, dur, soft);
+}
+// a close-up of a rifle laid beside a photograph, with a cream line from it to the rifle in the picture (gx, gy: 0..1)
+function gunInset(p0, photo, photoName, [gx, gy], name, label, { x, y, w, r = 0 }, t0) {
+ const p = G(p0, {}), [px, py] = spot(photo, photoName, gx, gy);
+ line(p, `M${px} ${py}L${x - w * .3} ${y - 40}`, t0, .35, 3, { opacity: .9 });
+ put(mk('circle', { cx: px, cy: py, r: 9, fill: 'none', stroke: CREAM, 'stroke-width': 3 }, p), { o: 0 });
+ const dot = p.lastChild; show(dot, t0, .2);
+ pic(p, name, { x, y, w, r, at: t0 + .2, from: [60, 0], dur: .45 });
+ tag(p, label, x, y + w * .17 + 36, t0 + .5, { anchor: 'middle', size: 36, fill: CREAM });
+ return p;
+}
+// a comic panel: a print's picture cropped to fill the box [x, y, w, h] around a point of interest (fx, fy), with a
+// cream frame; it slides in from `from` ([dx, dy], or [x, y, scale] for one that starts large and stays there until
+// moved) at t0. Returns the group, with at(fx, fy) giving a point of the picture on stage.
+let panelN = 0;
+function comicPanel(p, name, [bx, by, bw, bh], [fx, fy], t0, from = [0, 40]) {
+ const [W, H] = ART[name], iw = W - 112, ih = H - 112; // the picture inside the print's border
+ const k = Math.max(bw / iw, bh / ih);
+ const ox = Math.min(0, Math.max(bw - iw * k, bw / 2 - fx * iw * k)), oy = Math.min(0, Math.max(bh - ih * k, bh / 2 - fy * ih * k));
+ const big = from.length > 2, g = G(p, { x: from[0], y: from[1], s: from[2] || 1, o: 0 }), id = `panel${panelN++}`;
+ mk('rect', { x: bx, y: by, width: bw, height: bh }, mk('clipPath', { id }, mk('defs', {}, g)));
+ const c = mk('g', { 'clip-path': `url(#${id})` }, g);
+ mk('image', { href: `../img/${name}.webp`, x: bx + ox - 56 * k, y: by + oy - 56 * k, width: W * k, height: H * k }, c);
+ mk('rect', { x: bx, y: by, width: bw, height: bh, fill: 'none', stroke: CREAM, 'stroke-width': 6 }, g);
+ tw(g, big ? { o: 1 } : { x: 0, y: 0, o: 1 }, t0, .35, out); // a large one keeps its place until it is moved
+ g.at = (u, v) => [bx + ox + u * iw * k, by + oy + v * ih * k];
+ return g;
+}
+// a figure of the jeering crowd (SHAPES man0..7), standing on `base`, rocking with laughter on the beat clock
+function shadow(p, i, x, base, h, at, phase, D, { o = 1, flip = false } = {}) {
+ const g = G(p, { x, y: base + 40, o: 0 });
+ const c = cutout(g, `man${i}`, 0, 0, h, { flip, rough: false });
+ tw(g, { y: base, o }, at, .35, out);
+ clockRun(t => { const q = (t - at) * 3.1 + phase * 6.3; put(c, t < at ? { y: 0, r: 0 } : { y: -4 * Math.abs(Math.sin(q)), r: 2.2 * Math.sin(q * .5) }); }, D, { tail: true });
+ return g;
+}
+// spaced capitals for a plan's labels
+function label(p, str, x, y, t0, { size = 22, o = .7 } = {}) {
+ const e = T(p, str, { x, y, size, font: KEY, weight: 500, fill: CREAM, anchor: 'middle', o: 0 });
+ e.setAttribute('letter-spacing', '.3em'); tw(e, { o }, t0, .5); return e;
+}
+// puppets (lib/puppets.js) on the beat clock: mounted into p, posed every frame from t0; at(tt) may move them
+PUP.defs(document.getElementById('stage'));
+function puppet(p, fig, x, y, k, { flip = false, t0 = 0, D, filter = true, at, rate = 1 } = {}) {
+ PUP.mount(p, fig, x, y, k, flip, filter);
+ clockRun(tt => {
+ fig.pose((tt - t0) * rate);
+ if (filter) PUP.boilAt(fig, tt);
+ if (at) { const q = at(tt); fig.g.setAttribute('transform', `translate(${q.x.toFixed(1)},${q.y.toFixed(1)}) scale(${flip ? -k : k},${k})`); }
+ }, D, { tail: true });
+ return fig;
+}
+// a crowd: one group carrying one boiling filter, its figures mounted without their own
+function troupe(p, D) { const g = G(p, {}); g.setAttribute('filter', 'url(#pupRim0)'); clockRun(tt => PUP.boilAt(g, tt), D, { tail: true }); return g; }
+// a small theatre drawn in SVG: the proscenium with its valance and tassels, curtains that part, the boards, footlights,
+// a spotlight, and an audience in silhouette in the foreground. Returns the groups the action needs.
+function theatre(p, t0, D) {
+ const g = G(p, {}), FLOOR = 640, L = 250, R = 1350, TOP = 110;
+ // the stage's back: dark, a faint painted backdrop of palms and a pagoda, as a touring company would hang
+ mk('rect', { x: L, y: TOP, width: R - L, height: FLOOR - TOP, fill: '#0c1610' }, g);
+ const back = G(g, { o: 0 });
+ for (const [x, h] of [[360, 300], [470, 240], [1130, 280], [1240, 220]]) {
+ mk('path', { d: `M${x} ${FLOOR}C${x + 6} ${FLOOR - h * .5} ${x - 4} ${FLOOR - h * .8} ${x + 10} ${FLOOR - h}`, fill: 'none', stroke: CREAM, 'stroke-width': 5, opacity: .18 }, back);
+ for (let k = 0; k < 6; k++) { const a = -2.6 + k * .55; mk('path', { d: `M${x + 10} ${FLOOR - h}q${40 * Math.cos(a)} ${30 * Math.sin(a) - 10} ${80 * Math.cos(a)} ${70 * Math.sin(a) + 20}`, fill: 'none', stroke: CREAM, 'stroke-width': 4, opacity: .18 }, back); }
+ }
+ show(back, t0 + .6, .8);
+ // the boards in perspective, and the footlights along the front edge
+ const boards = G(g, { o: 0 });
+ mk('path', { d: `M${L - 60} 700L${L} ${FLOOR}H${R}L${R + 60} 700Z`, fill: '#1a2a20', stroke: CREAM, 'stroke-width': 2.5 }, boards);
+ for (let i = 1; i < 12; i++) { const x = L + (R - L) * i / 12, xb = L - 60 + (R - L + 120) * i / 12; mk('path', { d: `M${x} ${FLOOR}L${xb} 700`, stroke: CREAM, 'stroke-width': 1.2, opacity: .3 }, boards); }
+ const lights = G(boards, {});
+ for (let i = 0; i < 14; i++) { const x = L + 20 + (R - L - 40) * i / 13; mk('ellipse', { cx: x, cy: 704, rx: 16, ry: 8, fill: CREAM, opacity: .85 }, lights); mk('ellipse', { cx: x, cy: 700, rx: 34, ry: 22, fill: CREAM, opacity: .12 }, lights); }
+ show(boards, t0 + .2, .6);
+ // the spotlight: a soft cone from above and a pool of light on the boards (it widens on "leading actor")
+ const spot = G(g, { o: 0 });
+ mk('path', { d: `M760 ${TOP}L860 ${TOP}L980 ${FLOOR + 10}L620 ${FLOOR + 10}Z`, fill: CREAM, opacity: .07 }, spot);
+ mk('ellipse', { cx: 800, cy: FLOOR + 14, rx: 200, ry: 26, fill: CREAM, opacity: .16 }, spot);
+ // the proscenium: pillars, an arch of double lines, a scalloped valance with tassels
+ const frame = G(g, {});
+ const stroke = { fill: 'none', stroke: CREAM, 'stroke-linejoin': 'round' };
+ mk('path', { d: `M${L - 70} 720V${TOP - 10}H${R + 70}V720H${R}V${TOP + 40}H${L}V720Z`, fill: CARD }, frame);
+ mk('path', { d: `M${L - 50} 720V${TOP + 10}H${R + 50}V720M${L - 30} 720V${TOP + 26}H${R + 30}V720`, ...stroke, 'stroke-width': 2.4 }, frame);
+ for (const x of [L - 40, R + 40]) for (let y = 160; y < 700; y += 60) mk('path', { d: `M${x - 10} ${y}h20M${x} ${y - 8}v16`, stroke: CREAM, 'stroke-width': 1.6, opacity: .6 }, frame);
+ let val = `M${L} ${TOP + 40}`;
+ for (let i = 0; i < 16; i++) { const x0 = L + (R - L) * i / 16, x1 = L + (R - L) * (i + 1) / 16; val += `Q${(x0 + x1) / 2} ${TOP + 96} ${x1} ${TOP + 40}`; }
+ mk('path', { d: val + `V${TOP + 26}H${L}Z`, fill: CARD, stroke: CREAM, 'stroke-width': 2.4 }, frame);
+ for (let i = 1; i < 16; i++) { const x = L + (R - L) * i / 16; mk('path', { d: `M${x} ${TOP + 40}v26m-7 0h14l-3 18h-8Z`, fill: CREAM, stroke: CREAM, 'stroke-width': 2 }, frame); }
+ // the sign on the valance (filled in later) and the curtains, which part from the middle
+ const sign = G(g, {});
+ const cid = 'stageOpening' + (theatre.n = (theatre.n || 0) + 1);
+ mk('rect', { x: L, y: TOP, width: R - L, height: FLOOR + 40 - TOP }, mk('clipPath', { id: cid }, mk('defs', {}, g)));
+ const drapes = mk('g', { 'clip-path': `url(#${cid})` }, g);
+ g.insertBefore(drapes, frame); // behind the proscenium
+ const curtains = [-1, 1].map(sx => {
+ const c = G(drapes, {}), x0 = 800, x1 = sx < 0 ? L : R;
+ let d = `M${x0} ${TOP + 40}L${x1} ${TOP + 40}L${x1} ${FLOOR + 10}`;
+ for (let i = 8; i >= 0; i--) d += `Q${x1 + (x0 - x1) * (i + .5) / 8} ${FLOOR + 30} ${x1 + (x0 - x1) * i / 8} ${FLOOR + 10}`;
+ mk('path', { d: d + 'Z', fill: '#2a0d0d', stroke: CREAM, 'stroke-width': 2.4 }, c);
+ for (let i = 1; i < 8; i++) { const x = x1 + (x0 - x1) * i / 8; mk('path', { d: `M${x} ${TOP + 44}C${x - 10 * sx} ${TOP + 240} ${x + 10 * sx} ${FLOOR - 200} ${x} ${FLOOR + 12}`, fill: 'none', stroke: CREAM, 'stroke-width': 1.4, opacity: .45 }, c); }
+ return c;
+ });
+ // the audience in the foreground: rows of heads and shoulders, black against the light, each one a little different:
+ // a gaung baung head-cloth with its knot to one side, a hair knot, a bare head, now and then an umbrella
+ const aud = G(p, {});
+ const R2 = rng(1936), ink = { fill: CARD, stroke: CREAM, 'stroke-width': 2.2, 'paint-order': 'stroke', 'stroke-linejoin': 'round' };
+ for (let row = 0; row < 3; row++) for (let i = 0; i < 16 - row * 2; i++) {
+ const x = 40 + i * (1520 / (15 - row * 2)) + (R2() - .5) * 40 + row * 30, y = 940 - row * 70, k = (1.3 - row * .2) * (.92 + R2() * .16), h = G(aud, {});
+ const sw = 66 + R2() * 14, hr = 33 + R2() * 6, kind = ['cloth', 'bare', 'knot', 'cloth', 'bare', 'umbrella'][Math.floor(R2() * 6)];
+ if (false) { // (umbrellas stood up over the stage: left out) // held up behind the head, its ribs as notches
+ mk('path', { d: `M${x + 20 * k} ${y - 120 * k}V${y - 230 * k}`, stroke: CREAM, 'stroke-width': 3 }, h);
+ let d = `M${x - 70 * k} ${y - 210 * k}Q${x + 20 * k} ${y - 300 * k} ${x + 110 * k} ${y - 210 * k}`;
+ for (let j = 6; j >= 0; j--) d += `Q${x - 70 * k + 180 * k * (j + .5) / 7} ${y - 200 * k} ${x - 70 * k + 180 * k * j / 7} ${y - 210 * k}`;
+ mk('path', { d, ...ink }, h);
+ }
+ mk('path', { d: `M${x - sw * k} ${y}C${x - (sw - 4) * k} ${y - 58 * k} ${x - 34 * k} ${y - 68 * k} ${x - 20 * k} ${y - 76 * k}L${x - 16 * k} ${y - 92 * k}C${x - hr * k} ${y - 100 * k} ${x - hr * k} ${y - 152 * k} ${x} ${y - 154 * k}C${x + hr * k} ${y - 152 * k} ${x + hr * k} ${y - 100 * k} ${x + 16 * k} ${y - 92 * k}L${x + 20 * k} ${y - 76 * k}C${x + 34 * k} ${y - 68 * k} ${x + (sw - 4) * k} ${y - 58 * k} ${x + sw * k} ${y}Z`, ...ink }, h);
+ if (kind === 'cloth') { // the cloth wound round the head, its knot standing out at one side
+ const sd = R2() < .5 ? -1 : 1;
+ mk('path', { d: `M${x - (hr + 4) * k} ${y - 128 * k}C${x - hr * k} ${y - 162 * k} ${x + hr * k} ${y - 162 * k} ${x + (hr + 4) * k} ${y - 128 * k}C${x + 10 * k} ${y - 136 * k} ${x - 10 * k} ${y - 136 * k} ${x - (hr + 4) * k} ${y - 128 * k}Z`, ...ink }, h);
+ mk('circle', { cx: x + sd * (hr - 6) * k, cy: y - 146 * k, r: 8 * k, ...ink }, h); // its knot
+ }
+ if (kind === 'knot') mk('circle', { cx: x, cy: y - 160 * k, r: 13 * k, ...ink }, h);
+ h._x = x; h._y = y - 154 * k;
+ }
+ return { g, frame, curtains, spot, sign, aud, FLOOR };
+}
+// a wooden marionette of the officer, drawn in SVG: pith helmet, tunic, belt, shorts, socks and boots, the rifle slung
+// across his back; limbs in two pieces with pegs at the joints. pose({ x, y, a, arms: [u, f, u, f], legs: [u, f, u, f] })
+// places it: (x, y) is the neck, a the body's lean, limb angles in degrees from hanging straight down (+ swings forward).
+// Returns the stage points of the head, the hands and the knees for the strings.
+function marionette(p) {
+ const g = G(p, {}), part = (d, host = g) => mk('path', { d, fill: CARD, stroke: CREAM, 'stroke-width': 2.4, 'paint-order': 'stroke', 'stroke-linejoin': 'round' }, host);
+ const seg = host => mk('g', {}, host || g);
+ const legB = [seg(), seg()], armB = [seg(), seg()], body = seg(), legF = [seg(), seg()], armF = [seg(), seg()], head = seg();
+ const limb = (gs, upper, lower, w0, w1, end) => {
+ part(`M${-w0} -6C${-w0} ${upper * .5} ${-w1} ${upper - 8} ${-w1} ${upper}H${w1}C${w1} ${upper - 8} ${w0} ${upper * .5} ${w0} -6Z`, gs[0]);
+ mk('circle', { cx: 0, cy: upper, r: 6, fill: CREAM }, gs[0]);
+ part(`M${-w1} -4V${lower - 10}H${w1}V-4Z` + end, gs[1]);
+ };
+ limb(legB, 80, 76, 15, 11, 'M-12 62H14L34 70C40 72 40 80 32 80H-14Z');
+ limb(legF, 80, 76, 15, 11, 'M-12 62H14L34 70C40 72 40 80 32 80H-14Z');
+ limb(armB, 70, 64, 11, 8, 'M-10 54C-12 70 12 72 10 54Z');
+ limb(armF, 70, 64, 11, 8, 'M-10 54C-12 70 12 72 10 54Z');
+ // the rifle across his back, stock at the hip, muzzle up past the shoulder
+ part('M-40 150L-34 146L44 -64L52 -60L-20 152L-24 170C-28 178 -44 176 -42 166Z', body);
+ part('M-34 0C-12 -8 12 -8 34 0L38 104C40 120 36 136 30 150H-30C-36 136 -40 120 -38 104Z', body); // the tunic
+ mk('path', { d: 'M-36 112H36M-30 4L34 104', stroke: CREAM, 'stroke-width': 3, opacity: .75 }, body); // belt and strap
+ for (const y of [30, 60, 90]) mk('circle', { cx: 8, cy: y, r: 3, fill: CREAM, opacity: .7 }, body); // buttons
+ part('M-10 -2V-14H10V-2Z', head);
+ part('M-28 -50C-28 -82 30 -84 30 -50L34 -40L28 -38C28 -26 18 -14 2 -14C-18 -14 -28 -28 -28 -50Z', head); // the face, carved
+ part('M-52 -58C-46 -66 -30 -70 -24 -72C-24 -104 26 -110 30 -74C40 -72 52 -66 56 -58C20 -62 -20 -62 -52 -58Z', head); // the helmet
+ mk('circle', { cx: 14, cy: -46, r: 3.5, fill: CREAM }, head); // a painted eye
+ mk('path', { d: 'M10 -30q10 -4 18 0', stroke: CREAM, 'stroke-width': 3, fill: 'none' }, head); // a painted moustache
+ const rad = d => d * Math.PI / 180, dir = d => [Math.sin(rad(d)), Math.cos(rad(d))];
+ const place = (e, x, y, d) => e.setAttribute('transform', `translate(${x.toFixed(1)},${y.toFixed(1)}) rotate(${(-d).toFixed(2)})`);
+ function pose({ x, y, a = 0, arms = [6, 4, -6, 4], legs = [3, 0, -3, 0] }) {
+ const ca = Math.cos(rad(a)), sa = Math.sin(rad(a)), W = (lx, ly) => [x + lx * ca - ly * sa, y + lx * sa + ly * ca];
+ place(body, x, y, -a); place(head, x, y, -a * 1.4);
+ const out = { head: W(0, -96) };
+ [[armF, 22, arms[0], arms[1], 'handF'], [armB, -18, arms[2], arms[3], 'handB']].forEach(([gs, sx, u, f, key]) => {
+ const [sx0, sy0] = W(sx, 10), [ux, uy] = dir(u), ex = sx0 + 70 * ux, ey = sy0 + 70 * uy, [fx, fy] = dir(u + f);
+ place(gs[0], sx0, sy0, u); place(gs[1], ex, ey, u + f); out[key] = [ex + 60 * fx, ey + 60 * fy];
+ });
+ [[legF, 12, legs[0], legs[1], 'kneeF'], [legB, -10, legs[2], legs[3], 'kneeB']].forEach(([gs, hx, u, f, key]) => {
+ const [hx0, hy0] = W(hx, 146), [ux, uy] = dir(u);
+ place(gs[0], hx0, hy0, u); place(gs[1], hx0 + 80 * ux, hy0 + 80 * uy, u + f); out[key] = [hx0 + 80 * ux, hy0 + 80 * uy];
+ });
+ return out;
+ }
+ return { g, pose };
+}
+
+// the elephant as a jointed shadow puppet: its silhouette (SHAPES.elephant, facing left) cut into the body, the forelegs,
+// the hind legs and the trunk, each turning about its joint; one rim round the whole (PUP's filter, boiling).
+// pose({ x, y, h, r, s, fore, hind, trunk, breathe }): (x, y) the middle of its feet on the ground, h its height,
+// r a lean of the whole about the point `about` (0..1 of the shape, default its feet), angles in degrees.
+function elephantPuppet(p, D) {
+ const S = SHAPES.elephant, W = S.w, H = S.h, wrap = G(p, {}), uid = 'ep' + (elephantPuppet.n = (elephantPuppet.n || 0) + 1);
+ wrap.setAttribute('filter', 'url(#pupRim0)'); clockRun(tt => PUP.boilAt(wrap, tt), D, { tail: true });
+ const all = mk('g', {}, wrap), defs = mk('defs', {}, all);
+ const poly = (id, pts) => { const c = mk('clipPath', { id: uid + id }, defs); mk('polygon', { points: pts.map(([u, v]) => `${u * W},${v * H}`).join(' ') }, c); };
+ poly('body', [[0, 0], [1, 0], [1, .66], [.62, .66], [.58, .6], [.48, .61], [.33, .59], [.25, .52], [.25, .47], [0, .47]]);
+ poly('fore', [[.19, .5], [.5, .56], [.5, 1.02], [.19, 1.02]]);
+ poly('hind', [[.55, .57], [1.02, .6], [1.02, 1.02], [.55, 1.02]]);
+ poly('trunk', [[-.02, .4], [.24, .4], [.24, 1.02], [-.02, 1.02]]);
+ const part = (id, px, py) => { const g = mk('g', {}, all); mk('path', { d: S.d, fill: CARD, 'fill-rule': 'evenodd', 'clip-path': `url(#${uid + id})` }, g); g.pv = [px * W, py * H]; return g; };
+ const hind = part('hind', .74, .6), fore = part('fore', .36, .56), body = part('body', 0, 0), trunk = part('trunk', .12, .43);
+ const turn = (g, a) => g.setAttribute('transform', `rotate(${a.toFixed(2)} ${g.pv[0]} ${g.pv[1]})`);
+ function pose({ x = 800, y = 740, h = 400, r = 0, s = 1, fore: f = 0, hind: hd = 0, trunk: tr = 0, breathe = 0, about = [.5, 1] } = {}) {
+ const k = h / H * s, ax = about[0] * W, ay = about[1] * H;
+ all.setAttribute('transform', `translate(${(x - (.5 - about[0]) * W * k).toFixed(1)},${(y - (1 - about[1]) * H * k).toFixed(1)}) rotate(${r.toFixed(2)}) scale(${k.toFixed(4)},${(k * (1 + breathe)).toFixed(4)}) translate(${-ax},${-ay})`);
+ turn(fore, f); turn(hind, hd); turn(trunk, tr);
+ }
+ pose();
+ return { g: wrap, all, pose, at: (u, v) => [u * W, v * H] };
+}
+
+// the elephant down: his own silhouette toppled over on its side, the legs thrust out stiffly, the head low on the left;
+// one rim round it (PUP's filter, boiling). pose({ x, y, h, breathe }): (x, y) where his side meets the ground, h the
+// size, breathe lifts the great mound of his side. heart(): a point over his heart, on stage.
+function lyingElephant(p, D) {
+ const S = SHAPES.elephant, wrap = G(p, {}); wrap.setAttribute('filter', 'url(#pupRim0)'); clockRun(tt => PUP.boilAt(wrap, tt), D, { tail: true });
+ const all = mk('g', {}, wrap);
+ mk('path', { d: S.d, fill: CARD, 'fill-rule': 'evenodd', transform: `translate(${-S.w / 2},${-S.h / 2})` }, all);
+ const A = 168 * Math.PI / 180, SY = .78;
+ let cur = { x: 800, y: 760, k: .3, b: 0 };
+ function pose({ x = 800, y = 760, h = 300, breathe = 0 } = {}) {
+ const k = h / S.h; cur = { x, y, k, b: breathe };
+ // the shape's middle sits half a body above the ground
+ all.setAttribute('transform', `translate(${x},${(y - S.h * k * SY * .42).toFixed(1)}) rotate(168) scale(${(-k).toFixed(4)},${(k * SY * (1 + breathe)).toFixed(4)})`);
+ }
+ // a point (u, v) of the shape (0..1 of its box), on stage, for the current pose
+ const at = (u, v) => {
+ const lx = -(u - .5) * S.w * cur.k, ly = (v - .5) * S.h * cur.k * SY * (1 + cur.b);
+ return [cur.x + lx * Math.cos(A) - ly * Math.sin(A), cur.y - S.h * cur.k * SY * .42 + lx * Math.sin(A) + ly * Math.cos(A)];
+ };
+ pose();
+ return { g: wrap, pose, heart: () => at(.4, .45) };
+}
+
+// the bullet holes, drawn on each photograph in the same place (in front of the ear-hole, where he aimed) so that every
+// picture agrees: one after the first shot, two after the second, three after the third, each with a thin red trickle.
+// WOUND: that place in each picture (0..1 of the picture inside its print border)
+const WOUND = { 'elephant-side': [.39, .41], 'e-gasp-blood': [.3, .4], 'e-down-blood': [.22, .5], 'e-stricken': [.33, .315], 'e-knees': [.33, .36], 'e-rise': [.33, .37], 'e-topple': [.35, .31], 'e-down': [.22, .5], 'e-gasp': [.3, .4] };
+// where the reader's head shots landed, as offsets from WOUND's place in the picture they were fired at (fractions of the
+// picture, held near the head so that the holes stay on him in the other poses); empty in the video: a default spread
+const HITS = [];
+function woundDefs() {
+ if (document.getElementById('woundRag')) return; // once: a ragged edge for holes and drips, and a soft damp halo
+ const d = mk('defs', {}, document.getElementById('stage'));
+ const f = mk('filter', { id: 'woundRag', x: '-50%', y: '-50%', width: '200%', height: '200%' }, d);
+ mk('feTurbulence', { type: 'fractalNoise', baseFrequency: .9, numOctaves: 2, seed: 7, result: 'n' }, f);
+ mk('feDisplacementMap', { in: 'SourceGraphic', in2: 'n', scale: 3.5, result: 'r' }, f);
+ mk('feGaussianBlur', { in: 'r', stdDeviation: .45 }, f);
+ const h = mk('filter', { id: 'woundHalo', x: '-100%', y: '-100%', width: '300%', height: '300%' }, d);
+ mk('feGaussianBlur', { stdDeviation: 2.4 }, h);
+}
+// one bullet hole at (x, y) in a print's own coordinates, u = one stage pixel of an 800-high print; seed i, so the same
+// hole looks the same wherever it is drawn
+function hole(box, x, y, i, u) {
+ const R = rng(4711 + i * 97);
+ mk('ellipse', { cx: x, cy: y + 2 * u, rx: 7 * u, ry: 8 * u, fill: '#3b2a24', opacity: .55, filter: 'url(#woundHalo)' }, box);
+ const runs = 2 + Math.floor(R() * 2);
+ for (let r = 0; r < runs; r++) { // the blood running down: thin runs, uneven, tapering, wandering a little
+ const px = x + (R() - .5) * 3 * u, py = y + 2 * u, w = (1.6 + R() * 1.2) * u, len = (14 + R() * 26) * u;
+ let left = '', right = '';
+ for (let s_ = 0; s_ <= 8; s_++) {
+ const q = s_ / 8, ww = w * (1 - .85 * q) * (.8 + .4 * R()), yy = py + len * q, xx = px + Math.sin(q * 3 + r * 2) * 1.6 * u + (R() - .5) * .8 * u;
+ left += `${s_ ? 'L' : 'M'}${(xx - ww / 2).toFixed(1)} ${yy.toFixed(1)}`; right = `L${(xx + ww / 2).toFixed(1)} ${yy.toFixed(1)}` + right;
+ }
+ mk('path', { d: left + right + 'Z', fill: '#2a120d', opacity: .82, filter: 'url(#woundRag)' }, box);
+ mk('circle', { cx: px + Math.sin(3 + r * 2) * 1.6 * u, cy: py + len + .6 * u, r: w * .35, fill: '#2a120d', opacity: .8 }, box);
+ }
+ let hd = '';
+ const rr = 3.2 * u; // the hole: a ragged dark opening, its torn rim a little lighter
+ for (let a = 0; a < 12; a++) { const ang = a / 12 * 2 * Math.PI, rad = rr * (.75 + R() * .5); hd += `${a ? 'L' : 'M'}${(x + rad * Math.cos(ang)).toFixed(1)} ${(y + rad * .85 * Math.sin(ang)).toFixed(1)}`; }
+ mk('path', { d: hd + 'Z', fill: '#4a332b', opacity: .7, transform: `translate(${x},${y}) scale(1.45) translate(${-x},${-y})`, filter: 'url(#woundRag)' }, box);
+ mk('path', { d: hd + 'Z', fill: '#0b0605', filter: 'url(#woundRag)' }, box);
+}
+function wounds(g, name, n) {
+ woundDefs();
+ const [W, H] = ART[name], k = g._w / W, [fx, fy] = WOUND[name], u = k * 1.9, iw = (W - 112) * k, ih = (H - 112) * k;
+ const box = mk('g', { style: 'mix-blend-mode:multiply' }, g);
+ for (let i = 0; i < n; i++) {
+ const hit = HITS[i], x = (fx - .5) * iw + (hit ? hit[0] * iw : i * 13 * u), y = (fy - .5) * ih + (hit ? hit[1] * ih : -(i % 2) * 8 * u);
+ hole(box, x, y, i, u);
+ }
+ return g;
+}
+// a print that breathes: the picture's group rises and falls about the ground line, slowly, like a heaving side
+function breathing(g, D, { amp = .012, period = 2, y0 = 760 } = {}) {
+ const inner = mk('g', {}, g.parentNode); inner.appendChild(g);
+ clockRun(tt => { const b = amp * Math.max(0, Math.sin(tt * Math.PI * 2 / period)); inner.setAttribute('transform', `translate(0,${y0}) scale(1,${(1 + b).toFixed(4)}) translate(0,${-y0})`); }, D, { tail: true });
+ return inner;
+}
+// a shot felt in the picture: a quick jolt of the whole panel
+function jolt(p, t, a = 14) { clockRun(tt => { const q = tt - t; if (q < 0 || q > .5) return; put(p, { x: a * Math.exp(-q * 9) * Math.sin(q * 70), y: a * .5 * Math.exp(-q * 9) * Math.sin(q * 53) }); }, t + .6); } // (its length counts in the beat's: keep it short)
+// the sight on a photograph: the picture placed big inside the scope's circle, the point (fx, fy) of it under the cross
+function scopeOn(p, name, fx, fy, h = 1500, opts, n = 0) {
+ return scope(p, a => { const g = pic(a, name, { x: 800, y: 450, h }), [sx, sy] = spot(g, name, fx, fy); put(g, { x: 800 + SCOPE.x - sx, y: 450 + SCOPE.y - sy }); if (n) wounds(g, name, n); a.shot = { g, name, n }; }, opts);
+}
+// the view through the rifle's telescopic sight: a circle cut in the dark, cross-hairs, and inside it whatever `fill`
+// draws into `view`; `aim` is the group the reader's mouse moves while the page waits for the shot
+const SCOPE = { x: 800, y: 430, r: 330 };
+function scope(p, fill, { small = false } = {}) {
+ const g = G(p, {}), id = 'scope' + (scope.n = (scope.n || 0) + 1);
+ mk('circle', { cx: SCOPE.x, cy: SCOPE.y, r: SCOPE.r }, mk('clipPath', { id }, mk('defs', {}, g)));
+ const view = G(mk('g', { 'clip-path': `url(#${id})` }, g), {});
+ mk('rect', { x: 0, y: 0, width: 1600, height: 900, fill: '#7d8277' }, view);
+ const aim = G(view, {});
+ fill(aim);
+ const { x, y, r } = SCOPE;
+ mk('path', { d: `M-200 -200H1800V1100H-200Z M${x - r} ${y}a${r} ${r} 0 1 0 ${2 * r} 0a${r} ${r} 0 1 0 ${-2 * r} 0Z`, fill: '#040805', 'fill-rule': 'evenodd' }, g);
+ const ink = { stroke: '#0b0b0b', fill: 'none' };
+ if (small) { // the small rifle's plain post and notch
+ mk('path', { d: `M${x - r} ${y + 120}H${x + r}M${x} ${y + 120}V${y + 12}`, 'stroke-width': 7, ...ink }, g);
+ } else {
+ mk('path', { d: `M${x - r} ${y}H${x - 26}M${x + 26} ${y}H${x + r}M${x} ${y - r}V${y - 26}`, 'stroke-width': 2, ...ink }, g);
+ mk('path', { d: `M${x - r} ${y}H${x - 150}M${x + 150} ${y}H${x + r}M${x} ${y + r}V${y + 18}`, 'stroke-width': 9, ...ink }, g);
+ }
+ mk('circle', { cx: x, cy: y, r: r - 2, 'stroke-width': 6, stroke: '#000', fill: 'none' }, g);
+ window.CURRENT_SCOPE = aim;
+ return g;
+}
+
+// a shot the reader fires: the beat's ask. While the page waits (after the narration), the mouse moves the view under the
+// cross-hairs and a line says how to fire; each click (or Space, Enter) fires: a flash, the bang at once; after n shots
+// the film goes on. The next beat opens with the same bang for the video, which the page silences when it was fired here.
+const LIVE = {};
+function fireAsk(n, next, { small = false, head } = {}) {
+ return done => {
+ const i = P.i, stage = document.getElementById('stage');
+ let fired = 0, ox = 0, oy = 0, tx = 0, ty = 0, alive = true;
+ const hint = mk('text', { x: 800, y: 870, 'text-anchor': 'middle', 'font-family': SER, 'font-style': 'italic', 'font-size': 34, fill: CREAM, opacity: 0 }, stage);
+ hint.textContent = n > 1 ? `click to fire · ${n} shots` : 'click to fire';
+ const flash = mk('rect', { x: 0, y: 0, width: 1600, height: 900, fill: '#fff8e8', opacity: 0, 'pointer-events': 'none' }, stage);
+ const shotSnd = `audio/sfx/${small ? 'rifle-small' : 'rifle'}.mp3`;
+ const clamp1 = v => Math.max(-1, Math.min(1, v));
+ // how far the picture can be moved and still fill the sight (its print border, about 40 px, kept out too); the mouse,
+ // anywhere in the window, maps onto that range, so the aim never runs off the picture
+ let room = null;
+ const measure = () => {
+ const a = window.CURRENT_SCOPE, bb = a && a.getBBox(), r = SCOPE.r, m_ = 40;
+ if (!bb || !bb.width) return [[0, 0], [0, 0]];
+ const span = (lo, size, c) => { const a0 = c + r - (lo + size) + m_, a1 = c - r - lo - m_; return a0 <= a1 ? [a0, a1] : [0, 0]; };
+ return [span(bb.x, bb.width, SCOPE.x), span(bb.y, bb.height, SCOPE.y)];
+ }; // measured while waiting, when the sight's picture is in place
+ const move = e => { // the whole window: leaving the player holds the aim at its edge
+ if (!P.waiting) return;
+ if (!room || !(room[0][1] - room[0][0] + room[1][1] - room[1][0])) room = measure();
+ const b = stage.getBoundingClientRect(), mx = clamp1(((e.clientX - b.left) / b.width - .5) * 2), my = clamp1(((e.clientY - b.top) / b.height - .5) * 2);
+ tx = (room[0][0] + room[0][1]) / 2 - mx * (room[0][1] - room[0][0]) / 2; ty = (room[1][0] + room[1][1]) / 2 - my * (room[1][1] - room[1][0]) / 2;
+ };
+ const fire = () => {
+ if (!alive || P.i !== i || !P.waiting) return;
+ fired++;
+ const a = new Audio(shotSnd); a.volume = Math.min(1, +($('volume')?.value ?? 1)); a.play().catch(() => {});
+ flash.animate([{ opacity: .8 }, { opacity: 0 }], { duration: 260, easing: 'ease-out' });
+ const sc = window.CURRENT_SCOPE?.shot;
+ if (sc) { // where the cross-hairs are on the picture, in the picture's own coordinates
+ const st = stage.getScreenCTM(), gm = sc.g.getScreenCTM(), pt = stage.createSVGPoint(); pt.x = SCOPE.x; pt.y = SCOPE.y;
+ const q = pt.matrixTransform(st).matrixTransform(gm.inverse()), [W, H] = ART[sc.name], k = sc.g._w / W, iw = (W - 112) * k, ih = (H - 112) * k;
+ woundDefs(); hole(mk('g', { style: 'mix-blend-mode:multiply' }, sc.g), q.x, q.y, (head ?? 3) + fired, k * 1.9);
+ if (head !== undefined && WOUND[sc.name]) {
+ const [ax, ay] = WOUND[sc.name], c = v => Math.max(-.07, Math.min(.07, v));
+ HITS[head] = [c(q.x / iw + .5 - ax), c(q.y / ih + .5 - ay)];
+ }
+ }
+ if (window.CURRENT_SCOPE) window.CURRENT_SCOPE.animate([{ transform: `translate(${ox}px,${oy - 40}px)` }, { transform: `translate(${ox}px,${oy}px)` }], { duration: 220 });
+ if (fired >= n) { LIVE[next] = true; cleanup(); setTimeout(() => { if (P.i === i) done(); }, small ? 250 : 500); }
+ };
+ const key = e => { if ((e.key === ' ' || e.key === 'Enter') && P.waiting && P.i === i) { e.preventDefault(); e.stopPropagation(); fire(); } };
+ const cleanup = () => { alive = false; stage.style.cursor = ''; stage.removeEventListener('click', fire); removeEventListener('pointermove', move); removeEventListener('keydown', key, true); hint.remove(); setTimeout(() => flash.remove(), 400); };
+ stage.addEventListener('click', fire); addEventListener('pointermove', move); addEventListener('keydown', key, true);
+ const tick = () => {
+ if (!alive) return;
+ if (P.i !== i) { cleanup(); return; } // a seek away
+ stage.style.cursor = P.waiting ? 'none' : ''; // while he aims, the cross-hairs are the cursor
+ if (P.waiting) {
+ hint.setAttribute('opacity', .9);
+ ox += (tx - ox) * .2; oy += (ty - oy) * .2;
+ const br = performance.now() / 1000, bx = 5 * Math.sin(br * 1.5), by = 7 * Math.sin(br * 1.1);
+ window.CURRENT_SCOPE?.setAttribute('transform', `translate(${(ox + bx).toFixed(1)},${(oy + by).toFixed(1)})`);
+ }
+ requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ };
+}
+// the bang that opens a beat after a shot (silent on the page when the reader fired it there)
+function openingShots(id, times, small = false) {
+ times.forEach(t => sfx(id, t, small ? 'rifle-small' : 'rifle', LIVE[id] ? 0 : 2));
+ if (!LIVE[id]) times.forEach(() => {});
+}
+// a flash on the beat clock (for the video, and the page when the shot came from the previous beat)
+function flashAt(p, t, live) { if (live) return; const f = put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#fff8e8' }, p), { o: 0 }); tw(f, { o: .8 }, t, .03, lin); tw(f, { o: 0 }, t + .05, .3, out); }
+// the ground of the shooting: a paddy field drawn as lines, a road at the foot
+function paddy(p, GY) {
+ const g = G(p, {});
+ line(g, `M0 ${GY}H1600`, 0, .01, 2, { opacity: .5 });
+ const R = rng(55);
+ for (let x = -20; x < 1620; x += 50 + R() * 50) mk('path', { d: `M${x} ${GY}l-5 -${10 + R() * 12}M${x} ${GY}l3 -${12 + R() * 10}M${x} ${GY}l10 -${8 + R() * 8}`, stroke: CREAM, 'stroke-width': 2, opacity: .4 }, g);
+ return g;
+}
+// the town as a police plan: the Salween on the west, the Strand and the main roads along it, blocks of houses, the
+// pagoda ridge on the east, the police station at the north end, my bungalow at the south end, and the telephone wire
+// between them on its poles. Draws itself on from t0; returns the page and the wire's points (page coordinates)
+function townPlan(p, t0, D) {
+ const PEN = INK, rnd = rng(1852);
+ const page = G(p, { x: 0, y: 30, o: 0 }), sheet = mk('g', { transform: 'rotate(1 800 450)' }, page);
+ tw(page, { y: 0, o: 1 }, t0, .45, out);
+ mk('rect', { x: 84, y: 54, width: 1452, height: 812, fill: '#000', opacity: .35 }, sheet);
+ mk('rect', { x: 70, y: 40, width: 1452, height: 812, fill: PAPER }, sheet);
+ mk('path', { d: 'M70 446H1522', stroke: PEN, 'stroke-width': 1.2, opacity: .12 }, sheet);
+ mk('rect', { x: 86, y: 56, width: 1420, height: 780, fill: 'none', stroke: PEN, 'stroke-width': 2, opacity: .55 }, sheet);
+ const ink = (d, w = 2, extra = {}, host = sheet) => mk('path', { d, fill: 'none', stroke: PEN, 'stroke-width': w, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', ...extra }, host);
+ const drawOn = (e, at, dur) => { const L = e.getTotalLength(); e.setAttribute('stroke-dasharray', `${L} ${L}`); e.setAttribute('stroke-dashoffset', L); prog(q => e.setAttribute('stroke-dashoffset', L * (1 - q)), at, dur, io); };
+ const write = (str, x, y, at, { size = 22, italic = true, font = SER, anchor = 'start', fill = PEN, ls, rot = 0, host = sheet } = {}) => {
+ const h = rot ? mk('g', { transform: `rotate(${rot} ${x} ${y})` }, host) : host;
+ const e = T(h, str, { x, y, size, font, weight: 400, fill, anchor, o: 0 });
+ if (italic) e.setAttribute('font-style', 'italic');
+ if (ls) e.setAttribute('letter-spacing', ls);
+ show(e, at, .35); return e;
+ };
+ const TYPE = '"Courier New", Courier, monospace';
+ write('BURMA POLICE · MOULMEIN TOWN', 1490, 96, t0 + .3, { size: 22, italic: false, font: TYPE, anchor: 'end' });
+ write('PLAN · telephone line, police station to S.D.P.O.', 1490, 126, t0 + .35, { size: 18, italic: false, font: TYPE, anchor: 'end' });
+ ink('M1050 140H1490', 1.2, { opacity: .5 });
+
+ // the river Salween, along the west side: its bank, water drawn in short level strokes, an island, two steamers
+ const bank = x => 330 + 26 * Math.sin(x / 140) + 12 * Math.sin(x / 47); // the bank's x for a y
+ let bd = ''; for (let y = 56; y <= 836; y += 12) bd += `${y > 56 ? 'L' : 'M'}${bank(y).toFixed(1)} ${y}`;
+ drawOn(ink(bd, 2.6), t0 + .2, .6);
+ const water = G(sheet, { o: 0 });
+ for (let y = 70; y < 830; y += 14) for (let x = 100 + (y % 28 ? 14 : 0); x < bank(y) - 30; x += 46 + rnd() * 20)
+ mk('path', { d: `M${x} ${y}h${16 + rnd() * 14}`, stroke: PEN, 'stroke-width': 1.1, opacity: .45 }, water);
+ show(water, t0 + .5, .5);
+ ink('M96 600C120 560 170 548 200 570C220 600 190 660 150 690C120 700 100 670 96 640', 1.8, { fill: PAPER }); // an island
+ write('Bilu Kyun', 112, 712, t0 + .9, { size: 18 });
+ for (const [x, y] of [[190, 260], [150, 420]]) { // steamers at anchor
+ const g = G(sheet, { o: 0 });
+ mk('path', { d: `M${x - 34} ${y}h68l-10 12h-48Z`, fill: PEN }, g); mk('path', { d: `M${x - 6} ${y}v-16h12v16`, fill: PEN }, g);
+ mk('path', { d: `M${x + 3} ${y - 18}q8 -10 20 -8`, fill: 'none', stroke: PEN, 'stroke-width': 1.4, opacity: .6 }, g);
+ show(g, t0 + .8, .2);
+ }
+ write('R. SALWEEN', 206, 520, t0 + .9, { size: 20, italic: false, font: KEY, ls: '.45em', rot: -84 });
+ for (const y of [180, 330, 480, 720]) ink(`M${bank(y)} ${y}h-44M${bank(y) - 44} ${y - 6}v12`, 2.2); // jetties
+
+ // the roads: the Strand along the bank, two main roads behind it, cross streets
+ const along_ = (dx) => { let d = ''; for (let y = 60; y <= 832; y += 16) d += `${y > 60 ? 'L' : 'M'}${(bank(y) + dx).toFixed(1)} ${y}`; return d; };
+ const roads = [[30, 'STRAND ROAD'], [260, 'LOWER MAIN ROAD'], [520, 'UPPER MAIN ROAD']];
+ roads.forEach(([dx, name], i) => {
+ for (const o of [-8, 8]) drawOn(ink(along_(dx + o), 1.8), t0 + .4 + i * .1, .7);
+ write(name, bank(330) + dx + 18, 330, t0 + 1.1, { size: 14, italic: false, font: KEY, ls: '.35em', rot: 86 });
+ });
+ const cross = [130, 250, 370, 500, 620, 750];
+ cross.forEach((y, i) => drawOn(ink(`M${bank(y) + 22} ${y}L${bank(y) + 1120} ${y + 6}`, 1.6), t0 + .6 + i * .05, .6));
+ // the blocks: little houses seen from above, crowded near the Strand, thinning towards the ridge
+ const houses = G(sheet, {});
+ for (let r = 0; r < cross.length - 1; r++) for (let c = 0; c < 3; c++) {
+ const x0 = bank(cross[r]) + [46, 276, 536][c], x1 = bank(cross[r]) + [246, 506, 860][c], y0 = cross[r] + 14, y1 = cross[r + 1] - 12;
+ const dens = [1, .7, .35][c];
+ for (let y = y0; y < y1 - 12; y += 22) for (let x = x0; x < x1 - 16; x += 24) {
+ if (rnd() > dens) continue;
+ const w = 12 + rnd() * 9, h = 10 + rnd() * 7, b = mk('rect', { x: x + rnd() * 4, y: y + rnd() * 3, width: w, height: h, fill: rnd() < .55 ? PEN : PAPER, stroke: PEN, 'stroke-width': 1.2, opacity: .8 }, houses);
+ put(b, { o: 0 }); show(b, t0 + .7 + (y - 60) / 780 * .6 + rnd() * .1, .12, lin);
+ }
+ }
+ // the pagoda ridge on the east: hachures down its slopes, stupas along the crest, the great one named
+ const ridgeX = y => 1310 + 40 * Math.sin(y / 120);
+ const hach = G(sheet, { o: 0 });
+ for (let y = 70; y < 830; y += 9) { const x = ridgeX(y); mk('path', { d: `M${x - 14} ${y}l-${30 + rnd() * 30} ${4 + rnd() * 4}M${x + 14} ${y}l${24 + rnd() * 26} ${3 + rnd() * 4}`, stroke: PEN, 'stroke-width': 1.1, opacity: .45 }, hach); }
+ show(hach, t0 + .9, .6);
+ for (const y of [170, 300, 420, 560, 680]) {
+ const x = ridgeX(y), big = y === 420, k = big ? 1.6 : 1, g = G(sheet, { o: 0 });
+ mk('path', { d: `M${x - 14 * k} ${y}h${28 * k}l-${4 * k} -${8 * k}C${x + 9 * k} ${y - 20 * k} ${x + 5 * k} ${y - 26 * k} ${x} ${y - 40 * k}C${x - 5 * k} ${y - 26 * k} ${x - 9 * k} ${y - 20 * k} ${x - 10 * k} ${y - 8 * k}Z`, fill: PEN }, g);
+ mk('path', { d: `M${x} ${y - 40 * k}v-${12 * k}`, stroke: PEN, 'stroke-width': 1.6 }, g);
+ show(g, t0 + 1.1 + y / 2000, .2);
+ }
+ write('Kyaikthanlan Pagoda', ridgeX(420) + 30, 432, t0 + 1.3, { size: 20 });
+ write('PAGODA RIDGE', ridgeX(640) - 10, 760, t0 + 1.3, { size: 16, italic: false, font: KEY, ls: '.35em', anchor: 'middle' });
+
+ // the police station at the north end, with its flag, and my bungalow at the south end, at the foot of the ridge
+ const ST = [bank(98) + 150, 98], ME = [ridgeX(780) - 120, 790];
+ const st = G(sheet, { o: 0 });
+ mk('rect', { x: ST[0] - 34, y: ST[1] - 18, width: 68, height: 36, fill: PEN }, st);
+ mk('path', { d: `M${ST[0] + 26} ${ST[1] - 18}v-34`, stroke: PEN, 'stroke-width': 2 }, st);
+ mk('path', { d: `M${ST[0] + 27} ${ST[1] - 52}l22 6-22 7Z`, fill: STAMP }, st);
+ show(st, t0 + 1.2, .25);
+ write('Police Station', ST[0] + 60, ST[1] + 2, t0 + 1.3, { size: 24 });
+ write('the sub-inspector', ST[0] + 60, ST[1] + 30, t0 + 1.4, { size: 20, fill: STAMP });
+ const me = G(sheet, { o: 0 });
+ mk('path', { d: `M${ME[0] - 30} ${ME[1] + 14}V${ME[1] - 8}L${ME[0]} ${ME[1] - 28}L${ME[0] + 30} ${ME[1] - 8}V${ME[1] + 14}Z`, fill: PAPER, stroke: PEN, 'stroke-width': 2.4 }, me);
+ mk('path', { d: `M${ME[0] - 40} ${ME[1] - 4}L${ME[0]} ${ME[1] - 34}L${ME[0] + 40} ${ME[1] - 4}`, fill: 'none', stroke: PEN, 'stroke-width': 2.4 }, me);
+ show(me, t0 + 1.3, .25);
+ write('S.D.P.O.’s bungalow', ME[0] - 44, ME[1] + 40, t0 + 1.4, { size: 22, anchor: 'end' });
+ write('me', ME[0] + 44, ME[1] + 6, t0 + 1.5, { size: 26, fill: HOT });
+
+ // the telephone wire on its poles: down Lower Main Road, along the last cross street, to the bungalow
+ const wy = y => bank(y) + 260 + 16;
+ const wire = [[ST[0] + 34, ST[1]], [wy(130), 130], [wy(250), 250], [wy(370), 370], [wy(500), 500], [wy(620), 620], [wy(750), 750], [ME[0] - 60, 760], [ME[0] - 30, ME[1] - 4]];
+ const wd = 'M' + wire.map(q => q.map(v => v.toFixed(1)).join(' ')).join('L');
+ drawOn(ink(wd, 1.4, { 'stroke-dasharray': '3 5' }), t0 + 1.4, .8);
+ const poles = G(sheet, { o: 0 });
+ for (let q = 0; q <= 1; q += .04) { const [x, y] = along(wire, q); mk('path', { d: `M${x - 6} ${y - 4}h12M${x} ${y - 4}v8`, stroke: PEN, 'stroke-width': 1.6 }, poles); }
+ show(poles, t0 + 1.6, .4);
+ // compass and scale
+ const cp = G(sheet, { o: 0 }); cp.setAttribute('transform', 'translate(1440,240)');
+ mk('path', { d: 'M0 -40L9 0L0 40L-9 0Z', fill: 'none', stroke: PEN, 'stroke-width': 2 }, cp);
+ mk('path', { d: 'M0 -40L9 0H-9Z', fill: PEN }, cp);
+ T(cp, 'N', { y: -50, size: 22, font: KEY, weight: 600, fill: PEN, anchor: 'middle' });
+ show(cp, t0 + 1.2, .3);
+ const sc = G(sheet, { o: 0 });
+ for (let i = 0; i < 4; i++) mk('rect', { x: 1260 + i * 50, y: 806, width: 50, height: 8, fill: i % 2 ? PAPER : PEN, stroke: PEN, 'stroke-width': 1.4 }, sc);
+ T(sc, '0', { x: 1260, y: 798, size: 15, font: SER, fill: PEN, anchor: 'middle' });
+ T(sc, '½ mile', { x: 1460, y: 798, size: 15, font: SER, fill: PEN, anchor: 'middle' });
+ show(sc, t0 + 1.3, .3);
+ return { page, sheet, wire, ME };
+}
+// a page of a police report: a sketch plan of the quarter, the road and the paddy, drawn in ink on cream paper and laid
+// on the ground slightly askew. Everything draws itself on from t0; returns the page's groups and the places the action
+// needs (the huts, the path, the elephant), in the page's own coordinates (the stage's, before the page's tilt)
+function sketchPlan(p, t0, tPaddy, tYards, D) {
+ const PEN = INK, RED = HOT, rnd = rng(1926);
+ const page = G(p, { x: 0, y: 30, o: 0 }), sheet = mk('g', { transform: 'rotate(-1.2 800 450)' }, page);
+ tw(page, { y: 0, o: 1 }, t0, .5, out);
+ mk('rect', { x: 84, y: 54, width: 1452, height: 812, fill: '#000', opacity: .35 }, sheet); // its shadow
+ mk('rect', { x: 70, y: 40, width: 1452, height: 812, fill: PAPER }, sheet);
+ mk('path', { d: 'M796 40V852', stroke: PEN, 'stroke-width': 1.2, opacity: .12 }, sheet); // where it was folded
+ mk('rect', { x: 86, y: 56, width: 1420, height: 780, fill: 'none', stroke: PEN, 'stroke-width': 2, opacity: .55 }, sheet);
+ const ink = (d, w = 2.4, extra = {}) => mk('path', { d, fill: 'none', stroke: PEN, 'stroke-width': w, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', ...extra }, sheet);
+ const drawOn = (e, at, dur) => { const L = e.getTotalLength(); e.setAttribute('stroke-dasharray', `${L} ${L}`); e.setAttribute('stroke-dashoffset', L); prog(q => e.setAttribute('stroke-dashoffset', L * (1 - q)), at, dur, io); };
+ const write = (str, x, y, at, { size = 26, italic = true, font = SER, anchor = 'start', fill = PEN, r = 0, ls } = {}) => {
+ const e = T(sheet, str, { x, y, size, font, weight: 400, fill, anchor, o: 0 });
+ if (italic) e.setAttribute('font-style', 'italic');
+ if (ls) e.setAttribute('letter-spacing', ls);
+ show(e, at, .4); return e;
+ };
+ const TYPE = '"Courier New", Courier, monospace';
+ // the typed head of the form, and the officer's stamp
+ write('BURMA POLICE · MOULMEIN DISTRICT', 1490, 96, t0 + .5, { size: 22, italic: false, font: TYPE, anchor: 'end' });
+ write('SKETCH PLAN · not to scale', 1490, 126, t0 + .6, { size: 22, italic: false, font: TYPE, anchor: 'end' });
+ ink('M1120 140H1490', 1.2, { opacity: .5 });
+ const stamp = G(sheet, { o: 0 }); stamp.setAttribute('transform', 'rotate(-14 1380 230)');
+ mk('circle', { cx: 1380, cy: 230, r: 52, fill: 'none', stroke: STAMP, 'stroke-width': 4, opacity: .8 }, stamp);
+ mk('circle', { cx: 1380, cy: 230, r: 42, fill: 'none', stroke: STAMP, 'stroke-width': 1.5, opacity: .8 }, stamp);
+ T(stamp, 'S.D.P.O.', { x: 1380, y: 240, size: 24, font: KEY, weight: 600, fill: STAMP, anchor: 'middle' });
+ tw(stamp, { o: .85 }, t0 + 1.1, .08, lin);
+
+ // the hill: closed contours round a summit, and hachures down its slopes between them
+ const C = [330, 250], ring = (k, a) => { const r = 55 + 48 * k; return [C[0] + 1.55 * r * (1 + .14 * Math.sin(2 * a + 1) + .07 * Math.sin(3 * a + k)) * Math.cos(a), C[1] + .9 * r * (1 + .12 * Math.sin(2 * a + 2.3) + .06 * Math.sin(4 * a + k)) * Math.sin(a)]; };
+ for (let k = 0; k < 5; k++) {
+ let d = ''; for (let i = 0; i <= 72; i++) { const [x, y] = ring(k, i / 72 * 2 * Math.PI); d += `${i ? 'L' : 'M'}${x.toFixed(1)} ${y.toFixed(1)}`; }
+ const e = ink(d + 'Z', 1.4, { opacity: .55 });
+ drawOn(e, t0 + .4 + k * .12, .7);
+ }
+ const hach = G(sheet, { o: 0 });
+ for (let k = 0; k < 4; k++) for (let i = 0; i < 64; i++) {
+ const a = i / 64 * 2 * Math.PI + k * .05, [x0, y0] = ring(k + .12, a), [x1, y1] = ring(k + .78, a);
+ mk('path', { d: `M${x0.toFixed(1)} ${y0.toFixed(1)}L${x1.toFixed(1)} ${y1.toFixed(1)}`, stroke: PEN, 'stroke-width': 1.1, opacity: .35 + .1 * (3 - k) }, hach);
+ }
+ show(hach, t0 + 1.1, .8);
+ // the quarter on the hillside: huts as a map draws them, hipped roofs seen from above, the shaded side hatched;
+ // palms among them
+ const homes = [], H = G(sheet, {});
+ for (let i = 0; i < 26; i++) {
+ const a = rnd() * 2 * Math.PI, k = 1 + rnd() * 2.6, [x, y] = ring(k, a);
+ if (y > 420 || x < 120) { i--; continue; }
+ const w = 30 + rnd() * 14, h = 20 + rnd() * 6, ang = -20 + rnd() * 40, g = G(H, { o: 0 });
+ g.setAttribute('transform', `translate(${x.toFixed(1)},${y.toFixed(1)}) rotate(${ang.toFixed(1)})`);
+ const r = (w - h) / 2;
+ mk('path', { d: `M${-w / 2} ${-h / 2}H${w / 2}V${h / 2}H${-w / 2}Z`, fill: PAPER, stroke: PEN, 'stroke-width': 2 }, g);
+ mk('path', { d: `M${-w / 2} ${h / 2}L${-r} 0H${r}L${w / 2} ${h / 2}Z`, fill: PEN, opacity: .28 }, g);
+ mk('path', { d: `M${-w / 2} ${-h / 2}L${-r} 0L${-w / 2} ${h / 2}M${w / 2} ${-h / 2}L${r} 0L${w / 2} ${h / 2}M${-r} 0H${r}`, fill: 'none', stroke: PEN, 'stroke-width': 1.6 }, g);
+ show(g, t0 + 1 + i * .035, .15, lin);
+ homes.push([x, y]);
+ }
+ for (let i = 0; i < 9; i++) {
+ const [x, y] = ring(.8 + rnd() * 3.2, rnd() * 2 * Math.PI), g = G(sheet, { o: 0 });
+ let d = ''; for (let j = 0; j < 7; j++) { const a = j / 7 * 2 * Math.PI + rnd() * .3; d += `M${x} ${y}q${(9 * Math.cos(a + .6)).toFixed(1)} ${(9 * Math.sin(a + .6)).toFixed(1)} ${(17 * Math.cos(a)).toFixed(1)} ${(17 * Math.sin(a)).toFixed(1)}`; }
+ mk('path', { d, fill: 'none', stroke: PEN, 'stroke-width': 1.6 }, g); mk('circle', { cx: x, cy: y, r: 2.5, fill: PEN }, g);
+ show(g, t0 + 1.5 + i * .05, .2);
+ }
+ write('the quarter', 640, 118, t0 + 1.4, { size: 32 });
+ ink('M636 110q-40 -4 -70 22', 1.4);
+ // where the coolie lay: a cross, and a note
+ const [bx, by] = ring(3.3, 1.15);
+ ink(`M${bx - 11} ${by - 11}l22 22M${bx + 11} ${by - 11}l-22 22`, 3);
+ write('body of coolie', bx + 22, by + 30, t0 + 2.3, { size: 22 });
+ // the path down the hill, a double dashed line
+ const path = [[430, 380], [452, 430], [420, 470], [446, 512], [500, 548]];
+ const pd = 'M' + path.map(q => q.join(' ')).join('L');
+ for (const dx of [-5, 5]) { const e = ink(pd, 1.6, { transform: `translate(${dx},0)`, 'stroke-dasharray': '8 7' }); show(e, t0 + 1.9, .5); }
+ // the metalled road, a firm double line, named along its length
+ const road = 'M86 566C380 548 700 560 980 548S1360 538 1506 546';
+ for (const dy of [0, 22]) drawOn(ink(road, 2.6, { transform: `translate(0,${dy})` }), t0 + 1.6, .9);
+ write('METALLED ROAD', 1180, 530, t0 + 2.3, { size: 18, italic: false, font: KEY, ls: '.4em' });
+ // the compass and the scale
+ const cp = G(sheet, { o: 0 }); cp.setAttribute('transform', 'translate(1250,250)');
+ mk('path', { d: 'M0 -46L10 0L0 46L-10 0Z', fill: 'none', stroke: PEN, 'stroke-width': 2 }, cp);
+ mk('path', { d: 'M0 -46L10 0H-10Z', fill: PEN }, cp);
+ mk('path', { d: 'M-34 0H34', stroke: PEN, 'stroke-width': 1.2 }, cp);
+ T(cp, 'N', { y: -56, size: 24, font: KEY, weight: 600, fill: PEN, anchor: 'middle' });
+ show(cp, t0 + 2, .4);
+ const sc = G(sheet, { o: 0 });
+ for (let i = 0; i < 4; i++) mk('rect', { x: 130 + i * 60, y: 800, width: 60, height: 9, fill: i % 2 ? PAPER : PEN, stroke: PEN, 'stroke-width': 1.5 }, sc);
+ T(sc, '0', { x: 130, y: 790, size: 16, font: SER, fill: PEN, anchor: 'middle' });
+ T(sc, '100', { x: 250, y: 790, size: 16, font: SER, fill: PEN, anchor: 'middle' });
+ T(sc, '200 yds', { x: 370, y: 790, size: 16, font: SER, fill: PEN, anchor: 'middle' });
+ show(sc, t0 + 2.1, .4);
+ const notes = [['Tame elephant, gone ‘must’.', 0], ['Broke its chain in the night.', 1], ['Mahout twelve hours’ journey away.', 2], ['Destroyed a hut, killed a cow,', 3], ['raided fruit-stalls. One coolie killed.', 4]];
+ notes.forEach(([str, i]) => write(str, 860, 250 + i * 40, t0 + 2.4 + i * .18, { size: 27 }));
+ ink('M860 236H1160', 1, { opacity: .35 });
+ const key = G(sheet, { o: 0 });
+ mk('rect', { x: 1220, y: 340, width: 260, height: 150, fill: 'none', stroke: PEN, 'stroke-width': 1.5 }, key);
+ T(key, 'REFERENCES', { x: 1350, y: 368, size: 16, font: KEY, weight: 600, fill: PEN, anchor: 'middle' }).setAttribute('letter-spacing', '.25em');
+ mk('path', { d: 'M1240 384H1268V402H1240ZM1240 402L1248 393H1260L1268 402M1240 384L1248 393M1268 384L1260 393', fill: 'none', stroke: PEN, 'stroke-width': 1.6 }, key);
+ T(key, 'hut', { x: 1290, y: 400, size: 20, font: SER, fill: PEN });
+ mk('path', { d: 'M1244 420l16 16M1260 420l-16 16', stroke: PEN, 'stroke-width': 2.4 }, key);
+ T(key, 'body', { x: 1290, y: 436, size: 20, font: SER, fill: PEN });
+ mk('circle', { cx: 1254, cy: 466, r: 5, fill: PEN }, key);
+ T(key, 'persons', { x: 1290, y: 472, size: 20, font: SER, fill: PEN });
+ show(key, t0 + 2.6, .4);
+ // the paddy fields below the road: uneven plots between bunds, tufts of coarse grass, standing water
+ const plots = G(sheet, {});
+ const X = [560, 760, 965, 1170, 1380, 1500], Y = [610, 712, 820];
+ const jx = (i, j) => X[i] + (i > 0 && i < 5 ? (rnd() - .5) * 40 : 0) + j * 14, jy = (i, j) => Y[j] + (j === 1 ? (rnd() - .5) * 26 : 0);
+ const P = Y.map((_, j) => X.map((_, i) => [jx(i, j), jy(i, j)]));
+ let n = 0;
+ for (let j = 0; j < 2; j++) for (let i = 0; i < 5; i++) {
+ const [a, b, c, d] = [P[j][i], P[j][i + 1], P[j + 1][i + 1], P[j + 1][i]];
+ const e = ink(`M${a.join(' ')}L${b.join(' ')}L${c.join(' ')}L${d.join(' ')}Z`, 1.8, { opacity: .8 });
+ drawOn(e, tPaddy - .5 + n * .05, .5);
+ const cx = (a[0] + b[0] + c[0] + d[0]) / 4, cy = (a[1] + b[1] + c[1] + d[1]) / 4, g = G(plots, { o: 0 });
+ for (let k = 0; k < 4; k++) { const x = cx - 60 + rnd() * 120, y = cy - 22 + rnd() * 44; mk('path', { d: `M${x} ${y}l-5 -10M${x} ${y}v-12M${x} ${y}l5 -10`, stroke: PEN, 'stroke-width': 1.4, opacity: .7 }, g); }
+ if ((i + j) % 2) for (let k = 0; k < 3; k++) { const x = cx - 40 + k * 22, y = cy + 18 + k * 6; mk('path', { d: `M${x} ${y}q8 -4 16 0`, fill: 'none', stroke: PEN, 'stroke-width': 1.2, opacity: .6 }, g); }
+ show(g, tPaddy + n * .05, .3); n++;
+ }
+ write('paddy · unploughed, soggy from the first rains', 540, 700, tPaddy + .3, { size: 22, anchor: 'end' });
+ // the elephant, small, inked, and named
+ const S = SHAPES.elephant, k = 64 / S.h, E = [1160, 700];
+ const el = G(sheet, { o: 0 }); el.setAttribute('transform', `translate(${E[0] - S.w * k / 2},${E[1] - 64}) scale(${k})`);
+ mk('path', { d: S.d, fill: PEN, 'fill-rule': 'evenodd' }, el);
+ show(el, tPaddy + .4, .3);
+ write('the elephant', E[0] + 50, E[1] - 52, tPaddy + .6, { size: 26 });
+ ink(`M${E[0] + 48} ${E[1] - 60}q-20 -6 -26 6`, 1.4);
+ // "only a few hundred yards away": a red pencil line from the foot of the path to the elephant, an arrowhead, a note
+ const rd = `M500 572C640 640 860 690 ${E[0] - 50} ${E[1] - 26}`;
+ const redline = mk('path', { d: rd, fill: 'none', stroke: RED, 'stroke-width': 3.2, 'stroke-dasharray': '12 9', 'stroke-linecap': 'round' }, sheet);
+ put(redline, { o: 0 }); show(redline, tYards - .3, .5, lin);
+ const ah = mk('path', { d: `M${E[0] - 50} ${E[1] - 26}l-22 -4l8 14Z`, fill: RED }, sheet); put(ah, { o: 0 }); show(ah, tYards + .1, .2);
+ write('a few hundred yards', 760, 690, tYards, { size: 28, fill: RED });
+ return { page, sheet, homes, path, road: [[505, 576], [640, 574], [780, 571]] }; // down the middle of the road
+}
+// a rifle cartridge, drawn: the case, the shoulder, the bullet; base at (0, 0), about 250 tall
+function cartridge(p) {
+ mk('path', { d: 'M-20 0V-12H-17V-150L-12 -170V-185C-12 -215 -6 -235 0 -246C6 -235 12 -215 12 -185V-170L17 -150V-12H20V0Z', fill: CARD, stroke: CREAM, 'stroke-width': 4, 'paint-order': 'stroke', 'stroke-linejoin': 'round' }, p);
+ mk('path', { d: 'M-12 -185H12', stroke: CREAM, 'stroke-width': 2, opacity: .6 }, p);
+}
+const blackout = (p, o = 0) => put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#030604' }, p), { o });
+
+/* ---------- beats ----------
+ [id, title, run, extra]: id names audio/en/<id>.mp3 and its TIMINGS entry; m('mark') is the time a word is heard.
+ `pre` gives the picture (and music) seconds before the narration starts. */
+const BEATS = [
+ // Part 1, Moulmein: one take, told without a stop; each picture comes in on its sentence's first word (s2, s3 …)
+ // and is gone when the next sentence begins, so the picture keeps the voice's pace.
+ ['open', 'Moulmein', (m, D) => {
+ let p = panel(0);
+ const s = sight(p, 'elephant-side', 'sight0');
+ // the click fires: flash, the sight kicks up, black
+ const flash = put(mk('rect', { x: 0, y: 0, width: 1600, height: 900, fill: '#fff8e8' }, p), { o: 0 });
+ tw(flash, { o: .85 }, 0, .03, lin); tw(flash, { o: 0 }, .05, .25, out);
+ tw(s, { y: -70, r: -2.5, s: 1.04 }, 0, .07, out);
+ const b = blackout(p);
+ tw(b, { o: 1 }, .12, .06, lin);
+ hide(s, .2, .01, lin); hide(flash, .3, .01, lin); // gone behind the black, so it never shows again
+ // the title, in the black while the trumpet's echo dies away
+ const ti = key(p, 'Shooting an Elephant', 800, 440, 1.6, { size: 110, from: 0 });
+ const by = tag(p, 'George Orwell · 1936', 800, 520, 2.2, { anchor: 'middle', size: 36, fill: CREAM });
+ hide(ti, m('moulmein') - 1.6, .6); hide(by, m('moulmein') - 1.6, .6);
+
+ // "In Moulmein …": the town, alive (shot 1.2 of the film experiments), then laid down as a print on the ground
+ const t0 = m('moulmein') - 1.2;
+ const frame = G(p, { x: 800, y: 450 });
+ const border = put(mk('rect', { x: -820, y: -470, width: 1640, height: 940, fill: PAPER }, frame), { o: 0 });
+ clip(frame, 'moulmein-live', D, { x: 0, y: 0, at: t0, dur: 1.4 });
+ hide(b, t0 + 1.5, .01, lin); // the town fades in over the black; the ground is behind it from then on
+ const tDown = m('only') - .3; // the town holds the screen through "hated by large numbers of people"
+ tw(frame, { s: .56, x: 560, y: 470, r: -1.5 }, tDown, 1.2, soft);
+ show(border, tDown + .4, .5);
+ dateChip(p, '1926', 'Moulmein · Lower Burma', m('moulmein') + .3);
+ const crowd = pic(p, 'crowd', { x: 1150, y: 520, h: 470, r: 2.5, at: tDown + .9, from: [80, 0] });
+ push(crowd, tDown + 1, m('s2'), 1.04);
+ sfx('open', t0, 'moulmein-amb', 1.2);
+
+ // "I was sub-divisional police officer of the town."
+ let t = m('s2') - .2; p = cut(t);
+ const map = pic(p, 'map-burma', { x: 400, y: 450, h: 830, r: -1, at: t, from: [-60, 0], dur: .6 });
+ const [px, py] = spot(map, 'map-burma', .70, .65);
+ const pin = G(p, { x: px, y: py, o: 0 });
+ mk('circle', { r: 9, fill: '#1d3527' }, pin);
+ mk('circle', { r: 22, fill: 'none', stroke: '#1d3527', 'stroke-width': 4 }, pin);
+ show(pin, t + .4, .25);
+ line(p, `M${px + 24} ${py}H680`, t + .5, .35, 2.5);
+ key(p, 'Moulmein', 700, py + 18, t + .7, { size: 56, anchor: 'start' });
+ pic(p, 'orwell-passport', { x: 1250, y: 450, h: 520, r: -3, at: m('police') - .3, from: [60, 40], dur: .6 });
+ tag(p, 'Eric Blair — later George Orwell', 1250, 760, m('police') + .4, { anchor: 'middle', size: 32, fill: CREAM });
+
+ // "When a nimble Burman tripped me up on the football field …"
+ t = m('s3') - .2; p = cut(t);
+ const fb = pic(p, 'football', { x: 800, y: 450, h: 720, at: t, from: [0, 30], dur: .6 });
+ push(fb, t, m('ref') - .3, 1.06);
+ closeups(p, fb, 'football', [['ref', .89, .42, 'the referee', 3], ['laugh', .2, .42, 'the crowd', 2.2]], m, m('s4') - .5, { x: 800, y: 450 });
+ // "… looked the other way": close on him, he looks back over his shoulder and grins (the same photograph, altered)
+ const refGrin = pic(fb, 'football-grin', { x: 0, y: 0, h: 720, o: 0 });
+ show(refGrin, m('ref') + 1.6, .3, lin);
+ sfx('open', m('laugh') - .15, 'jeer', .6);
+
+ // "The young Buddhist priests were the worst of all."
+ t = m('s4') - .2; p = cut(t);
+ const mk1 = pic(p, 'monks', { x: 800, y: 450, h: 720, at: t, from: [0, 30], dur: .5 });
+ // "… were the worst of all": the smallest novice looks back and grins at him (the same photograph, altered)
+ const grin = pic(mk1, 'monks-turn', { x: 0, y: 0, h: 720, o: 0 });
+ show(grin, m('priests') + 1, .35, lin);
+ closeups(p, mk1, 'monks', [['priests', .3, .82, 'young priests', 2.8]], m, m('s5'));
+
+ // "I had already made up my mind that imperialism was an evil thing."
+ t = m('s5') - .2; p = cut(t);
+ const em = pic(p, 'map-empire', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .6 });
+ push(em, t, m('theo'), 1.05);
+ tag(p, 'Imperial Federation: the British Empire in 1886', 800, 880, t + .5, { anchor: 'middle', size: 24 });
+ tw(em, { o: .16 }, m('imp') - .3, .5);
+ key(p, 'Imperialism', 800, 470, m('imp') - .1, { size: 160 });
+ sayRed(p, ['an evil thing'], 800, 580, m('evil'), m('evil') + .7, { size: 58, anchor: 'middle' });
+
+ // "Theoretically — and secretly, of course — I was all for the Burmese and all against their oppressors, the British."
+ // and on into "All I knew was that I was stuck …": both sides are there from "Theoretically", and he slides in between
+ t = m('theo') - .2; p = cut(t);
+ say(p, ['Theoretically — and secretly, of course —'], 800, 110, m('theo'), m('for') - .3, { size: 44, anchor: 'middle', fill: COL.dim });
+ const side = G(p, {}); // the two sides, which give way to the next picture's while he stays
+ const bu = pic(side, 'burmese', { x: 380, y: 560, h: 520, r: -2, at: t + .1, from: [-60, 0], dur: .6, o: .35 });
+ const rj = pic(side, 'raj', { x: 1250, y: 540, w: 540, r: 1.5, at: t + .3, from: [60, 0], dur: .6, o: .35 });
+ keyRed(side, 'For', 380, 245, m('for'), { size: 120 });
+ tw(bu, { o: 1 }, m('for'), .4);
+ tag(side, 'the Burmese', 380, 860, m('for') + .5, { anchor: 'middle', size: 34, fill: CREAM });
+ keyRed(side, 'Against', 1220, 245, m('against'), { size: 120 });
+ tw(rj, { o: 1 }, m('against'), .4);
+ tag(side, 'the British — Government House, Rangoon', 1220, 780, m('british'), { anchor: 'middle', size: 34, fill: CREAM });
+ hide(side, m('empire') - 1.2, .5);
+ const POR = { x: 800, y: 470, h: 380 }; // his portrait: the same place here and in the next picture, where it tears
+ pic(p, 'orwell-passport', { ...POR, at: m('stuck') - .4, from: [0, 60], dur: .6 });
+
+ // "All I knew was that I was stuck between my hatred of the empire I served and my rage against … beasts …"
+ // and on through "One day …": the picture stays, and at the end it tears apart down the middle of him.
+ // It is built once in <defs> and shown twice, each half clipped by the same jagged line, so the halves can part.
+ // the same layout as the one before (the Burmese left, the British right, he in the middle, not moving): the new
+ // picture comes in at once over the old, and only its two sides change
+ t = m('empire') - .6; p = panel(t); put(p, { o: 0 }); show(p, t, .01, lin); // (built at the beat's start: hidden until then)
+ put(blackout(p), { o: 1 });
+ const defs = mk('defs', {}, p);
+ const all = G(mk('g', { id: 'torn' }, defs), {});
+ mk('rect', { x: -60, y: -60, width: 1720, height: 1020, fill: COL.board }, all); // each half carries its ground
+ const left = G(all, {}), right = G(all, {});
+ const mess = pic(right, 'raj-mess', { x: 1270, y: 460, h: 470, r: 1.5, at: m('empire') - .5, from: [80, 0], dur: .6, o: .45 });
+ key(right, 'Empire', 1270, 500, m('empire'), { size: 140 });
+ // the "little beasts": the jeering crowd as he felt it, in silhouette, no one's face; a crowd that grows, back row
+ // first, smaller and dimmer behind; each figure rocks with laughter on its own beat. The word stays in quotation
+ // marks: his word, not the film's
+ const rows = [[515, 280, .5, 9, 10, 610], [610, 320, .75, 7, 20, 600], [695, 350, 1, 5, 40, 570]]; // the front row's feet on the engraving's bottom edge
+ let k = 0;
+ const mob = G(left, {}); boil(mob, D); // one filter for the whole crowd: cheaper than one per figure
+ rows.forEach(([base, h, o, n, x0, x1]) => { for (let i = 0; i < n; i++) {
+ const x = x0 + (x1 - x0) * i / (n - 1) + ((k * 37) % 23 - 11);
+ shadow(mob, k % 8, x, base, h, m('empire') + 1 + k * .12, (k * .37) % 1, D, { o, flip: k % 3 === 1 });
+ k++;
+ } });
+ key(left, '“Beasts”', 310, 500, m('beasts'), { size: 140 });
+ const me = pic(all, 'orwell-passport', POR);
+ // the two sides close in on him until the sentence ends
+ tw(left, { x: 95 }, m('beasts'), m('one') - .4 - m('beasts'), soft);
+ tw(right, { x: -95 }, m('beasts'), m('one') - .4 - m('beasts'), soft);
+ // the tear: a jagged line down x = 800 (fixed seed, so every replay tears the same way)
+ const R = rng(1936), zig = [];
+ for (let y = -60; y <= 960; y += 34) zig.push([800 + (R() - .5) * 26, y]);
+ const pts = zig.map(([x, y]) => `${x.toFixed(1)} ${y}`).join(' L');
+ const halves = [`M-400 -60 L${pts} L-400 960Z`, `M2000 -60 L${pts} L2000 960Z`].map((d, i) => {
+ const cp = mk('clipPath', { id: `tear${i}` }, defs);
+ mk('path', { d }, cp);
+ const h = G(p, {});
+ mk('use', { href: '#torn', 'clip-path': `url(#tear${i})` }, h);
+ return h;
+ });
+ // until the crack, one whole copy covers the halves, so their seam never shows before it should
+ const whole = G(p, {});
+ mk('use', { href: '#torn' }, whole);
+ hide(whole, m('one') + .1, .01, lin);
+ // "One day": the crack opens a little; "enlightening": the halves come apart
+ tw(halves[0], { x: -7, r: -.4 }, m('one') + .1, .25, out); tw(halves[1], { x: 7, r: .4 }, m('one') + .1, .25, out);
+ tw(halves[0], { x: -980, r: -5, y: 40 }, m('enl') - .1, 1.3, io); tw(halves[1], { x: 980, r: 5, y: 40 }, m('enl') - .1, 1.3, io);
+ sfx('open', m('one') + .05, 'tear', 1.2);
+ sfx('open', m('enl') - .15, 'tear-long', 1.4);
+ }, { pre: OPEN_PRE }],
+
+ // Part 2, the elephant: one take; the phone rings in the black the first part tore open
+ ['p2', 'The elephant', (m, D) => {
+ let p = panel(0);
+ const dark = put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#030604' }, p), { o: 1 });
+ // "Early one morning": the town in the first light; the phone is heard before it is seen
+ const dawn = pic(p, 'dawn', { x: 800, y: 450, w: 1720, at: .15, from: [0, 0], dur: 1 });
+ toward(dawn, 'dawn', .42, .3, 1.7, 0, .01); toward(dawn, 'dawn', .5, .32, 1.85, .2, 3); // the river at dawn, closer than part 1's view
+ hide(dark, 1.2, .01, lin);
+ sfx('p2', .25, 'phone-ring', 1.1);
+ // "the sub-inspector at a police station the other end of the town rang me up on the phone": the town as a police
+ // plan draws itself; the call runs down the telephone wire from the station to my bungalow, and the phone rings there,
+ // in a callout on the plan
+ let t = 4.1; p = cut(t);
+ const town = townPlan(p, t, D);
+ const tCall = m('phone') - 1.5;
+ const pulse = G(town.sheet, { o: 0 }); mk('circle', { r: 9, fill: HOT }, pulse); mk('circle', { r: 18, fill: 'none', stroke: HOT, 'stroke-width': 2 }, pulse);
+ show(pulse, tCall, .1);
+ clockRun(tt => { const q = Math.min(1, Math.max(0, (tt - tCall) / 1.1)); const [x, y] = along(town.wire, q); put(pulse, { x, y, s: 1 + .25 * Math.sin(tt * 20) }); }, D, { tail: true });
+ hide(pulse, tCall + 1.2, .2);
+ // the callout: a disc of the ground beside the bungalow, a leader line, the found drawing of the phone in it, rattling
+ const tr = tCall + 1.05;
+ const [cx, cy] = [town.ME[0] - 260, town.ME[1] - 250];
+ line(town.sheet, `M${town.ME[0] - 34} ${town.ME[1] - 30}L${cx + 120} ${cy + 90}`, tr, .25, 2.4, { stroke: INK });
+ const call = G(town.sheet, { x: cx, y: cy, o: 0, s: .6 });
+ mk('circle', { r: 150, fill: COL.board, stroke: INK, 'stroke-width': 4 }, call);
+ const ph = pic(call, 'phone', { x: 0, y: 6, h: 210 });
+ tw(call, { o: 1, s: 1 }, tr, .25, out);
+ const rings = G(call, { o: 0 });
+ for (const sx of [-1, 1]) for (const k of [0, 1]) path(rings, `M${-34 + sx * (60 + k * 22)} ${-82 - k * 4}q${sx * 13} 26 0 52`, { stroke: CREAM, 'stroke-width': 4, fill: 'none', 'stroke-linecap': 'round' });
+ clockRun(tt => {
+ const on = tt > tr && tt < tr + 2.2, w = tt * 2 * Math.PI * 12;
+ put(ph, on ? { r: 4 * Math.sin(w), x: 5 * Math.sin(w + 1), y: 6 - 5 * Math.abs(Math.sin(w)) } : { r: 0, x: 0, y: 6 });
+ put(rings, { o: on ? (Math.sin(w * .5) > 0 ? 1 : .55) : 0 });
+ }, D, { tail: true });
+ sfx('p2', tr, 'phone-ring-long', 1.3);
+ tw(town.page, { s: 1.25, x: 800 - 1.25 * 1000, y: 450 - 1.25 * 560 }, tCall - .3, 1.6, soft); // in towards the south end as the call arrives
+
+ // "… an elephant was ravaging the bazaar. Would I please come and do something about it?"
+ t = m('eleph') - .2; p = cut(t);
+ const ch = pic(p, 'rampage', { x: 800, y: 450, h: 780, at: t, from: [0, 0], dur: .45 });
+ push(ch, t, m('q3'), 1.07);
+ tw(ch, { o: .16 }, m('would') - .3, .4);
+ const ask = say(p, ['“Would I please come and', 'do something about it?”'], 800, 420, m('would'), m('q3') - .7, { size: 64, anchor: 'middle', mark: ['do', 'something'] });
+ hide(ask, m('q3') - .45, .25);
+
+ // "I took my rifle, an old .44 Winchester and much too small to kill an elephant." — he holds it
+ t = m('q3') - .2; p = cut(t);
+ const of = pic(p, 'officer', { x: 800, y: 450, h: 760, at: t, from: [0, 0], dur: .5 });
+ push(of, t, m('small'), 1.04);
+ // the rifle itself beside the one in his hands, joined by a line
+ const gi = gunInset(p, of, 'officer', [.38, .455], 'winchester-bw', 'an old .44 Winchester', { x: 1150, y: 690, w: 780, r: -1.5 }, m('w44') - .3);
+ hide(gi, m('small') - .3, .3);
+ // "… and much too small to kill an elephant": the man and his rifle against the elephant, both in silhouette
+ t = m('small') - .3; p = cut(t, .3);
+ line(p, 'M0 780H1600', t, .4, 2, { opacity: .45 });
+ const man = G(p, {}), manL = G(p, { o: 0 }); // facing the elephant, and turned to run
+ cutout(man, 'officer', 400, 790, 330, { at: t + .05, from: [-40, 0], D });
+ cutout(manL, 'officer', 0, 0, 330, { flip: true, D });
+ const big = cutout(p, 'elephant', 1060, 790, 560, { at: t + .2, from: [60, 0], D });
+ key(p, 'Much too small', 800, 170, m('small') - .6, { size: 110 });
+ // then the elephant lunges at him, and he runs: it rocks back, steps forward hard; he jumps, turns and is gone
+ const tl = m('small') + .9;
+ tw(big, { x: 1085, r: 2 }, tl - .25, .25, io);
+ tw(big, { x: 940, r: -5 }, tl, .22, out);
+ tw(big, { x: 965, r: 0 }, tl + .22, .5, soft);
+ sfx('p2', tl + .05, 'thud', 1.4);
+ tw(man, { y: -40 }, tl + .08, .12, out);
+ tw(man, { y: 0 }, tl + .2, .12, io);
+ show(manL, tl + .32, .01, lin); hide(man, tl + .32, .01, lin);
+ // the run: off to the left, bobbing
+ clockRun(tt => { const q = Math.max(0, tt - tl - .32); put(manL, { x: 400 - 900 * q, y: 790 - 18 * Math.abs(Math.sin(q * 16)) }); }, D, { tail: true });
+
+ // "It was not, of course, a wild elephant, but a tame one which had gone 'must'."
+ t = m('q4') - .2; p = cut(t);
+ const cn = pic(p, 'chained', { x: 800, y: 450, h: 760, at: t, from: [0, 30], dur: .6, o: .08 });
+ push(cn, t, m('must'), 1.05);
+ const wild = key(p, 'Wild', 800, 500, m('q4') + 1.0, { size: 190 });
+ const ws = strike(p, wild, 800, 500, m('tame') - .3, 190);
+ hide(wild, m('tame') + .1, .3); hide(ws, m('tame') + .1, .3);
+ tw(cn, { o: 1 }, m('tame'), .4);
+ tag(p, 'a tame elephant and its mahouts, about 1920', 800, 875, m('tame'), { anchor: 'middle', size: 26 });
+ // "… which had gone 'must'": chained by the foreleg, it snaps the chain and charges; then a tracking shot: the elephant
+ // runs on the spot while the ground rolls in from the left with a bamboo hut, a cow and a fruit stall on it, each
+ // knocked down as its word is said ("… destroyed somebody's bamboo hut, killed a cow and raided some fruit-stalls")
+ t = m('must') - .45; p = cut(t, .25);
+ const GY = 800, V = 620, tm = m('must'), tRun = tm + .25;
+ const world = G(p, {}); // everything on the ground; it rolls right while the elephant runs left
+ line(p, `M0 ${GY}H1600`, t, .3, 2, { opacity: .45 });
+ const R = rng(1926);
+ for (let x = -4200; x < 1700; x += 70 + R() * 90) mk('path', { d: `M${x} ${GY}l-6 -${10 + R() * 14}M${x} ${GY}l4 -${12 + R() * 12}M${x} ${GY}l12 -${8 + R() * 10}`, stroke: CREAM, 'stroke-width': 2, opacity: .4 }, world);
+ const EH = 380, EW = SHAPES.elephant.w * EH / SHAPES.elephant.h, X0 = 1290, XR = 960; // chained, and running
+ const front = XR - EW * .48; // where the trunk is while it runs
+ const roll = tt => tt < tRun ? 0 : V * (tt - tRun);
+ clockRun(tt => put(world, { x: roll(tt) }), D, { tail: true });
+ const things = [['hut', m('hut'), 300], ['cow', m('cow'), 190], ['stall', m('fruit'), 250]].map(([n, th, h]) => {
+ const w = SHAPES[n].w * h / SHAPES[n].h, x = front - V * (th - tRun) - w * .45; // its near edge meets the trunk at th
+ return [n, x, h, th, cutout(world, n, x, GY + 4, h, { D })];
+ });
+ const stakeX = X0 - EW * .19 - 150;
+ mk('path', { d: `M${stakeX} ${GY + 6}V${GY - 50}`, stroke: CREAM, 'stroke-width': 8, 'stroke-linecap': 'round' }, world);
+ const debris = G(world, {});
+ const el2 = cutout(p, 'elephant', X0, GY + 8, EH, { D }); // drawn after the ground and the debris: it is in front
+ const [fx, fy] = el2.foot(.31, .8);
+ const L = [...Array(8)].map((_, i) => [stakeX + (fx - stakeX) * i / 7, GY - 34 + (fy - GY + 34) * i / 7 + 10 * Math.sin(Math.PI * i / 7)]);
+ const links = (a, b) => { const g = G(p, {}); L.slice(a, b).forEach(([x, y], i) => mk('ellipse', { cx: x, cy: y, rx: 13, ry: 7, fill: 'none', stroke: CREAM, 'stroke-width': 4, transform: `rotate(${(a + i) % 2 ? 90 : 18} ${x} ${y})` }, g)); return g; };
+ const ca = links(0, 4), cb = links(4, 8);
+ tw(ca, { x: -40, y: 14, o: 0 }, tm, .45, out); tw(cb, { x: 30, y: 10, o: 0 }, tm, .45, out);
+ clockRun(tt => { // rears back, runs forward to its place, then strides on the spot as the ground rolls
+ if (tt < tm) return put(el2, { x: X0, y: GY + 8, r: 0 });
+ if (tt < tRun) { const k = Math.sin(Math.PI * Math.min(1, (tt - tm) / .25)); return put(el2, { x: X0 + 25 * k, y: GY + 8, r: 4 * k }); }
+ const q = tt - tRun, x = q < .6 ? X0 + (XR - X0) * (1 - (1 - q / .6) ** 2) : XR;
+ put(el2, { x, y: GY + 8 - 14 * Math.abs(Math.sin(q * 13)), r: -3 + 2.5 * Math.sin(q * 13) });
+ }, D, { tail: true });
+ for (const [n, x, h, th, g] of things) {
+ tw(g, { r: -78, x: x - h * .55, y: GY + 4 }, th, .38, out);
+ sfx('p2', th, n === 'hut' ? 'crash' : 'thud', 1.5);
+ const Rb = rng(n.length * 97), bits = n === 'stall' ? 14 : n === 'hut' ? 8 : 0;
+ for (let k = 0; k < bits; k++) {
+ const vx = 220 + Rb() * 380, vy = 360 + Rb() * 360, x0 = x + (Rb() - .5) * 80, y0 = GY - h * (.3 + Rb() * .5), spin = (Rb() - .5) * 1400;
+ const b = n === 'stall' ? mk('circle', { r: 7 + Rb() * 5, fill: CREAM, opacity: .85 }, debris) : mk('rect', { x: -34, y: -3, width: 68, height: 6, rx: 3, fill: CREAM }, debris);
+ put(b, { o: 0 });
+ const tLand = (vy + Math.sqrt(vy * vy + 4 * 1300 * (GY - 10 - y0))) / 2600;
+ clockRun(tt => {
+ const q = tt - th; if (q < 0) return;
+ const qq = Math.min(q, tLand), yy = y0 - vy * qq + 1300 * qq * qq, xx = x0 - vx * qq;
+ b.setAttribute('transform', `translate(${xx.toFixed(1)},${Math.min(GY - 10, yy).toFixed(1)}) rotate(${q < tLand ? spin * q : 0})`);
+ b.style.opacity = q > 1.4 ? Math.max(0, 1 - (q - 1.4) * 2) : 1;
+ }, D, { tail: true });
+ }
+ }
+ for (let i = 0; i < 9; i++) sfx('p2', tRun + .1 + i * .48, 'thud', .7); // its strides
+ const ttl = key(p, 'Must', 800, 200, tm - .05, { size: 150 });
+ const def = tag(p, 'a bull elephant’s yearly frenzy', 800, 270, tm + .1, { anchor: 'middle', size: 40, fill: CREAM });
+ hide(ttl, m('q6') + .4, .4); hide(def, m('q6') + .4, .4);
+
+ // "I rounded the hut and saw a man's dead body sprawling in the mud.": first the corner of the hut, then, on "dead", him
+ t = m('q7') - .2; p = cut(t, .8);
+ const bd = pic(p, 'body', { x: 800, y: 450, h: 780, at: t, from: [0, 0], dur: .9 });
+ toward(bd, 'body', .82, .38, 1.9, t, .01); // the corner of the hut
+ toward(bd, 'body', .6, .66, 1.7, m('dead') - .5, 1.6); // round it, to the man in the mud
+ toward(bd, 'body', .5, .52, 1.6, m('q8'), 2.5); // out a little: the Indian labourers standing over him
+ toward(bd, 'body', .6, .68, 2.3, m('coolie') + .8, 3); // and close on him: "almost naked … dead many minutes"
+
+ // "Never tell me, by the way, that the dead look peaceful. Most of the corpses I have seen looked devilish."
+ t = m('never') - .2; p = cut(t, .6);
+ put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#030604' }, p), { o: 1 });
+ pic(p, 'orwell-passport', { x: 360, y: 450, h: 520, r: -2, at: m('never') - .1, from: [-40, 0], dur: .8, o: .55 });
+ say(p, ['Never tell me, by the way,', 'that the dead look peaceful.'], 640, 400, m('never'), m('never') + 3.2, { size: 58 });
+ say(p, ['Most of the corpses', 'I have seen looked devilish.'], 640, 590, m('never') + 3.7, m('devil') + .5, { size: 58, mark: ['devilish'] });
+
+ // "As soon as I saw the dead man, I sent an orderly … to borrow an elephant rifle." — three moments in a row, so
+ // they are laid out as a comic page, panel by panel, each staying while the next comes in
+ t = m('q10') - .2; p = cut(t, .25);
+ const b1 = comicPanel(p, 'body', [40, 40, 560, 400], [.6, .62], t, [800 - 320 * 2.2, 450 - 240 * 2.2, 2.2]);
+ tw(b1, { x: 0, y: 0, s: 1 }, m('q10') + 1.8, .55, io);
+ comicPanel(p, 'orderly', [40, 460, 1520, 400], [.5, .52], m('q10') + 2.1, [0, 50]);
+ const sw = comicPanel(p, 'swap', [620, 40, 940, 400], [.4, .3], m('erifle') - .45, [50, 0]);
+ const [lx, ly] = sw.at(.32, .34);
+ line(p, `M${lx} ${ly}L1110 640`, m('erifle') - .1, .35, 3, { opacity: .9 });
+ put(mk('circle', { cx: lx, cy: ly, r: 9, fill: 'none', stroke: CREAM, 'stroke-width': 3 }, p), { o: 0 });
+ show(p.lastChild, m('erifle') - .1, .2);
+ pic(p, 'double-rifle-bw', { x: 1260, y: 690, w: 560, r: 1.5, at: m('erifle') + .1, from: [60, 0], dur: .45 });
+ key(p, 'An elephant rifle', 1260, 820, m('erifle') + .3, { size: 46 });
+ }, { pre: 1.6 }],
+
+ // Part 3, the crowd: one take; the rifle comes, the crowd follows him down to the paddy, the elephant grazes
+ ['p3', 'The crowd', (m, D) => {
+ // the words that have no mark of their own, from the voice's word times (books/…/review/ch01/p3-words.json) + pre
+ const W = { yards: 10.75 + .8, but: 24.8 + .8, english: 29.6 + .8, besides: 31.84 + .8, meat: 32.68 + .8, not: 51.3 + .8 };
+ // "The orderly came back in a few minutes with a rifle and five cartridges"
+ let p = panel(0);
+ pic(p, 'double-rifle-bw', { x: 800, y: 320, w: 1150, at: .05, from: [0, 0], dur: .4 });
+ for (let i = 0; i < 5; i++) {
+ const c = G(p, { x: 560 + i * 120, y: 700, o: 0 }); cartridge(c);
+ tw(c, { o: 1, y: 680 }, m('five') + i * .16, .25, out);
+ sfx('p3', m('five') + i * .16, 'clack', .9);
+ }
+ tag(p, 'five cartridges', 800, 790, m('five') + 1, { anchor: 'middle', size: 40, fill: CREAM });
+
+ // "… some Burmans had arrived and told us that the elephant was in the paddy fields below, only a few hundred yards
+ // away": a page of the police report's sketch plan, drawing itself
+ let t = m('s2') - .2; p = cut(t);
+ const plan = sketchPlan(p, t, m('paddy'), W.yards, D);
+
+ // "As I started forward practically the whole population of the quarter flocked out of the houses and followed me."
+ // On the plan: he, a red dot, sets off down the path; the people pour out of every hut after him, a stream of ink dots
+ // that keeps growing, down the path and along the road; the view closes in on them
+ const route = [...plan.path, ...plan.road];
+ const tGo = m('s3') + .2, goDur = m('s4') - .3 - tGo, go = tt => Math.min(1, Math.max(0, (tt - tGo) / goDur));
+ const me = G(plan.sheet, { o: 0 }); mk('circle', { r: 11, fill: HOT, stroke: PAPER, 'stroke-width': 3 }, me);
+ show(me, m('s3') - .4, .3);
+ const meT = T(plan.sheet, 'me', { x: 0, y: 0, size: 26, font: SER, weight: 400, fill: HOT, anchor: 'middle', o: 0 });
+ meT.setAttribute('font-style', 'italic'); show(meT, m('s3') - .3, .3);
+ clockRun(tt => { const [x, y] = along(route, go(tt)); put(me, { x, y }); meT.setAttribute('x', x + 34); meT.setAttribute('y', y + 40); }, D, { tail: true });
+ const flock = G(plan.sheet, {}), Rf = rng(77);
+ for (let k = 0; k < 140; k++) {
+ const [hx, hy] = plan.homes[k % plan.homes.length], t1 = m('pop') - .5 + k * .03, lag = .05 + k * .0055;
+ const jx = (Rf() - .5) * 30, jy = (Rf() - .5) * 18, d = mk('circle', { r: 4.2, fill: INK }, flock);
+ put(d, { o: 0 });
+ clockRun(tt => {
+ if (tt < t1) return;
+ const out = Math.min(1, (tt - t1) / .6), q = Math.max(0, go(tt) - lag), [x0, y0] = route[0], [rx, ry] = along(route, q);
+ const x = out < 1 ? hx + (x0 - hx) * out : rx, y = out < 1 ? hy + (y0 - hy) * out : ry;
+ d.setAttribute('transform', `translate(${(x + jx * Math.min(1, out * 2)).toFixed(1)},${(y + jy * Math.min(1, out * 2)).toFixed(1)})`);
+ d.style.opacity = Math.min(.85, (tt - t1) / .2);
+ }, D, { tail: true });
+ }
+ tw(plan.page, { s: 1.45, x: 800 - 1.45 * 560, y: 450 - 1.45 * 480 }, m('s3') - .2, 3.5, soft);
+ sfx('p3', m('pop'), 'murmur', .7);
+
+ // "They had not shown much interest in the elephant when he was merely ravaging their homes, but it was different
+ // now that he was going to be shot."
+ t = m('s4') - .2; p = cut(t);
+ const eg = pic(p, 'aftermath', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .5 });
+ toward(eg, 'aftermath', .3, .45, 1.3, t, m('ravaging') - t); // the crushed hut, the dead cow
+ toward(eg, 'aftermath', .7, .5, 1.15, m('ravaging') + .3, 2.5); // the stalls, and the people standing by
+ tw(eg, { o: .32 }, W.but - .4, .4);
+ say(p, ['“… but it was different now', 'that he was going to be shot.”'], 800, 420, W.but, m('shot') + .2, { size: 60, anchor: 'middle', mark: ['shot'] }); // held into the next sentence, to "fun"
+ sfx('p3', m('shot') - .2, 'cheer', .7);
+
+ // "It was a bit of fun to them, as it would be to an English crowd; besides they wanted the meat."
+ t = m('fun') - .3; p = cut(t); // the quote above stays up until here
+ // the two crowds side by side: the Burmese one is laid down on the left at once, the English one joins it on its word
+ const fn = pic(p, 'fun', { x: 470, y: 450, h: 520, r: -1.5, at: t, from: [-60, 0], dur: .5 });
+ push(fn, t, W.besides, 1.04);
+ sfx('p3', m('fun') - .1, 'jeer', .4);
+ pic(p, 'english-crowd', { x: 1150, y: 450, h: 520, r: 1.5, at: W.english - .2, from: [80, 0], dur: .5 }); // … the English one beside it
+ tag(p, 'as it would be to an English crowd: Wembley, 1923', 1150, 760, W.english + .2, { anchor: 'middle', size: 28, fill: CREAM });
+ t = W.besides - .2; p = cut(t);
+ cutout(p, 'elephant', 860, 800, 560, { D });
+ const chart = G(p, { o: 0 }); // a butcher's chart drawn over him
+ for (const d of ['M560 300C580 420 590 560 560 720', 'M760 270C780 420 790 580 780 760', 'M1000 280C1020 430 1020 600 1010 760', 'M560 500C760 480 980 480 1150 520'])
+ mk('path', { d, fill: 'none', stroke: CREAM, 'stroke-width': 4, 'stroke-dasharray': '16 12' }, chart);
+ show(chart, W.meat + .1, .3);
+ keyRed(p, 'Meat', 800, 190, W.meat + .2, { size: 130 });
+
+ // "The elephant was standing eight yards from the road, his left side towards us." — the picture, and a measure on it
+ t = m('s6') - .2; p = cut(t);
+ const ey = pic(p, 'eight', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .5 });
+ push(ey, t, m('s7'), 1.04);
+ const [ax, ay] = spot(ey, 'eight', .36, .62), [bx, by] = spot(ey, 'eight', .56, .62);
+ line(p, `M${ax} ${ay}H${bx}M${ax} ${ay - 14}v28M${bx} ${by - 14}v28`, m('eight') - .2, .5, 3, { 'stroke-dasharray': '12 8' });
+ key(p, 'Eight yards', (ax + bx) / 2, ay - 36, m('eight') + .1, { size: 50 });
+ say(p, ['his left side towards us'], 1520, 200, m('left'), m('left') + 1, { size: 46, anchor: 'end' });
+
+ // "He was tearing up bunches of grass, beating them against his knees to clean them and stuffing them into his mouth."
+ t = m('s7') - .2; p = cut(t);
+ const gz = pic(p, 'graze', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .5 });
+ closeups(p, gz, 'graze', [['grass', .32, .55, 'grass', 2.2], ['knees', .38, .68, 'his knees', 2.2], ['mouth', .3, .37, 'his mouth', 2.4]], m, m('s8') - .5, { x: 800, y: 450 });
+ sfx('p3', m('knees') + .1, 'thud', .5); sfx('p3', m('knees') + .55, 'thud', .5);
+
+ // "As soon as I saw the elephant, I knew with perfect certainty that I ought not to shoot him." "Moreover, I did not
+ // in the least want to shoot him." — behind him, looking at it; the words on screen
+ t = m('s8') - .2; p = cut(t, .5);
+ const og = pic(p, 'ought', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .6 });
+ push(og, t, D, 1.06);
+ tw(og, { o: .4 }, m('cert') - .5, .4);
+ say(p, ['“I knew with perfect certainty', 'that I ought not to shoot him.”'], 800, 380, m('cert') - .3, m('s9') - .4, { size: 58, anchor: 'middle', mark: ['not'] });
+ say(p, ['“… I did not in the least want to shoot him.”'], 800, 600, m('s9') + .4, m('want') + 1, { size: 48, anchor: 'middle', mark: ['want'] });
+ }, { pre: .8 }],
+
+ // Part 4, the turn: one take; the crowd, the conjurer, the wills that push him, the theatre and the puppet, the mask
+ ['p4', 'The turn', (m, D) => {
+ // "But at that moment I glanced round at the crowd that had followed me. It was an immense crowd, two thousand at the
+ // least and growing every minute." — one picture for both sentences, the view travelling back along the crowd; a count
+ let p = panel(0);
+ const gl = pic(p, 'glance', { x: 800, y: 450, h: 800, at: 0, from: [0, 0], dur: .5 });
+ toward(gl, 'glance', .7, .45, 1.2, 0, .01);
+ toward(gl, 'glance', .25, .4, 1.3, m('crowd') - .4, m('s3') - m('crowd'));
+ const cnt = G(p, { x: 1240, y: 790, o: 0 });
+ mk('rect', { x: -220, y: -96, width: 360, height: 136, fill: COL.board, opacity: .88 }, cnt);
+ const num = T(cnt, '0', { x: 120, y: 0, size: 96, font: KEY, weight: 600, fill: CREAM, anchor: 'end' });
+ const sub = T(cnt, 'and growing every minute', { x: 120, y: 30, size: 22, font: SER, fill: CREAM, anchor: 'end', o: 0 }); sub.setAttribute('font-style', 'italic');
+ show(cnt, m('s2') + .4, .3); show(sub, m('growing'), .4);
+ clockRun(tt => {
+ const a = m('s2') + .5, b = m('two') + .2, n = tt < a ? 0 : tt < b ? 2000 * smooth01((tt - a) / (b - a)) : 2000 + Math.floor((tt - b) * 3.2);
+ num.textContent = Math.floor(n).toLocaleString('en');
+ }, D, { tail: true });
+
+ // "They were watching me as they would watch a conjurer about to perform a trick."
+ let t = m('s3') - .2; p = cut(t);
+ const cj = pic(p, 'conjurer', { x: 800, y: 450, h: 820, at: t, from: [0, 0], dur: .5 });
+ push(cj, t, m('shoot') + 1.5, 1.08);
+ tag(p, 'a conjurer: Kellar’s levitation, a poster of 1894', 800, 885, m('conjurer'), { size: 26, fill: CREAM, anchor: 'middle' });
+
+ // "And suddenly I realized that I should have to shoot the elephant after all."
+ tw(cj, { o: .25 }, m('s4') + .6, .6);
+ say(p, ['“… I should have to shoot', 'the elephant after all.”'], 800, 400, m('s4') + 1.2, m('shoot') + 1.4, { size: 72, anchor: 'middle', mark: ['shoot'] });
+
+ // "The people expected it of me and I had got to do it; I could feel their two thousand wills pressing me forward,
+ // irresistibly." — seen from above: the crowd an arc of dots, each throwing an arrow at him; he is pushed towards it
+ t = m('s5') + 1; p = cut(t); // the quote above stays 1.5 s after its last word
+ const C = [700, 520], R3 = rng(2000), arrows = G(p, { o: 0 }), dotsG = G(p, {});
+ const meDot = G(p, { x: C[0], y: C[1], o: 0 }); mk('circle', { r: 13, fill: HOT }, meDot);
+ show(meDot, t + .3, .3);
+ const meTag = key(p, 'Me', C[0], C[1] - 34, t + .5, { size: 40 });
+ const eT = cutout(p, 'elephant', 1360, 560, 110, { D, at: t + .5, from: [0, 0] });
+ label(p, 'THE ELEPHANT', 1360, 610, t + .8, { size: 20 });
+ for (let k = 0; k < 420; k++) {
+ const a = Math.PI * (.55 + R3() * .9), r = 170 + R3() * 260, x = C[0] + 1.25 * r * Math.cos(a), y = C[1] + .8 * r * Math.sin(a);
+ const d = mk('circle', { cx: x, cy: y, r: 3.6, fill: CREAM }, dotsG); put(d, { o: 0 }); show(d, t + .2 + k * .004, .2);
+ if (k % 4 === 0) { // every fourth throws its will at him
+ const dx = C[0] - x, dy = C[1] - y, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, x1 = x + ux * (L - 17), y1 = y + uy * (L - 17);
+ mk('path', { d: `M${(x + ux * 10).toFixed(1)} ${(y + uy * 10).toFixed(1)}L${x1.toFixed(1)} ${y1.toFixed(1)}l${(-ux * 12 - uy * 6).toFixed(1)} ${(-uy * 12 + ux * 6).toFixed(1)}M${x1.toFixed(1)} ${y1.toFixed(1)}l${(-ux * 12 + uy * 6).toFixed(1)} ${(-uy * 12 - ux * 6).toFixed(1)}`, fill: 'none', stroke: CREAM, 'stroke-width': 1.3, opacity: .45 }, arrows);
+ }
+ }
+ tw(arrows, { o: .35 }, t + .6, .8); tw(arrows, { o: 1 }, m('wills') - .3, .4);
+ keyRed(p, 'Two thousand wills', 800, 150, m('wills') - .1, { size: 90 });
+ // pushed forward: he, the crowd and its arrows all slide towards the elephant
+ tw(meDot, { x: C[0] + 330, y: C[1] + 10 }, m('irres') - .3, 1.4, io); tw(meTag, { x: C[0] + 330, y: C[1] - 24 }, m('irres') - .3, 1.4, io); // pushed …
+ for (const e of [dotsG, arrows]) tw(e, { x: 300, y: 10 }, m('irres') + .1, 1.4, io); // … and the crowd after him
+
+ // "Here was I, the white man with his gun, standing in front of the unarmed native crowd — seemingly the leading actor
+ // of the piece; but in reality I was only an absurd puppet pushed to and fro by the will of those yellow faces behind."
+ t = m('s6') - .2; p = cut(t);
+ const th = theatre(p, t, D);
+ th.curtains.forEach((c, i) => tw(c, { x: (i ? 1 : -1) * 560, o: .9 }, t + .3, 1.4, io));
+ const actor = G(p, {});
+ p.insertBefore(actor, th.aud); // on the boards, behind the audience
+ const pup = marionette(actor), NECK = th.FLOOR - 312;
+ show(th.spot, m('gun') - .4, .4);
+ tw(th.spot, { s: 1.15, x: -120, y: -100 }, m('actor') - .2, .5, out);
+ th.aud.childNodes.forEach((h, i) => { put(h, { o: 0 }); show(h, m('gun') + 1.2 + i * .03, .25); });
+ // the playbill, high on the left of the valance, clear of the strings: struck out in red when he turns out a puppet
+ const bill = G(th.sign, { o: 0 });
+ mk('rect', { x: 290, y: 30, width: 400, height: 74, fill: PAPER, stroke: INK, 'stroke-width': 3 }, bill);
+ const bt = T(bill, 'THE LEADING ACTOR', { x: 490, y: 82, size: 40, font: KEY, weight: 600, fill: INK, anchor: 'middle' }); bt.setAttribute('letter-spacing', '.06em');
+ show(bill, m('actor') - .1, .3);
+ const st = path(bill, 'M300 70L680 64', { stroke: HOT, 'stroke-width': 7, 'stroke-linecap': 'round' }, { d: 0 }); draw(st, m('puppet') - .1, .35);
+ // the control bar: a cross, the long bar for the hands, the short one for the knees, the head on the middle
+ const bar = G(p, { x: 800, y: 112, o: 0 });
+ mk('path', { d: 'M-120 0H120M0 -30V60M-70 46H70', stroke: CREAM, 'stroke-width': 10, 'stroke-linecap': 'round' }, bar);
+ const strings = G(p, { o: 0 }), sl = [0, 1, 2, 3, 4].map(() => mk('path', { d: '', stroke: CREAM, 'stroke-width': 2, fill: 'none' }, strings));
+ // the will of the faces behind: two long lines from the bar's ends down to the audience
+ const ropes = G(p, { o: 0 }), heads = [5, 9].map(i => th.aud.childNodes[i]);
+ const rl = heads.map(() => mk('path', { d: '', stroke: CREAM, 'stroke-width': 1.8, fill: 'none', opacity: .55 }, ropes));
+ const tP = m('puppet') - .2;
+ show(bar, tP, .3); show(strings, tP + .1, .3); show(ropes, tP + .6, .5);
+ const wave_ = (q, f, ph = 0) => Math.sin(q * f + ph);
+ clockRun(tt => {
+ const q = Math.max(0, tt - tP), on = Math.min(1, q / .5), swing = q < .5 ? 0 : q - .5;
+ // each push bigger than the last, the bar tilting with it; the puppet follows late, its limbs later still
+ const amp = on * Math.min(1, .35 + swing * .18), sway = amp * (90 * wave_(swing, 2.4) + 20 * wave_(swing, 5.3)), tilt = amp * 14 * wave_(swing, 2.4, .4);
+ const bx = 800 + sway * .55, by = 112 + 8 * wave_(swing, 4.8);
+ put(bar, { x: bx, y: by, r: tilt });
+ const lag = (d, k) => amp * k * wave_(swing - d, 2.4), lift = on * (34 + 10 * Math.abs(wave_(swing, 2.4)));
+ const pts = pup.pose({
+ x: 800 + amp * (90 * wave_(swing - .12, 2.4) + 20 * wave_(swing - .12, 5.3)), y: NECK - lift, a: lag(.25, 8),
+ arms: [6 + lag(.35, 34) + on * 18, 4 + on * (10 + 12 * Math.abs(wave_(swing, 4.8))), -6 + lag(.45, 30) - on * 10, 4 + on * 14],
+ legs: [3 + lag(.4, 20), on * (12 + 16 * Math.abs(wave_(swing - .3, 2.4))), -3 + lag(.5, 18), on * (8 + 14 * Math.abs(wave_(swing - .4, 2.4)))],
+ });
+ const ca = Math.cos(tilt * Math.PI / 180), sa = Math.sin(tilt * Math.PI / 180), B = (lx, ly) => [bx + lx * ca - ly * sa, by + lx * sa + ly * ca];
+ [[B(0, -30), pts.head], [B(120, 0), pts.handF], [B(-120, 0), pts.handB], [B(70, 46), pts.kneeF], [B(-70, 46), pts.kneeB]].forEach(([a, b], i) =>
+ sl[i].setAttribute('d', `M${a[0].toFixed(1)} ${a[1].toFixed(1)}L${b[0].toFixed(1)} ${b[1].toFixed(1)}`));
+ heads.forEach((h, i) => { // each line runs from the bar's end to a head, which tugs on it
+ const tug = on * 10 * wave_(swing, 2.4, i * 1.5), [ex, ey] = B(i ? 120 : -120, 0);
+ h.setAttribute('transform', `translate(0,${tug.toFixed(1)})`);
+ rl[i].setAttribute('d', `M${ex.toFixed(1)} ${ey.toFixed(1)}L${h._x.toFixed(1)} ${(h._y + tug).toFixed(1)}`); // straight, taut
+ });
+ }, D, { tail: true });
+
+ // "I perceived in this moment that when the white man turns tyrant it is his own freedom that he destroys." — the
+ // stage stays, darkened, the sentence over it
+ const veil = put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#030604' }, p), { o: 0 });
+ tw(veil, { o: .72 }, m('s7') - .3, .6);
+ say(p, ['“… when the white man turns tyrant', 'it is his own freedom that he destroys.”'], 800, 400, m('s7') + .9, m('freedom') + 1.2, { size: 66, anchor: 'middle', mark: ['freedom'] });
+
+ // "He wears a mask, and his face grows to fit it." — an iron face-plate comes down over his face, a slot across the
+ // eyes and down to the mouth, cheek-guards, a row of rivets (black card and a cream line, like the film's cut-outs);
+ // on "grows" the photograph is cut to the plate's outline and the iron sinks into the skin: the face has taken its
+ // shape. Then what shows through the slot goes black: there is no one behind it. The view closes in throughout.
+ t = m('mask') - .3; p = cut(t); // (the quote above held 1.5 s)
+ const FACE = [800, 372];
+ const OUTER = 'M-120 -168C-60 -196 60 -196 120 -168C140 -96 140 -10 124 64C114 112 96 146 70 168L28 158C30 128 30 100 26 78H-26C-30 100 -30 128 -28 158L-70 168C-96 146 -114 112 -124 64C-140 -10 -140 -96 -120 -168Z';
+ const SLOT = 'M-104 -38C-86 -58 -32 -60 -10 -44C-6 -41 6 -41 10 -44C32 -60 86 -58 104 -38C88 -18 40 -12 13 -24V78H-13V-24C-40 -12 -88 -18 -104 -38Z';
+ const at = `translate(${FACE[0]},${FACE[1] - 8}) scale(.78)`, uid = Math.floor(t * 100); // sized to his face, the slot on his eyes
+ const shot = G(p, {});
+ const defs = mk('defs', {}, shot);
+ const cpp = mk('clipPath', { id: 'visorClip' + uid }, defs), cut_ = mk('path', { d: OUTER.replace('L28 158C30 128 30 100 26 78H-26C-30 100 -30 128 -28 158L-70 168', 'Q0 192 -70 168') }, cpp); // closed below: no bite out of the picture while it closes
+ const face = G(mk('g', { 'clip-path': `url(#visorClip${uid})` }, shot), {});
+ pic(face, 'orwell-passport', { x: 806, y: 402, h: 640 }); // placed so his eyes sit in the slot
+ // the clip starts as large as the picture and closes to the plate's outline on "grows"
+ clockRun(tt => { const q = smooth01(span01(tt, m('grows') - .1, m('grows') + 1.2)), k = 9 - 8 * q ** .6; cut_.setAttribute('transform', `${at} scale(${k})`); /* large at first: its notch off the picture */ }, D, { tail: true });
+ // the plate: iron with the slot cut out of it (a mask), then its lines and rivets
+ const mkid = 'visorMask' + uid, msk = mk('mask', { id: mkid, maskUnits: 'userSpaceOnUse', x: -400, y: -400, width: 800, height: 800 }, defs);
+ mk('path', { d: OUTER, fill: '#fff' }, msk); mk('path', { d: SLOT, fill: '#000' }, msk);
+ const plate = G(p, { x: 0, y: -260, o: 0 });
+ const inner = mk('g', { transform: at }, plate);
+ const iron = mk('path', { d: OUTER, fill: '#161d19', mask: `url(#${mkid})` }, inner);
+ mk('path', { d: OUTER, fill: 'none', stroke: CREAM, 'stroke-width': 4, 'stroke-linejoin': 'round' }, inner);
+ mk('path', { d: SLOT, fill: 'none', stroke: CREAM, 'stroke-width': 2.6, 'stroke-linejoin': 'round' }, inner);
+ mk('path', { d: 'M-112 -104C-60 -132 60 -132 112 -104M-96 6C-70 30 -50 60 -40 104M96 6C70 30 50 60 40 104', fill: 'none', stroke: CREAM, 'stroke-width': 2, opacity: .6 }, inner); // brow ridge, cheek-guards
+ const tmp = mk('path', { d: OUTER, fill: 'none' }, inner), LL = tmp.getTotalLength();
+ for (let k = 0; k < 26; k++) { const pt = tmp.getPointAtLength(LL * (k + .5) / 26), cx = pt.x * .9, cy = pt.y * .9 + 4; mk('circle', { cx, cy, r: 3.6, fill: CREAM, opacity: .8 }, inner); }
+ tmp.remove();
+ tw(plate, { y: 0, o: 1 }, m('mask') - .1, .45, out);
+ tw(iron, { o: .5 }, m('grows'), 1.4, io); // the iron sinks into the skin
+ // nothing behind it: what shows through the slot goes black
+ const voidS = mk('path', { d: SLOT, fill: '#000', transform: at }, p); put(voidS, { o: 0 });
+ tw(voidS, { o: 1 }, m('grows') + .5, 1.3, io);
+ tw(p, { s: 1.35, x: 800 - 1.35 * FACE[0], y: 450 - 1.35 * FACE[1] }, t, m('laugh') - t + .2, soft);
+ // then the dark closes in from the edges until only the mask-face hangs in a small pool of light. (Heart of Darkness)
+ const gid = 'dark' + Math.floor(t * 100), gr = mk('radialGradient', { id: gid, gradientUnits: 'userSpaceOnUse', cx: FACE[0], cy: FACE[1], r: 1600 }, mk('defs', {}, p));
+ mk('stop', { offset: .55, 'stop-color': '#000', 'stop-opacity': 0 }, gr); mk('stop', { offset: 1, 'stop-color': '#000', 'stop-opacity': 1 }, gr);
+ mk('rect', { x: -1600, y: -1200, width: 4800, height: 3300, fill: `url(#${gid})` }, p);
+ // then, on "laugh", the faces come up out of the dark all round it, laughing at him; the mask stays where it is
+ clockRun(tt => gr.setAttribute('r', (1600 - 1360 * smooth01(span01(tt, m('grows') + .5, m('laugh') - .4)) + 760 * smooth01(span01(tt, m('laugh') - .1, m('laugh') + 1))).toFixed(0)), D, { tail: true });
+ const crowdL = G(p, { o: 0 }); p.insertBefore(crowdL, p.firstChild); // behind the mask
+ pic(crowdL, 'eager', { x: FACE[0], y: FACE[1], h: 800 / 1.35 });
+ show(crowdL, m('laugh') - .1, .6);
+ tw(crowdL, { o: .45 }, m('laughed') - 3.4, .5); // the faces sink back a little for the last words
+ sfx('p4', m('laugh') - .1, 'jeer', .45);
+ // the last words under the mask, in the dark at the foot of the frame (the panel is zoomed 1.35 about the face)
+ say(p, ['“… one long struggle not to be laughed at.”'], FACE[0], FACE[1] + 300 / 1.35, m('laughed') - 3, m('laughed') + .6, { size: 64 / 1.35, anchor: 'middle', mark: ['laughed'] });
+
+
+
+ }, { pre: .8 }],
+
+ // Part 5, the shooting. Seven beats; between them the reader fires (on the page) or the shot is fired for them (video)
+ ['p5a', 'The aim', (m, D) => {
+ // "I shoved the cartridges into the magazine and lay down on the road to get a better aim."
+ let p = panel(0);
+ const pr = pic(p, 'prone', { x: 800, y: 450, h: 800, at: 0, from: [0, 0], dur: .5 });
+ toward(pr, 'prone', .45, .6, 1.25, 0, .01); toward(pr, 'prone', .5, .5, 1.1, m('lay'), 4);
+ sfx('p5a', m('cart'), 'clack', .7); sfx('p5a', m('cart') + .4, 'clack', .7);
+ // "The crowd grew very still, and a deep, low, happy sigh, as of people who see the theatre curtain go up at last,
+ // breathed from innumerable throats." — the theatre of part 4: the curtain goes up on the elephant in the paddy
+ let t = m('sigh') - .8; p = cut(t);
+ const th = theatre(p, t, D);
+ const stageEl = elephantPuppet(G(p, {}), D); p.insertBefore(stageEl.g.parentNode, th.aud);
+ stageEl.pose({ x: 820, y: th.FLOOR + 6, h: 300 });
+ th.curtains.forEach((c, i) => tw(c, { x: (i ? 1 : -1) * 560, o: .9 }, m('curtain') - .3, 1.6, io));
+ th.aud.childNodes.forEach(h => put(h, { o: 1 }));
+ show(th.spot, m('curtain'), .6);
+ sfx('p5a', m('sigh') - .2, 'sigh', 1.2);
+ // "The rifle was a beautiful German thing with cross-hair sights."
+ t = m('s3') - .2; p = cut(t);
+ scope(p, a => { mk('rect', { x: 0, y: 0, width: 1600, height: 900, fill: '#59604f' }, a); paddy(a, 600); });
+ label(p, 'CROSS-HAIR SIGHTS', 800, 850, m('cross') + .2, { size: 26, o: .9 });
+ // "… an imaginary bar running from ear-hole to ear-hole. I ought … to have aimed straight at his ear-hole; actually I
+ // aimed several inches in front of this, thinking the brain would be further forward." — a hunting manual's plate
+ t = m('s4') - .2; p = cut(t);
+ const hd = pic(p, 'e-head', { x: 800, y: 450, h: 820, at: t, from: [0, 0], dur: .5 });
+ push(hd, t, m('forward') + .4, 1.04);
+ tw(hd, { o: .55 }, m('bar') - .5, .5);
+ const [bx_, by_] = spot(hd, 'e-head', .52, .3), [ex, ey] = spot(hd, 'e-head', .6, .43), [ax, ay] = spot(hd, 'e-head', .46, .44);
+ const plate = G(p, {});
+ const brain = path(plate, `M${bx_ - 70} ${by_}a70 46 0 1 0 140 0a70 46 0 1 0 -140 0`, { stroke: CREAM, 'stroke-width': 3.5, 'stroke-dasharray': '10 8', fill: 'none' }, { d: 0 });
+ draw(brain, m('bar') - .4, .6);
+ tag(plate, 'the brain', bx_ + 84, by_ - 40, m('bar'), { size: 32, fill: CREAM });
+ line(plate, `M${ex - 260} ${ey}H${ex + 160}`, m('bar') + .2, .6, 3, { 'stroke-dasharray': '6 6' });
+ tag(plate, 'an imaginary bar, ear-hole to ear-hole', ex + 170, ey + 8, m('bar') + .5, { size: 30, fill: CREAM });
+ const eh = G(plate, { x: ex, y: ey, o: 0 }); mk('circle', { r: 15, fill: 'none', stroke: CREAM, 'stroke-width': 4 }, eh); show(eh, m('ear') - .1, .3);
+ tag(plate, 'ear-hole: where to aim', ex + 24, ey + 52, m('ear') + .2, { size: 30, fill: CREAM });
+ const xx = path(plate, `M${ax - 18} ${ay - 18}l36 36M${ax + 18} ${ay - 18}l-36 36`, { stroke: HOT, 'stroke-width': 8, 'stroke-linecap': 'round' }, { d: 0 });
+ draw(xx, m('inches') - .1, .35);
+ tag(plate, 'where I aimed', ax - 26, ay + 60, m('inches') + .3, { size: 34, fill: HOT, anchor: 'end' });
+ // and the sight: the same picture as the film's first frame; the reader fires
+ t = m('forward') + .5; p = cut(t, .3);
+ scope(p, a => { const g = pic(a, 'elephant-side', { x: SCOPE.x + 150, y: SCOPE.y + 70, h: 880 }); g.setAttribute('filter', 'grayscale(1) contrast(1.1)'); a.shot = { g, name: 'elephant-side', n: 0 }; });
+ }, { pre: .6, ask: fireAsk(1, 'p5b', { head: 0 }), hold: 1.5 }],
+
+ ['p5b', 'The first shot', (m, D) => {
+ let p = panel(0);
+ openingShots('p5b', [.01]); flashAt(p, 0, LIVE.p5b); jolt(p, 0);
+ // "… I heard the devilish roar of glee that went up from the crowd."
+ const e0 = pic(p, 'graze', { x: 800, y: 450, h: 800 });
+ sfx('p5b', m('roar') - .2, 'roar', 1.4);
+ const cr = G(p, { o: 0 }); pic(cr, 'glance', { x: 800, y: 450, h: 800 }); show(cr, m('roar') - .3, .25); hide(cr, m('s2') + .2, .4);
+ // "… a mysterious, terrible change had come over the elephant. He looked suddenly stricken, shrunken, immensely old"
+ const e1 = wounds(pic(p, 'e-stricken', { x: 800, y: 450, h: 800, o: 0 }), 'e-stricken', 1);
+ tw(e1, { o: 1 }, m('change') - .2, .5, lin); // the change, quicker than a dissolve should be
+ push(e1, m('change'), m('s4'), 1.06); hide(e0, m('change') + .4, .01, lin);
+ // "… he sagged flabbily to his knees."
+ const e2 = wounds(pic(p, 'e-knees', { x: 800, y: 450, h: 800, o: 0 }), 'e-knees', 1);
+ tw(e2, { o: 1 }, m('knees') - 1.6, 1.8, io);
+ toward(e2, 'e-knees', .38, .5, 1.25, m('knees'), m('thousands') + 1 - m('knees')); hide(e1, m('knees') + .3, .01, lin);
+ // "One could have imagined him thousands of years old."
+ tw(e2, { o: .4 }, m('s5') - .3, .4);
+ say(p, ['“… thousands of years old.”'], 800, 470, m('s5') + .3, m('thousands') + .9, { size: 70, anchor: 'middle', mark: ['thousands'] });
+ // the sight again, on him kneeling
+ const t = m('thousands') + 2.6; p = cut(t, .3);
+ scopeOn(p, 'e-knees', .32, .42, 1500, undefined, 1);
+ }, { pre: .6, ask: fireAsk(1, 'p5c', { head: 1 }), hold: 1.5 }],
+
+ ['p5c', 'The second shot', (m, D) => {
+ let p = panel(0);
+ openingShots('p5c', [.01]); flashAt(p, 0, LIVE.p5c); jolt(p, 0);
+ wounds(pic(p, 'e-knees', { x: 800, y: 450, h: 800 }), 'e-knees', 2);
+ // "… climbed with desperate slowness to his feet and stood weakly upright, with legs sagging and head drooping."
+ const e = wounds(pic(p, 'e-rise', { x: 800, y: 450, h: 800, o: 0 }), 'e-rise', 2);
+ tw(e, { o: 1 }, m('climbed') - .3, 3.2, io);
+ push(e, m('climbed'), m('upright') + 2, 1.05);
+ const t = m('upright') + 2.4; p = cut(t, .3);
+ scopeOn(p, 'e-rise', .3, .4, 1500, undefined, 2);
+ }, { pre: .6, ask: fireAsk(1, 'p5d', { head: 2 }), hold: 1.5 }],
+
+ ['p5d', 'The third shot', (m, D) => {
+ let p = panel(0);
+ openingShots('p5d', [.01]); flashAt(p, 0, LIVE.p5d); jolt(p, 0);
+ // "That was the shot that did for him."
+ const e0 = wounds(pic(p, 'e-rise', { x: 800, y: 450, h: 800 }), 'e-rise', 3);
+ // "… he seemed to tower upward like a huge rock toppling, his trunk reaching skyward like a tree."
+ const e1 = wounds(pic(p, 'e-topple', { x: 800, y: 450, h: 800, o: 0 }), 'e-topple', 3);
+ tw(e1, { o: 1 }, m('rise') - .4, 1.4, io);
+ toward(e1, 'e-topple', .3, .35, 1.3, m('rise'), m('s3') - m('rise')); hide(e0, m('rise') + 1.1, .01, lin);
+ // "He trumpeted, for the first and only time."
+ sfx('p5d', m('trumpet'), 'trumpet', 2);
+ tw(e1, { o: .38 }, m('trumpet') + .4, .4);
+ say(p, ['“He trumpeted,', 'for the first and only time.”'], 800, 400, m('trumpet') + .2, m('s4') - .2, { size: 64, anchor: 'middle', mark: ['only'] });
+ // "And then down he came, his belly towards me, with a crash that seemed to shake the ground even where I lay."
+ const tc = m('crash') - .3, e2 = wounds(pic(p, 'e-down', { x: 800, y: 450, h: 800, o: 0 }), 'e-down', 3);
+ tw(e2, { o: 1 }, tc, .08, lin); hide(e1, tc + .1, .01, lin);
+ sfx('p5d', tc, 'crash', 2);
+ clockRun(tt => { const q = tt - tc; if (q < 0) return; const a = 20 * Math.exp(-q * 4); put(p, { x: a * Math.sin(q * 61), y: a * Math.sin(q * 47) }); }, D, { tail: true });
+ push(e2, tc, D, 1.04);
+ }, { pre: .6 }],
+
+ ['p5e', 'Not dead', (m, D) => {
+ let p = panel(0);
+ // "… he was not dead. He was breathing very rhythmically with long rattling gasps, his great mound of a side painfully
+ // rising and falling."
+ for (let k = 0; k < 4; k++) sfx('p5e', .2 + k * 8, 'gasps', 1.1);
+ const e0 = wounds(pic(p, 'e-down', { x: 800, y: 450, h: 800 }), 'e-down', 3); breathing(e0, D, { y0: 700 });
+ const e1 = wounds(pic(p, 'e-gasp', { x: 800, y: 450, h: 800, o: 0 }), 'e-gasp', 3); breathing(e1, D, { y0: 720, amp: .016 });
+ tw(e1, { o: 1 }, m('s2') - .3, 1, io); hide(e0, m('s2') + .8, .01, lin);
+ toward(e1, 'e-gasp', .3, .55, 1.25, m('gasps'), 4);
+ const t = m('gasps') + 3.2; p = cut(t, .3);
+ scopeOn(p, 'e-down', .5, .55, 950, undefined, 3);
+ }, { pre: .4, ask: fireAsk(2, 'p5f'), hold: 2 }],
+
+ ['p5f', 'Still he did not die', (m, D) => {
+ let p = panel(0);
+ openingShots('p5f', [.01, .6]); flashAt(p, 0, LIVE.p5f); flashAt(p, .6, LIVE.p5f); jolt(p, 0); jolt(p, .6, 9);
+ for (let k = 0; k < 2; k++) sfx('p5f', .2 + k * 8, 'gasps', 1.1);
+ const e0 = wounds(pic(p, 'e-down', { x: 800, y: 450, h: 800 }), 'e-down', 3); const br = breathing(e0, D, { y0: 700 });
+ // "The thick blood welled out of him like red velvet, but still he did not die." — the only red that spreads
+ // "The thick blood welled out of him like red velvet" — the same photograph with the blood in it (its blood alone
+ // tinted betel red), dissolving in slowly as the words are said
+ const eb = wounds(pic(br, 'e-down-blood', { x: 800, y: 450, h: 800, o: 0 }), 'e-down', 3);
+ tw(eb, { o: 1 }, m('blood') - .2, 2.6, io);
+ toward(e0, 'e-down', .5, .55, 1.2, 0, m('s2')); toward(eb, 'e-down-blood', .5, .55, 1.2, 0, m('s2'));
+ // "I sent back for my small rifle" — the small rifle's sight
+ const t = m('small') - .2; p = cut(t, .3);
+ scopeOn(p, 'e-down-blood', .5, .55, 950, { small: true }, 3);
+ }, { pre: .4, ask: fireAsk(8, 'p5g', { small: true }), hold: 2.4 }],
+
+ ['p5g', 'Half an hour', (m, D) => {
+ let p = panel(0);
+ const shots = [...Array(8)].map((_, k) => .02 + k * .28);
+ openingShots('p5g', shots, true); shots.forEach(t => { flashAt(p, t, LIVE.p5g); jolt(p, t, 5); });
+ for (let k = 0; k < 3; k++) sfx('p5g', .2 + k * 8, 'gasps', 1);
+ const e0 = wounds(pic(p, 'e-gasp-blood', { x: 800, y: 450, h: 800 }), 'e-gasp-blood', 3); breathing(e0, D, { y0: 720, amp: .016 });
+ // "They seemed to make no impression. The tortured gasps continued as steadily as the ticking of a clock."
+ for (let k = 0; k < 9; k++) sfx('p5g', m('s3') + k, 'tick', 1.2);
+ // "In the end I could not stand it any longer and went away." — the view draws back and the light goes
+ tw(e0, { s: .8 }, m('away') - .5, D - m('away'), soft);
+ const dark = put(mk('rect', { x: -2000, y: -2000, width: 6000, height: 5000, fill: '#000' }, p), { o: 0 });
+ tw(dark, { o: 1 }, m('away'), D - m('away') - .2, io);
+ // "I heard later that it took him half an hour to die."
+ say(p, ['“… it took him half an hour to die.”'], 800, 460, m('s5') + .3, m('hour') + .8, { size: 56, anchor: 'middle', mark: ['hour'] });
+ }, { pre: .4 }],
+
+ // Part 6, afterwards: one take; then the title, the author, the year, and The End
+ ['p6', 'Afterwards', (m, D) => {
+ // "Afterwards, of course, there were endless discussions about the shooting of the elephant. Among the Europeans
+ // opinion was divided. The older men said I was right, the younger men said it was a damn shame …"
+ let p = panel(0);
+ const cl = pic(p, 'club', { x: 800, y: 450, h: 800, at: 0, from: [0, 0], dur: .8 });
+ push(cl, 0, m('s3'), 1.04);
+ closeups(p, cl, 'club', [['older', .17, .45, 'the older men', 1.8], ['younger', .78, .45, 'the younger men', 1.8]], m, m('s4') - .3, { x: 800, y: 450 });
+ // "And afterwards I was very glad that the coolie had been killed; it put me legally in the right and it gave me a
+ // sufficient pretext for shooting the elephant."
+ let t = m('s4') - .2; p = cut(t);
+ const bd = pic(p, 'body', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .6 });
+ push(bd, t, m('s5'), 1.05);
+ tw(bd, { o: .3 }, m('pretext') - 2.2, .5);
+ say(p, ['“… a sufficient pretext', 'for shooting the elephant.”'], 800, 400, m('pretext') - 2, m('s5') + .6, { size: 64, anchor: 'middle', mark: ['pretext'] });
+ // "I often wondered whether any of the others grasped that I had done it solely to avoid looking a fool."
+ t = m('s5') + 1.2; p = cut(t);
+ const of = pic(p, 'officer', { x: 800, y: 450, h: 800, at: t, from: [0, 0], dur: .6 });
+ toward(of, 'officer', .48, .3, 1.3, t, D - t + 1);
+ tw(of, { o: .3 }, m('fool') - 2.4, .5);
+ say(p, ['“… solely to avoid', 'looking a fool.”'], 800, 400, m('fool') - 2.2, m('fool') + .5, { size: 70, anchor: 'middle', mark: ['fool'] });
+ // the end card
+ t = D + 2.2; p = cut(t, 1);
+ put(mk('rect', { x: -10, y: -10, width: 1620, height: 920, fill: '#030604' }, p), { o: 1 });
+ key(p, 'Shooting an Elephant', 800, 400, t + .8, { size: 110 });
+ tag(p, 'George Orwell · 1936', 800, 480, t + 1.8, { anchor: 'middle', size: 40, fill: CREAM });
+ const end = T(p, 'The End', { x: 800, y: 650, size: 44, font: SER, weight: 400, fill: CREAM, anchor: 'middle', o: 0 });
+ end.setAttribute('font-style', 'italic'); end.setAttribute('letter-spacing', '.12em');
+ show(end, t + 4, 1.2);
+ hide(end, t + 9, .01, lin); // (the beat's length: the card holds about 5 s)
+ }, { pre: .8 }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+/* ---------- music ----------
+ Elgar's Crown of India (1912, written for the imperial Durbar) under Moulmein: it waits until the black has passed. */
+// Grieg's Mountain King, one piece through the whole part: it sinks to a fifth as he finds the body and comes back as the
+// orderly runs for the rifle (the levels are in m2-grieg-p2.mp3, mixed to the beat clock: down 1.2 s before "I rounded
+// the hut", up 1.6 s after "As soon as I saw the dead man"; MUSIC_OFF would silence it, not lower it)
+music('audio/bgm/m2-grieg-p2.mp3', ['p2'], .55, 1.5);
+// Grieg's Morning Mood under part 3: the morning, the crowd, the elephant at peace
+music('audio/bgm/m3-grieg-morning.mp3', ['p3'], .5, 2);
+// Grieg's Death of Aase under part 4: grave, rising
+music('audio/bgm/m4-grieg-aase.mp3', ['p4'], .5, 2.5);
+// Satie's first Gymnopédie under the shooting: slow and plain against what happens; it plays on while the page waits
+// for the reader to fire (rising a little, engine v2.3), and plays on through the end
+music('audio/bgm/m5-satie.mp3', ['p5a', 'p5b', 'p5c', 'p5d', 'p5e', 'p5f', 'p5g', 'p6'], .4, 2.5); // and on to the end
+music('audio/bgm/m1-crown-menuetto.mp3', ['open'], .5, 3);
+window.MUSIC_OFF = { open: t => t < OPEN_PRE - .8 };
+sfx('open', .01, 'rifle', 2);
+// the first shot can miss: the elephant only trumpets if the crosshair was on it when the reader fired; a miss sends
+// birds up instead (as Orwell's own first shot was misplaced). Decided at the click, before the film starts.
+sfx('open', .5, 'trumpet', 1.6);
+sfx('open', .35, 'flee', 0);
+// the elephant in elephant-grazing-gen.png, as fractions of the picture (inside the print's border)
+const ELEPHANT = [[.42, .02], [.62, 0], [1, .1], [1, 1], [.6, 1], [.55, .72], [.5, .86], [.4, .87], [.33, .75], [.33, .45], [.37, .22]];
+function onElephant() {
+ // the crosshair (SIGHT) over the picture, which sits at SIGHT + (150, 70) + the aim, 880 high with its border
+ const [W, H] = ART['elephant-side'], k = 880 / H, iw = (W - 112) * k, ih = (H - 112) * k;
+ const fx = .5 + (SIGHT.x - (SIGHT.x + 150 + AIM.x)) / iw, fy = .5 + (SIGHT.y - (SIGHT.y + 70 + AIM.y)) / ih;
+ let inside = false; // point in polygon (even-odd)
+ for (let i = 0, j = ELEPHANT.length - 1; i < ELEPHANT.length; j = i++) {
+ const [xi, yi] = ELEPHANT[i], [xj, yj] = ELEPHANT[j];
+ if ((yi > fy) !== (yj > fy) && fx < (xj - xi) * (fy - yi) / (yj - yi) + xi) inside = !inside;
+ }
+ return inside;
+}
+const fire = () => { if (P.started) return; const hit = onElephant(); sfx('open', .5, 'trumpet', hit ? 1.6 : 0); sfx('open', .35, 'flee', hit ? 0 : 1.4); };
+$('cover').addEventListener('click', fire, true);
+addEventListener('keydown', e => { if (e.key === ' ' || e.key === 'Enter') fire(); }, true);
+sfx('open', 1.6, 'ring', .8);
+
+// the fonts must be in before words are measured
+Promise.all(['600 40px Oswald', '500 40px Oswald', 'italic 400 40px "EB Garamond"', '400 40px "EB Garamond"']
+ .map(f => document.fonts.load(f))).then(boot);
+</script>
+</body>
+</html>
diff --git a/site/shooting-an-elephant/img/aftermath.webp b/site/shooting-an-elephant/img/aftermath.webp
new file mode 100644
index 0000000..90ec8d1
Binary files /dev/null and b/site/shooting-an-elephant/img/aftermath.webp differ
diff --git a/site/shooting-an-elephant/img/art.js b/site/shooting-an-elephant/img/art.js
new file mode 100644
index 0000000..17c24fe
--- /dev/null
+++ b/site/shooting-an-elephant/img/art.js
@@ -0,0 +1 @@
+window.ART = {"elephant-side":[1648,976],"moulmein-pagoda":[752,679],"moulmein-1846":[1392,647],"orwell-passport":[751,1012],"crowd":[980,712],"football":[1648,1136],"monks":[912,714],"map-burma":[752,1457],"police":[724,602],"raj":[1088,727],"raj-mess":[1542,1102],"burmese":[1112,1512],"map-empire":[2012,1525],"monks-alms":[1512,1174],"phone":[475,545],"chased":[1112,982],"winchester":[1712,533],"chained":[1412,1294],"aftermath":[1648,1136],"coolie":[829,1132],"double-rifle":[1648,521],"body":[1648,1136],"dawn":[1712,1012],"officer":[1648,1136],"orderly":[1648,1136],"swap":[1648,1136],"winchester-bw":[1712,533],"double-rifle-bw":[1648,521],"rampage":[1648,1136],"jeer0":[276,494],"jeer1":[211,417],"jeer2":[180,506],"jeer3":[285,575],"jeer4":[192,489],"jeer5":[199,458],"jeer6":[224,479],"jeer7":[151,463],"monks-turn":[912,714],"english-crowd":[1589,1120],"follow":[1648,1136],"eager":[1648,1136],"fun":[1648,1136],"eight":[1648,1136],"ought":[1648,1136],"graze":[1648,1136],"football-grin":[1648,1136],"glance":[1648,1136],"conjurer":[1008,1412],"prone":[1648,1136],"e-head":[1648,1136],"e-stricken":[1648,1136],"e-knees":[1648,1136],"e-rise":[1648,1136],"e-topple":[1648,1136],"e-down":[1648,1136],"e-gasp":[1648,1136],"e-down-blood":[1648,1136],"e-gasp-blood":[1648,1136],"club":[1648,1136]};
diff --git a/site/shooting-an-elephant/img/body.webp b/site/shooting-an-elephant/img/body.webp
new file mode 100644
index 0000000..be22e6e
Binary files /dev/null and b/site/shooting-an-elephant/img/body.webp differ
diff --git a/site/shooting-an-elephant/img/burmese.webp b/site/shooting-an-elephant/img/burmese.webp
new file mode 100644
index 0000000..91e336c
Binary files /dev/null and b/site/shooting-an-elephant/img/burmese.webp differ
diff --git a/site/shooting-an-elephant/img/chained.webp b/site/shooting-an-elephant/img/chained.webp
new file mode 100644
index 0000000..4c36268
Binary files /dev/null and b/site/shooting-an-elephant/img/chained.webp differ
diff --git a/site/shooting-an-elephant/img/club.webp b/site/shooting-an-elephant/img/club.webp
new file mode 100644
index 0000000..4d75f7d
Binary files /dev/null and b/site/shooting-an-elephant/img/club.webp differ
diff --git a/site/shooting-an-elephant/img/conjurer.webp b/site/shooting-an-elephant/img/conjurer.webp
new file mode 100644
index 0000000..bef258c
Binary files /dev/null and b/site/shooting-an-elephant/img/conjurer.webp differ
diff --git a/site/shooting-an-elephant/img/coolie.webp b/site/shooting-an-elephant/img/coolie.webp
new file mode 100644
index 0000000..31d9fbb
Binary files /dev/null and b/site/shooting-an-elephant/img/coolie.webp differ
diff --git a/site/shooting-an-elephant/img/cover.webp b/site/shooting-an-elephant/img/cover.webp
new file mode 100644
index 0000000..a456f2e
Binary files /dev/null and b/site/shooting-an-elephant/img/cover.webp differ
diff --git a/site/shooting-an-elephant/img/crowd.webp b/site/shooting-an-elephant/img/crowd.webp
new file mode 100644
index 0000000..ea4dbbb
Binary files /dev/null and b/site/shooting-an-elephant/img/crowd.webp differ
diff --git a/site/shooting-an-elephant/img/dawn.webp b/site/shooting-an-elephant/img/dawn.webp
new file mode 100644
index 0000000..85c22c2
Binary files /dev/null and b/site/shooting-an-elephant/img/dawn.webp differ
diff --git a/site/shooting-an-elephant/img/double-rifle-bw.webp b/site/shooting-an-elephant/img/double-rifle-bw.webp
new file mode 100644
index 0000000..6a358ef
Binary files /dev/null and b/site/shooting-an-elephant/img/double-rifle-bw.webp differ
diff --git a/site/shooting-an-elephant/img/double-rifle.webp b/site/shooting-an-elephant/img/double-rifle.webp
new file mode 100644
index 0000000..405329b
Binary files /dev/null and b/site/shooting-an-elephant/img/double-rifle.webp differ
diff --git a/site/shooting-an-elephant/img/e-down-blood.webp b/site/shooting-an-elephant/img/e-down-blood.webp
new file mode 100644
index 0000000..c00d680
Binary files /dev/null and b/site/shooting-an-elephant/img/e-down-blood.webp differ
diff --git a/site/shooting-an-elephant/img/e-down.webp b/site/shooting-an-elephant/img/e-down.webp
new file mode 100644
index 0000000..9b79550
Binary files /dev/null and b/site/shooting-an-elephant/img/e-down.webp differ
diff --git a/site/shooting-an-elephant/img/e-gasp-blood.webp b/site/shooting-an-elephant/img/e-gasp-blood.webp
new file mode 100644
index 0000000..8083f2d
Binary files /dev/null and b/site/shooting-an-elephant/img/e-gasp-blood.webp differ
diff --git a/site/shooting-an-elephant/img/e-gasp.webp b/site/shooting-an-elephant/img/e-gasp.webp
new file mode 100644
index 0000000..98d3deb
Binary files /dev/null and b/site/shooting-an-elephant/img/e-gasp.webp differ
diff --git a/site/shooting-an-elephant/img/e-head.webp b/site/shooting-an-elephant/img/e-head.webp
new file mode 100644
index 0000000..785f701
Binary files /dev/null and b/site/shooting-an-elephant/img/e-head.webp differ
diff --git a/site/shooting-an-elephant/img/e-knees.webp b/site/shooting-an-elephant/img/e-knees.webp
new file mode 100644
index 0000000..921da28
Binary files /dev/null and b/site/shooting-an-elephant/img/e-knees.webp differ
diff --git a/site/shooting-an-elephant/img/e-rise.webp b/site/shooting-an-elephant/img/e-rise.webp
new file mode 100644
index 0000000..4cf13ca
Binary files /dev/null and b/site/shooting-an-elephant/img/e-rise.webp differ
diff --git a/site/shooting-an-elephant/img/e-stricken.webp b/site/shooting-an-elephant/img/e-stricken.webp
new file mode 100644
index 0000000..4342b0b
Binary files /dev/null and b/site/shooting-an-elephant/img/e-stricken.webp differ
diff --git a/site/shooting-an-elephant/img/e-topple.webp b/site/shooting-an-elephant/img/e-topple.webp
new file mode 100644
index 0000000..f1b8cc7
Binary files /dev/null and b/site/shooting-an-elephant/img/e-topple.webp differ
diff --git a/site/shooting-an-elephant/img/eager.webp b/site/shooting-an-elephant/img/eager.webp
new file mode 100644
index 0000000..14d20d5
Binary files /dev/null and b/site/shooting-an-elephant/img/eager.webp differ
diff --git a/site/shooting-an-elephant/img/eight.webp b/site/shooting-an-elephant/img/eight.webp
new file mode 100644
index 0000000..742603c
Binary files /dev/null and b/site/shooting-an-elephant/img/eight.webp differ
diff --git a/site/shooting-an-elephant/img/elephant-side.webp b/site/shooting-an-elephant/img/elephant-side.webp
new file mode 100644
index 0000000..cc6678c
Binary files /dev/null and b/site/shooting-an-elephant/img/elephant-side.webp differ
diff --git a/site/shooting-an-elephant/img/english-crowd.webp b/site/shooting-an-elephant/img/english-crowd.webp
new file mode 100644
index 0000000..5dffce1
Binary files /dev/null and b/site/shooting-an-elephant/img/english-crowd.webp differ
diff --git a/site/shooting-an-elephant/img/follow.webp b/site/shooting-an-elephant/img/follow.webp
new file mode 100644
index 0000000..530102b
Binary files /dev/null and b/site/shooting-an-elephant/img/follow.webp differ
diff --git a/site/shooting-an-elephant/img/football-grin.webp b/site/shooting-an-elephant/img/football-grin.webp
new file mode 100644
index 0000000..628a09c
Binary files /dev/null and b/site/shooting-an-elephant/img/football-grin.webp differ
diff --git a/site/shooting-an-elephant/img/football.webp b/site/shooting-an-elephant/img/football.webp
new file mode 100644
index 0000000..c7f06f7
Binary files /dev/null and b/site/shooting-an-elephant/img/football.webp differ
diff --git a/site/shooting-an-elephant/img/fun.webp b/site/shooting-an-elephant/img/fun.webp
new file mode 100644
index 0000000..cda007f
Binary files /dev/null and b/site/shooting-an-elephant/img/fun.webp differ
diff --git a/site/shooting-an-elephant/img/glance.webp b/site/shooting-an-elephant/img/glance.webp
new file mode 100644
index 0000000..b39f91b
Binary files /dev/null and b/site/shooting-an-elephant/img/glance.webp differ
diff --git a/site/shooting-an-elephant/img/graze.webp b/site/shooting-an-elephant/img/graze.webp
new file mode 100644
index 0000000..9c93524
Binary files /dev/null and b/site/shooting-an-elephant/img/graze.webp differ
diff --git a/site/shooting-an-elephant/img/map-burma.webp b/site/shooting-an-elephant/img/map-burma.webp
new file mode 100644
index 0000000..a19aca0
Binary files /dev/null and b/site/shooting-an-elephant/img/map-burma.webp differ
diff --git a/site/shooting-an-elephant/img/map-empire.webp b/site/shooting-an-elephant/img/map-empire.webp
new file mode 100644
index 0000000..1b2dffe
Binary files /dev/null and b/site/shooting-an-elephant/img/map-empire.webp differ
diff --git a/site/shooting-an-elephant/img/monks-turn.webp b/site/shooting-an-elephant/img/monks-turn.webp
new file mode 100644
index 0000000..c745c54
Binary files /dev/null and b/site/shooting-an-elephant/img/monks-turn.webp differ
diff --git a/site/shooting-an-elephant/img/monks.webp b/site/shooting-an-elephant/img/monks.webp
new file mode 100644
index 0000000..4667e2c
Binary files /dev/null and b/site/shooting-an-elephant/img/monks.webp differ
diff --git a/site/shooting-an-elephant/img/moulmein-live.mp4 b/site/shooting-an-elephant/img/moulmein-live.mp4
new file mode 100644
index 0000000..4709b76
Binary files /dev/null and b/site/shooting-an-elephant/img/moulmein-live.mp4 differ
diff --git a/site/shooting-an-elephant/img/officer.webp b/site/shooting-an-elephant/img/officer.webp
new file mode 100644
index 0000000..4da5b11
Binary files /dev/null and b/site/shooting-an-elephant/img/officer.webp differ
diff --git a/site/shooting-an-elephant/img/orderly.webp b/site/shooting-an-elephant/img/orderly.webp
new file mode 100644
index 0000000..9bd0d14
Binary files /dev/null and b/site/shooting-an-elephant/img/orderly.webp differ
diff --git a/site/shooting-an-elephant/img/orwell-passport.webp b/site/shooting-an-elephant/img/orwell-passport.webp
new file mode 100644
index 0000000..ef9311a
Binary files /dev/null and b/site/shooting-an-elephant/img/orwell-passport.webp differ
diff --git a/site/shooting-an-elephant/img/ought.webp b/site/shooting-an-elephant/img/ought.webp
new file mode 100644
index 0000000..7472b1c
Binary files /dev/null and b/site/shooting-an-elephant/img/ought.webp differ
diff --git a/site/shooting-an-elephant/img/phone.webp b/site/shooting-an-elephant/img/phone.webp
new file mode 100644
index 0000000..0b7195e
Binary files /dev/null and b/site/shooting-an-elephant/img/phone.webp differ
diff --git a/site/shooting-an-elephant/img/police.webp b/site/shooting-an-elephant/img/police.webp
new file mode 100644
index 0000000..cdd0911
Binary files /dev/null and b/site/shooting-an-elephant/img/police.webp differ
diff --git a/site/shooting-an-elephant/img/prone.webp b/site/shooting-an-elephant/img/prone.webp
new file mode 100644
index 0000000..db9966d
Binary files /dev/null and b/site/shooting-an-elephant/img/prone.webp differ
diff --git a/site/shooting-an-elephant/img/raj-mess.webp b/site/shooting-an-elephant/img/raj-mess.webp
new file mode 100644
index 0000000..f40ea91
Binary files /dev/null and b/site/shooting-an-elephant/img/raj-mess.webp differ
diff --git a/site/shooting-an-elephant/img/raj.webp b/site/shooting-an-elephant/img/raj.webp
new file mode 100644
index 0000000..affd189
Binary files /dev/null and b/site/shooting-an-elephant/img/raj.webp differ
diff --git a/site/shooting-an-elephant/img/rampage.webp b/site/shooting-an-elephant/img/rampage.webp
new file mode 100644
index 0000000..d338a58
Binary files /dev/null and b/site/shooting-an-elephant/img/rampage.webp differ
diff --git a/site/shooting-an-elephant/img/still-ch01.webp b/site/shooting-an-elephant/img/still-ch01.webp
new file mode 100644
index 0000000..a456f2e
Binary files /dev/null and b/site/shooting-an-elephant/img/still-ch01.webp differ
diff --git a/site/shooting-an-elephant/img/swap.webp b/site/shooting-an-elephant/img/swap.webp
new file mode 100644
index 0000000..583dd24
Binary files /dev/null and b/site/shooting-an-elephant/img/swap.webp differ
diff --git a/site/shooting-an-elephant/img/winchester-bw.webp b/site/shooting-an-elephant/img/winchester-bw.webp
new file mode 100644
index 0000000..a474ec5
Binary files /dev/null and b/site/shooting-an-elephant/img/winchester-bw.webp differ
diff --git a/site/shooting-an-elephant/img/winchester.webp b/site/shooting-an-elephant/img/winchester.webp
new file mode 100644
index 0000000..2c36681
Binary files /dev/null and b/site/shooting-an-elephant/img/winchester.webp differ
diff --git a/site/shooting-an-elephant/index.html b/site/shooting-an-elephant/index.html
new file mode 100644
index 0000000..af66313
--- /dev/null
+++ b/site/shooting-an-elephant/index.html
@@ -0,0 +1,73 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Shooting an Elephant</title>
+<meta name="description" content="A short interactive documentary of George Orwell’s 1936 essay, in his own words: the reader holds the rifle.">
+<link rel="stylesheet" href="lib/fonts.css">
+<link rel="stylesheet" href="lib/book.css"><!-- only for --progress-key, if the book sets one -->
+<!-- A picture book's cover and episode list. A starting point, not a design: give it the book's own look. -->
+<style>
+ :root { --ink: #f3ede0; --soft: #bccdb9; --paper: #1d3527; --card: #172b20; --line: #355443; --accent: #c0392b;
+ --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif; --serif: "Iowan Old Style", Palatino, Georgia, serif; color-scheme: dark; }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.6 var(--ui); }
+ header { 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; }
+ header img { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 14px 40px #4a33182e; }
+ h1 { margin: 0 0 8px; font: 700 clamp(34px, 4.6vw, 56px)/1.05 var(--serif); }
+ .lede { font-size: 20px; color: var(--soft); }
+ main { max-width: 1000px; margin: 0 auto; padding: 8px 24px 80px; }
+ .episodes { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
+ .episodes a { display: flex; flex-direction: column; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
+ overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
+ .episodes a:hover, .episodes a:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
+ .episodes img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
+ .episodes small { margin: 12px 16px 0; color: var(--soft); font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
+ .episodes b { margin: 2px 16px 4px; font: 700 21px/1.25 var(--serif); }
+ .episodes span { margin: 0 16px 16px; color: var(--soft); font-size: 15px; line-height: 1.5; }
+ .watched small::after { content: " · ✓ watched"; color: var(--accent); }
+ @media (max-width: 760px) { header { grid-template-columns: 1fr; padding-top: 28px; } .episodes { grid-template-columns: 1fr; } }
+ .credits { max-width: 1100px; margin: 40px auto 60px; padding: 0 24px; color: var(--soft); font-size: 14px; line-height: 1.6; }
+ .credits h2 { font: 600 20px/1.3 var(--serif); color: inherit; } .credits h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin: 18px 0 6px; }
+ .credits ul { margin: 0; padding-left: 18px; columns: 2 340px; } .credits a { color: inherit; }
+</style>
+</head>
+<body>
+<header>
+ <img src="img/cover.webp" width="1400" height="788" alt="An elephant grazing in a flooded paddy field, in black and white.">
+ <div>
+ <h1>Shooting an Elephant</h1>
+ <p class="lede">George Orwell’s 1936 essay, told in his own words: a young police officer in Burma, an elephant in a paddy field, and a crowd that wants a shot. This time the reader holds the rifle.</p>
+ </div>
+</header>
+<main>
+ <ul class="episodes" id="episodes"></ul>
+</main>
+<section class="credits">
+ <h2>Sources and credits</h2>
+ <p>The words are George Orwell’s, from “Shooting an Elephant” (<i>New Writing</i>, 1936), cut but not rewritten, read by an ElevenLabs v4 voice (“daniel”); the crowd’s laughter is six more ElevenLabs voices. Archive pictures, music and two sound recordings are public-domain or CC0 works from Wikimedia Commons, listed below. Where no photograph exists, the scenes are reconstructions made with an image model (gpt-image via OpenRouter): Orwell as the young officer, the orderly, the football match, the rampage, the body, the double rifle, the club, the painted town of Moulmein, and the grazing elephant and every stage of its shooting, including the cover; the novice who turns and grins is an altered archive photograph. The silhouettes, maps and theatre are drawn in code, as are the other sound effects. Type: Oswald and EB Garamond (SIL Open Font License, <code>lib/fonts/</code>).</p>
+ <h3>Pictures</h3><ul><li><a href="https://commons.wikimedia.org/wiki/File%3AOrwellBurmaPassport.jpg">OrwellBurmaPassport.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ABurmese_Funeral_procession_1900.jpg">Burmese Funeral procession 1900.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ABurmese_monks_and_novices.jpg">Burmese monks and novices.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ABurma_showing_British_acquisitions_%281826-1890%29.jpg">Burma showing British acquisitions (1826-1890).jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ABurma_Military_Police_1898.jpg">Burma Military Police 1898.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ARangoon_Government_House.jpg">Rangoon Government House.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3APrivate_audience-room_in_the_Palace_at_Mandalay%2C_used_as_the_British_Head-quarters_mess_ILN-1886-0320-0024.jpg">Private audience-room in the Palace at Mandalay, used as the British Head-quarters mess ILN-1886-0320-0024.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AA_Burmese_Lady%2C_photograph_by_Philip_Adolphe_Klier.jpg">A Burmese Lady, photograph by Philip Adolphe Klier.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AImperial_Federation%2C_Map_of_the_World_Showing_the_Extent_of_the_British_Empire_in_1886_%28levelled%29.jpg">Imperial Federation, Map of the World Showing the Extent of the British Empire in 1886 (levelled).jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ACandlestick_Telephone_with_Note_Pad.png">Candlestick Telephone with Note Pad.png</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AWinchester_1873_Rifle.jpg">Winchester 1873 Rifle.jpg</a> · CC0</li><li><a href="https://commons.wikimedia.org/wiki/File%3AElephant%2C_India%2C_ca._1920_%28IMP-CSCNWW33-OS16-17%29.jpg">Elephant, India, ca. 1920 (IMP-CSCNWW33-OS16-17).jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AA_coolie_in_Calcutta_in_the_1920s.jpg">A coolie in Calcutta in the 1920s.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AWhite_Horse_Final1923.jpg">White Horse Final1923.jpg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AFlickr_-_%E2%80%A6trialsanderrors_-_Kellar%2C_Levitation%2C_magician_poster%2C_ca._1894.jpg">Flickr - …trialsanderrors - Kellar, Levitation, magician poster, ca. 1894.jpg</a> · Public domain</li></ul>
+ <h3>Music</h3><ul><li><a href="https://commons.wikimedia.org/wiki/File%3AThe_Crown_of_India_Suite%2C_2._Menuetto_-_U.S._Marine_Band.ogg">The Crown of India Suite, 2. Menuetto - U.S. Marine Band.ogg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AMusopen_-_In_the_Hall_Of_The_Mountain_King.ogg">Musopen - In the Hall Of The Mountain King.ogg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AGrieg_-_Peer_Gynt_Suite_No._1%2C_Op._46_-_II._The_Death_of_Aase_%28Musopen_Symphony%29.flac">Grieg - Peer Gynt Suite No. 1, Op. 46 - II. The Death of Aase (Musopen Symphony).flac</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AGrieg_-_Peer_Gynt_Suite_No._1%2C_Op._46_-_I._Morning_Mood_%28Musopen_Symphony%29.flac">Grieg - Peer Gynt Suite No. 1, Op. 46 - I. Morning Mood (Musopen Symphony).flac</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3ASatie_Gymnopedie_No_1_performed_by_Michael_Laucke.flac">Satie Gymnopedie No 1 performed by Michael Laucke.flac</a> · Public domain</li></ul>
+ <h3>Sound</h3><ul><li><a href="https://commons.wikimedia.org/wiki/File%3AGunshots_8.ogg">Gunshots 8.ogg</a> · Public domain</li><li><a href="https://commons.wikimedia.org/wiki/File%3AElephant_voice_-_trumpeting.ogg">Elephant voice - trumpeting.ogg</a> · CC0</li></ul>
+</section>
+
+<script>
+'use strict';
+// One entry per finished episode, in order: its folder, title, a still (16:9) with alt text, and one line.
+const EPISODES = [
+ { ch: 'ch01', title: 'Shooting an Elephant', minutes: 9, still: 'img/still-ch01.webp', alt: 'An elephant grazing in a flooded paddy field, in black and white.', line: 'Moulmein, 1920s: Orwell tells how he shot an elephant “solely to avoid looking a fool.” You aim, and you fire.' },
+];
+// The player records finished episodes under the same key as here (engine progress(): lib/book.css --progress-key,
+// else this folder's path).
+const key = getComputedStyle(document.documentElement).getPropertyValue('--progress-key').trim().replace(/^["']|["']$/g, '')
+ || 'animebook:progress:' + new URL('.', location.href).pathname;
+let done = [];
+try { done = JSON.parse(localStorage.getItem(key) || '{}').done || []; } catch {}
+const esc = s => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
+document.getElementById('episodes').innerHTML = EPISODES.map((e, i) => `<li${done.includes(+e.ch.slice(2)) ? ' class="watched"' : ''}>
+ <a href="${e.ch}/"><img src="${esc(e.still)}" alt="${esc(e.alt)}" loading="lazy">
+ <small>Episode ${i + 1} · ${e.minutes} minute${e.minutes == 1 ? "" : "s"}</small><b>${esc(e.title)}</b><span>${esc(e.line)}</span></a></li>`).join('');
+</script>
+</body>
+</html>
diff --git a/site/shooting-an-elephant/lib/book.css b/site/shooting-an-elephant/lib/book.css
new file mode 100644
index 0000000..71bfb1e
--- /dev/null
+++ b/site/shooting-an-elephant/lib/book.css
@@ -0,0 +1,15 @@
+/* The film's colours: jungle green and cream (ground test: books/shooting-an-elephant/review/ground/sheet.png).
+ --board is the ground, --chalk the ink on it, --dim captions; --accent (betel red: only for the betel juice and the
+ elephant's blood), and an old document's --paper, --paper-ink and --stamp, are read by film.js. Bake pictures to match
+ (prep.py and frames.py --ink is --chalk, prep.py --paper the paper). Imported by engine.css; engine.py never
+ overwrites it. */
+@import url("fonts.css");
+:root {
+ --page: #0e1d14; --board: #1d3527; --panel: #172b20; --edge: #355443;
+ --chalk: #f3ede0; --dim: #bccdb9; --faint: #6f8a76;
+ --task: #f0b45a; --quiz: #e8c8a0; --good: #c8e0b0; --bad: #ffb0a0;
+ --vignette: rgba(4, 14, 8, .5);
+ --rule: #2c4a39; --track: #26402f; --track-ask: #26402f;
+ --bar-edge: #26402f; --hover: #2a4636; --veil: #0b1710;
+ --accent: #c0392b; --paper: #f3ede0; --paper-ink: #3a2a24; --stamp: #7a1a20;
+}
diff --git a/site/shooting-an-elephant/lib/contents.css b/site/shooting-an-elephant/lib/contents.css
new file mode 100644
index 0000000..d8f7f70
--- /dev/null
+++ b/site/shooting-an-elephant/lib/contents.css
@@ -0,0 +1,137 @@
+/* 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; }
+/* #references is its own view: the full list, reached from one link at the end of the contents. */
+body:not(.refsview) #refpage, .refsview #cover, .refsview #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; } }
+/* ---------- references: every source the book cites, linked to its DOI or catalogue record ---------- */
+.refs-more { max-width: 1212px; margin: 44px auto 0; padding: 0 16px; }
+.refs-more[hidden] { display: none; }
+.refs-more a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 16px 20px; border-radius: 16px; background: var(--panel);
+ border: 1.5px solid var(--edge); text-decoration: none; transition: border-color .3s; }
+.refs-more a:hover { border-color: var(--dim); }
+.refs-more b { font: 500 22px/1.2 var(--book); }
+.refs-more span { color: var(--dim); font-size: 15px; }
+.refs-more i { margin-left: auto; font-style: normal; color: var(--quiz); font-weight: 600; font-size: 15px; }
+#refpage { padding-bottom: 80px; }
+.top .back { display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 600; text-decoration: none; color: var(--quiz); border-radius: 8px; }
+.top .rp-book { margin-left: auto; font: 500 18px/1.2 var(--book); color: var(--dim); }
+.top .rp-book i { color: var(--task); }
+.refs { max-width: 1212px; margin: 32px auto 0; padding: 0 16px; }
+.refs h1 { margin: 0 0 8px; font: 500 clamp(32px, 5vw, 44px)/1.1 var(--book); view-transition-name: none; }
+.refs .lead { margin: 0 0 26px; max-width: 46em; color: var(--dim); }
+.refs ol { margin: 0; padding: 0; list-style: none; color: var(--dim); font-size: 16px; line-height: 1.5; }
+.refs li { margin: 0 0 10px; padding-left: 2em; text-indent: -2em; }
+.refs a { color: var(--chalk); text-underline-offset: 3px; overflow-wrap: anywhere; }
+.refs a:hover { color: var(--quiz); }
+.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/shooting-an-elephant/lib/contents.js b/site/shooting-an-elephant/lib/contents.js
new file mode 100644
index 0000000..0bacf99
--- /dev/null
+++ b/site/shooting-an-elephant/lib/contents.js
@@ -0,0 +1,226 @@
+/* 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. With refs.js (REFS, built by the skill's
+ scripts/refs.py) loaded first, the page also gets its References view (#references). */
+'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',
+ references: 'References', viewAll: 'View all →', backToContents: '← Contents',
+ refsLead: 'Every work cited in the lessons. Each link opens the work’s DOI or library record in a new tab; works with no reliable online record are listed without a link.',
+ refsCount: { one: '{n} work cited in the lessons', other: '{n} works cited in the lessons' },
+ refsAllLinked: ', each linked to its source', refsSomeLinked: ', {n} linked to their sources',
+ },
+ 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: ' · Открыта последней',
+ references: 'Список литературы', viewAll: 'Весь список →', backToContents: '← Оглавление',
+ refsLead: 'Все работы, которые цитируются в уроках. Ссылка открывает DOI или библиотечную запись в новой вкладке; работы без надёжной записи в сети даны без ссылки.',
+ refsCount: { one: '{n} работа цитируется в уроках', few: '{n} работы цитируются в уроках', many: '{n} работ цитируются в уроках', other: '{n} работы цитируются в уроках' },
+ refsAllLinked: ', у каждой есть ссылка на источник', refsSomeLinked: ', ссылок на источник: {n}',
+ },
+ 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: ' · 上次打开',
+ references: '参考文献', viewAll: '查看全部 →', backToContents: '← 目录',
+ refsLead: '课程中引用的全部作品。每个链接会在新标签页中打开该作品的 DOI 或图书馆记录;没有可靠在线记录的作品不附链接。',
+ refsCount: '课程中引用了 {n} 部作品', refsAllLinked: ',均链接到来源', refsSomeLinked: ',其中 {n} 部链接到来源',
+ },
+ 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: ' · 最後に開いた章',
+ references: '参考文献', viewAll: 'すべて見る →', backToContents: '← 目次',
+ refsLead: '授業で引用したすべての著作です。リンクは著作の DOI または図書館の記録を新しいタブで開きます。信頼できるオンライン記録のない著作はリンクなしで載せています。',
+ refsCount: '授業で引用した著作 {n} 件', refsAllLinked: '、すべて出典へのリンクつき', refsSomeLinked: '、うち {n} 件は出典へのリンクつき',
+ },
+ };
+ // the same lookup as translate() in engine.js (the two pages never load each other's file): keep them in step
+ 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;').replace(/"/g, '&quot;');
+ 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 References view, from refs.js: full entries, each linked to its DOI or catalogue record. It appears as one
+ // link at the end of the contents only when the book cites something.
+ function references() {
+ const all = Object.values(typeof REFS === 'object' && REFS ? REFS : {});
+ if (!$('refList') || !all.length) return;
+ $('refList').innerHTML = all.sort((a, b) => a.ref.localeCompare(b.ref)).map(r => `<li>${esc(r.ref)}${r.url
+ ? ` <a href="${esc(r.url)}" target="_blank" rel="noopener">${esc(r.url.replace(/^https?:\/\//, ''))}</a>` : ''}</li>`).join('');
+ const linked = all.filter(r => r.url).length;
+ $('refsCount').textContent = translate('refsCount', { n: all.length }) +
+ (linked === all.length ? translate('refsAllLinked') : translate('refsSomeLinked', { n: linked }));
+ $('rpBook').innerHTML = document.querySelector('#contents .home strong')?.innerHTML || '';
+ $('refsMore').hidden = false;
+ }
+
+ // 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, the contents and the references share this page: no hash or #book shows the cover, #references the
+ // reference list, #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 refs = location.hash === '#references';
+ const open = location.hash.length > 1 && location.hash !== '#book' && !refs;
+ const apply = () => {
+ document.body.classList.toggle('open', open);
+ document.body.classList.toggle('refsview', refs);
+ 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(refs ? '#refsTitle' : 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));
+ references();
+ guides(ink || getComputedStyle(document.documentElement).getPropertyValue('--chalk').trim() || '#ece8dc');
+ views();
+ }
+
+ return { book, translate };
+})();
diff --git a/site/shooting-an-elephant/lib/engine.css b/site/shooting-an-elephant/lib/engine.css
new file mode 100644
index 0000000..3e6079a
--- /dev/null
+++ b/site/shooting-an-elephant/lib/engine.css
@@ -0,0 +1,261 @@
+@import url(volume.css);
+@import url(book.css); /* this book's own settings and overrides (not shared), before the rules below */
+/* The palette. lib/book.css may redefine any of it in its own ':root' (this one has no specificity), e.g. a light board
+ with dark ink: the stage, COL in engine.js, the cards and the player bar all follow. Colours are #rrggbb. The last
+ lines are shades between those colours, written out so the dark board stays exact: a palette of its own sets them too
+ (the light set in book.css). */
+:where(: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;
+ --vignette: rgba(0, 0, 0, .35); /* the stage's darkened edges; a light board wants a faint, warm one */
+ color-scheme: dark;
+ --rule: #2e433b; /* lines between answer rows */
+ --track: #2f4640; --track-ask: #2d4a57; /* the player bar's steps, and its question steps */
+ --bar-edge: #2a3b35; --hover: #2b3f36; /* the bar's top line, the volume control under the pointer */
+ --veil: #0a100e; /* behind the help panel and the captions */
+}
+* { 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%, var(--vignette)), var(--grain, none), var(--board); }
+#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: color-mix(in srgb, var(--page) 50%, transparent); 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: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 22px; }
+
+/* Question cards inside the picture. */
+.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: color-mix(in srgb, var(--panel) 97%, transparent); 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: var(--on-fill, #1b2320); font-weight: 600; }
+.opt.good { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 35%, transparent); }
+.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: var(--on-fill, #10242e); } /* --on-fill: text on a coloured fill */
+.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 var(--rule); }
+.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: color-mix(in srgb, var(--page) 50%, var(--board)); border-top: 1px solid var(--bar-edge); }
+.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: var(--track); 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: var(--track-ask); }
+.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: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 19px; }
+.sound-note[hidden] { display: none; }
+.blanks .brow { padding: 8px 0; border-bottom: 1px solid var(--rule); }
+.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: color-mix(in srgb, var(--chalk) 7%, transparent); 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: color-mix(in srgb, var(--quiz) 16%, transparent); }
+.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: color-mix(in srgb, var(--chalk) 5%, transparent); box-shadow: inset 4px 0 var(--quiz); }
+.help { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; display: grid; place-items: center; background: color-mix(in srgb, var(--veil) 72%, transparent); }
+.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-cols:has(> [hidden]) { grid-template-columns: 1fr; }
+.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: color-mix(in srgb, var(--veil) 82%, transparent); 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; }
+/* Citations (cite() and plain-text labels found in refs.js) and the finish card's source list open the source in a new tab. */
+a.cite { cursor: pointer; }
+a.cite text, a.cite tspan { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
+a.cite:hover text, a.cite:hover tspan { fill: var(--quiz); }
+a.cite:focus { outline: none; }
+a.cite:focus-visible text, a.cite:focus-visible tspan { fill: var(--task); }
+a.cite:focus-visible { outline: 3px solid var(--task); outline-offset: 6px; border-radius: 4px; }
+#ui a.cite { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
+#ui a.cite:hover { color: var(--quiz); }
+.fin .srcs { margin: 26px 0 0; max-width: 1100px; font-size: 19px; line-height: 1.45; color: var(--dim); text-align: left; }
+.fin .srcs h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }
+.fin .srcs ol { margin: 0; padding-left: 0; list-style: none; max-height: 190px; overflow: auto; }
+.fin .srcs li { padding-left: 2em; text-indent: -2em; margin: 0 0 6px; }
+.fin .srcs a { color: var(--chalk); text-underline-offset: 3px; }
+.fin .srcs a:hover { color: var(--quiz); }
+.fin .srcs a:focus-visible { outline: 3px solid var(--task); outline-offset: 2px; }
+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/shooting-an-elephant/lib/engine.js b/site/shooting-an-elephant/lib/engine.js
new file mode 100644
index 0000000..bdd729c
--- /dev/null
+++ b/site/shooting-an-elephant/lib/engine.js
@@ -0,0 +1,1650 @@
+// Papermorph lesson engine: stage, drawing, timeline, questions, player.
+// A chapter page loads this file, defines CHAPTER and BEATS, then calls boot().
+'use strict';
+// A fast follow-up navigation can abort the incoming page transition.
+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));
+
+/* ---------- interface language ---------- */
+// The page's <html lang> picks the interface text; CHAPTER.language picks the audio folder. Set both alike.
+// A value is a string or plural forms { one, few, many, other } chosen by vars.n. Missing keys fall back to English.
+const TRANSLATIONS = {
+ en: {
+ decimalSign: '.', stageLabel: 'Lesson animation', stageLabelTitled: 'Lesson animation: {title}',
+ shortcuts: 'Keyboard shortcuts', lesson: 'Lesson', questions: 'Questions',
+ helpPlay: 'Play or pause', helpStep: 'Previous or next step', helpStepInQuestion: 'Change step during a question', helpRestart: 'Start over',
+ helpCaptions: 'Captions on or off', helpSpeed: 'Slower or faster', helpFullScreen: 'Full screen', helpList: 'Show this list',
+ helpChoose: 'Choose an answer or a ring', helpTrueFalse: 'True or false', helpRows: 'Move between rows',
+ helpNumberLine: 'Move along the number line, or pick a number to sort', helpEnter: 'Check, then continue',
+ helpShowAnswer: 'Show the answer', helpLeaveBox: 'Leave an answer box', helpClose: 'Press {key} to close.',
+ paused: 'Paused. Press space or click to continue.',
+ soundFailed: 'Sound could not play. The lesson continues with the on-screen text.',
+ startLesson: 'Start lesson', startFilm: 'Play', aboutMinutesFilm: 'About {n} minutes, with sound.', coverKeys: 'Press {space} to start, {help} for shortcuts.', spaceKey: 'Space',
+ chapterNumber: 'Chapter {n}', aboutMinutes: 'About {n} minutes, with sound and quick checks.',
+ allChapters: 'All chapters', playLabel: 'Play or pause (space)', backLabel: 'Previous step (left arrow)', restartLabel: 'Restart lesson',
+ checksInLesson: 'Quick checks and practice are in the interactive lesson.',
+ volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',
+ helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',
+ quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',
+ correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',
+ hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',
+ hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',
+ hintTypeDecimal: 'type the number, ', hintNextBox: ' next box, ', hintCheck: ' check, ', hintLeaveBox: ' leave the box',
+ hintPickNumber: ' pick a number, ', hintPickRing: ' choose its ring',
+ rowsRight: '{r} of {n} right. Fix the rows marked ✗ and check again.',
+ choicesShown: 'the correct choices are now selected.', numbersShown: 'the correct numbers are filled in.',
+ notPlacedYet: '{x} is not placed yet.',
+ realRingIsEmpty: '{x}: every real number is rational or irrational, so that space has no numbers of its own.',
+ ringsRight: '{r} of {n} in the right ring.', ringsShown: 'every number is now in its smallest ring.',
+ chipPlaced: '{x}, placed in {ring}', chipNotPlaced: '{x}, not placed', pointLabel: 'The point {v}', answerBox: 'Answer',
+ stepsLeftOfZero: '{n} steps left of 0',
+ natural: 'Natural', whole: 'Whole', integers: 'Integers', rational: 'Rational', irrational: 'Irrational', real: 'Real', integerColumn: 'Integer',
+ trueLabel: 'True', falseLabel: 'False',
+ chapterComplete: 'Chapter {n} complete', quickChecks: 'Quick checks', chapterPractice: 'Chapter practice', sources: 'Sources in this chapter', opensSource: '{label}, opens the source in a new tab',
+ firstTryScore: '{name}: {r} of {t} right on the first try.', notAttempted: '{name}: not attempted.',
+ watchAgain: 'Watch again', nextChapter: 'Next chapter',
+ },
+ ru: {
+ decimalSign: ',', stageLabel: 'Анимация урока', stageLabelTitled: 'Анимация урока: {title}',
+ shortcuts: 'Горячие клавиши', lesson: 'Урок', questions: 'Вопросы',
+ helpPlay: 'Пуск или пауза', helpStep: 'Предыдущий или следующий шаг', helpStepInQuestion: 'Сменить шаг во время вопроса', helpRestart: 'Начать сначала',
+ helpCaptions: 'Субтитры вкл. или выкл.', helpSpeed: 'Медленнее или быстрее', helpFullScreen: 'Полноэкранный режим', helpList: 'Показать этот список',
+ helpChoose: 'Выбрать ответ или круг', helpTrueFalse: 'Верно или неверно', helpRows: 'Перейти между строками',
+ helpNumberLine: 'Двигаться по числовой прямой или выбрать число для сортировки', helpEnter: 'Проверить, затем продолжить',
+ helpShowAnswer: 'Показать ответ', helpLeaveBox: 'Выйти из поля ответа', helpClose: 'Нажмите {key}, чтобы закрыть.',
+ paused: 'Пауза. Нажмите пробел или щёлкните, чтобы продолжить.',
+ soundFailed: 'Звук не воспроизводится. Урок продолжится с текстом на экране.',
+ startLesson: 'Начать урок', startFilm: 'Смотреть', aboutMinutesFilm: { one: 'Около {n} минуты, со звуком.', few: 'Около {n} минут, со звуком.', many: 'Около {n} минут, со звуком.', other: 'Около {n} минуты, со звуком.' }, coverKeys: '{space} — начать, {help} — горячие клавиши.', spaceKey: 'Пробел',
+ chapterNumber: 'Глава {n}',
+ aboutMinutes: { one: 'Около {n} минуты, со звуком и проверками.', few: 'Около {n} минут, со звуком и проверками.',
+ many: 'Около {n} минут, со звуком и проверками.', other: 'Около {n} минуты, со звуком и проверками.' },
+ allChapters: 'Все главы', playLabel: 'Пуск или пауза (пробел)', backLabel: 'Предыдущий шаг (стрелка влево)', restartLabel: 'Начать урок заново',
+ checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',
+ volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',
+ helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',
+ quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',
+ correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',
+ hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',
+ hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',
+ hintTypeDecimal: 'вводите числа вида 0,75, ', hintNextBox: ' следующее поле, ', hintCheck: ' проверить, ', hintLeaveBox: ' выйти из поля',
+ hintPickNumber: ' выбрать число, ', hintPickRing: ' выбрать его круг',
+ rowsRight: 'Верно {r} из {n}. Исправьте строки с ✗ и проверьте снова.',
+ choicesShown: 'правильные варианты отмечены.', numbersShown: 'правильные числа вписаны.',
+ notPlacedYet: '{x}: ещё не размещено.',
+ realRingIsEmpty: '{x}: каждое действительное число рационально или иррационально, поэтому своих чисел у этой области нет.',
+ ringsRight: 'В нужном круге: {r} из {n}.', ringsShown: 'каждое число теперь в своём наименьшем круге.',
+ chipPlaced: '{x}, в круге «{ring}»', chipNotPlaced: '{x}, не размещено', pointLabel: 'Точка {v}', answerBox: 'Ответ',
+ stepsLeftOfZero: { one: '{n} шаг влево от 0', few: '{n} шага влево от 0', many: '{n} шагов влево от 0', other: '{n} шага влево от 0' },
+ natural: 'Натуральные', whole: 'Целые неотрицательные', integers: 'Целые', rational: 'Рациональные', irrational: 'Иррациональные', real: 'Действительные', integerColumn: 'Целые',
+ trueLabel: 'Верно', falseLabel: 'Неверно',
+ chapterComplete: 'Глава {n} пройдена', quickChecks: 'Проверь себя', chapterPractice: 'Практика по главе', sources: 'Источники этой главы', opensSource: '{label}, источник откроется в новой вкладке',
+ firstTryScore: '{name}: {r} из {t} верно с первой попытки.', notAttempted: '{name}: не выполнялось.',
+ watchAgain: 'Смотреть снова', nextChapter: 'Следующая глава',
+ },
+ zh: {
+ decimalSign: '.', stageLabel: '课程动画', stageLabelTitled: '课程动画:{title}',
+ shortcuts: '键盘快捷键', lesson: '课程', questions: '题目',
+ helpPlay: '播放或暂停', helpStep: '上一步或下一步', helpStepInQuestion: '答题时切换步骤', helpRestart: '从头开始',
+ helpCaptions: '打开或关闭字幕', helpSpeed: '减速或加速', helpFullScreen: '全屏', helpList: '显示此列表',
+ helpChoose: '选择答案或圆环', helpTrueFalse: '对或错', helpRows: '在各行之间移动',
+ helpNumberLine: '在数轴上移动,或选一个数来分类', helpEnter: '检查,然后继续',
+ helpShowAnswer: '显示答案', helpLeaveBox: '离开答题框', helpClose: '按 {key} 关闭。',
+ paused: '已暂停。按空格键或点击继续。',
+ soundFailed: '声音无法播放。课程将借助屏幕上的文字继续。',
+ startLesson: '开始上课', startFilm: '播放', aboutMinutesFilm: '约 {n} 分钟,有配音。', coverKeys: '按 {space} 开始,按 {help} 查看快捷键。', spaceKey: '空格',
+ chapterNumber: '第 {n} 章', aboutMinutes: '约 {n} 分钟,含配音和随堂小测。',
+ allChapters: '全部章节', playLabel: '播放或暂停(空格)', backLabel: '上一步(左方向键)', restartLabel: '重新开始本课',
+ checksInLesson: '小测验和练习在互动课程里。',
+ volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',
+ helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',
+ quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',
+ correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',
+ hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',
+ hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',
+ hintTypeDecimal: '输入数字,', hintNextBox: ' 下一个框,', hintCheck: ' 检查,', hintLeaveBox: ' 离开答题框',
+ hintPickNumber: ' 选一个数,', hintPickRing: ' 选它所在的圆环',
+ rowsRight: '{n} 行中对了 {r} 行。改正标 ✗ 的行,再检查一次。',
+ choicesShown: '正确选项已经选上。', numbersShown: '正确的数已经填上。',
+ notPlacedYet: '{x} 还没有放好。',
+ realRingIsEmpty: '{x}:每个实数不是有理数就是无理数,所以这一块没有只属于它的数。',
+ ringsRight: '{n} 个中有 {r} 个放在了正确的圆环里。', ringsShown: '每个数现在都在它所属的最小圆环里。',
+ chipPlaced: '{x},放在「{ring}」', chipNotPlaced: '{x},未放置', pointLabel: '点 {v}', answerBox: '答案',
+ stepsLeftOfZero: '0 左边 {n} 步',
+ natural: '正整数', whole: '非负整数', integers: '整数', rational: '有理数', irrational: '无理数', real: '实数', integerColumn: '整数',
+ trueLabel: '对', falseLabel: '错',
+ chapterComplete: '第 {n} 章完成', quickChecks: '小测', chapterPractice: '本章练习', sources: '本章引用的文献', opensSource: '{label},在新标签页中打开来源',
+ firstTryScore: '{name}:第一次就答对 {r} / {t}。', notAttempted: '{name}:未作答。',
+ watchAgain: '再看一遍', nextChapter: '下一章',
+ },
+ ja: {
+ decimalSign: '.', stageLabel: '授業アニメーション', stageLabelTitled: '授業アニメーション:{title}',
+ shortcuts: 'キーボードショートカット', lesson: '授業', questions: '問題',
+ helpPlay: '再生/一時停止', helpStep: '前または次のステップ', helpStepInQuestion: '問題の途中でステップを移動', helpRestart: '最初から',
+ helpCaptions: '字幕のオン/オフ', helpSpeed: '遅く/速く', helpFullScreen: '全画面', helpList: 'この一覧を表示',
+ helpChoose: '答えまたは輪を選ぶ', helpTrueFalse: '正しい/誤り', helpRows: '行を移動',
+ helpNumberLine: '数直線上を移動、または分類する数を選ぶ', helpEnter: '答え合わせ、そして次へ',
+ helpShowAnswer: '答えを表示', helpLeaveBox: '解答欄から出る', helpClose: '{key} で閉じる。',
+ paused: '一時停止中。スペースキーかクリックで再開します。',
+ soundFailed: '音声を再生できません。画面の文字で授業を続けます。',
+ startLesson: '授業を始める', startFilm: '再生', aboutMinutesFilm: '約{n}分、音声つき。', coverKeys: '{space} で開始、{help} でショートカット一覧。', spaceKey: 'スペース',
+ chapterNumber: '第{n}章', aboutMinutes: '約{n}分、音声と確認問題つき。',
+ allChapters: 'すべての章', playLabel: '再生/一時停止(スペース)', backLabel: '前のステップ(左矢印)', restartLabel: '授業を最初から',
+ checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',
+ volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',
+ helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',
+ quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',
+ correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',
+ hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',
+ hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',
+ hintTypeDecimal: '数を入力、', hintNextBox: ' 次の欄、', hintCheck: ' 答え合わせ、', hintLeaveBox: ' 欄から出る',
+ hintPickNumber: ' 数を選ぶ、', hintPickRing: ' その輪を選ぶ',
+ rowsRight: '{n} 行中 {r} 行正解。✗ の行を直して、もう一度答え合わせ。',
+ choicesShown: '正しい選択肢を選びました。', numbersShown: '正しい数を入れました。',
+ notPlacedYet: '{x} はまだ置かれていません。',
+ realRingIsEmpty: '{x}:実数はどれも有理数か無理数なので、この部分だけに入る数はありません。',
+ ringsRight: '{n} 個中 {r} 個が正しい輪に入っています。', ringsShown: 'どの数も、入るいちばん小さい輪に移しました。',
+ chipPlaced: '{x}、「{ring}」に配置', chipNotPlaced: '{x}、未配置', pointLabel: '点 {v}', answerBox: '答え',
+ stepsLeftOfZero: '0 から左へ {n}',
+ natural: '自然数', whole: '0 以上の整数', integers: '整数', rational: '有理数', irrational: '無理数', real: '実数', integerColumn: '整数',
+ trueLabel: '正しい', falseLabel: '誤り',
+ chapterComplete: '第{n}章 完了', quickChecks: '確認問題', chapterPractice: '章末練習', sources: 'この章の出典', opensSource: '{label}(出典を新しいタブで開く)',
+ firstTryScore: '{name}:1 回目で {t} 問中 {r} 問正解。', notAttempted: '{name}:未挑戦。',
+ watchAgain: 'もう一度見る', nextChapter: '次の章へ',
+ },
+};
+const LANGUAGE = (document.documentElement.lang || 'en').toLowerCase().split('-')[0];
+const pluralRules = {};
+// Interface text in LANGUAGE: translate('chapterNumber', { n: 3 }) → 'Chapter 3'. Chapters may use it too, e.g. for practice labels.
+// contents.js has its own copy for the contents page: keep the two in step.
+function translate(key, vars = {}) {
+ const language = TRANSLATIONS[LANGUAGE]?.[key] !== undefined ? LANGUAGE : 'en';
+ let text = TRANSLATIONS[language][key] ?? key;
+ if (typeof text === 'object') {
+ try { pluralRules[language] ??= new Intl.PluralRules(language); } catch { pluralRules[language] = new Intl.PluralRules('en'); }
+ text = text[pluralRules[language].select(vars.n)] ?? text.other;
+ }
+ return text.replace(/\{(\w+)\}/g, (placeholder, name) => name in vars ? vars[name] : placeholder);
+}
+const DECIMAL_SIGN = translate('decimalSign'); // shown by num() and accepted by answer boxes
+const isLatinLetter = key => /^[a-z]$/i.test(key);
+// A letter shortcut on any keyboard layout: the typed letter, or the same physical key when the layout types a non-Latin letter.
+const isShortcut = (event, letter) => event.key.toLowerCase() === letter.toLowerCase()
+ || (isLatinLetter(letter) && !isLatinLetter(event.key) && event.code === 'Key' + letter.toUpperCase());
+// A punctuation shortcut (code 'Comma', 'Period') on a layout that types a non-Latin letter on that key.
+const isShortcutCode = (event, code) => /^\p{L}$/u.test(event.key) && !isLatinLetter(event.key) && event.code === code;
+
+document.body.insertAdjacentHTML('afterbegin', `<div id="frame">
+ <svg id="stage" viewBox="0 0 1600 900" role="img" aria-label="${translate('stageLabel')}">
+ <g id="scene"></g>
+ </svg>
+ <div id="ui"></div>
+ <div class="paused-mark"><div>${translate('paused')}</div></div>
+ <div class="caption" id="caption" hidden></div>
+ <div class="help" id="help" hidden role="dialog" aria-label="${translate('shortcuts')}">
+ <div class="help-box">
+ <h2>${translate('shortcuts')}</h2>
+ <div class="help-cols">
+ <div><h3>${translate('lesson')}</h3><dl>
+ <dt><kbd>${translate('spaceKey')}</kbd></dt><dd>${translate('helpPlay')}</dd>
+ <dt><kbd>←</kbd><kbd>→</kbd></dt><dd>${translate('helpStep')}</dd>
+ <dt><kbd>Shift</kbd><kbd>←</kbd><kbd>→</kbd></dt><dd>${translate('helpStepInQuestion')}</dd>
+ <dt><kbd>Home</kbd></dt><dd>${translate('helpRestart')}</dd>
+ <dt><kbd>C</kbd></dt><dd>${translate('helpCaptions')}</dd>
+ <dt><kbd>&lt;</kbd><kbd>&gt;</kbd></dt><dd>${translate('helpSpeed')}</dd>
+ <dt><kbd>F</kbd></dt><dd>${translate('helpFullScreen')}</dd>
+ <dt><kbd>?</kbd></dt><dd>${translate('helpList')}</dd>
+ </dl></div>
+ <div><h3>${translate('questions')}</h3><dl>
+ <dt><kbd>1</kbd>–<kbd>6</kbd></dt><dd>${translate('helpChoose')}</dd>
+ <dt><kbd>T</kbd><kbd>F</kbd></dt><dd>${translate('helpTrueFalse')}</dd>
+ <dt><kbd>↑</kbd><kbd>↓</kbd></dt><dd>${translate('helpRows')}</dd>
+ <dt><kbd>←</kbd><kbd>→</kbd></dt><dd>${translate('helpNumberLine')}</dd>
+ <dt><kbd>Enter</kbd></dt><dd>${translate('helpEnter')}</dd>
+ <dt><kbd>S</kbd></dt><dd>${translate('helpShowAnswer')}</dd>
+ <dt><kbd>Esc</kbd></dt><dd>${translate('helpLeaveBox')}</dd>
+ </dl></div>
+ </div>
+ <p class="help-close">${translate('helpClose', { key: '<kbd>Esc</kbd>' })}</p>
+ </div>
+ </div>
+ <p class="sound-note" id="soundNote" hidden>${translate('soundFailed')}</p>
+ <button class="cover" id="cover"><div>
+ <p class="cover-k" id="coverK"></p>
+ <h1 class="cover-t" id="coverT"></h1>
+ <span class="go"><svg width="24" height="24" viewBox="0 0 18 18"><path d="M3 1.5v15l13-7.5z" fill="currentColor"/></svg><span id="coverGo">${translate('startLesson')}</span></span>
+ <small><span id="coverMeta"></span> ${translate('coverKeys', { space: `<kbd>${translate('spaceKey')}</kbd>`, help: '<kbd>?</kbd>' })}</small>
+ </div></button>
+ <div id="bar">
+ <a class="icon" id="bHome" href="../" aria-label="${translate('allChapters')}" title="${translate('allChapters')}">
+ <svg viewBox="0 0 18 18"><path d="M2 2h6v6H2zM10 2h6v6h-6zM2 10h6v6H2zM10 10h6v6h-6z"/></svg>
+ </a>
+ <button class="icon" id="bPlay" aria-label="${translate('playLabel')}">
+ <svg class="i-play" viewBox="0 0 18 18"><path d="M4 2v14l12-7z"/></svg>
+ <svg class="i-pause" viewBox="0 0 18 18"><path d="M3.5 2h4v14h-4zM10.5 2h4v14h-4z"/></svg>
+ </button>
+ <button class="icon" id="bBack" aria-label="${translate('backLabel')}">
+ <svg viewBox="0 0 18 18"><path d="M3 2h2.5v14H3zM16 2v14L6.5 9z"/></svg>
+ </button>
+ <button class="icon" id="bRestart" aria-label="${translate('restartLabel')}">
+ <svg viewBox="0 0 18 18"><path d="M9 2.5a6.5 6.5 0 1 1-6.3 8.1l2-.5A4.5 4.5 0 1 0 9 4.5V7L4.5 3.5 9 0z"/></svg>
+ </button>
+ <div class="segs" id="segs"></div>
+ <div class="step" id="stepName"></div>
+ <button class="icon txt" id="bHelp" aria-label="${translate('helpLabel')}" title="${translate('helpLabel')}">?</button>
+ <button class="icon txt speed" id="bSpeed" aria-label="${translate('speedLabel')}" title="${translate('speedLabel')}">1×</button>
+ <button class="icon cc" id="bCC" aria-pressed="false" aria-label="${translate('captionsLabel')}" title="${translate('captionsLabel')}">CC</button>
+ <button class="icon" id="bFull" aria-label="${translate('fullScreenLabel')}">
+ <svg viewBox="0 0 18 18"><path d="M1 1h6v2H3v4H1zM11 1h6v6h-2V3h-4zM1 11h2v4h4v2H1zM15 11h2v6h-6v-2h4z"/></svg>
+ </button>
+ </div>
+</div>`);
+
+// Board colour, grain and vignette are a static CSS background of #stage (engine.css). The grain is a small noise
+// texture made once here: an SVG turbulence filter behind animated content is recomputed on every frame in Firefox.
+{
+ const c = document.createElement('canvas'); c.width = c.height = 256;
+ const x = c.getContext('2d'), d = x.createImageData(256, 256);
+ for (let i = 0, s = 7; i < d.data.length; i += 4) { s = s * 16807 % 2147483647; d.data.set([235, 242, 230, 4 + s % 12], i); }
+ x.putImageData(d, 0, 0);
+ document.getElementById('stage').style.setProperty('--grain', `url(${c.toDataURL()})`);
+}
+
+/* ---------- drawing helpers ---------- */
+const NS = 'http://www.w3.org/2000/svg';
+const UI = '"Avenir Next","Segoe UI","Helvetica Neue",Arial,sans-serif';
+// Book settings (lib/book.css, next to engine.css and imported by it): --math-font for numbers and formulas,
+// --progress-key for the localStorage key the cover and chapters share.
+const BOOK = getComputedStyle(document.documentElement);
+const bookSetting = name => BOOK.getPropertyValue(name).trim().replace(/^(["'])([^"']*)\1$/, '$2'); // unquote a lone string only
+// The board and ink colours come from the palette in engine.css, which lib/book.css may redefine (a light board):
+// the picture, the cards and the player bar then agree. The six hues are the chapters' meanings, set in JS.
+const COL = { nat: '#f4a48c', whole: '#86c9e8', int: '#f3c95c', rat: '#e8a0c8', irr: '#8fd6b0', real: '#bba8ee',
+ chalk: '#ece8dc', dim: '#9aaba3', faint: '#5d7068', task: '#f0b45a', good: '#8fd6b0', bad: '#f08c7a', board: '#1d2b27' };
+{ // a canvas reads any CSS colour back as #rrggbb, the form colour tweens mix; a missing or bad one keeps the default
+ const c = document.createElement('canvas').getContext('2d');
+ for (const k of ['chalk', 'dim', 'faint', 'task', 'good', 'bad', 'board']) { c.fillStyle = COL[k]; c.fillStyle = bookSetting('--' + k) || COL[k]; COL[k] = c.fillStyle; }
+}
+const MATH = bookSetting('--math-font') || '"STIX Two Text","Cambria Math","Iowan Old Style",Palatino,Georgia,serif';
+const NAME = { nat: translate('natural'), whole: translate('whole'), int: translate('integers'), rat: translate('rational'), irr: translate('irrational'), real: translate('real') };
+// Card positions inside the 1600×900 picture.
+const BAND = { x: 96, y: 686, w: 1408, cls: 'band' }; // bottom band (moves up when taller than the space left)
+const RIGHT = { x: 1258, y: 546, w: 330, cls: 'side', maxH: 346 }; // right of the number map
+const TOPR = { x: 960, y: 70, w: 624, cls: 'side', maxH: 470 }; // top right, above the number line
+const SCREEN = { x: 0, y: 0, w: 1600, cls: 'screen' };
+const SORT_SCREEN = { x: 0, y: 0, w: 1600, cls: 'screen sort' };
+const $m = (...parts) => ({ m: parts });
+
+function mk(tag, attrs = {}, parent) {
+ const e = document.createElementNS(NS, tag);
+ for (const k in attrs) e.setAttribute(k, attrs[k]);
+ if (parent) parent.appendChild(e);
+ return e;
+}
+// Every animated element keeps a small state object; render() writes it to the DOM.
+// Keys: x y s r o (transform/opacity), d (0..1 stroke drawn), a_<attr> numeric attr, c_<attr> hex colour.
+function st(e) { return e._st || (e._st = { x: 0, y: 0, s: 1, r: 0, o: 1 }); }
+function put(e, o) { Object.assign(st(e), o); render(e); return e; }
+// Unchanged transform/opacity are not rewritten: per-frame updates of still elements cost repaints (notably in Firefox).
+function render(e) {
+ const s = e._st, tf = s.x || s.y || s.s !== 1 || s.r ? `translate(${s.x},${s.y}) rotate(${s.r}) scale(${s.s})` : null;
+ // _tf starts unset: an element never moved keeps a transform attribute it was made with
+ if (tf !== (e._tf ?? null)) { if (tf) e.setAttribute('transform', tf); else e.removeAttribute('transform'); e._tf = tf; }
+ if (s.o !== e._o) { e.setAttribute('opacity', s.o); e._o = s.o; }
+ if (s.d !== undefined) {
+ e.setAttribute('stroke-dashoffset', 1 - s.d);
+ e.style.visibility = s.d < .002 ? 'hidden' : '';
+ }
+ for (const k in s) {
+ if (k.startsWith('a_')) e.setAttribute(k.slice(2), s[k]);
+ else if (k.startsWith('c_')) e.setAttribute(k.slice(2), s[k]);
+ }
+}
+function G(parent, o = {}) { return put(mk('g', {}, parent), o); }
+function path(parent, d, attrs = {}, o = {}) {
+ const p = mk('path', { d, fill: 'none', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', ...attrs }, parent);
+ if (o.d !== undefined) { p.setAttribute('pathLength', 1); p.setAttribute('stroke-dasharray', '1 1'); }
+ return put(p, o);
+}
+function T(parent, str, { x = 0, y = 0, size = 30, fill = COL.chalk, font = UI, weight = 500, anchor = 'start', o = 1 } = {}) {
+ const t = mk('text', { 'font-size': size, fill, 'font-family': font, 'font-weight': weight, 'text-anchor': anchor }, parent);
+ t.textContent = str;
+ t.style.whiteSpace = 'pre';
+ return put(t, { x, y, o });
+}
+// A citation drawn in the picture that opens its source (REFS from ../refs.js, built by scripts/refs.py) in a new tab.
+// cite(p, key, opts) takes T's options; str overrides the label (default REFS[key].cite). Returns the <a>; animate it like T.
+const CITED = new Set();
+function cite(parent, key, { str, ...opts } = {}) {
+ const r = (typeof REFS === 'object' && REFS) ? REFS[key] : null;
+ if (!r) throw new Error(`cite: no reference "${key}" in refs.js`);
+ CITED.add(key);
+ if (!r.url) return T(parent, str || r.cite, opts);
+ linkStage();
+ const a = mk('a', { class: 'cite', href: r.url, target: '_blank', rel: 'noopener', 'aria-label': translate('opensSource', { label: r.cite }) }, parent);
+ const { o = 1, x = 0, y = 0, ...rest } = opts;
+ T(a, str || r.cite, { ...rest, fill: rest.fill || COL.chalk });
+ return put(a, { x, y, o });
+}
+// Any text in the picture or a card that equals a reference's cite label or one of its match strings (case-insensitive)
+// becomes a link to the source, so chapters write citations as plain text. Watched by citeObs (set up after the player).
+let CITE_RE = null, CITE_KEY = null;
+function citeIndex() {
+ if (CITE_RE !== null) return CITE_RE;
+ CITE_KEY = new Map();
+ for (const [k, r] of Object.entries(typeof REFS === 'object' && REFS ? REFS : {}))
+ for (const s of [r.cite, ...(r.match || [])]) if (s) CITE_KEY.set(s.toLowerCase(), k);
+ const alts = [...CITE_KEY.keys()].sort((a, b) => b.length - a.length).map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
+ return (CITE_RE = alts.length ? new RegExp(alts.join('|'), 'gi') : false);
+}
+function autoCite(root) {
+ const re = citeIndex();
+ if (!re) return;
+ const nodes = [];
+ if (root.nodeType === 3) nodes.push(root);
+ else if (root.nodeType === 1) for (let w = document.createTreeWalker(root, NodeFilter.SHOW_TEXT), n; (n = w.nextNode());) nodes.push(n);
+ for (const n of nodes) {
+ const host = n.parentElement;
+ if (!host || host.closest('a, button, input, script, style, kbd')) continue; // no links inside controls
+ const ms = [...n.data.matchAll(re)];
+ if (!ms.length) continue;
+ const svg = host.namespaceURI === NS, frag = document.createDocumentFragment();
+ let i = 0, made = 0;
+ for (const m of ms) {
+ const k = CITE_KEY.get(m[0].toLowerCase()), r = REFS[k];
+ CITED.add(k);
+ if (!r.url) continue; // a work with no reliable online record stays plain text but is still listed
+ frag.append(n.data.slice(i, m.index));
+ const a = svg ? mk('a', { href: r.url }) : document.createElement('a');
+ if (!svg) a.href = r.url;
+ a.setAttribute('class', 'cite');
+ a.setAttribute('target', '_blank');
+ a.setAttribute('rel', 'noopener');
+ a.setAttribute('aria-label', translate('opensSource', { label: m[0] }));
+ if (svg) mk('tspan', {}, a).textContent = m[0]; else a.textContent = m[0];
+ frag.append(a);
+ i = m.index + m[0].length;
+ made++;
+ }
+ if (!made) continue; // replacing the node unchanged would re-trigger the observer
+ if (svg) linkStage();
+ frag.append(n.data.slice(i));
+ n.replaceWith(frag);
+ }
+}
+// The stage is announced as one image; once it holds a link it becomes a group, so the link stays reachable.
+function linkStage() { document.getElementById('stage').setAttribute('role', 'group'); }
+// Links that have faded out (or sit in a faded group) must not take clicks or Tab focus.
+function syncLinks() {
+ for (const a of scene.querySelectorAll('a.cite')) {
+ let o = 1;
+ for (let e = a; e && e !== scene; e = e.parentNode) o *= +(e.getAttribute('opacity') ?? 1);
+ const on = o > .5;
+ if (on === a._on) continue;
+ a._on = on;
+ a.style.pointerEvents = on ? '' : 'none';
+ if (on) { a.removeAttribute('tabindex'); a.removeAttribute('aria-hidden'); }
+ else { a.setAttribute('tabindex', '-1'); a.setAttribute('aria-hidden', 'true'); }
+ }
+}
+const ctx2d = document.createElement('canvas').getContext('2d');
+function textW(str, size, italic = false) { ctx2d.font = `${italic ? 'italic ' : ''}${size}px ${MATH}`; return ctx2d.measureText(str).width; }
+const VAR = /(?<![A-Za-z°])(?:(?!(?:of|in|is|to|or|at|on|by|as|an|if|it|be|no|so|up|we|my)(?![A-Za-z]))[a-z]{1,2}|(?!(?:If|In|It|Is|On|At|No|So|Or|An|As|To|By|Up)(?![A-Za-z]))[a-z]?[A-Z]{1,3}[a-z]?)(?![A-Za-z])/g; // capitals: A, PV, nRT // short lowercase runs are variables (a, x, ab), except short English words
+const F = (n, d) => ({ f: [String(n), String(d)] }); // fraction
+const R = (x, i) => ({ r: x && x.f ? x : String(x), i: i && String(i) }); // root of a number or of F(n, d); i = index, e.g. 3 for a cube root
+const E = x => ({ sup: String(x) }); // exponent, raised after the part before it
+const TX = tex => ({ tex: String(tex) }); // LaTeX, drawn by MathJax; the book loads lib/mathjax.js right after this file
+const $tex = tex => $m(TX(tex)); // LaTeX inline in HTML text
+// MathJax takes this object as its configuration when lib/mathjax.js loads after the engine.
+window.MathJax ??= {
+ startup: { typeset: false }, // no page scan; formulas are converted on demand
+ svg: { fontCache: 'none', mtextInheritFont: true }, // self-contained paths; \text{} in the book's math font
+ tex: { packages: { '[-]': ['noerrors', 'noundefined'] }, // a typo stops the page, like a misspelt mark
+ formatError: (_, error) => { throw error; } },
+ options: { enableMenu: false },
+};
+const TEX_CACHE = new Map(); // TeX source -> { graphic, viewBox }; seek() redraws every earlier beat
+// A copy of the formula's MathJax drawing: units of 1/1000 em, baseline at y = 0; viewBox is [x, y, width, height].
+function texGraphic(tex) {
+ let drawn = TEX_CACHE.get(tex);
+ if (!drawn) {
+ if (!window.MathJax?.tex2svg) throw new Error(`TX('${tex}') needs lib/mathjax.js: load ../lib/mathjax.js right after engine.js`);
+ if (!document.getElementById('MJX-SVG-styles')) document.head.append(MathJax.svgStylesheet()); // draws table rules and frames
+ let svg;
+ try { svg = MathJax.tex2svg(tex, { display: false, family: MATH }).querySelector('svg'); } // family: \text{} is measured in the font it is drawn in
+ catch (error) { throw new Error(`TX('${tex}'): ${error.message}`); }
+ const graphic = mk('g');
+ graphic.append(...svg.childNodes);
+ drawn = { graphic, viewBox: svg.getAttribute('viewBox').split(' ').map(Number) };
+ TEX_CACHE.set(tex, drawn);
+ }
+ return { graphic: drawn.graphic.cloneNode(true), viewBox: drawn.viewBox };
+}
+// The part of a TeX formula marked \class{name}{...}, ready for tw/fx on c_color and o.
+// MathJax places the part with its own transform, so the tweens act on a group inside it.
+function texPart(el, name) {
+ const part = el.querySelector(`g.${CSS.escape(name)}`);
+ if (!part) throw new Error(`texPart: no \\class{${name}}{…} in this formula`);
+ if (!part._tweenGroup) {
+ const group = mk('g');
+ group.append(...part.childNodes);
+ part.append(group);
+ const color = part.closest('[color]')?.getAttribute('color'); // the formula's fill
+ put(group, /^#[\da-f]{6}$/i.test(color) ? { c_color: color } : {});
+ part._tweenGroup = group;
+ }
+ return part._tweenGroup;
+}
+const OV = x => ({ ov: String(x) }); // digits under a repeat bar: ['0.', OV('3')] is 0.333…
+// Math expression from parts: 'text' | F(n,d) | R(x) | E(exp) | OV(digits) | TX(tex). Baseline at y; anchor start/middle/end.
+// _ascent and _descent are the TeX parts' height above and below the baseline (0 without TX).
+function M(parent, parts, { x = 0, y = 0, size = 36, fill = COL.chalk, anchor = 'middle', o = 1, s = 1 } = {}) {
+ const g = G(parent, { x, y, o, s });
+ const inner = mk('g', {}, g);
+ const lw = size * .05;
+ const text = (str, tx, ty, sz) => {
+ const t = mk('text', { x: tx, y: ty, 'font-size': sz, 'font-family': MATH, fill }, inner);
+ t.style.whiteSpace = 'pre';
+ let w = 0, last = 0;
+ const run = (piece, italic) => {
+ if (!piece) return;
+ mk('tspan', italic ? { 'font-style': 'italic' } : {}, t).textContent = piece;
+ w += textW(piece, sz, italic);
+ };
+ for (const m of str.matchAll(VAR)) { run(str.slice(last, m.index), false); run(m[0], true); last = m.index + m[0].length; }
+ run(str.slice(last), false);
+ return w;
+ };
+ const rule = (x1, x2, yy) => mk('path', { d: `M${x1} ${yy}H${x2}`, stroke: fill, 'stroke-width': lw, 'stroke-linecap': 'round' }, inner);
+ let cx = 0, ascent = 0, descent = 0;
+ for (const p of parts) {
+ if (typeof p === 'string') cx += text(p, cx, 0, size);
+ else if (p.tex !== undefined) {
+ const { graphic, viewBox: [, top, w, h] } = texGraphic(p.tex), k = size / 1000; // 1000 units = 1 em = size
+ graphic.setAttribute('transform', `translate(${cx},0) scale(${k})`);
+ graphic.setAttribute('color', fill); // MathJax paints with currentColor
+ inner.append(graphic);
+ ascent = Math.max(ascent, -top * k);
+ descent = Math.max(descent, (top + h) * k);
+ cx += w * k;
+ } else if (p.f) {
+ const fs = size * .72, [n, d] = p.f, wn = textW(n, fs), wd = textW(d, fs);
+ const w = Math.max(wn, wd) + size * .2, bar = -size * .3;
+ text(n, cx + (w - wn) / 2, bar - size * .12, fs);
+ text(d, cx + (w - wd) / 2, bar + size * .62, fs);
+ rule(cx + size * .04, cx + w - size * .04, bar);
+ cx += w + size * .04;
+ } else if (p.r) {
+ const fr = typeof p.r === 'object', mid = fr ? -size * .12 : -size * .3, bot = fr ? size * .45 : size * .06, top = fr ? -size * 1.12 : -size * .82;
+ let x0 = cx + size * .04;
+ if (p.i) { const iw = textW(p.i, size * .42); text(p.i, x0, mid - size * .14, size * .42); x0 += Math.max(0, iw - size * .12); } // index in the radical's crook
+ let w;
+ if (fr) { // a fraction under the radical, laid out like F()
+ const fs = size * .72, [n, d] = p.r.f, wn = textW(n, fs), wd = textW(d, fs), bx = x0 + size * .56, bar = -size * .3;
+ w = Math.max(wn, wd) + size * .2;
+ text(n, bx + (w - wn) / 2, bar - size * .12, fs);
+ text(d, bx + (w - wd) / 2, bar + size * .62, fs);
+ mk('path', { d: `M${bx + size * .04} ${bar}H${bx + w - size * .04}`, stroke: fill, 'stroke-width': lw, 'stroke-linecap': 'round' }, inner);
+ } else { w = textW(p.r, size); text(p.r, x0 + size * .56, 0, size); }
+ mk('path', { d: `M${x0} ${mid}L${x0 + size * .1} ${mid - size * .06}L${x0 + size * .27} ${bot}L${x0 + size * .45} ${top}H${x0 + size * .56 + w + size * .06}`,
+ fill: 'none', stroke: fill, 'stroke-width': lw, 'stroke-linejoin': 'round', 'stroke-linecap': 'round' }, inner);
+ cx = x0 + size * .56 + w + size * .1;
+ } else if (p.sup !== undefined) {
+ cx += text(p.sup, cx + size * .03, -size * .45, size * .62) + size * .06;
+ } else if (p.ov !== undefined) {
+ const w = text(p.ov, cx, 0, size);
+ rule(cx + size * .04, cx + w - size * .02, -size * .8);
+ cx += w;
+ }
+ }
+ const dx = anchor === 'middle' ? -cx / 2 : anchor === 'end' ? -cx : 0;
+ inner.setAttribute('transform', `translate(${dx},0)`);
+ g._w = cx;
+ g._ascent = ascent;
+ g._descent = descent;
+ return g;
+}
+// Pill-shaped number token, centred on (x, y).
+function chip(parent, parts, color, { x = 0, y = 0, o = 1, s = 1, size = 34 } = {}) {
+ const g = G(parent, { x, y, o, s });
+ const rect = mk('rect', {}, g);
+ const m = M(g, parts, { size, y: size * .3 });
+ const w = Math.max(m._w + 36, 64);
+ let h = size * (parts.some(p => p.f) ? 1.75 : 1.45);
+ if (m._ascent) { // a TeX formula: centre it and grow the pill to fit
+ const above = Math.max(size * 1.05, m._ascent), below = Math.max(size * .45, m._descent);
+ put(m, { y: (above - below) / 2 });
+ h = Math.max(h, m._ascent + m._descent + size * .4);
+ }
+ for (const [k, v] of Object.entries({ x: -w / 2, y: -h / 2, width: w, height: h, rx: h / 2, fill: COL.board, stroke: color, 'stroke-width': 2.5 })) rect.setAttribute(k, v);
+ g._rect = rect;
+ return g;
+}
+// A row of math tokens laid out left to right. Items: string | parts array | { t, fill }.
+// Each token is centred on its own x, so it can move alone (swaps, sliding parentheses). Spacing comes from the strings.
+function tokens(parent, items, { x = 0, y = 0, size = 44, fill = COL.chalk, anchor = 'start', o = 1 } = {}) {
+ const els = items.map(it => {
+ const spec = it && it.t !== undefined ? it : { t: it };
+ return M(parent, [].concat(spec.t), { size, fill: spec.fill || fill, o });
+ });
+ return layRow(els, { x, y, size, anchor }, e => put(e, { x: e._px, y }));
+}
+// Place a row's tokens side by side. Each token keeps its planned centre in _px, so later steps
+// can be planned before earlier tweens have run.
+function layRow(els, { x, y, size, anchor }, move) {
+ const total = els.reduce((a, e) => a + e._w, 0);
+ let cx = anchor === 'middle' ? x - total / 2 : anchor === 'end' ? x - total : x;
+ for (const e of els) { e._px = cx + e._w / 2; move(e); cx += e._w; }
+ return Object.assign(els, { w: total, x, y, size, anchor });
+}
+// One simplification step: box tokens i..j, shrink them into a single result token, then close the gap.
+// Returns the new row. live = true runs on the question clock (inside ask) instead of the lesson clock.
+function collapse(row, i, j, parts, t0, { color = COL.task, fill = COL.chalk, live = false } = {}) {
+ const run = live ? fx : tw, p = row[0].parentNode, { size, y } = row;
+ const left = row[i]._px - row[i]._w / 2, right = row[j]._px + row[j]._w / 2;
+ let above = size * .95, height = size * 1.3;
+ const tall = row.slice(i, j + 1).filter(e => e._ascent); // TeX tokens may reach higher and lower than text
+ if (tall.length) {
+ above = Math.max(above, ...tall.map(e => e._ascent + 8));
+ height = above + Math.max(size * .35, ...tall.map(e => e._descent + 8));
+ }
+ const box = put(mk('rect', { rx: 10, fill: 'none', stroke: color, 'stroke-width': 3 }, p),
+ { o: 0, a_x: left - 8, a_y: y - above, a_width: right - left + 16, a_height: height });
+ run(box, { o: 1 }, t0, .3);
+ run(box, { o: 0 }, t0 + 1.2, .3);
+ const res = M(p, parts, { size, fill, o: 0, x: (left + right) / 2, y });
+ for (let k = i; k <= j; k++) run(row[k], { o: 0, s: .6 }, t0 + .8, .35);
+ run(res, { o: 1 }, t0 + .95, .35);
+ const next = [...row.slice(0, i), res, ...row.slice(j + 1)];
+ return layRow(next, row, e => run(e, { x: e._px }, t0 + 1.3, .5));
+}
+// The maths helpers (number lines, tiles, fractions, planes, the number map, sorter) are in math.js.
+// Inline math for HTML text.
+function mathEl(parts, size = 22) {
+ const svg = mk('svg', { class: 'm', 'font-weight': 400 }); // widths are measured at normal weight, so a bold prompt must not thicken the math
+ const m = M(svg, parts, { size, anchor: 'start', fill: 'currentColor' });
+ let top = size * 1.05, bottom = size * .45, h = size * 1.5;
+ if (m._ascent) { // a TeX formula may reach higher and lower than text
+ top = Math.max(top, m._ascent + size * .1);
+ bottom = Math.max(bottom, m._descent + size * .1);
+ h = top + bottom;
+ }
+ svg.setAttribute('viewBox', `0 ${-top} ${m._w + 2} ${h}`);
+ svg.setAttribute('width', m._w + 2);
+ svg.setAttribute('height', h);
+ svg.style.verticalAlign = `${-bottom}px`; // line up the math baseline with the text baseline
+ return svg;
+}
+
+
+/* ---------- timeline ---------- */
+let TW = [];
+const io = p => p < .5 ? 4 * p * p * p : 1 - (-2 * p + 2) ** 3 / 2;
+const out = p => 1 - (1 - p) ** 3;
+const back = p => 1 + 2.2 * (p - 1) ** 3 + 1.2 * (p - 1) ** 2;
+const lin = p => p;
+function tw(e, to, t0, dur = .6, ease = io) { TW.push({ e, to, t0, dur, ease }); }
+function prog(pf, t0, dur, ease = io) { TW.push({ pf, t0, dur, ease }); }
+const show = (e, t0, dur = .5, ease) => tw(e, { o: 1 }, t0, dur, ease);
+const hide = (e, t0, dur = .5, ease) => tw(e, { o: 0 }, t0, dur, ease);
+const draw = (e, t0, dur = .9, ease) => tw(e, { d: 1 }, t0, dur, ease);
+const pop = (e, t0) => tw(e, { s: 1, o: 1 }, t0, .45, back);
+function pulse(e, t0, k = 1.7) { tw(e, { s: k }, t0, .22, out); tw(e, { s: 1 }, t0 + .22, .4); }
+function stream(t, str, t0, dur) { prog(q => { t.textContent = str.slice(0, Math.round(q * str.length)); }, t0, dur, lin); }
+function mix(a, b, q) {
+ const h = c => [1, 3, 5].map(i => parseInt(c.slice(i, i + 2), 16));
+ const A = h(a), B = h(b);
+ return '#' + A.map((v, i) => Math.round(v + (B[i] - v) * q).toString(16).padStart(2, '0')).join('');
+}
+// A colour or attribute tween with no starting value in the state starts from the element's attribute.
+const fromAttr = (e, k) => k.startsWith('c_') ? e.getAttribute(k.slice(2)) : k.startsWith('a_') ? parseFloat(e.getAttribute(k.slice(2))) : undefined;
+function evalTo(t, list = TW) {
+ for (const w of list) {
+ if (w.done || t < w.t0) continue;
+ if (!w.go) { w.go = 1; if (w.e) { const s = st(w.e); w.from = {}; for (const k in w.to) w.from[k] = s[k] ?? fromAttr(w.e, k); } }
+ const p = w.dur ? Math.min(1, (t - w.t0) / w.dur) : 1, q = w.ease(p);
+ if (w.e) {
+ const s = st(w.e);
+ for (const k in w.to) s[k] = k.startsWith('c_') ? mix(w.from[k], w.to[k], q) : w.from[k] + (w.to[k] - w.from[k]) * q;
+ render(w.e);
+ } else w.pf(q);
+ if (p >= 1) w.done = 1;
+ }
+}
+
+/* ---------- world clock and camera ---------- */
+const soft = p => (1 - Math.cos(Math.PI * p)) / 2; // gentle in-out, for camera moves
+// Continuous motion: f(t) runs on every frame of the beat with t in seconds from its start (0..D).
+// Keep f a pure function of t, so pause, seek and ?beat=N&t=S show the same frame. A beat holds its picture for HOLD s
+// after its narration and last tween; with { tail: true } f keeps running through that hold (t up to the beat's end)
+// instead of freezing at D, for motion that never stops, as in a film. A camera runs through the hold too when anything
+// in its beat does (its tail is 'follow'), so a follow shot keeps up with a tailed subject.
+const clockRun = (f, D, { tail = false } = {}) => { f(0); const w = { t0: 0, dur: D, ease: lin, tail }; w.pf = q => f(q * w.dur); TW.push(w); };
+// A camera looks at a world group through the stage (or a box, for split screen and picture-in-picture).
+// The view {x, y, z, r} is the world point at the centre, the zoom (screen px per world px) and the roll in degrees.
+// Moves are keyed on the beat clock: to(view, t0, dur, ease) blends each given key from its value at t0; a key may be a
+// function of t (follow). Unspecified keys keep following the earlier moves. dur 0 is a hard cut.
+let camN = 0;
+function camera(p, D, { box, x = 800, y = 450, z, r = 0, bg = COL.board } = {}) {
+ const [bx, by, bw, bh] = box || [0, 0, 1600, 900];
+ const el = G(p, { x: bx + bw / 2, y: by + bh / 2 });
+ let hold = el;
+ if (box) {
+ const id = 'cam' + (++camN);
+ mk('rect', { x: -bw / 2, y: -bh / 2, width: bw, height: bh, rx: 18 }, mk('clipPath', { id }, mk('defs', {}, el)));
+ hold = G(el); hold.setAttribute('clip-path', `url(#${id})`);
+ mk('rect', { x: -bw / 2, y: -bh / 2, width: bw, height: bh, fill: bg }, hold);
+ }
+ const view = mk('g', {}, hold), world = G(view);
+ if (box) mk('rect', { x: -bw / 2, y: -bh / 2, width: bw, height: bh, rx: 18, fill: 'none', stroke: COL.faint, 'stroke-width': 2 }, el);
+ const v0 = { x, y, z: z ?? (box ? Math.min(bw / 1600, bh / 900) : 1), r };
+ const ops = [], shakes = [], layers = [];
+ const val = (v, t) => typeof v === 'function' ? v(t) : v;
+ // The view at time t after the first n moves; each move remembers the view it starts from.
+ function at(t, n = ops.length) {
+ const s = { ...v0 };
+ for (let i = 0; i < n && ops[i].t0 <= t; i++) {
+ const o = ops[i], a = o.from || (o.from = at(o.t0, i));
+ const q = o.dur ? o.ease(Math.min(1, (t - o.t0) / o.dur)) : 1, b = {};
+ for (const k in o.v) b[k] = val(o.v[k], t);
+ if ('z' in b) s.z = a.z * (b.z / a.z) ** q; // even zoom speed
+ // While zooming, x/y move so that one world point stays put on screen (when start and end allow it).
+ const u = 'z' in b && Math.abs(b.z - a.z) > 1e-6 * a.z ? (1 / s.z - 1 / a.z) / (1 / b.z - 1 / a.z) : q;
+ for (const k of ['x', 'y']) if (k in b) s[k] = a[k] + (b[k] - a[k]) * u;
+ if ('r' in b) s.r = a.r + (b.r - a.r) * q;
+ }
+ return s;
+ }
+ function apply(t) {
+ const s = at(t);
+ let sx = 0, sy = 0;
+ for (const k of shakes) if (t > k.t0 && t < k.t0 + k.dur) {
+ const e = k.amp * Math.min(1, (t - k.t0) / .3, (k.t0 + k.dur - t) / .3), w = 2 * Math.PI * k.hz * t;
+ sx += e * (Math.sin(w) + .5 * Math.sin(2.3 * w + 1)) / 1.5; sy += e * (Math.sin(1.7 * w + 2) + .5 * Math.sin(3.1 * w)) / 1.5;
+ }
+ const tf = `translate(${sx} ${sy}) rotate(${-s.r}) scale(${s.z}) translate(${-s.x} ${-s.y})`;
+ if (tf !== view._tf) view.setAttribute('transform', view._tf = tf);
+ const dx = s.x - v0.x, dy = s.y - v0.y;
+ for (const L of layers) put(L.g, { x: L.wrap ? dx - ((L.k * dx) % L.wrap + L.wrap) % L.wrap : (1 - L.k) * dx, y: (1 - L.k) * dy });
+ }
+ const cam = { el, world, at,
+ to(v, t0, dur = 1, ease = soft) { ops.push({ v, t0, dur, ease }); ops.sort((a, b) => a.t0 - b.t0); ops.forEach(o => delete o.from); return cam; },
+ cut: (v, t0) => cam.to(v, t0, 0),
+ shake(amp, t0, dur, hz = 7) { shakes.push({ amp, t0, dur, hz }); return cam; },
+ // Parallax layer: k < 1 is far (moves slower than the camera), k > 1 near. With wrap = W the layer's content
+ // repeats every W world px: draw one period plus the widest view, and the layer never runs out.
+ layer(k = 1, wrap) { const g = G(world); layers.push({ g, k, wrap }); return g; },
+ // Screen position of a world point at time t (k = 1 layers, no shake): for labels that track an object.
+ screen(wx, wy, t) {
+ const s = at(t), a = -s.r * Math.PI / 180, ux = (wx - s.x) * s.z, uy = (wy - s.y) * s.z;
+ return [bx + bw / 2 + ux * Math.cos(a) - uy * Math.sin(a), by + bh / 2 + ux * Math.sin(a) + uy * Math.cos(a)];
+ },
+ // Put a screen-space label (text, anchor middle, outside the camera) over world point (wx, wy) at time t, kept
+ // inside the frame or box by margin m; it fades out once the point itself leaves. Fade it in with a wrapper group.
+ track(el, wx, wy, t, m = 24) {
+ const [sx, sy] = cam.screen(wx, wy, t), str = el.textContent;
+ if (el._tw?.[0] !== str) el._tw = [str, el.getComputedTextLength() / 2];
+ const h = el._tw[1], away = Math.max(bx - sx, sx - bx - bw, 0);
+ put(el, { x: Math.min(bx + bw - m - h, Math.max(bx + m + h, sx)), y: sy, o: Math.max(0, 1 - away / 80) });
+ },
+ };
+ clockRun(apply, D, { tail: 'follow' });
+ return cam;
+}
+
+/* ---------- scene ---------- */
+const scene = document.getElementById('scene');
+const S = {};
+const AXIS = { o: 800, u: 120 }; // number line: x of 0, pixels per unit; a chapter may change it
+const X = v => AXIS.o + AXIS.u * v, Y0 = 610;
+const num = v => (v < 0 ? '−' : '') + String(Math.abs(v)).replace('.', DECIMAL_SIGN);
+function reset() {
+ scene.replaceChildren();
+ for (const k in S) delete S[k];
+ Object.assign(S, { dots: {}, tick: {}, rows: [], chips: [], samples: [], list: G(scene), line: G(scene), venn: G(scene) });
+}
+function tick(v) {
+ const g = G(S.line, { o: 0 });
+ path(g, `M${X(v)} ${Y0 - 11}V${Y0 + 11}`, { stroke: COL.dim, 'stroke-width': 2.5 });
+ T(g, num(v), { x: X(v), y: Y0 + 50, size: 30, fill: COL.dim, font: MATH, anchor: 'middle' });
+ return (S.tick[v] = g);
+}
+function dot(key, v, r = 9, name = v) {
+ const g = G(S.line, { x: X(v), y: Y0, s: 0, o: 0 });
+ mk('circle', { r, fill: COL[key], stroke: COL.board, 'stroke-width': 2 }, g);
+ return (S.dots[name] = g);
+}
+const arrow = (x, dir) => `M${x - 15 * dir} ${Y0 - 10}L${x} ${Y0}L${x - 15 * dir} ${Y0 + 10}`;
+function panel(t0) {
+ if (t0 < .5) S.cleared = true; // the old panel fades, or this is the first panel after the title
+ const old = S.panel;
+ if (old && t0 < .5) retire(old);
+ else if (old) { // a panel change later in the beat stays on the beat clock
+ hide(old, t0, .4);
+ prog(q => { if (q === 1) old.style.display = 'none'; }, t0 + .4, 0, lin);
+ }
+ return (S.panel = G(scene));
+}
+// Take a beat's old picture away on wall time: a 150 ms fade, then out of rendering. On the beat clock the fade would
+// wait for the new clip's audio to start (a few hundred ms in Firefox) with the old, frozen scene still showing.
+// While seeking, the pictures passed on the way were never seen: they go at once.
+let seeking = false;
+function retire(e) {
+ if (seeking) { e.style.display = 'none'; return; }
+ e.style.transition = 'opacity .15s linear';
+ e.style.opacity = '0';
+ setTimeout(() => { e.style.display = 'none'; }, 160);
+}
+function header(p, str, t0, x = 1000, y = 170) {
+ const h = T(p, str, { x, y, size: 30, fill: COL.dim, weight: 600, o: 0 });
+ show(h, t0);
+ return h;
+}
+
+/* ---------- question effects: run on wall time, independent of the lesson clock ---------- */
+let FX = [], clock = 0;
+function fx(e, to, delay = 0, dur = .5, ease = io) { FX.push({ e, to, t0: clock + delay, dur, ease }); }
+function fxp(pf, delay, dur, ease = io) { FX.push({ pf, t0: clock + delay, dur, ease }); }
+function finishFx() { FX.sort((a, b) => a.t0 - b.t0); evalTo(Infinity, FX); FX = []; }
+const pulseFx = (e, k = 1.8) => { if (!e) return; fx(e, { s: k }, 0, .22, out); fx(e, { s: 1 }, .22, .45); };
+const shakeFx = e => { if (!e) return; const x0 = st(e).x; fxp(q => put(e, { x: x0 + Math.sin(q * Math.PI * 6) * (1 - q) * 12 }), 0, .55, lin); };
+function floatText(str, x, y, colr) {
+ const t = T(S.q || qlayer(), str, { x, y: y + 14, size: 24, fill: colr, anchor: 'middle', weight: 600, o: 0 });
+ fx(t, { o: 1, y }, 0, .5, out);
+}
+
+/* ---------- shared answer columns ---------- */
+const TF = [['t', translate('trueLabel'), null, 'T'], ['f', translate('falseLabel'), null, 'F']];
+function finishCard() {
+ const c = card(SCREEN, 'fin');
+ const sum = pre => Object.entries(SCORE).filter(([k]) => k.startsWith(pre)).reduce((a, [, v]) => [a[0] + v.right, a[1] + v.total], [0, 0]);
+ const line = (name, [r, t]) => h('p', 'fb', t ? translate('firstTryScore', { name, r, t }) : translate('notAttempted', { name }));
+ progress(p => { p.done = [...new Set([...(p.done || []), CHAPTER.number])]; });
+ const home = h('a', 'btn quiet', translate('allChapters'));
+ home.href = $('bHome').href;
+ const again = h('button', 'btn' + (CHAPTER.next ? ' quiet' : ' go'), [translate('watchAgain'), kbd(CHAPTER.next ? 'R' : 'Enter')]);
+ again.onclick = restart;
+ const next = CHAPTER.next && h('button', 'btn go', [translate('nextChapter'), kbd('Enter')]);
+ if (next) next.onclick = () => { location.href = CHAPTER.next; };
+ P.keys = e => e.key === 'Enter' ? ((next ? next.onclick() : restart()), true)
+ : isShortcut(e, 'r') ? (restart(), true) : false;
+ const guide = mascotEl(240);
+ c.append(h('div', 'finwrap', [guide, h('p', 'kicker', translate('chapterComplete', { n: CHAPTER.label ?? CHAPTER.number })), h('p', 'prompt', CHAPTER.title),
+ line(translate('quickChecks'), sum('c-')), line(translate('chapterPractice'), sum('p-')), h('div', 'acts', next ? [home, again, next] : [home, again]), sources()].filter(Boolean)));
+ setTimeout(() => mood(guide, 'happy'), 400);
+}
+
+/* ---------- in-picture cards ---------- */
+const $ = id => document.getElementById(id);
+// The volume control (volume.js, volume.css) lives in its own files next to this one, the same in every book.
+document.head.append(Object.assign(document.createElement('script'), { src: new URL('volume.js', document.currentScript.src) }));
+const kbd = s => h('kbd', '', s);
+// The chapter's sources: every key passed to cite() plus CHAPTER.refs, as full references that link to the source.
+function sources() {
+ for (const m of citeObs.takeRecords()) for (const n of m.addedNodes) autoCite(n); // link text added just now (a seek to the end)
+ const keys = [...new Set([...(CHAPTER.refs || []), ...CITED])].filter(k => typeof REFS === 'object' && REFS?.[k]);
+ if (!keys.length) return null;
+ const items = keys.map(k => REFS[k]).sort((a, b) => a.ref.localeCompare(b.ref)).map(r => {
+ if (!r.url) return h('li', '', r.ref);
+ const a = h('a', '', r.url.replace(/^https?:\/\//, ''));
+ Object.assign(a, { href: r.url, target: '_blank', rel: 'noopener' });
+ return h('li', '', [r.ref + ' ', a]);
+ });
+ return h('section', 'srcs', [h('h2', '', translate('sources')), h('ol', '', items)]);
+}
+const uiW = (str, size) => { ctx2d.font = `600 ${size}px ${UI}`; return ctx2d.measureText(str).width; };
+const SCORE = {}; // question id -> first-attempt {right, total}
+
+function h(tag, cls, kids = []) {
+ const e = document.createElement(tag);
+ if (cls) e.className = cls;
+ for (const k of [].concat(kids)) e.append(k);
+ return e;
+}
+// Rich text: strings, DOM nodes, or $m(...) inline math.
+function rich(parts, size = 28) {
+ const s = document.createElement('span');
+ for (const p of [].concat(parts)) s.append(typeof p === 'string' || p instanceof Node ? p : mathEl(p.m, size));
+ return s;
+}
+// A card at pos; a band card keeps its bottom on the stage: when its content grows (a long question, feedback),
+// it moves up rather than running under the player bar.
+function card(pos, cls) {
+ const c = h('div', `card ${pos.cls} ${cls}`);
+ Object.assign(c.style, { left: pos.x + 'px', top: pos.y + 'px', width: pos.w + 'px' });
+ if (pos.maxH) c.style.maxHeight = pos.maxH + 'px';
+ $('ui').append(c);
+ if (pos.cls === 'band') {
+ const fit = () => { c.style.top = Math.max(16, Math.min(pos.y, 900 - 16 - c.offsetHeight)) + 'px'; };
+ const ro = new ResizeObserver(fit);
+ ro.observe(c); fit();
+ P.cleanup.push(() => ro.disconnect());
+ }
+ return c;
+}
+// The guide: an infinity sign whose two loops are its eyes. Drawn in SVG so it can blink, hop and wobble.
+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 mascotEl(size = 100) {
+ const svg = mk('svg', { class: 'mascot', viewBox: '0 0 120 84', width: size, height: size * .7, 'aria-hidden': 'true' });
+ const body = mk('g', { class: 'mbody' }, svg);
+ const line = { fill: 'none', stroke: COL.chalk, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' };
+ mk('path', { d: lemniscate(60, 40, 52, 1.5), ...line, 'stroke-width': 6 }, body);
+ const eyes = mk('g', { class: 'eyes' }, body);
+ for (const x of [33, 87]) {
+ mk('circle', { class: 'pupil', cx: x, cy: 40, r: 6.5, fill: COL.chalk }, eyes);
+ mk('path', { class: 'joy', d: `M${x - 7} 43Q${x} 32 ${x + 7} 43`, ...line, 'stroke-width': 4 }, body);
+ }
+ mk('path', { class: 'smile', d: 'M55 62Q60 67 65 62', ...line, 'stroke-width': 3.5 }, body);
+ mk('path', { class: 'flat', d: 'M55 64H65', ...line, 'stroke-width': 3.5 }, body);
+ return svg;
+}
+function mood(el, m) {
+ el.classList.remove('happy', 'oops');
+ void el.getBoundingClientRect(); // restart the CSS animation
+ if (m) el.classList.add(m);
+}
+// A sequence of questions in one card. Each question: { id, prompt, build(body, api) -> { check?, reveal, lock? } }.
+function quiz(pos, qs, done, label = translate('quickCheck')) {
+ const c = card(pos, 'quiz');
+ let k = 0;
+ const show = () => {
+ const q = qs[k];
+ let first = true, resolved = false;
+ const fb = h('div', 'fb'), body = h('div', 'body'), acts = h('div', 'acts');
+ fb.setAttribute('role', 'status'); // screen readers announce right or wrong
+ const bCheck = h('button', 'btn', [translate('check'), kbd('Enter')]), bShow = h('button', 'btn quiet', [translate('showAnswer'), kbd('S')]);
+ const bNext = h('button', 'btn go', [k < qs.length - 1 ? translate('nextQuestion') : translate('continue'), kbd('Enter')]);
+ bShow.hidden = bNext.hidden = true;
+ const guide = pos.cls === 'band' || pos.cls === 'side' ? mascotEl(pos.cls === 'band' ? 108 : 70) : null;
+ const say = (cls, parts) => { fb.className = 'fb ' + cls; fb.replaceChildren(rich(parts, 24)); fb.style.animation = 'none'; void fb.offsetWidth; fb.style.animation = ''; };
+ const resolve = () => {
+ resolved = true;
+ bCheck.hidden = bShow.hidden = true;
+ ctl.lock?.();
+ bNext.hidden = false;
+ bNext.focus({ preventScroll: true });
+ };
+ const api = {
+ grade(ok, msg, score) {
+ if (resolved) return;
+ if (first) { if (!Object.hasOwn(SCORE, q.id)) SCORE[q.id] = score || { right: +ok, total: 1 }; first = false; }
+ say(ok ? 'ok' : 'no', [ok ? translate('correct') : translate('notQuite'), ...[].concat(msg || [])]);
+ if (guide) {
+ mood(guide, ok ? 'happy' : 'oops');
+ if (!ok) setTimeout(() => { if (guide.classList.contains('oops')) mood(guide, null); }, 1600);
+ }
+ if (ok) resolve(); else bShow.hidden = false;
+ },
+ };
+ const ctl = q.build(body, api);
+ if (ctl.check) { bCheck.onclick = () => ctl.check(); acts.append(bCheck); }
+ acts.append(bShow, bNext);
+ bShow.onclick = () => { say('', [translate('answerPrefix'), ...[].concat(ctl.reveal())]); resolve(); };
+ bNext.onclick = () => { if (k < qs.length - 1) { k++; show(); } else done(); };
+ P.keys = e => {
+ if (e.key === 'Enter' && resolved) { bNext.click(); return true; }
+ if (!resolved && ctl.key?.(e)) return true;
+ if (e.key === 'Enter' && !resolved && ctl.check) { bCheck.click(); return true; }
+ if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }
+ return false;
+ };
+ const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');
+ const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type size
+ if (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));
+ c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);
+ };
+ show();
+}
+function qlayer() {
+ S.q?.remove();
+ S.q = G(scene);
+ S.q.classList.add('qlayer');
+ return S.q;
+}
+const keyAct = (el, fn) => el.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); fn(); } });
+
+/* ---------- question builders ---------- */
+// Single answer from buttons; each wrong option has its own explanation.
+const choice = (opts, right, yes, no, onRight) => (body, api) => {
+ const row = h('div', 'opts');
+ const bs = opts.map((o, i) => {
+ const b = h('button', 'opt', [kbd(String(i + 1)), rich(o, 32)]);
+ b.onclick = () => {
+ if (i === right) { b.classList.add('good'); onRight?.(); api.grade(true, yes); }
+ else { b.classList.add('bad'); b.disabled = true; api.grade(false, no[i]); }
+ };
+ row.append(b);
+ return b;
+ });
+ body.append(row);
+ return {
+ reveal() { bs[right].classList.add('good'); onRight?.(); return yes; },
+ lock() { bs.forEach(b => { b.disabled = true; }); },
+ key(e) { const b = bs[+e.key - 1]; if (!b || b.disabled) return false; b.click(); return true; },
+ };
+};
+// A choice question from the chapter's item bank: ITEMS from ./items.js, built by scripts/items.py from the
+// mcq-item-writer JSON. mcq('ID', onRight?) returns a quiz entry, so quiz(TOPR, [mcq('MB-03-01')], done) asks it.
+function mcq(id, onRight) {
+ const it = (typeof ITEMS === 'object' && ITEMS) ? ITEMS[id] : null;
+ if (!it) throw new Error(`mcq: no item "${id}" in items.js`);
+ return { id, prompt: it.prompt, build: choice(it.opts, it.right, it.why, it.no, onRight) };
+}
+// The shared body of the stage tap questions: each target ring is a focusable button that answers on click or Enter,
+// and ← / → move the focus between them. targets: [{ g, label, ok, wrong }], wrong() shakes and returns the explanation.
+const stageTap = (api, targets, show, yes, onRight, hint) => {
+ let locked = false, cur = -1;
+ const gs = targets.map(({ g, label, ok, wrong }) => {
+ g.classList.add('hit');
+ g.setAttribute('tabindex', 0);
+ g.setAttribute('role', 'button');
+ g.setAttribute('aria-label', label);
+ const act = () => {
+ if (locked) return;
+ if (ok) { g.classList.add('good'); onRight?.(); api.grade(true, yes); }
+ else { g.classList.add('bad'); api.grade(false, wrong()); }
+ };
+ g.addEventListener('click', act);
+ keyAct(g, act);
+ return g;
+ });
+ return {
+ reveal() { gs[show].classList.add('good'); onRight?.(); return yes; },
+ lock() { locked = true; },
+ hint,
+ key(e) {
+ const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;
+ if (!d || locked) return false;
+ cur = cur < 0 ? (d > 0 ? 0 : gs.length - 1) : (cur + d + gs.length) % gs.length;
+ gs[cur].focus();
+ return true;
+ },
+ };
+};
+// Tap a point on the stage number line.
+const tap = (values, right, yes, no, onRight) => (body, api) => {
+ const L = qlayer();
+ const targets = values.map(v => {
+ const g = G(L, { x: X(v), y: Y0 });
+ mk('circle', { r: 30, class: 'ring' }, g);
+ return { g, label: translate('pointLabel', { v: num(v) }), ok: v === right, wrong: () => { shakeFx(S.dots[v]); return no(v); } };
+ });
+ return stageTap(api, targets, values.lastIndexOf(right), yes, onRight,
+ [kbd('←'), kbd('→'), translate('hintMoveAlongLine'), kbd('Enter'), translate('hintChoose')]);
+};
+// Tap one token of a stage token row, e.g. the operation to do first. idx: tappable token indexes.
+const tapEls = (row, idx, right, yes, no, onRight) => (body, api) => {
+ const L = qlayer();
+ const targets = idx.map(i => {
+ const e = row[i], w = e._w + 18, g = G(L, { x: e._px, y: row.y });
+ mk('rect', { class: 'ring', x: -w / 2, y: -row.size * .95, width: w, height: row.size * 1.3, rx: 12 }, g);
+ return { g, label: e.textContent.trim(), ok: i === right, wrong: () => { shakeFx(e); return no(i); } };
+ });
+ return stageTap(api, targets, idx.indexOf(right), yes, onRight,
+ [kbd('←'), kbd('→'), translate('hintMove'), kbd('Enter'), translate('hintChoose')]);
+};
+// Click one of several stage objects (table cells, bars, small graphs). items: [{ el, box: [x, y, w, h], label }].
+const pickEls = (items, right, yes, no, onRight) => (body, api) => {
+ const L = qlayer();
+ const targets = items.map((it, i) => {
+ const [x, y, w, hh] = it.box, g = G(L);
+ mk('rect', { class: 'ring', x, y, width: w, height: hh, rx: 12 }, g);
+ return { g, label: it.label, ok: i === right, wrong: () => { shakeFx(it.el); return no(i); } };
+ });
+ return stageTap(api, targets, right, yes, onRight,
+ [kbd('←'), kbd('→'), translate('hintMove'), kbd('Enter'), translate('hintChooseOrClick')]);
+};
+// Rows of toggles. items: { parts, ans: [keys], why }. parts are math parts (strings, F, R) unless text: true,
+// where they are rich text (strings and $m(...)). cols: [[key, label, colour?, shortcut?]]. multi: several per row.
+const grid = (items, cols, { multi = true, text = false } = {}) => (body, api) => {
+ const wrap = h('div', 'grid' + (text ? ' text' : ''));
+ const hot = cols.map((c, j) => c[3] || String(j + 1));
+ let cur = 0, locked = false;
+ const rows = items.map((it, ri) => {
+ const opts = h('div', 'opts'), mark = h('div', 'mark'), why = h('div', 'why');
+ const bs = cols.map(([key, lab, colr], j) => {
+ const b = h('button', 'opt', [kbd(hot[j]), lab]);
+ if (colr) b.style.setProperty('--c', colr);
+ b.setAttribute('aria-pressed', 'false');
+ b.onclick = () => {
+ const on = b.getAttribute('aria-pressed') !== 'true';
+ if (!multi) bs.forEach(x => x.setAttribute('aria-pressed', 'false'));
+ b.setAttribute('aria-pressed', String(on));
+ };
+ opts.append(b);
+ return b;
+ });
+ const el = h('div', 'row', [h('div', 'num', [text ? rich(it.parts, 26) : mathEl(it.parts, 32)]), opts, mark, why]);
+ el.addEventListener('click', () => { cur = ri; showCur(); });
+ wrap.append(el);
+ const picked = () => cols.filter((c, i) => bs[i].getAttribute('aria-pressed') === 'true').map(c => c[0]);
+ return { it, bs, mark, why, picked, el, played: false };
+ });
+ const single = rows.length === 1;
+ const showCur = () => rows.forEach((r, i) => {
+ const on = !single && !locked && i === cur;
+ r.el.classList.toggle('cur', on);
+ if (on && r.el.isConnected) r.el.scrollIntoView({ block: 'nearest' }); // a long practice list scrolls
+ });
+ showCur();
+ body.append(wrap);
+ const judge = r => {
+ const p = r.picked(), ok = p.length === r.it.ans.length && r.it.ans.every(k => p.includes(k));
+ r.mark.className = 'mark ' + (ok ? 'good' : 'bad');
+ r.mark.textContent = ok ? '✓' : '✗';
+ r.why.replaceChildren(ok || single ? '' : rich(r.it.why, 20));
+ if (ok && !r.played) { r.played = true; r.it.fx?.(); }
+ return ok;
+ };
+ return {
+ check() {
+ const right = rows.filter(judge).length;
+ const all = right === rows.length;
+ api.grade(all, single ? rows[0].it.why : all ? [] : [translate('rowsRight', { r: right, n: rows.length })], { right, total: rows.length });
+ },
+ reveal() {
+ for (const r of rows) {
+ r.bs.forEach((b, i) => b.setAttribute('aria-pressed', String(r.it.ans.includes(cols[i][0]))));
+ judge(r);
+ if (!single) r.why.replaceChildren(rich(r.it.why, 20));
+ }
+ return single ? rows[0].it.why : translate('choicesShown');
+ },
+ lock() { locked = true; showCur(); rows.forEach(r => r.bs.forEach(b => { b.disabled = true; })); },
+ hint: [...(single ? [] : [kbd('↑'), kbd('↓'), translate('hintRow')]), ...(/\d/.test(hot[0]) ? [kbd(hot[0]), '–', kbd(hot[hot.length - 1])] : hot.map(kbd)), translate('hintChoose')],
+ key(e) {
+ if (locked) return false;
+ if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !single) {
+ cur = (cur + (e.key === 'ArrowDown' ? 1 : -1) + rows.length) % rows.length;
+ showCur();
+ return true;
+ }
+ const j = hot.findIndex(x => isShortcut(e, x));
+ if (j < 0) return false;
+ rows[cur].bs[j].click();
+ if (!multi && cur < rows.length - 1) { cur++; showCur(); }
+ return true;
+ },
+ };
+};
+// Exact value of a typed answer: integer, decimal, fraction a/b or mixed number "w a/b"; returns [num, den] or null.
+// Accepts −, – or - as the sign, a currency sign before or after ($5, -$5, 5 €), thousands grouped by spaces (any kind)
+// or, where the decimal sign is a point, by commas, and a decimal comma when DECIMAL_SIGN is ','. Never evaluates the text as code.
+function rat(str) {
+ let t = String(str).trim().replace(/^[−–]/, '-').replace(/\s+/g, ' ').replace(/^(-?) ?\p{Sc} ?|(?<=\d) ?\p{Sc}$/gu, '$1');
+ const group = DECIMAL_SIGN === ',' ? ' ' : '[, ]'; // one kind of separator throughout: 1,000 000 is not a number
+ t = t.replace(new RegExp(`^(-?\\d{1,3})(${group})(\\d{3}(?:\\2\\d{3})*)(?=$|[.,])`), (_, head, sep, rest) => head + rest.split(sep).join(''));
+ if (DECIMAL_SIGN === ',') t = t.replace(/^(-?\d+),(\d+)$/, '$1.$2'); // 0,75 where the decimal sign is a comma
+ let m = t.match(/^(-?)(\d+)(?:\.(\d+))?$/);
+ if (m) { const d = 10 ** (m[3] || '').length, n = (m[1] ? -1 : 1) * (Number(m[2]) * d + Number(m[3] || 0)); return Number.isSafeInteger(n) && Number.isSafeInteger(d) ? [n, d] : null; }
+ m = t.match(/^(-?)(?:(\d+) )?(\d+) ?\/ ?(\d+)$/);
+ if (m && Number(m[4]) > 0) { const d = Number(m[4]), n = (m[1] ? -1 : 1) * (Number(m[2] || 0) * d + Number(m[3])); return Number.isSafeInteger(n) && Number.isSafeInteger(d) ? [n, d] : null; }
+ return null;
+}
+const gcd = (a, b) => { a = Math.abs(a); b = Math.abs(b); while (b) [a, b] = [b, a % b]; return a; };
+const lowest = ([n, d]) => gcd(n, d) === 1;
+// Fill-in boxes inside math. rows: [{ parts: [math parts and { box: '21' }], why, hint?, fx? }].
+// test(values), when given, judges the whole row from the typed numbers (e.g. a factor pair in either order); the boxes' answers are still what Show answer fills in.
+// Answers are exact numbers: "−5", "-5", "0.5", "3/4" and "2 1/4" all work, and equal values match ("6/8" = "3/4")
+// unless the box has lowest: true. hint is shown after a wrong try, why after a right one.
+const blanks = rowsIn => (body, api) => {
+ const all = [];
+ const rows = rowsIn.map(it => {
+ const line = h('div', 'bline'), mark = h('span', 'mark'), why = h('div', 'why');
+ let run = [];
+ const flush = () => { if (run.length) line.append(mathEl(run, 34)); run = []; };
+ const boxes = [];
+ for (const p of it.parts) {
+ if (p && p.box !== undefined) {
+ flush();
+ const b = h('input', 'box');
+ Object.assign(b, { type: 'text', inputMode: 'decimal', autocomplete: 'off', spellcheck: false });
+ b.setAttribute('aria-label', translate('answerBox'));
+ b.dataset.ans = p.box;
+ if (p.lowest) b.dataset.lowest = '1';
+ b.style.width = `${Math.max(2, String(p.box).length) + 2}ch`;
+ line.append(b);
+ boxes.push(b);
+ all.push(b);
+ } else run.push(p);
+ }
+ flush();
+ line.append(mark);
+ body.append(h('div', 'brow', [line, why]));
+ return { it, boxes, mark, why, played: false };
+ });
+ body.classList.add('blanks');
+ const single = rows.length === 1;
+ const judge = r => {
+ let ok = true;
+ if (r.it.test) { // the row is judged as a whole, e.g. two factors in either order
+ const vals = r.boxes.map(b => rat(b.value));
+ ok = vals.every(Boolean) && !!r.it.test(vals.map(([n, d]) => n / d));
+ r.boxes.forEach(b => { b.classList.toggle('good', ok); b.classList.toggle('bad', !ok); });
+ } else for (const b of r.boxes) {
+ const want = rat(b.dataset.ans), got = rat(b.value);
+ const good = !!got && !!want && BigInt(got[0]) * BigInt(want[1]) === BigInt(want[0]) * BigInt(got[1]) && (!b.dataset.lowest || lowest(got));
+ b.classList.toggle('good', good);
+ b.classList.toggle('bad', !good);
+ ok = ok && good;
+ }
+ r.mark.className = 'mark ' + (ok ? 'good' : 'bad');
+ r.mark.textContent = ok ? '✓' : '✗';
+ r.why.replaceChildren(ok || single ? '' : rich(r.it.hint ?? r.it.why, 20));
+ if (ok && !r.played) { r.played = true; r.it.fx?.(); }
+ return ok;
+ };
+ // not on the frame ?beat=N opens before the lesson has started: there Space starts it rather than typing a space
+ requestAnimationFrame(() => { if (P.started) all[0]?.focus({ preventScroll: true }); });
+ return {
+ check() {
+ const right = rows.filter(judge).length, done = right === rows.length;
+ const msg = single ? (done ? rows[0].it.why : rows[0].it.hint ?? rows[0].it.why)
+ : done ? [] : [translate('rowsRight', { r: right, n: rows.length })];
+ api.grade(done, msg, { right, total: rows.length });
+ },
+ reveal() {
+ for (const r of rows) {
+ r.boxes.forEach(b => { b.value = b.dataset.ans.replace('-', '−'); }); // shown exactly as authored
+ judge(r);
+ if (!single) r.why.replaceChildren(rich(r.it.why, 20));
+ }
+ return single ? rows[0].it.why : translate('numbersShown');
+ },
+ lock() { all.forEach(b => { b.disabled = true; }); },
+ hint: [translate(all.some(b => b.dataset.ans.includes('/')) ? 'hintTypeFraction' : all.some(b => /[.,]/.test(b.dataset.ans)) ? 'hintTypeDecimal' : 'hintTypeNumber'),
+ kbd('Tab'), translate('hintNextBox'), kbd('Enter'), translate('hintCheck'), kbd('Esc'), translate('hintLeaveBox')],
+ };
+};
+
+/* ---------- sound effects and music ----------
+ sfx(beat, at, name, vol, bed): play audio/sfx/<name>.mp3 when the clock of beat `beat` passes `at` in normal playback
+ (a seek past it fires nothing), at half volume (vol 2 is full). A long ambience is listed in SFX_BED with its length
+ (SFX_BED.birds = 10): a seek into it joins it part-way. A beat function runs again at every seek; an effect is listed once.
+ An effect still loading when it is due plays late, joined part-way, for up to a second (or its bed).
+ music(file, beats, gain, fade): a looping track under the listed beats (all of them by default). Its place is the
+ length of its earlier beats plus the clock. It ducks to 30 % under the whole beat, or 70 % in the music-only lead-in
+ (`pre`) of the beats in window.MUSIC_UP_IN_PRE (true: every beat). It crossfades over `fade` s (0: a cut), and
+ window.MUSIC_OFF = { beat: t => true } fades it out for a moment.
+ export.py reads SFX, BGM and these settings, and mixes the film by the same rules.
+ Films only (a chapter without questions): effects and music go through one Web Audio graph, so ducks, fades and the
+ volume slider reach them on phones too (iOS ignores an element's .volume). A pause holds them; a seek stops the effects.
+ When a clip loading or buffering holds the film's clock, the music runs on and then eases back (5 % slower or faster),
+ or jumps back once if it is more than a second out. */
+const SND = { sfx: [], bed: {}, bgm: [], len: [], on: [], wait: [], buf: {}, ctx: null, out: null, last: { i: -1, t: 0 }, duck: .3 };
+// window properties, not declarations: a book with its own older sfx() or BGM declares them over these
+Object.assign(window, { SFX: SND.sfx, SFX_BED: SND.bed, BGM: SND.bgm,
+ sfx(beat, at, name, vol = 1, bed = SND.bed[name] || 0) {
+ const e = SND.sfx.find(x => x.beat === beat && x.at === at && x.name === name);
+ if (e) Object.assign(e, { vol, bed }); else SND.sfx.push({ beat, at, name, vol, bed });
+ sfxLoad(name);
+ },
+ music(file, beats = BEATS.map(b => b.id), gain = 1, fade = .8) {
+ const m = { n: file, beats, gain, fade, v: 0, a: Object.assign(new Audio(file), { preload: 'auto', loop: true, volume: 0 }) };
+ SND.bgm.push(m);
+ if (SND.ctx) bgmWire(m);
+ },
+});
+function sfxLoad(name) {
+ const s = SND.buf[name] ??= { data: fetch(`audio/sfx/${name}.mp3`).then(r => r.ok ? r.arrayBuffer() : null).catch(() => null) };
+ if (SND.ctx && !s.decoded) s.decoded = s.data.then(d => d && SND.ctx.decodeAudioData(d)).then(b => { s.b = b; }, () => {});
+}
+function sfxPlay(e, late) {
+ const ctx = SND.ctx, src = ctx.createBufferSource(), g = ctx.createGain();
+ src.buffer = SND.buf[e.name].b; src._sfx = e.name; g.gain.value = src._vol = .5 * e.vol;
+ src.playbackRate.value = P.rate;
+ src.connect(g).connect(SND.out);
+ src.start(0, late && !e.bed ? 0 : Math.max(0, P.t - e.at)); // a late one-shot starts from its attack
+ SND.on.push(src);
+ src.onended = () => { const k = SND.on.indexOf(src); if (k >= 0) SND.on.splice(k, 1); };
+}
+function bgmWire(m) {
+ m.g = SND.ctx.createGain();
+ SND.ctx.createMediaElementSource(m.a).connect(m.g).connect(SND.out);
+ m.a.volume = 1;
+}
+// A browser starts sound only after a click or a key: the first one builds the graph (films only) and readies the music.
+function soundUnlock() {
+ if (!SND.ctx && window.AudioContext && (!BEATS.some(b => b.ask) || CHAPTER.film)) { // a film with a question (CHAPTER.film) keeps its sound
+ if (navigator.audioSession) navigator.audioSession.type = 'playback'; // iOS: the silent switch must not mute the film
+ SND.ctx = new AudioContext();
+ SND.out = SND.ctx.createGain();
+ SND.out.connect(SND.ctx.destination);
+ for (const n in SND.buf) sfxLoad(n);
+ for (const m of SND.bgm) bgmWire(m);
+ }
+ if (SND.ctx && SND.ctx.state !== 'running' && SND.ctx.state !== 'closed') SND.ctx.resume().catch(() => {}); // also iOS 'interrupted'
+ for (const m of SND.bgm) if (!m.blessed) { // iOS lets an element play later only if it once played inside a click
+ m.blessed = true; m.a.muted = true;
+ m.a.play().then(() => { if (!m.cur) m.a.pause(); m.a.muted = false; }, () => { m.a.muted = false; m.blessed = false; });
+ }
+}
+// a touch activates the page on touchend or click, not on pointerdown
+for (const type of ['pointerdown', 'touchend', 'click', 'keydown']) addEventListener(type, soundUnlock, true);
+function soundTick(dt) {
+ const id = BEATS[P.i]?.id, pre = BEATS[P.i]?.pre || 0, on = P.started && P.playing && !P.waiting && !P.done, L = SND.last;
+ // a film waiting for the reader (CHAPTER.film, a question beat after its narration): the music plays on, louder
+ const wait = P.started && P.playing && P.waiting && !P.done && !!CHAPTER.film;
+ const held = P.started && !P.playing && !P.done, ctx = SND.ctx;
+ if (ctx?.state === 'running' && held) ctx.suspend();
+ else if (ctx && ctx.state !== 'running' && ctx.state !== 'closed' && !held) ctx.resume().catch(() => {});
+ // the clock ran on (or stood still, paused) in the same beat; anything else is a seek, a replay or the next beat
+ const same = L.i === P.i && P.t >= L.t && P.t - Math.max(0, L.t) < .5;
+ if (!same) { while (SND.on.length) SND.on.pop().stop(); SND.wait = []; }
+ // a beat that has just begun fires its effects from 0 on; a seek fires nothing it skipped, but joins a bed
+ const from = same ? L.t : P.t < .25 ? -1 : P.t, seeked = !same || L.pend;
+ if (on && ctx) {
+ for (const e of SND.sfx) {
+ if (e.beat !== id || !(e.at > from && e.at <= P.t || seeked && e.bed && e.at < P.t && P.t < e.at + e.bed)) continue;
+ if (SND.buf[e.name]?.b) sfxPlay(e); else SND.wait.push(e);
+ }
+ SND.wait = SND.wait.filter(e => P.t - e.at < (e.bed || 1) && !(SND.buf[e.name]?.b && (sfxPlay(e, true), true)));
+ for (const s of SND.on) if (s.playbackRate.value !== P.rate) s.playbackRate.value = P.rate;
+ }
+ SND.last = { i: P.i, t: on ? P.t : from, pend: !on && (!same || !!L.pend) };
+ const vol = +($('volume')?.value ?? 1), up = window.MUSIC_UP_IN_PRE;
+ if (SND.out) SND.out.gain.value = vol;
+ if (!SND.bgm.length) return;
+ // the film's clock moved this frame (a clip loading or buffering holds it), or jumped (a seek, a replay)
+ const runs = on && same && P.t > L.t, jump = !same && !(L.i === P.i - 1 && P.t < .5);
+ if (!held) SND.duck += Math.max(-dt, Math.min(dt, (wait || P.t < pre && (up === true || up?.includes?.(id)) ? .7 : .3) - SND.duck));
+ for (const m of SND.bgm) {
+ const k = m.beats.indexOf(id), current = (on || wait) && k >= 0 && !window.MUSIC_OFF?.[id]?.(P.t);
+ if (jump) m.off = 0; // a seek or a replay puts every track back where the film's own timing says
+ if (wait && current) m.off = (m.off || 0) + dt * P.rate; // the time it ran on while the reader decided
+ m.cur = current;
+ if (!held) m.v = m.fade > 0 ? Math.max(0, Math.min(1, m.v + (current ? 1 : -1) * dt / m.fade)) : +current;
+ const g = m.v * m.gain * SND.duck;
+ if (m.g) m.g.gain.value = g; else m.a.volume = Math.min(1, g * vol);
+ if (current) {
+ // where the film is: the beats before this one in the track as they really ran (P.end), plus now
+ const dur = m.a.duration || Infinity;
+ const want = (m.beats.slice(0, k).reduce((s, b) => s + (SND.len[BEATS.findIndex(x => x.id === b)] || 0), 0) + P.t + (m.off || 0)) % dur;
+ let d = m.a.currentTime - want;
+ if (d > dur / 2) d -= dur; else if (d < -dur / 2) d += dur;
+ // a start, a jump, or more than a second out once the clock runs again: seek. Less: ease back while the clock runs,
+ // from .25 s out until .05 s
+ const ok = runs && !m.a.seeking;
+ // (once more after a jump: the element plays on while it seeks)
+ if (m.a.paused || jump && Math.abs(d) > .05 || ok && Math.abs(d) > (m.settle ? .25 : 1)) {
+ m.a.currentTime = want; d = 0; m.settle = !ok;
+ } else if (ok) m.settle = false;
+ if (Math.abs(d) > .25) m.fix = true; else if (Math.abs(d) < .05) m.fix = false;
+ // a frame where the clock stood still keeps the rate it had
+ const rate = !m.fix ? P.rate : ok ? P.rate * (1 - Math.sign(d) * .05) : m.a.playbackRate;
+ if (Math.abs(m.a.playbackRate - rate) > .001) m.a.playbackRate = rate;
+ if (m.a.paused) m.a.play().catch(() => {});
+ } else {
+ if (m.a.playbackRate !== P.rate) m.a.playbackRate = P.rate;
+ if (m.v === 0 && !m.a.paused) m.a.pause();
+ }
+ }
+ if (!on && !wait && !P.done) for (const m of SND.bgm) m.a.pause();
+}
+
+/* ---------- player ---------- */
+const P = { i: 0, t: 0, end: 1, playing: false, waiting: false, done: false, started: false, audio: null, afail: false, stall: 0, cleanup: [], rate: 1, nextClip: null };
+function runBeat(i) {
+ TW = [];
+ const b = BEATS[i], tm = TIMINGS[b.id], pre = b.pre || 0; // pre: seconds of picture before the narration starts
+ const m = (k, off = 0) => {
+ if (!(k in tm.marks)) throw new Error(`${b.id}: missing mark ${k}`);
+ return pre + tm.marks[k] + off;
+ };
+ S.cleared = false;
+ b.run(m, pre + tm.dur);
+ if (S.cleared && b.lead !== false && CHAPTER.lead !== false && !pre) leadIn(); // CHAPTER.lead false: no beat gets one (a film)
+ TW.sort((a, c) => a.t0 - c.t0);
+ const end = Math.max(pre + tm.dur, ...TW.map(w => w.t0 + w.dur)) + HOLD;
+ const tail = TW.some(w => w.tail === true);
+ for (const w of TW) if (w.tail === true || tail && w.tail === 'follow') w.dur = end - w.t0;
+ return SND.len[i] = end; // the music places itself by how long each beat really runs
+}
+const HOLD = .6;
+// A beat that clears the picture must not leave it empty while the narration has started.
+// If nothing appears before LEAD_MAX, the opening group (every tween that starts within LEAD_GROUP s of the
+// first reveal) moves earlier so it begins at LEAD_AT, just after the old panel has faded. Later steps keep their word timing.
+const LEAD_AT = .4, LEAD_MAX = .8, LEAD_GROUP = 1.2;
+function leadIn() {
+ const reveals = TW.filter(w => {
+ if (!w.e) return false;
+ const s = st(w.e), to = w.to;
+ return (to.o > 0 && s.o === 0) || (to.s > 0 && s.s === 0) || (to.d > 0 && (s.d ?? 1) === 0);
+ });
+ if (!reveals.length) return;
+ const first = Math.min(...reveals.map(w => w.t0));
+ if (first <= LEAD_MAX) return;
+ for (const w of TW) if (w.t0 >= first && w.t0 < first + LEAD_GROUP) w.t0 -= first - LEAD_AT;
+}
+function stopAudio() {
+ const a = P.audio;
+ if (!a) return;
+ a.onerror = null; a.pause(); a.removeAttribute('src'); a.load();
+ P.audio = null;
+}
+function clearCards() {
+ $('ui').replaceChildren();
+ P.cleanup.forEach(f => f());
+ P.cleanup = [];
+ finishFx();
+ P.keys = null;
+ S.q?.remove();
+ delete S.q;
+}
+// Rebuild the scene from scratch and fast-forward every earlier beat, so any step starts from its exact picture.
+function seek(i, play = P.playing) {
+ stopAudio(); clearCards(); reset();
+ seeking = true;
+ try {
+ for (let k = 0; k < i; k++) { runBeat(k); evalTo(Infinity); }
+ start(i, play);
+ } finally { seeking = false; }
+}
+// Jump to a point inside beat i (frac of its narration); question beats always start at their beginning.
+function seekInto(i, frac) {
+ seek(i, true);
+ const pre = BEATS[i].pre || 0, t = BEATS[i].ask && !CHAPTER.film ? 0 : frac * (pre + TIMINGS[BEATS[i].id].dur); // a film's question beats seek like any other
+ if (t < .3) return;
+ P.t = t;
+ evalTo(t);
+ if (P.audio) P.audio.currentTime = Math.max(0, t - pre);
+}
+function start(i, play) {
+ stopAudio(); clearCards();
+ Object.assign(P, { i, t: 0, waiting: false, done: false, afail: false, stall: 0 });
+ P.end = runBeat(i);
+ evalTo(0);
+ const a = P.audio = beatClip(i, true);
+ a.volume = +($('volume')?.value ?? 1);
+ a.playbackRate = P.rate;
+ // An aborted or superseded load (fast stepping, a reload) is not a failure: only a real error for the current clip
+ // shows the note, and the note goes away as soon as a clip plays.
+ a.onerror = () => { if (P.audio === a && a.error && a.error.code !== MediaError.MEDIA_ERR_ABORTED) soundFailed(); };
+ a.onplaying = () => {
+ if (P.audio !== a) return;
+ $('soundNote').hidden = true;
+ if (P.afail) { P.afail = false; a.currentTime = Math.max(0, P.t - (BEATS[P.i].pre || 0)); } // sound came back late: rejoin the picture where it is
+ };
+ const b = BEATS[i];
+ if (b.ask) b.ask(() => {
+ if (P.i !== i || P.done) return;
+ evalTo(Infinity);
+ if (i + 1 < BEATS.length) start(i + 1, true);
+ else { P.done = true; setPlaying(false); filmDone(); }
+ });
+ setPlaying(play);
+ if (i + 1 < BEATS.length) beatClip(i + 1);
+}
+// The next beat's clip starts loading while this one plays, so a slow connection does not stall between beats.
+function beatClip(i, take) {
+ // the clip's length rides on the URL: regenerated narration gets a new address, so a browser cache cannot pair new
+ // timings with an old clip
+ const src = `audio/${CHAPTER.language || 'en'}/${BEATS[i].id}.mp3?v=${TIMINGS[BEATS[i].id]?.dur ?? ''}`;
+ let a = P.nextClip?._src === src ? P.nextClip : null;
+ if (!a) {
+ if (P.nextClip && P.nextClip !== P.audio) { P.nextClip.removeAttribute('src'); P.nextClip.load(); } // abandon a stale preload
+ a = Object.assign(new Audio(src), { preload: 'auto', _src: src });
+ }
+ P.nextClip = take ? null : a;
+ return a;
+}
+// Playback speed: the audio clock drives the picture, so changing the clip's rate keeps them together.
+const SPEEDS = [.75, 1, 1.25, 1.5];
+function setSpeed(r) {
+ P.rate = r;
+ $('bSpeed').textContent = r + '×';
+ if (P.audio) P.audio.playbackRate = r;
+ try { localStorage.setItem('speed', String(r)); } catch {}
+}
+const stepSpeed = d => setSpeed(SPEEDS[Math.max(0, Math.min(SPEEDS.length - 1, SPEEDS.indexOf(P.rate) + d))]);
+function soundFailed() { P.afail = true; $('soundNote').hidden = false; }
+function setPlaying(v) {
+ P.playing = v;
+ const a = P.audio;
+ if (!a) return;
+ const lead = v && P.t < (BEATS[P.i]?.pre || 0);
+ if (v && !P.waiting && !a.ended && !P.afail && !lead) a.play().catch(e => { if (P.audio === a && e.name === 'NotAllowedError') soundFailed(); });
+ else if (lead && !a._unlocked) { // the clip starts later, outside this click: play it silently now so the browser allows that
+ a._unlocked = true; a.muted = true;
+ a.play().then(() => { if (P.t < (BEATS[P.i].pre || 0)) { a.pause(); a.currentTime = 0; } a.muted = false; }, () => { a.muted = false; });
+ } else a.pause();
+}
+function beatDone() {
+ evalTo(Infinity);
+ const b = BEATS[P.i];
+ if (b.ask) P.waiting = true;
+ else if (P.i < BEATS.length - 1) start(P.i + 1, true);
+ else { P.done = true; setPlaying(false); filmDone(); }
+}
+// A chapter that ends on its last frame, with no closing card of questions (a picture book), is finished there: it
+// counts as done, and CHAPTER.next is offered over that frame. Seeking or replaying clears the button with the cards.
+function filmDone() {
+ progress(p => { p.done = [...new Set([...(p.done || []), CHAPTER.number])]; });
+ document.activeElement?.blur(); // a last question's Continue keeps focus, and Enter would press it again
+ // as on the finish card: Enter opens the next chapter (or replays), R and Space replay
+ const go = () => { if (CHAPTER.next) location.href = CHAPTER.next; else restart(); };
+ P.keys = e => e.key === 'Enter' ? (go(), true) : isShortcut(e, 'r') ? (restart(), true) : false;
+ if (!CHAPTER.next) return;
+ const next = h('button', 'btn go', [translate('nextChapter'), kbd('Enter')]);
+ next.onclick = go;
+ const c = card({ x: 0, y: 770, w: 0, cls: 'side' }, 'next');
+ Object.assign(c.style, { left: 'auto', right: '40px', width: 'auto' });
+ c.append(h('div', 'acts', [next]));
+}
+let last = performance.now();
+function frame(now) {
+ const dt = Math.min(.1, (now - last) / 1000);
+ last = now;
+ clock += dt;
+ if (FX.length) { evalTo(clock, FX); FX = FX.filter(w => !w.done); }
+ if (P.playing && !P.waiting && !P.done) {
+ const a = P.audio;
+ // While the clip plays, its clock drives the picture; before it starts or after it ends, wall time does.
+ const pre = BEATS[P.i].pre || 0;
+ if (a && P.t < pre) { // the picture's lead before the narration, on wall time; then the clip starts
+ P.t += dt * P.rate;
+ if (P.t >= pre && !P.afail) { a.muted = false; a.currentTime = P.t - pre; a.play().catch(e => { if (P.audio === a && e.name === 'NotAllowedError') soundFailed(); }); }
+ } else if (a && !P.afail && !a.ended) {
+ if (a.currentTime > 0) { P.t = Math.max(P.t, pre + a.currentTime); P.stall = 0; }
+ else if ((P.stall += dt) > (a.readyState < 2 ? 8 : 15)) soundFailed(); // nothing to play after 8 s, or stuck for 15
+ } else P.t += dt * P.rate;
+ evalTo(P.t);
+ if (P.t >= P.end) beatDone();
+ }
+ soundTick(dt);
+ syncLinks();
+ ui();
+ requestAnimationFrame(frame);
+}
+let segs = [];
+function buildSegs() {
+ segs = BEATS.map((b, i) => {
+ const s = h('button', 'seg' + (b.ask ? ' ask' : ''), [h('i')]);
+ s.style.flex = TIMINGS[b.id].dur + (b.ask ? 12 : 0);
+ s.title = b.title;
+ s.setAttribute('aria-label', translate('goToStep', { n: i + 1, title: b.title }));
+ // A click lands at that point of the step; keyboard activation (no pointer position) starts the step.
+ s.onclick = e => {
+ const r = s.getBoundingClientRect();
+ hideCover(); seekInto(i, e.detail ? (e.clientX - r.left) / r.width : 0);
+ };
+ $('segs').append(s);
+ return s.firstChild;
+ });
+}
+// ui() runs on every frame, paused or not: it writes only what changed, so an idle lesson does no layout work.
+let stepText = '';
+const setWidth = (f, w) => { if (f._w !== w) { f._w = w; f.style.width = w + '%'; } };
+function ui() {
+ segs.forEach((f, k) => setWidth(f, k < P.i || P.done ? 100 : k > P.i ? 0 : Math.min(100, P.t / P.end * 100)));
+ const fr = $('frame');
+ fr.classList.toggle('is-playing', P.playing && !P.done && !P.waiting);
+ fr.classList.toggle('paused', P.started && !P.playing && !P.waiting && !P.done && !BEATS[P.i].ask);
+ const step = `${P.i + 1} / ${BEATS.length} ${BEATS[P.i].title}`;
+ if (step !== stepText) { stepText = step; $('stepName').textContent = step; }
+ const b = BEATS[P.i];
+ let text = '';
+ // a question's caption shows while its narration plays, clear of the cards; a full-screen card already shows the
+ // question, so it has none
+ const asking = !!b.ask;
+ if (P.started && !P.done && !(asking && (P.waiting || $('ui').querySelector('.card.screen')))) {
+ // a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
+ // words are over; a 1 marks a line in another language, whose subtitle shows even with captions off
+ for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ if (t + (b.pre || 0) > P.t + .05) break;
+ text = (captions || forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
+ }
+ }
+ if (text !== capText) { capText = text; $('caption').textContent = text; $('caption').hidden = !text; }
+ if (text) placeCaption(asking);
+}
+// Above a bottom band, or centred left of a card in the bottom right; elsewhere the caption keeps its place.
+let capAt = '';
+function placeCaption(asking) {
+ const c = asking ? $('ui').querySelector('.card.band, .card.side') : null;
+ let at = '';
+ if (c?.classList.contains('band')) at = `${960 - c.offsetTop + 12}||`;
+ else if (c && c.offsetLeft > 800 && c.offsetTop + c.offsetHeight > 700) at = `|${c.offsetLeft / 2}|${c.offsetLeft - 60}`;
+ if (at === capAt) return;
+ capAt = at;
+ const [bottom, left, width] = at.split('|'), s = $('caption').style;
+ Object.assign(s, { bottom: bottom && bottom + 'px', left: left && left + 'px', maxWidth: width && width + 'px' });
+}
+let captions = false, capText = '';
+try { captions = localStorage.getItem('captions') === '1'; } catch {}
+function setCaptions(on, save = true) {
+ captions = on;
+ $('bCC').setAttribute('aria-pressed', String(on));
+ if (save) try { localStorage.setItem('captions', on ? '1' : '0'); } catch {}
+}
+setCaptions(captions, false); // only the reader's own choice is stored, so a book can still pick the first-time default
+function hideCover() {
+ P.started = true; $('cover').hidden = true;
+ // a question that ?beat=N opened before the start (its box waited unfocused, so Space started) now takes the typing
+ if (BEATS[P.i].ask) $('ui').querySelector('input.box:not(:disabled)')?.focus({ preventScroll: true });
+}
+function togglePlay() {
+ if (!P.started) { hideCover(); return setPlaying(true); }
+ if (P.done) return restart(); // the end of a film (or of a chapter whose last step is a question): play again
+ if (P.waiting) return;
+ setPlaying(!P.playing);
+}
+const back1 = () => seek(P.t > 2.5 || P.i === 0 ? P.i : P.i - 1);
+const restart = () => { for (const k in SCORE) delete SCORE[k]; hideCover(); seek(0, true); };
+$('cover').onclick = togglePlay;
+$('stage').addEventListener('click', e => {
+ if (e.target.closest('a.cite')) { if (P.playing && !P.waiting) setPlaying(false); return; } // opening a source pauses the lesson
+ const b = BEATS[P.i];
+ if (!b.ask && !P.done && !e.target.closest('.qlayer')) togglePlay(); // a tap on a finished film's last frame does nothing
+});
+const citeObs = new MutationObserver(ms => { for (const m of ms) for (const n of m.addedNodes) autoCite(n); });
+citeObs.observe(scene, { childList: true, subtree: true });
+citeObs.observe($('ui'), { childList: true, subtree: true });
+$('bPlay').onclick = togglePlay;
+$('bBack').onclick = () => { hideCover(); back1(); };
+$('bRestart').onclick = restart;
+$('bCC').onclick = () => setCaptions(!captions);
+$('bSpeed').onclick = () => setSpeed(SPEEDS[(SPEEDS.indexOf(P.rate) + 1) % SPEEDS.length]);
+try { const r = +localStorage.getItem('speed'); if (SPEEDS.includes(r)) setSpeed(r); } catch {}
+$('bFull').onclick = () => toggleFull();
+const toggleFull = () => document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen?.();
+let helpResume = false;
+function toggleHelp() {
+ const open = $('help').hidden;
+ $('help').hidden = !open;
+ if (open) { helpResume = P.playing; if (P.playing) setPlaying(false); }
+ else if (helpResume) setPlaying(true);
+}
+// Review notes, only with ?review in the URL: N pauses and asks for a note on this moment, Shift+N copies every
+// note of the chapter (one line each, with the ?beat=N&t=S that reopens it) and offers to clear them.
+const REVIEW = new URLSearchParams(location.search).has('review');
+const REVIEW_KEY = 'papermorph:review:' + location.pathname;
+const reviewNotes = () => { try { return JSON.parse(localStorage.getItem(REVIEW_KEY) || '[]'); } catch { return []; } };
+function reviewNote() {
+ if (P.playing) setPlaying(false);
+ const at = `?beat=${P.i}&t=${P.t.toFixed(1)}`, note = prompt(`Note at ${BEATS[P.i].id} ${at}`);
+ if (!note) return;
+ try { localStorage.setItem(REVIEW_KEY, JSON.stringify([...reviewNotes(), `ch${String(CHAPTER.number).padStart(2, '0')} ${at} (${BEATS[P.i].id}): ${note}`])); } catch {}
+}
+function reviewCopy() {
+ const notes = reviewNotes(), text = notes.join('\n');
+ console.log(text);
+ navigator.clipboard?.writeText(text).catch(() => {});
+ if (confirm(`${notes.length} notes copied (also in the console). Clear them?`)) try { localStorage.removeItem(REVIEW_KEY); } catch {}
+}
+// Every action has a key. A question's own keys (P.keys) come first; Shift reaches the player during a question.
+document.addEventListener('keydown', e => {
+ if (e.altKey || e.metaKey || e.ctrlKey) return;
+ const k = e.key;
+ if (!$('help').hidden) { if (k === 'Escape' || k === '?') { e.preventDefault(); toggleHelp(); } return; }
+ if (e.target.matches?.('input')) { // Keep native input keys; only answer boxes use Enter to check.
+ if (k === 'Enter' && e.target.type !== 'range' && P.keys) { e.preventDefault(); P.keys(e); }
+ else if (k === 'Escape') e.target.blur();
+ return;
+ }
+ if (k === '?') { e.preventDefault(); toggleHelp(); return; }
+ if (REVIEW && isShortcut(e, 'n')) { e.preventDefault(); e.shiftKey ? reviewCopy() : reviewNote(); return; }
+ if ((k === 'Enter' || k === ' ') && e.target.closest?.('button, [tabindex], a')) return; // a Tab-focused control acts itself
+ if (!P.started) { if (k === ' ' || k === 'Enter') { e.preventDefault(); togglePlay(); } return; }
+ if (P.keys && !e.shiftKey && P.keys(e)) { e.preventDefault(); return; }
+ const free = e.shiftKey || !P.keys || P.done; // after the end no question holds the arrows
+ let used = true;
+ if (k === ' ') togglePlay();
+ else if (k === 'ArrowLeft' && free) back1();
+ else if (k === 'ArrowRight' && free) { if (P.i < BEATS.length - 1) seek(P.i + 1); }
+ else if (k === 'Home') restart();
+ else if (isShortcut(e, 'c')) setCaptions(!captions);
+ else if (k === '<' || k === ',' || isShortcutCode(e, 'Comma')) stepSpeed(-1);
+ else if (k === '>' || k === '.' || isShortcutCode(e, 'Period')) stepSpeed(1);
+ else if (isShortcut(e, 'f')) toggleFull();
+ else used = false;
+ if (used) e.preventDefault();
+});
+// Mouse clicks should not leave focus on a control, so Enter and Space keep meaning "check" and "play".
+$('frame').addEventListener('mousedown', e => { if (e.target.closest('button, [tabindex]')) e.preventDefault(); });
+$('bHelp').onclick = toggleHelp;
+const fit = () => document.documentElement.style.setProperty('--k', Math.min(innerWidth / 1640, (innerHeight - (innerWidth <= 700 ? 120 : 0)) / 1000));
+addEventListener('resize', fit);
+fit();
+
+// Start the lesson once the chapter page has defined CHAPTER and BEATS.
+// ?beat=N&t=S opens a paused frame, for reviewing a single moment.
+// Per-book progress shared with the cover/contents at the parent URL folder.
+const BOOK_PROGRESS_KEY = bookSetting('--progress-key') || 'animebook:progress:' + new URL('../', location.href).pathname;
+function progress(f) {
+ try {
+ const saved = JSON.parse(localStorage.getItem(BOOK_PROGRESS_KEY) || '{}');
+ const p = saved && typeof saved === 'object' && !Array.isArray(saved) ? saved : {};
+ p.done = Array.isArray(p.done) ? p.done.filter(n => Number.isInteger(n) && n > 0) : [];
+ f(p); localStorage.setItem(BOOK_PROGRESS_KEY, JSON.stringify(p));
+ } catch {}
+}
+function boot() {
+ $('coverK').textContent = translate('chapterNumber', { n: CHAPTER.label ?? CHAPTER.number });
+ $('coverT').textContent = CHAPTER.title;
+ $('bHome').href = `../#ch${String(CHAPTER.number).padStart(2, '0')}`;
+ progress(p => { p.last = CHAPTER.number; });
+ document.getElementById('stage').setAttribute('aria-label', translate('stageLabelTitled', { title: CHAPTER.title }));
+ const film = !!CHAPTER.film || !BEATS.some(b => b.ask); // a picture book or a film: no "lesson" or "quick checks" on its cover
+ if (film) { // the help lists no question keys and needs no column titles
+ $('coverGo').textContent = translate('startFilm');
+ const shift = [...$('help').querySelectorAll('dt')].find(e => e.textContent.startsWith('Shift'));
+ for (const e of [$('help').querySelector('.help-cols > :last-child'), $('help').querySelector('h3'), shift, shift.nextElementSibling]) e.hidden = true;
+ }
+ $('coverMeta').textContent = translate(film ? 'aboutMinutesFilm' : 'aboutMinutes', { n: num(CHAPTER.minutes) });
+ buildSegs();
+ const qs = new URLSearchParams(location.search);
+ if (qs.has('beat')) {
+ $('cover').hidden = true;
+ seek(Math.max(0, Math.min(BEATS.length - 1, qs.get('beat') | 0)), false);
+ P.t = +(qs.get('t') || 0);
+ evalTo(P.t);
+ if (P.audio) P.audio.currentTime = Math.max(0, P.t - (BEATS[P.i].pre || 0));
+ } else seek(0, false);
+ requestAnimationFrame(frame);
+}
diff --git a/site/shooting-an-elephant/lib/film.js b/site/shooting-an-elephant/lib/film.js
new file mode 100644
index 0000000..d46445a
--- /dev/null
+++ b/site/shooting-an-elephant/lib/film.js
@@ -0,0 +1,309 @@
+/* film.js — the documentary kit: found pictures, line drawings, words and maps on the engine's beat clock.
+ This is the book's own copy: its look is set in lib/book.css (colours) and lib/fonts.css; add the film's recurring
+ pieces at the end. Every helper is a pure function of the beat clock, so pause, seek, ?beat=N&t=S and export.py agree.
+ Pictures are img/<name>.webp with their sizes in ART (img/art.js, from prep.py); traced drawings are LINES (lib/lines.js,
+ from trace.py); clips are FRAMES (img/frames.js, from frames.py). The fonts must be loaded before boot(): words are
+ measured on a canvas (chapter.html does this). */
+'use strict';
+/* ---------- the look ---------- */
+const KEY = '"Oswald", "Arial Narrow", sans-serif', SER = '"EB Garamond", Georgia, serif'; // titles and key words; quotes and captions
+// colours from lib/book.css (read by the engine into COL, or with bookSetting): ink on the ground, the accent, captions,
+// a document's paper, ink on paper, a document's heading
+const CREAM = COL.chalk, SOFT = COL.dim, HOT = bookSetting('--accent') || '#f08a4b', PAPER = bookSetting('--paper') || CREAM,
+ INK = bookSetting('--paper-ink') || '#3a2a24', STAMP = bookSetting('--stamp') || '#7a1a20';
+
+// a picture from img/: centred on (x, y), h or w in stage px; `at` makes it enter (from offset dx, dy) at that time
+function pic(p, name, { x = 800, y = 450, h = 600, w, r = 0, s = 1, at, from = [0, 40], dur = .9, o = 1, back = false } = {}) {
+ const sz = ART[name];
+ const g = G(p, at === undefined ? { x, y, r, s, o } : { x: x + from[0], y: y + from[1], r, s, o: 0 });
+ const k = w ? w / sz[0] : h / sz[1], W = sz[0] * k, H = sz[1] * k;
+ if (back) mk('rect', { x: -W / 2 + 4, y: -H / 2 + 4, width: W - 8, height: H - 8, fill: COL.board }, g); // a solid line drawing (a door)
+ mk('image', { href: `../img/${name}.webp`, x: -W / 2, y: -H / 2, width: W, height: H }, g);
+ g._w = W; g._h = H; g._x = x; g._y = y;
+ if (at !== undefined) tw(g, { x, y, o }, at, dur, out);
+ return g;
+}
+const leave = (g, t0, dx = 0, dy = 0, dur = .7) => tw(g, { x: g._x + dx, y: g._y + dy, o: 0 }, t0, dur, io);
+const push = (g, t0, t1, s1 = 1.06, dx = 0, dy = 0) => tw(g, { s: s1, x: g._x + dx, y: g._y + dy }, t0, t1 - t0, lin); // slow Ken Burns
+// one picture turning into another in place (a figure changing era)
+const dissolve = (a, b, t0, dur = 1.2) => { hide(a, t0, dur, lin); show(b, t0, dur, lin); };
+
+// a line drawing traced into strokes (LINES[name] from trace.py): drawn on stroke by stroke over `draw` s, or shown whole
+function traced(p, name, { x = 800, y = 450, h = 600, at = 0, draw: dd = 0, o = 1, flip = false } = {}) {
+ const L = LINES[name], [x0, y0, x1, y1] = L.box, k = h / (y1 - y0);
+ const g = G(p, { x, y, o: dd ? 1 : 0 });
+ const inner = mk('g', { transform: `scale(${flip ? -k : k},${k}) translate(${-(x0 + x1) / 2},${-(y0 + y1) / 2})` }, g);
+ const total = L.l.reduce((a, b) => a + b, 0);
+ let acc = 0;
+ L.p.forEach((d, i) => {
+ const e = path(inner, d, { stroke: CREAM, 'stroke-width': 2.4 / k }, dd ? { d: 0 } : {});
+ if (dd) { draw(e, at + dd * acc / total, Math.max(.04, dd * L.l[i] / total), lin); acc += L.l[i]; }
+ });
+ if (!dd) tw(g, { o }, at, .6);
+ g._x = x; g._y = y; g._h = h;
+ return g;
+}
+// words in a font measured on a canvas (fonts are loaded before boot)
+const CTX = document.createElement('canvas').getContext('2d');
+const wid = (str, size, font, style = '', weight = 400) => { CTX.font = `${style} ${weight} ${size}px ${font}`; return CTX.measureText(str).width; };
+
+// big condensed word(s)
+function key(p, str, x, y, t0, { size = 96, fill = CREAM, anchor = 'middle', from = 24, o = 1 } = {}) {
+ const e = T(p, str.toUpperCase(), { x, y: y + from, size, fill, font: KEY, weight: 600, anchor, o: 0 });
+ e.setAttribute('letter-spacing', '.02em');
+ e._w = wid(str.toUpperCase(), size, KEY, '', 600) * 1.02;
+ tw(e, { y, o }, t0, .55, out);
+ return e;
+}
+// a line struck through a key word (the word's own width)
+function strike(p, e, x, y, t0, size, anchor = 'middle') {
+ const x0 = anchor === 'middle' ? x - e._w / 2 : anchor === 'end' ? x - e._w : x;
+ return line(p, `M${x0 - 16} ${y - size * .32}H${x0 + e._w + 16}`, t0, .4, Math.max(5, size / 12), { stroke: HOT });
+}
+// serif lines typed word by word between t0 and t1 (Chinese, Japanese and Korean characters one by one)
+const CJK = /[⺀-鿿가-힯豈-﫿＀-￯]|[^⺀-鿿가-힯豈-﫿＀-￯]+/g;
+// mark: words that get a betel-red copy under them, out of register (the rest stays plain, for contrast)
+function say(p, lines, x, y, t0, t1, { size = 44, fill = CREAM, italic = true, anchor = 'start', lh = 1.3, weight = 400, mark = [] } = {}) {
+ const g = G(p, {}), style = italic ? 'italic' : '', words = [];
+ const sp = wid(' ', size, SER, style, weight);
+ lines.forEach((ln, i) => {
+ const W = wid(ln, size, SER, style, weight);
+ let cx = anchor === 'middle' ? x - W / 2 : anchor === 'end' ? x - W : x;
+ ln.split(' ').forEach(word => (word.match(CJK) || ['']).forEach((w, j, ws) => {
+ const e = T(g, w, { x: cx, y: y + i * size * lh, size, fill, font: SER, weight, o: 0 });
+ if (italic) e.setAttribute('font-style', 'italic');
+ if (mark.includes(w.replace(/[^\p{L}']/gu, ''))) {
+ e._red = T(g, w, { x: cx + 3, y: y + i * size * lh + 2, size, fill: HOT, font: SER, weight, o: 0 });
+ if (italic) e._red.setAttribute('font-style', 'italic');
+ g.insertBefore(e._red, e);
+ }
+ words.push(e); cx += wid(w, size, SER, style, weight) + (j === ws.length - 1 ? sp : 0);
+ }));
+ });
+ const chars = words.map(e => e.textContent.length + 1), all = chars.reduce((a, b) => a + b, 0);
+ let acc = 0;
+ words.forEach((e, i) => { const at = t1 === t0 ? t0 : t0 + (t1 - t0) * acc / all; show(e, at, .25, lin); if (e._red) show(e._red, at, .25, lin); acc += chars[i]; });
+ return g;
+}
+// a small caption under a picture (a credit or a name tag)
+function tag(p, str, x, y, t0, { size = 24, anchor = 'start', fill = SOFT } = {}) {
+ const e = T(p, str, { x, y, size, fill, font: SER, anchor, o: 0 });
+ e.setAttribute('font-style', 'italic');
+ show(e, t0, .5);
+ return e;
+}
+// the era at the top left, like a chapter opener: the year in italic, a hairline, the place or topic in spaced capitals
+function dateChip(p, year, topic, t0 = .2) {
+ const g = G(p, { x: 80, y: 112, o: 0 });
+ T(g, year, { size: 72, font: SER, weight: 400, fill: HOT }).setAttribute('font-style', 'italic');
+ const tw_ = wid(topic.toUpperCase(), 26, SER) * 1.3 + 8; // letter-spacing .28em widens the caps by about 30 %
+ const rule = path(g, `M3 22H${Math.max(220, tw_)}`, { stroke: CREAM, 'stroke-width': 1.4, opacity: .7 }, { d: 0 });
+ T(g, topic.toUpperCase(), { x: 3, y: 58, size: 26, font: SER, weight: 400, fill: CREAM }).setAttribute('letter-spacing', '.28em');
+ tw(g, { o: 1 }, t0, .6); draw(rule, t0 + .2, .6);
+ return g;
+}
+// cream line, drawn on
+const line = (p, d, t0, dur = .8, w = 3, extra = {}) => { const e = path(p, d, { stroke: CREAM, 'stroke-width': w, ...extra }, { d: 0 }); draw(e, t0, dur); return e; };
+// wavy water lines that flow forever (pure function of the beat clock); amp may be a function of t
+function water(p, y0, D, { rows = 3, amp = 8, len = 1700, x0 = -50, gap = 26, o = .75 } = {}) {
+ const g = G(p, { o: 0 }); tw(g, { o }, 0, .6);
+ const ps = [...Array(rows)].map((_, i) => path(g, '', { stroke: CREAM, 'stroke-width': 2.2, opacity: 1 - i * .25 }));
+ clockRun(t => { const a = typeof amp === 'function' ? amp(t) : amp; ps.forEach((e, i) => {
+ let d = ''; for (let x = 0; x <= len; x += 20) d += `${x ? 'L' : 'M'}${x0 + x} ${(y0 + i * gap * (a / 8) ** .5 + a * Math.sin(x / 70 + t * 1.6 + i)).toFixed(1)}`;
+ e.setAttribute('d', d);
+ }); }, D, { tail: true });
+ return g;
+}
+// something that bobs on the water (a boat); x may follow a function of t
+const bob = (g, D, a = 6, xf) => clockRun(t => put(g, { y: g._y + a * Math.sin(t * 1.6), r: 1.5 * Math.sin(t * 1.1), ...(xf ? { x: xf(t) } : {}) }), D, { tail: true });
+const span01 = (t, a, b) => Math.min(1, Math.max(0, (t - a) / (b - a)));
+const smooth01 = q => q * q * (3 - 2 * q);
+// a speech balloon, cream outline, its tail to (tx, ty)
+function balloon(p, x, y, w, h, tx, ty, t0) {
+ const bx = Math.min(Math.max(tx, x + 60), x + w - 100);
+ const d = `M${x + 30} ${y}H${x + w - 30}Q${x + w} ${y} ${x + w} ${y + 30}V${y + h - 30}Q${x + w} ${y + h} ${x + w - 30} ${y + h}H${bx + 40}L${tx} ${ty}L${bx} ${y + h}H${x + 30}Q${x} ${y + h} ${x} ${y + h - 30}V${y + 30}Q${x} ${y} ${x + 30} ${y}Z`;
+ return line(p, d, t0, .7, 3);
+}
+// a field of dots: positions from a fixed seed so every replay is the same
+function rng(seed) { return () => (seed = (seed * 16807) % 2147483647) / 2147483647; }
+function dots(p, n, box, r, seed, fill = CREAM) {
+ const R = rng(seed), g = G(p, {});
+ return { g, el: [...Array(n)].map(() => mk('circle', { cx: box[0] + R() * box[2], cy: box[1] + R() * box[3], r, fill }, g)).map(e => put(e, { o: 0 })) };
+}
+// close-ups inside a print as their words are spoken: shots [[mark, fx, fy, label, zoom, band]], fx/fy the point in the picture
+// (0..1 of the picture inside its border); the view never leaves the picture; a band names each one; back to the whole after
+function closeups(p, g, name, shots, m, tBack, home) {
+ const [W, H] = ART[name], k = g._w / W, iw = (W - 112) * k, ih = (H - 112) * k; // a print's picture sits 56 px in
+ const clamp = (v, lim) => Math.max(-lim, Math.min(lim, v));
+ shots.forEach(([mark, fx, fy, label, Z = 3, band], i) => { // band: 'top' or 'bottom' to choose where the label goes
+ const dx = clamp((fx - .5) * iw, iw / 2 - 800 / Z), dy = clamp((fy - .5) * ih, ih / 2 - 450 / Z), t0 = m(mark) - .15;
+ tw(g, { s: Z, x: 800 - Z * dx, y: 450 - Z * dy, r: 0 }, t0, .35, out);
+ // the band sits under the subject itself (the view may stop short of centring a subject near the picture's edge)
+ const lw = wid(label.toUpperCase(), 72, KEY, '', 600) + 70, sx = 800 + Z * ((fx - .5) * iw - dx);
+ const l = G(p, { x: Math.max(lw / 2 + 30, Math.min(1570 - lw / 2, sx)), y: band ? (band === 'top' ? 130 : 820) : fy > .7 || fy < .45 ? 130 : 820, o: 0 }); // clear of the subject: top for a low or a high one
+ mk('rect', { x: -lw / 2, y: -68, width: lw, height: 92, fill: COL.board }, l);
+ T(l, label.toUpperCase(), { y: 0, size: 72, font: KEY, weight: 600, fill: CREAM, anchor: 'middle' });
+ show(l, t0, .12);
+ hide(l, i < shots.length - 1 ? m(shots[i + 1][0]) - .15 : tBack, .15);
+ });
+ if (home) tw(g, { s: 1, ...home }, tBack, .8, soft); // no home: stay on the last close-up
+}
+// a generated clip as cream-line frames on one sprite sheet (frames.py), played on the beat clock from t0:
+// the frame is a pure function of the time, so pausing, seeking and the export all show the same picture
+function anim(p, name, { x = 800, y = 450, size = 600, at = 0, t0 = at, D, o = 1 } = {}) {
+ const F = FRAMES[name], rows = Math.ceil(F.n / F.cols);
+ const g = G(p, { x, y, o: 0 });
+ const v = mk('svg', { x: -size / 2, y: -size / 2, width: size, height: size, viewBox: `0 0 ${F.fw} ${F.fh}` }, g);
+ mk('image', { href: `../img/${name}-sheet.webp`, width: F.cols * F.fw, height: rows * F.fh }, v);
+ let last = -1;
+ clockRun(t => {
+ const f = Math.max(0, Math.min(F.n - 1, Math.floor((t - t0) * F.fps)));
+ if (f !== last) { last = f; v.setAttribute('viewBox', `${(f % F.cols) * F.fw} ${Math.floor(f / F.cols) * F.fh} ${F.fw} ${F.fh}`); }
+ }, D, { tail: true });
+ tw(g, { o }, at, .8);
+ return g;
+}
+// an old document: paper, lines of ink, a label
+function doc(p, label, x, y, r, t0, seed) {
+ const R = rng(seed), g = G(p, { x: x - 700, y, r, o: 0 });
+ mk('rect', { x: -150, y: -200, width: 300, height: 400, fill: PAPER, stroke: '#cdbfa6' }, g);
+ for (let i = 0; i < 13; i++) {
+ const yy = -130 + i * 24, ww = 160 + R() * 70;
+ path(g, `M-118 ${yy}q${ww / 4} ${-3 + R() * 6} ${ww / 2} 0t${ww / 2} 0`, { stroke: INK, 'stroke-width': 2, opacity: .7 });
+ }
+ T(g, label.toUpperCase(), { y: -160, size: 22, font: KEY, weight: 600, fill: STAMP, anchor: 'middle' }).setAttribute('letter-spacing', '.06em');
+ tw(g, { x, o: 1 }, t0, .8, out);
+ g._x = x; g._y = y;
+ return g;
+}
+// a point moving along a polyline [[x, y], …] as q goes 0..1
+function along(pts, q) {
+ const seg = pts.slice(1).map((b, i) => Math.hypot(b[0] - pts[i][0], b[1] - pts[i][1])), L = seg.reduce((a, b) => a + b, 0);
+ let d = q * L, i = 0;
+ while (i < seg.length - 1 && d > seg[i]) d -= seg[i++];
+ const f = seg[i] ? d / seg[i] : 0, a = pts[i], b = pts[i + 1];
+ return [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f];
+}
+
+// a picture with its credit or name under it, and a quote typed beside it (an epigraph): portrait left, the quote large
+function epigraph(p, name, who, lines, tin, tq, tq1, tout) {
+ const g = G(p, {});
+ pic(g, name, { x: 330, y: 430, h: 440, r: -2, at: tin, from: [-500, 0] });
+ tag(g, who, 330, 690, tin + .5, { anchor: 'middle', size: 30, fill: CREAM });
+ say(g, lines, 620, 330, tq, tq1, { size: 62 });
+ if (tout !== undefined) tw(g, { x: -200, o: 0 }, tout, .7, io);
+ return g;
+}
+
+/* ---------- this film's own pieces ---------- */
+// a video clip (img/<name>.mp4, muted) on the beat clock: it plays while the film plays and follows every pause and seek;
+// held on its last frame after it ends. shortcut: export.py seeks frame by frame without waiting for the video to decode,
+// so an exported clip may lag a frame; check the export, and render the clip as frames if it shows.
+function clip(p, name, D, { x = 800, y = 450, w = 1600, h = 900, at = 0, o = 1, dur = .8 } = {}) {
+ const g = G(p, { x, y, o: 0 });
+ const fo = mk('foreignObject', { x: -w / 2, y: -h / 2, width: w, height: h }, g);
+ const v = document.createElement('video');
+ Object.assign(v, { src: `../img/${name}.mp4`, muted: true, playsInline: true, preload: 'auto' });
+ v.setAttribute('muted', ''); v.setAttribute('playsinline', '');
+ v.style.cssText = 'display:block;width:100%;height:100%;object-fit:cover';
+ fo.appendChild(v);
+ clockRun(t => {
+ const want = Math.max(0, Math.min((v.duration || 1e4) - .05, t - at));
+ const running = P.playing && !P.waiting && t >= at && want < (v.duration || 1e4) - .05;
+ if (running) {
+ if (v.paused) v.play().catch(() => {});
+ v.playbackRate = P.rate;
+ if (Math.abs(v.currentTime - want) > .25) v.currentTime = want;
+ } else {
+ if (!v.paused) v.pause();
+ if (Math.abs(v.currentTime - want) > .04) v.currentTime = want;
+ }
+ }, D, { tail: true });
+ // the beat clock stops while the film is paused, so the clock alone cannot stop the video: watch it every frame,
+ // and let it go once a seek has rebuilt the scene and taken it off the page
+ const watch = () => {
+ if (!v.isConnected) { v.pause(); v.removeAttribute('src'); v.load(); return; }
+ if ((!P.playing || P.waiting) && !v.paused) v.pause();
+ requestAnimationFrame(watch);
+ };
+ requestAnimationFrame(watch);
+ tw(g, { o }, at, dur, lin);
+ g._x = x; g._y = y; g._w = w; g._h = h;
+ return g;
+}
+
+// where the reader aimed before firing: the sight's picture follows the mouse (heavily, as a rifle does) until the
+// first click, and the shot keeps that aim on every replay of the opening
+const AIM = { x: 0, y: 0, tx: 0, ty: 0, lim: [260, 170] };
+function aimable(view) {
+ const wrap = mk('g', {}, view);
+ const set = () => wrap.setAttribute('transform', `translate(${AIM.x.toFixed(1)},${AIM.y.toFixed(1)})`);
+ set();
+ if (P.started) return wrap;
+ const cover = $('cover');
+ addEventListener('pointermove', e => { // the whole window: leaving the player holds the aim at its edge
+ if (P.started) return;
+ const r = cover.getBoundingClientRect(), bb = wrap.getBBox(), R_ = 330, m_ = 40; // the sight's circle (SIGHT.r) and the print border
+ // the picture may move only as far as it still fills the sight
+ const span = (lo, size, c) => { const a0 = c + R_ - (lo + size) + m_, a1 = c - R_ - lo - m_; return a0 <= a1 ? [a0, a1] : [0, 0]; };
+ const [sx, sy] = [span(bb.x, bb.width, 800), span(bb.y, bb.height, 430)];
+ const mx = Math.max(-1, Math.min(1, ((e.clientX - r.left) / r.width - .5) * 2)), my = Math.max(-1, Math.min(1, ((e.clientY - r.top) / r.height - .5) * 2));
+ AIM.tx = (sx[0] + sx[1]) / 2 - mx * (sx[1] - sx[0]) / 2; AIM.ty = (sy[0] + sy[1]) / 2 - my * (sy[1] - sy[0]) / 2;
+ });
+ const step = () => {
+ if (P.started) return;
+ AIM.x += (AIM.tx - AIM.x) * .2; AIM.y += (AIM.ty - AIM.y) * .2;
+ set(); requestAnimationFrame(step);
+ };
+ requestAnimationFrame(step);
+ return wrap;
+}
+
+/* ---------- cut-outs: silhouettes drawn as SVG paths (lib/shapes.js, from tools/shooting-an-elephant/vectorize.py) ----------
+ Near-black card with a thin cream rim, its edges cut a little unevenly (feDisplacementMap) and, where a scene holds,
+ "boiling": three roughening filters with different noise seeds swapped twelve times a second. A paper grain, drawn
+ once on a canvas, lies over the whole stage so the drawings and the photographs share one surface. */
+(() => {
+ const svg = document.getElementById('stage'), defs = mk('defs', {}, svg);
+ [4, 11, 23].forEach((seed, i) => {
+ const f = mk('filter', { id: `rough${i}`, x: '-5%', y: '-5%', width: '110%', height: '110%' }, defs);
+ mk('feTurbulence', { type: 'fractalNoise', baseFrequency: .035, numOctaves: 3, seed, result: 'n' }, f);
+ mk('feDisplacementMap', { in: 'SourceGraphic', in2: 'n', scale: 4 }, f);
+ });
+ const c = document.createElement('canvas'); c.width = c.height = 256;
+ const cx = c.getContext('2d'), im = cx.createImageData(256, 256);
+ let s = 1926;
+ for (let i = 0; i < im.data.length; i += 4) { s = s * 16807 % 2147483647; const v = 175 + s % 80; im.data[i] = im.data[i + 1] = v; im.data[i + 2] = v - 12; im.data[i + 3] = (s >> 7) % 30; }
+ cx.putImageData(im, 0, 0);
+ const pat = mk('pattern', { id: 'grain', width: 256, height: 256, patternUnits: 'userSpaceOnUse' }, defs);
+ mk('image', { href: c.toDataURL(), width: 256, height: 256 }, pat);
+ mk('rect', { width: 1600, height: 900, fill: 'url(#grain)', 'pointer-events': 'none' }, svg); // after #scene: over every picture
+})();
+const CARD = '#07100b';
+// a filter that boils on the beat clock while the element is up
+const boil = (e, D) => clockRun(t => e.setAttribute('filter', `url(#rough${Math.floor(t * 12) % 3})`), D, { tail: true });
+// a silhouette from SHAPES standing on (x, base), h high (rotation is about its feet); `at` makes it enter from `from`;
+// foot(fx, fy) gives a point of the shape (0..1 of its box) on stage
+function cutout(p, name, x, base, h, { flip = false, o = 1, at, from = [0, 30], dur = .4, D, rim = 2.6, rough = true } = {}) {
+ const S = SHAPES[name], k = h / S.h;
+ const g = G(p, at === undefined ? { x, y: base, o } : { x: x + from[0], y: base + from[1], o: 0 });
+ const inner = mk('g', { transform: `scale(${flip ? -k : k},${k}) translate(${-S.w / 2},${-S.h})` }, g);
+ const e = mk('path', { d: S.d, fill: CARD, 'fill-rule': 'evenodd', stroke: CREAM, 'stroke-width': rim * 2 / k, 'paint-order': 'stroke', 'stroke-linejoin': 'round' }, inner);
+ if (rough) { e.setAttribute('filter', 'url(#rough0)'); if (D) boil(e, D); }
+ if (at !== undefined) tw(g, { x, y: base, o }, at, dur, out);
+ g._x = x; g._y = base; g._h = h; g._w = S.w * k;
+ g.foot = (fx, fy) => [x + (flip ? -1 : 1) * (fx - .5) * S.w * k, base - (1 - fy) * S.h * k];
+ return g;
+}
+// a key word with a betel-red copy under it, a little out of register, like a second printing colour
+function keyRed(p, str, x, y, t0, opts = {}) {
+ key(p, str, x + 4, y + 3, t0, { ...opts, fill: HOT });
+ return key(p, str, x, y, t0, opts);
+}
+// typed words with a betel-red copy under them, out of register (as keyRed); one group, so it can be hidden as one
+function sayRed(p, lines, x, y, t0, t1, opts = {}) {
+ const g = G(p, {});
+ say(g, lines, x + 3, y + 2, t0, t1, { ...opts, fill: HOT });
+ say(g, lines, x, y, t0, t1, opts);
+ return g;
+}
diff --git a/site/shooting-an-elephant/lib/fonts.css b/site/shooting-an-elephant/lib/fonts.css
new file mode 100644
index 0000000..6f0e95d
--- /dev/null
+++ b/site/shooting-an-elephant/lib/fonts.css
@@ -0,0 +1,81 @@
+/* Oswald and EB Garamond (SIL Open Font License 1.1), latin and latin-ext subsets, from Google Fonts */
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-italic-400-latin-ext.woff2) format('woff2');
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-italic-400-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-normal-400-latin-ext.woff2) format('woff2');
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-normal-400-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: normal;
+ font-weight: 500;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-normal-500-latin-ext.woff2) format('woff2');
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+@font-face {
+ font-family: 'EB Garamond';
+ font-style: normal;
+ font-weight: 500;
+ font-display: block;
+ src: url(../lib/fonts/EBGaramond-normal-500-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+@font-face {
+ font-family: 'Oswald';
+ font-style: normal;
+ font-weight: 500;
+ font-display: block;
+ src: url(../lib/fonts/Oswald-normal-500-latin-ext.woff2) format('woff2');
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+@font-face {
+ font-family: 'Oswald';
+ font-style: normal;
+ font-weight: 500;
+ font-display: block;
+ src: url(../lib/fonts/Oswald-normal-500-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+@font-face {
+ font-family: 'Oswald';
+ font-style: normal;
+ font-weight: 600;
+ font-display: block;
+ src: url(../lib/fonts/Oswald-normal-600-latin-ext.woff2) format('woff2');
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
+}
+@font-face {
+ font-family: 'Oswald';
+ font-style: normal;
+ font-weight: 600;
+ font-display: block;
+ src: url(../lib/fonts/Oswald-normal-600-latin.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin-ext.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin-ext.woff2
new file mode 100644
index 0000000..54a3a75
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin-ext.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin.woff2
new file mode 100644
index 0000000..dbb5b42
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-italic-400-latin.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin-ext.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin-ext.woff2
new file mode 100644
index 0000000..ac677d1
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin-ext.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin.woff2
new file mode 100644
index 0000000..4971c6a
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-400-latin.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin-ext.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin-ext.woff2
new file mode 100644
index 0000000..0712a53
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin-ext.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin.woff2 b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin.woff2
new file mode 100644
index 0000000..eebd0b1
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/EBGaramond-normal-500-latin.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/OFL-EBGaramond.txt b/site/shooting-an-elephant/lib/fonts/OFL-EBGaramond.txt
new file mode 100644
index 0000000..c1ec5e1
--- /dev/null
+++ b/site/shooting-an-elephant/lib/fonts/OFL-EBGaramond.txt
@@ -0,0 +1,93 @@
+Copyright 2017 The EB Garamond Project Authors (https://github.com/octaviopardo/EBGaramond12)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/site/shooting-an-elephant/lib/fonts/OFL-Oswald.txt b/site/shooting-an-elephant/lib/fonts/OFL-Oswald.txt
new file mode 100644
index 0000000..9d0219e
--- /dev/null
+++ b/site/shooting-an-elephant/lib/fonts/OFL-Oswald.txt
@@ -0,0 +1,93 @@
+Copyright 2016 The Oswald Project Authors (https://github.com/googlefonts/OswaldFont)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin-ext.woff2 b/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin-ext.woff2
new file mode 100644
index 0000000..c05db68
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin-ext.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin.woff2 b/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin.woff2
new file mode 100644
index 0000000..371bb5e
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/Oswald-normal-500-latin.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin-ext.woff2 b/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin-ext.woff2
new file mode 100644
index 0000000..4e5bfd6
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin-ext.woff2 differ
diff --git a/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin.woff2 b/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin.woff2
new file mode 100644
index 0000000..600dec1
Binary files /dev/null and b/site/shooting-an-elephant/lib/fonts/Oswald-normal-600-latin.woff2 differ
diff --git a/site/shooting-an-elephant/lib/lines.js b/site/shooting-an-elephant/lib/lines.js
new file mode 100644
index 0000000..ff56eae
--- /dev/null
+++ b/site/shooting-an-elephant/lib/lines.js
@@ -0,0 +1,2 @@
+// centreline traces of line drawings (trace.py)
+window.LINES = {"phone":{"box":[22,19,671,763],"p":["M307.0 107.0 L307.0 94.0 L305.0 89.0 L305.0 82.0 L300.0 67.0 L289.0 52.0 L283.0 40.0 L266.0 27.0 L244.0 20.0 L211.0 19.0 L200.0 22.0 L198.0 24.0 L198.0 26.0 L181.0 44.0","M180.0 45.0 L175.0 45.0 L168.0 42.0 L164.0 42.0 L162.0 44.0 L156.0 44.0 L146.0 48.0 L143.0 48.0 L133.0 54.0 L131.0 60.0 L130.0 74.0 L132.0 78.0 L137.0 83.0 L138.0 87.0","M138.0 88.0 L136.0 90.0 L135.0 96.0 L139.0 106.0 L139.0 111.0 L141.0 115.0","M140.0 116.0 L138.0 119.0 L138.0 129.0 L140.0 138.0 L144.0 146.0 L145.0 151.0 L156.0 170.0 L166.0 180.0 L173.0 185.0 L187.0 192.0 L190.0 192.0 L196.0 195.0 L208.0 196.0 L209.0 197.0 L231.0 196.0 L233.0 194.0 L241.0 193.0 L252.0 189.0 L256.0 189.0","M256.0 189.0 L252.0 189.0 L241.0 193.0 L233.0 194.0 L231.0 196.0 L209.0 197.0 L208.0 196.0 L196.0 195.0 L190.0 192.0 L187.0 192.0 L173.0 185.0 L166.0 180.0 L156.0 170.0 L145.0 151.0 L144.0 146.0 L140.0 138.0 L138.0 129.0 L138.0 119.0 L140.0 116.0","M142.0 116.0 L153.0 119.0 L156.0 121.0 L173.0 123.0","M173.0 123.0 L183.0 120.0 L190.0 112.0","M190.0 112.0 L183.0 120.0 L173.0 123.0","M173.0 123.0 L175.0 125.0 L176.0 133.0 L190.0 147.0 L200.0 150.0 L205.0 146.0","M205.0 146.0 L196.0 137.0","M196.0 137.0 L205.0 146.0","M205.0 146.0 L216.0 147.0 L226.0 145.0 L232.0 134.0","M233.0 133.0 L239.0 132.0 L252.0 127.0 L257.0 120.0 L259.0 109.0","M259.0 109.0 L257.0 120.0 L252.0 127.0 L239.0 132.0 L233.0 133.0","M232.0 132.0 L232.0 122.0 L230.0 120.0","M229.0 120.0 L222.0 127.0 L211.0 127.0 L203.0 125.0 L192.0 112.0","M192.0 112.0 L203.0 125.0 L211.0 127.0 L222.0 127.0 L229.0 120.0","M230.0 111.0 L225.0 109.0 L215.0 109.0 L209.0 107.0 L201.0 99.0","M201.0 99.0 L209.0 107.0 L215.0 109.0 L225.0 109.0 L230.0 111.0","M231.0 111.0 L237.0 104.0","M237.0 104.0 L231.0 111.0","M237.0 101.0 L235.0 90.0 L229.0 84.0 L213.0 78.0 L209.0 75.0 L196.0 75.0","M195.0 76.0 L198.0 86.0 L200.0 88.0 L200.0 98.0","M199.0 99.0 L192.0 106.0 L191.0 111.0","M173.0 123.0 L175.0 125.0 L176.0 133.0 L190.0 147.0 L200.0 150.0 L205.0 146.0","M205.0 146.0 L200.0 150.0 L190.0 147.0 L176.0 133.0 L175.0 125.0 L173.0 123.0","M173.0 123.0 L156.0 121.0 L153.0 119.0 L142.0 116.0","M139.0 88.0 L177.0 89.0 L181.0 88.0 L194.0 76.0","M194.0 76.0 L181.0 88.0 L177.0 89.0 L139.0 88.0","M194.0 73.0 L188.0 53.0 L181.0 46.0","M181.0 46.0 L188.0 53.0 L194.0 73.0","M196.0 73.0 L217.0 52.0 L223.0 51.0 L230.0 53.0","M230.0 53.0 L223.0 51.0 L217.0 52.0 L196.0 73.0","M231.0 53.0 L240.0 54.0 L249.0 59.0 L253.0 63.0 L261.0 77.0 L262.0 90.0","M262.0 90.0 L261.0 77.0 L253.0 63.0 L249.0 59.0 L240.0 54.0 L231.0 53.0","M239.0 102.0 L242.0 100.0 L250.0 100.0 L256.0 96.0","M256.0 96.0 L250.0 100.0 L242.0 100.0 L239.0 102.0","M257.0 97.0 L257.0 106.0 L259.0 108.0","M259.0 108.0 L257.0 106.0 L257.0 97.0","M263.0 91.0 L268.0 95.0 L268.0 102.0 L264.0 106.0 L260.0 108.0","M306.0 108.0 L301.0 112.0 L300.0 116.0 L300.0 130.0 L303.0 133.0","M303.0 133.0 L312.0 133.0","M312.0 133.0 L303.0 133.0","M303.0 133.0 L301.0 135.0 L299.0 145.0","M299.0 145.0 L294.0 148.0 L289.0 155.0 L285.0 164.0 L285.0 167.0","M285.0 167.0 L285.0 164.0 L289.0 155.0 L294.0 148.0 L299.0 145.0","M299.0 145.0 L305.0 151.0 L308.0 151.0 L311.0 154.0","M311.0 154.0 L308.0 151.0 L305.0 151.0 L299.0 145.0","M312.0 154.0 L316.0 150.0 L317.0 147.0","M319.0 146.0 L326.0 146.0 L333.0 144.0","M333.0 144.0 L326.0 146.0 L319.0 146.0","M318.0 145.0 L318.0 140.0 L313.0 134.0","M313.0 134.0 L318.0 140.0 L318.0 145.0","M312.0 156.0 L315.0 159.0 L320.0 160.0 L326.0 166.0","M327.0 166.0 L331.0 164.0 L334.0 161.0 L335.0 158.0 L334.0 157.0 L334.0 150.0 L335.0 149.0 L334.0 144.0","M334.0 143.0 L334.0 136.0 L331.0 133.0 L317.0 129.0","M317.0 129.0 L331.0 133.0 L334.0 136.0 L334.0 143.0","M316.0 128.0 L311.0 120.0 L311.0 112.0 L307.0 108.0","M311.0 156.0 L310.0 157.0 L309.0 173.0","M310.0 174.0 L320.0 175.0 L323.0 174.0 L326.0 167.0","M326.0 167.0 L323.0 174.0 L320.0 175.0 L310.0 174.0","M306.0 176.0 L306.0 197.0 L304.0 200.0 L299.0 202.0","M298.0 202.0 L294.0 196.0 L289.0 194.0","M289.0 194.0 L294.0 196.0 L298.0 202.0","M298.0 203.0 L290.0 211.0","M290.0 211.0 L298.0 203.0","M289.0 212.0 L288.0 214.0 L289.0 233.0 L291.0 236.0 L292.0 242.0 L299.0 251.0","M301.0 251.0 L308.0 248.0 L318.0 246.0","M318.0 246.0 L308.0 248.0 L301.0 251.0","M298.0 255.0 L291.0 255.0 L280.0 259.0 L266.0 259.0 L260.0 264.0","M259.0 264.0 L256.0 261.0 L255.0 256.0 L246.0 251.0 L244.0 247.0 L246.0 242.0 L249.0 239.0 L258.0 237.0 L268.0 237.0","M269.0 236.0 L271.0 230.0 L271.0 215.0 L275.0 211.0","M275.0 211.0 L283.0 211.0","M283.0 211.0 L275.0 211.0","M275.0 211.0 L262.0 200.0 L261.0 193.0 L257.0 189.0","M257.0 189.0 L261.0 193.0 L262.0 200.0 L275.0 211.0","M284.0 210.0 L284.0 203.0 L287.0 194.0","M287.0 194.0 L284.0 203.0 L284.0 210.0","M288.0 193.0 L285.0 179.0 L279.0 173.0","M279.0 173.0 L285.0 179.0 L288.0 193.0","M278.0 173.0 L272.0 175.0 L268.0 179.0 L260.0 184.0 L257.0 188.0","M285.0 168.0 L290.0 173.0 L305.0 175.0","M299.0 256.0 L299.0 283.0 L298.0 284.0","M298.0 284.0 L298.0 374.0 L297.0 375.0 L297.0 380.0 L298.0 381.0 L298.0 421.0 L297.0 422.0 L297.0 453.0 L298.0 454.0 L297.0 515.0 L298.0 516.0 L298.0 526.0 L297.0 527.0 L297.0 574.0 L301.0 579.0","M301.0 579.0 L297.0 574.0 L297.0 527.0 L298.0 526.0 L298.0 516.0 L297.0 515.0 L298.0 454.0 L297.0 453.0 L297.0 422.0 L298.0 421.0 L298.0 381.0 L297.0 380.0 L297.0 375.0 L298.0 374.0 L298.0 284.0","M298.0 284.0 L287.0 273.0 L263.0 271.0 L260.0 268.0","M260.0 268.0 L263.0 271.0 L287.0 273.0 L298.0 284.0","M259.0 269.0 L259.0 306.0 L258.0 307.0","M258.0 308.0 L258.0 317.0","M257.0 318.0 L221.0 318.0 L218.0 315.0","M218.0 314.0 L221.0 310.0 L222.0 305.0","M222.0 305.0 L221.0 310.0 L218.0 314.0","M217.0 315.0 L201.0 318.0 L190.0 318.0","M189.0 317.0 L189.0 292.0","M189.0 292.0 L189.0 317.0","M187.0 323.0 L184.0 323.0 L182.0 321.0 L176.0 321.0","M176.0 321.0 L182.0 321.0 L184.0 323.0 L187.0 323.0","M188.0 324.0 L188.0 440.0","M188.0 441.0 L189.0 442.0 L189.0 464.0 L191.0 471.0 L191.0 477.0 L195.0 487.0 L196.0 497.0","M196.0 497.0 L195.0 487.0 L191.0 477.0 L191.0 471.0 L189.0 464.0 L189.0 442.0 L188.0 441.0","M187.0 441.0 L182.0 446.0 L154.0 446.0","M154.0 446.0 L182.0 446.0 L187.0 441.0","M153.0 445.0 L150.0 438.0 L151.0 435.0 L151.0 397.0 L150.0 396.0 L150.0 374.0 L151.0 373.0 L152.0 329.0","M152.0 329.0 L151.0 373.0 L150.0 374.0 L150.0 396.0 L151.0 397.0 L151.0 435.0 L150.0 438.0 L153.0 445.0","M153.0 446.0 L149.0 451.0 L146.0 470.0","M146.0 470.0 L149.0 451.0 L153.0 446.0","M146.0 471.0 L150.0 475.0 L150.0 480.0 L143.0 509.0","M144.0 510.0 L153.0 514.0 L178.0 515.0 L195.0 498.0","M197.0 498.0 L199.0 503.0 L199.0 507.0","M200.0 508.0 L205.0 510.0 L222.0 510.0 L224.0 511.0","M224.0 511.0 L222.0 510.0 L205.0 510.0 L200.0 508.0","M199.0 509.0 L188.0 525.0 L183.0 530.0 L179.0 531.0 L176.0 530.0 L161.0 530.0 L160.0 529.0 L151.0 529.0 L145.0 527.0 L135.0 526.0 L121.0 521.0 L118.0 517.0 L116.0 510.0 L117.0 506.0 L121.0 504.0","M122.0 504.0 L128.0 509.0 L142.0 510.0","M142.0 510.0 L128.0 509.0 L122.0 504.0","M122.0 503.0 L124.0 498.0 L129.0 493.0 L129.0 491.0 L133.0 485.0 L137.0 475.0 L145.0 471.0","M145.0 471.0 L137.0 475.0 L133.0 485.0 L129.0 491.0 L129.0 493.0 L124.0 498.0 L122.0 503.0","M63.0 546.0 L50.0 518.0 L46.0 505.0 L43.0 500.0 L43.0 497.0 L41.0 494.0 L41.0 491.0 L36.0 477.0 L32.0 457.0 L29.0 452.0 L29.0 443.0 L26.0 433.0 L26.0 425.0 L24.0 419.0 L24.0 409.0 L22.0 401.0 L22.0 381.0 L23.0 380.0 L24.0 370.0 L26.0 366.0 L26.0 354.0 L29.0 341.0 L32.0 335.0 L32.0 331.0 L36.0 320.0 L42.0 315.0 L47.0 305.0 L58.0 292.0","M58.0 292.0 L59.0 293.0 L64.0 293.0 L74.0 290.0 L78.0 286.0 L87.0 281.0 L107.0 264.0 L111.0 255.0","M111.0 255.0 L107.0 264.0 L87.0 281.0 L78.0 286.0 L74.0 290.0 L64.0 293.0 L59.0 293.0 L58.0 292.0","M58.0 292.0 L64.0 278.0 L78.0 265.0 L88.0 258.0 L90.0 258.0 L98.0 253.0 L109.0 252.0 L111.0 254.0","M111.0 254.0 L109.0 252.0 L98.0 253.0 L90.0 258.0 L88.0 258.0 L78.0 265.0 L64.0 278.0 L58.0 292.0","M98.0 324.0 L95.0 322.0 L92.0 313.0 L93.0 306.0 L97.0 298.0 L102.0 293.0 L110.0 289.0 L115.0 289.0 L118.0 293.0","M118.0 293.0 L115.0 289.0 L110.0 289.0 L102.0 293.0 L97.0 298.0 L93.0 306.0 L92.0 313.0 L95.0 322.0 L98.0 324.0","M99.0 324.0 L105.0 319.0","M106.0 318.0 L107.0 305.0 L118.0 294.0","M118.0 294.0 L107.0 305.0 L106.0 318.0","M107.0 319.0 L120.0 329.0","M120.0 330.0 L117.0 335.0 L113.0 335.0 L103.0 331.0 L99.0 327.0 L99.0 325.0","M99.0 325.0 L99.0 327.0 L103.0 331.0 L113.0 335.0 L117.0 335.0 L120.0 330.0","M126.0 328.0 L130.0 329.0 L144.0 324.0 L147.0 324.0 L152.0 328.0","M153.0 328.0 L155.0 327.0 L169.0 327.0 L175.0 321.0","M175.0 320.0 L166.0 311.0 L159.0 310.0 L155.0 307.0 L149.0 294.0","M149.0 294.0 L155.0 307.0 L159.0 310.0 L166.0 311.0 L175.0 320.0","M189.0 291.0 L183.0 286.0 L176.0 286.0","M176.0 286.0 L183.0 286.0 L189.0 291.0","M196.0 288.0 L206.0 298.0 L218.0 300.0 L222.0 304.0","M222.0 304.0 L218.0 300.0 L206.0 298.0 L196.0 288.0","M196.0 287.0 L203.0 280.0 L209.0 277.0 L212.0 274.0 L212.0 268.0 L206.0 262.0 L192.0 262.0 L185.0 257.0","M184.0 257.0 L176.0 257.0","M176.0 257.0 L184.0 257.0","M187.0 251.0 L182.0 246.0 L182.0 239.0 L184.0 237.0 L190.0 237.0 L192.0 240.0 L191.0 247.0 L187.0 251.0","M175.0 258.0 L175.0 285.0","M174.0 286.0 L153.0 286.0","M152.0 285.0 L152.0 261.0","M152.0 261.0 L152.0 285.0","M149.0 287.0 L143.0 281.0 L136.0 277.0 L137.0 270.0 L147.0 260.0","M147.0 260.0 L137.0 270.0 L136.0 277.0 L143.0 281.0 L149.0 287.0","M148.0 294.0 L143.0 299.0 L135.0 299.0","M135.0 299.0 L132.0 302.0 L131.0 305.0 L132.0 314.0 L129.0 318.0 L129.0 324.0 L126.0 327.0","M126.0 327.0 L129.0 324.0 L129.0 318.0 L132.0 314.0 L131.0 305.0 L132.0 302.0 L135.0 299.0","M135.0 299.0 L132.0 297.0 L128.0 297.0 L126.0 295.0 L119.0 294.0","M119.0 294.0 L126.0 295.0 L128.0 297.0 L132.0 297.0 L135.0 299.0","M153.0 260.0 L161.0 259.0 L165.0 257.0","M165.0 257.0 L160.0 249.0 L158.0 241.0 L154.0 239.0 L150.0 239.0 L146.0 242.0 L145.0 250.0 L143.0 254.0","M143.0 254.0 L145.0 250.0 L146.0 242.0 L150.0 239.0 L154.0 239.0 L158.0 241.0 L160.0 249.0 L165.0 257.0","M165.0 257.0 L174.0 257.0","M174.0 257.0 L165.0 257.0","M142.0 255.0 L136.0 256.0 L135.0 255.0 L114.0 255.0 L112.0 254.0","M112.0 254.0 L114.0 255.0 L135.0 255.0 L136.0 256.0 L142.0 255.0","M223.0 304.0 L255.0 305.0 L257.0 307.0","M258.0 319.0 L257.0 555.0 L254.0 563.0 L251.0 567.0","M251.0 567.0 L254.0 563.0 L257.0 555.0 L258.0 319.0","M252.0 568.0 L260.0 575.0 L275.0 576.0 L282.0 578.0 L293.0 589.0","M293.0 590.0 L282.0 601.0 L264.0 601.0 L254.0 599.0","M254.0 599.0 L264.0 601.0 L282.0 601.0 L293.0 590.0","M301.0 589.0 L302.0 590.0 L302.0 604.0","M302.0 604.0 L302.0 590.0 L301.0 589.0","M301.0 588.0 L301.0 580.0","M302.0 579.0 L308.0 574.0 L316.0 572.0","M317.0 572.0 L323.0 566.0 L326.0 566.0 L333.0 563.0 L355.0 563.0 L358.0 566.0 L359.0 569.0 L359.0 576.0","M359.0 576.0 L359.0 569.0 L358.0 566.0 L355.0 563.0 L333.0 563.0 L326.0 566.0 L323.0 566.0 L317.0 572.0","M317.0 573.0 L325.0 581.0 L333.0 583.0 L341.0 589.0","M341.0 589.0 L333.0 583.0 L325.0 581.0 L317.0 573.0","M341.0 589.0 L346.0 587.0 L358.0 577.0","M360.0 577.0 L365.0 577.0 L375.0 574.0 L416.0 540.0 L430.0 537.0 L431.0 538.0 L438.0 538.0 L439.0 539.0 L446.0 539.0 L452.0 541.0 L464.0 542.0","M464.0 542.0 L474.0 555.0 L477.0 556.0 L494.0 556.0 L498.0 555.0","M498.0 555.0 L494.0 556.0 L477.0 556.0 L474.0 555.0 L464.0 542.0","M464.0 542.0 L469.0 537.0 L472.0 537.0 L477.0 534.0 L492.0 534.0 L494.0 535.0","M499.0 540.0 L499.0 554.0","M500.0 555.0 L511.0 556.0","M512.0 556.0 L515.0 553.0 L520.0 553.0 L524.0 549.0","M524.0 548.0 L517.0 541.0 L500.0 539.0","M512.0 557.0 L518.0 564.0 L521.0 565.0 L532.0 565.0 L538.0 559.0","M539.0 559.0 L549.0 571.0 L558.0 571.0 L559.0 570.0","M559.0 570.0 L558.0 571.0 L549.0 571.0 L539.0 559.0","M539.0 555.0 L534.0 550.0 L525.0 549.0","M540.0 555.0 L554.0 555.0 L562.0 557.0","M562.0 558.0 L560.0 561.0 L560.0 569.0","M560.0 570.0 L565.0 575.0 L571.0 575.0 L581.0 585.0","M581.0 585.0 L581.0 598.0 L579.0 602.0 L579.0 607.0 L591.0 619.0","M591.0 619.0 L579.0 607.0 L579.0 602.0 L581.0 598.0 L581.0 585.0","M581.0 585.0 L571.0 575.0 L565.0 575.0 L560.0 570.0","M563.0 557.0 L572.0 554.0 L573.0 555.0 L584.0 556.0 L587.0 559.0 L589.0 569.0 L585.0 581.0 L581.0 585.0","M581.0 585.0 L585.0 581.0 L589.0 569.0 L587.0 559.0 L584.0 556.0 L573.0 555.0 L572.0 554.0 L563.0 557.0","M592.0 619.0 L601.0 614.0 L612.0 614.0 L620.0 612.0 L626.0 608.0","M626.0 607.0 L620.0 601.0 L620.0 586.0 L625.0 574.0 L625.0 571.0 L630.0 567.0 L635.0 567.0 L651.0 561.0 L658.0 561.0 L659.0 560.0","M659.0 560.0 L658.0 561.0 L651.0 561.0 L635.0 567.0 L630.0 567.0 L625.0 571.0 L625.0 574.0 L620.0 586.0 L620.0 601.0 L626.0 607.0","M627.0 607.0 L633.0 606.0 L641.0 602.0 L650.0 601.0 L654.0 599.0 L659.0 594.0 L665.0 593.0 L667.0 591.0 L671.0 590.0","M671.0 590.0 L667.0 591.0 L665.0 593.0 L659.0 594.0 L654.0 599.0 L650.0 601.0 L641.0 602.0 L633.0 606.0 L627.0 607.0","M591.0 620.0 L589.0 626.0 L582.0 635.0 L573.0 641.0 L560.0 654.0 L555.0 655.0 L546.0 663.0 L542.0 664.0 L533.0 670.0 L527.0 676.0 L521.0 679.0 L451.0 751.0","M450.0 751.0 L434.0 735.0 L420.0 735.0 L406.0 749.0","M405.0 749.0 L400.0 748.0 L392.0 744.0 L383.0 742.0 L378.0 739.0 L367.0 736.0 L349.0 728.0 L339.0 726.0","M338.0 725.0 L334.0 719.0 L329.0 716.0 L316.0 715.0 L310.0 713.0 L304.0 713.0 L298.0 711.0 L292.0 711.0 L291.0 710.0 L285.0 710.0 L270.0 707.0","M269.0 706.0 L263.0 697.0 L250.0 695.0","M248.0 694.0 L247.0 693.0 L234.0 692.0 L230.0 694.0 L226.0 694.0 L217.0 697.0 L212.0 697.0 L207.0 699.0 L174.0 699.0 L172.0 698.0 L171.0 699.0 L152.0 699.0 L151.0 700.0","M151.0 700.0 L152.0 699.0 L171.0 699.0 L172.0 698.0 L174.0 699.0 L207.0 699.0 L212.0 697.0 L217.0 697.0 L226.0 694.0 L230.0 694.0 L234.0 692.0 L247.0 693.0 L248.0 694.0","M247.0 695.0 L239.0 703.0 L239.0 724.0","M238.0 725.0 L228.0 725.0 L227.0 724.0 L214.0 725.0 L209.0 724.0 L206.0 722.0 L178.0 716.0 L171.0 713.0 L167.0 713.0 L155.0 709.0 L150.0 701.0","M149.0 700.0 L145.0 699.0 L131.0 691.0 L118.0 678.0","M117.0 678.0 L111.0 684.0 L110.0 688.0","M110.0 688.0 L111.0 684.0 L117.0 678.0","M118.0 677.0 L121.0 666.0 L125.0 662.0 L130.0 660.0 L136.0 655.0 L156.0 652.0 L159.0 655.0 L164.0 656.0","M165.0 656.0 L171.0 649.0 L174.0 637.0 L188.0 623.0 L197.0 619.0 L220.0 615.0 L227.0 611.0","M227.0 611.0 L220.0 615.0 L197.0 619.0 L188.0 623.0 L174.0 637.0 L171.0 649.0 L165.0 656.0","M167.0 664.0 L165.0 672.0 L163.0 674.0 L163.0 677.0","M163.0 677.0 L163.0 674.0 L165.0 672.0 L167.0 664.0","M119.0 699.0 L131.0 711.0 L137.0 715.0 L153.0 722.0 L161.0 724.0 L163.0 726.0 L173.0 727.0 L179.0 730.0 L187.0 731.0 L190.0 733.0 L201.0 734.0 L202.0 735.0 L211.0 735.0 L215.0 737.0 L227.0 738.0 L231.0 740.0 L238.0 740.0 L239.0 741.0 L258.0 741.0 L259.0 742.0 L288.0 743.0 L289.0 744.0 L319.0 743.0 L337.0 726.0","M268.0 707.0 L250.0 725.0 L240.0 725.0","M240.0 725.0 L250.0 725.0 L268.0 707.0","M249.0 693.0 L250.0 674.0 L254.0 659.0 L267.0 645.0 L274.0 640.0 L277.0 631.0","M277.0 630.0 L267.0 620.0 L257.0 617.0 L250.0 617.0 L248.0 615.0","M247.0 614.0 L238.0 614.0 L233.0 616.0 L228.0 611.0","M228.0 610.0 L237.0 597.0 L250.0 596.0 L251.0 595.0","M251.0 595.0 L250.0 596.0 L237.0 597.0 L228.0 610.0","M248.0 613.0 L251.0 610.0 L251.0 600.0 L252.0 599.0","M252.0 599.0 L251.0 600.0 L251.0 610.0 L248.0 613.0","M252.0 594.0 L252.0 572.0 L251.0 569.0","M251.0 569.0 L252.0 572.0 L252.0 594.0","M250.0 568.0 L242.0 570.0 L234.0 570.0","M234.0 570.0 L242.0 570.0 L250.0 568.0","M302.0 605.0 L295.0 623.0 L286.0 628.0 L278.0 630.0","M278.0 630.0 L286.0 628.0 L295.0 623.0 L302.0 605.0","M303.0 605.0 L306.0 608.0 L312.0 608.0 L332.0 603.0 L337.0 599.0 L341.0 589.0","M341.0 589.0 L337.0 599.0 L332.0 603.0 L312.0 608.0 L306.0 608.0 L303.0 605.0","M406.0 750.0 L412.0 759.0 L425.0 760.0 L440.0 763.0 L444.0 763.0 L447.0 761.0 L450.0 752.0"],"l":[192,87,29,169,169,32,21,21,48,13,13,34,40,40,13,46,46,33,33,9,9,55,23,15,48,48,32,60,60,31,31,43,43,54,54,19,19,12,12,24,29,9,9,13,27,27,16,16,9,14,14,13,13,18,27,26,26,23,17,21,21,30,13,13,11,11,42,18,18,40,53,27,8,8,30,30,16,16,23,23,26,22,28,299,299,44,44,38,9,40,10,10,27,25,25,12,12,116,58,58,35,35,118,118,26,26,40,59,9,25,25,111,22,22,41,41,273,69,69,72,72,55,55,8,29,29,16,28,28,28,25,39,39,15,15,32,32,58,8,8,39,27,21,24,24,38,38,15,32,32,18,18,12,44,44,9,9,31,31,35,250,250,48,44,44,15,15,8,16,56,56,30,30,21,118,41,41,33,14,11,15,27,32,26,26,16,22,12,27,39,39,27,55,55,37,76,76,49,49,195,56,70,73,24,100,100,32,96,39,13,13,60,83,83,14,14,238,36,36,72,34,22,30,30,16,16,25,25,16,16,38,38,48,48,56]}};
diff --git a/site/shooting-an-elephant/lib/math.js b/site/shooting-an-elephant/lib/math.js
new file mode 100644
index 0000000..19a26f5
--- /dev/null
+++ b/site/shooting-an-elephant/lib/math.js
@@ -0,0 +1,698 @@
+// Papermorph maths helpers: number lines, tiles, fractions, planes, dice, the number map, sorter.
+// A maths chapter loads this right after engine.js; it uses the engine's globals as it loads.
+'use strict';
+// Vertical number line at x; Yf maps a value to its y. Labels sit on the left.
+function vAxis(p, { x, Yf, lo, hi, step = 1, t0 = .1, unit = '' }) {
+ draw(path(p, `M${x} ${Yf(lo - .5)}V${Yf(hi + .5)}`, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .8);
+ for (let v = lo; v <= hi; v += step) {
+ const g = G(p, { o: 0 });
+ path(g, `M${x - 9} ${Yf(v)}H${x + 9}`, { stroke: COL.dim, 'stroke-width': 2.5 });
+ T(g, num(v) + unit, { x: x - 46, y: Yf(v) + 9, size: 24, fill: v === 0 ? COL.chalk : COL.dim, font: MATH, anchor: 'end' });
+ show(g, t0 + .2 + Math.abs(v - lo) * .02);
+ }
+}
+// Thermometer from lo (bottom) to hi (top). set(v, t0, run) moves the column; run = tw (lesson) or fx (answer).
+function thermometer(p, { x = 800, bottom = 600, top = 200, lo = -10, hi = 15, step = 5, value = 0, color = COL.nat } = {}) {
+ const Yt = v => bottom - (v - lo) / (hi - lo) * (bottom - top), bulb = bottom + 32, g = G(p);
+ mk('rect', { x: x - 18, y: top - 24, width: 36, height: bulb - top + 24, rx: 18, fill: COL.board, stroke: COL.dim, 'stroke-width': 2.5 }, g);
+ mk('circle', { cx: x, cy: bulb, r: 26, fill: color }, g);
+ const merc = put(mk('rect', { x: x - 9, width: 18, rx: 9, fill: color }, g), { a_y: Yt(value), a_height: bulb - Yt(value) });
+ for (let v = lo; v <= hi; v += step) {
+ path(g, `M${x - 30} ${Yt(v)}H${x - 18}`, { stroke: COL.dim, 'stroke-width': 2 });
+ T(g, `${num(v)}°`, { x: x - 40, y: Yt(v) + 9, size: 24, fill: v === 0 ? COL.chalk : COL.dim, font: MATH, anchor: 'end' });
+ }
+ return { g, merc, Yt, set: (v, t0, run = tw, dur = 1.2) => run(merc, { a_y: Yt(v), a_height: bulb - Yt(v) }, t0, dur) };
+}
+/* ---------- fractions: rows with strikable parts, bars and brackets ---------- */
+// A row of fractions and symbols whose numerators and denominators can be struck out one by one.
+// items: { f: [n, d], fill } | 'symbol text'. The fraction bars sit on y.
+function fracRow(p, items, { x = 800, y = 300, size = 60, anchor = 'middle', o = 0 } = {}) {
+ const fs = size * .8, g = G(p, { o });
+ const els = items.map(it => {
+ if (typeof it === 'string') {
+ const w = textW(it, size);
+ return { w, draw(cx) { this.cx = cx; T(g, it, { x: cx, y: y + size * .33, size, font: MATH, fill: COL.chalk, anchor: 'middle' }); } };
+ }
+ const [n, d] = it.f.map(String), w = Math.max(textW(n, fs), textW(d, fs)) + size * .35, fill = it.fill || COL.chalk;
+ return { w, n, d, draw(cx) {
+ this.cx = cx;
+ path(g, `M${cx - w / 2 + 4} ${y}H${cx + w / 2 - 4}`, { stroke: fill, 'stroke-width': size * .055 });
+ this.num = T(g, n, { x: cx, y: y - size * .18, size: fs, font: MATH, fill, anchor: 'middle' });
+ this.den = T(g, d, { x: cx, y: y + size * .78, size: fs, font: MATH, fill, anchor: 'middle' });
+ } };
+ });
+ const total = els.reduce((a, e) => a + e.w, 0);
+ let cx = anchor === 'middle' ? x - total / 2 : x;
+ for (const e of els) { e.draw(cx + e.w / 2); cx += e.w; }
+ return Object.assign(els, { g, y, size, x0: anchor === 'middle' ? x - total / 2 : x, w: total });
+}
+// Strike the numerator ('num') or denominator ('den') of fraction k and write its reduced value beside it.
+function reduce(row, k, part, value, color, t0, run = tw) {
+ const e = row[k], { y, size } = row, top = part === 'num';
+ const cy = top ? y - size * .42 : y + size * .52, g = row.g;
+ const slash = path(g, `M${e.cx - size * .28} ${cy + size * .3}L${e.cx + size * .28} ${cy - size * .3}`, { stroke: color, 'stroke-width': 3.5 }, { d: 0 });
+ const nv = T(g, String(value), { x: e.cx + size * .02, y: top ? y - size * .92 : y + size * 1.36, size: size * .5, font: MATH, fill: color, anchor: 'middle', o: 0 });
+ run(slash, { d: 1 }, t0, .4); run(nv, { o: 1 }, t0 + .3, .4);
+ run(e[part], { o: .45 }, t0 + .3, .4);
+}
+function rect(p, x, y, w, h, fill, o = 0, stroke = 'none') {
+ return put(mk('rect', { x, y, width: w, height: h, fill, stroke, 'stroke-width': 2.5 }, p), { o });
+}
+function bracketH(p, x1, x2, y, label, color, t0) {
+ draw(path(p, `M${x1} ${y - 10}V${y}H${x2}V${y - 10}`, { stroke: color, 'stroke-width': 3 }, { d: 0 }), t0, .5);
+ show(T(p, label, { x: (x1 + x2) / 2, y: y + 32, size: 26, fill: color, font: MATH, anchor: 'middle', o: 0 }), t0 + .3);
+}
+
+/* ---------- decimal point that hops between digits (ch10, ch20) ---------- */
+// Digits in evenly spaced slots with a decimal point that can hop between them.
+// places = digits after the point (0 = point at the far right, hidden).
+function pointRow(p, digits, x, y, places, { size = 72, fill = COL.chalk, sign = '' } = {}) {
+ const g = G(p, { o: 0 }), w = size * .7, n = digits.length, x0 = x - n * w / 2;
+ if (sign) T(g, sign, { x: x0 - w * .6, y, size, fill, font: MATH, anchor: 'middle' });
+ const ds = [...digits].map((c, i) => T(g, c, { x: x0 + i * w + w / 2, y, size, fill, font: MATH, anchor: 'middle' }));
+ const px = k => x0 + (n - k) * w;
+ const dot = mk('circle', { r: size * .065, fill: COL.task }, g);
+ put(dot, { x: px(places), y: y - size * .02, o: places ? 1 : 0 });
+ const trail = path(g, '', { stroke: COL.task, 'stroke-width': 2.5, 'stroke-dasharray': '5 6' });
+ return { g, ds, dot, px, w,
+ hop(from, to, t0, run = tw, dur = .55) {
+ const steps = Math.abs(to - from);
+ run(dot, { o: 1 }, t0, .2);
+ let d = '';
+ for (let k = 0; k < steps; k++) {
+ const a = px(from + Math.sign(to - from) * k), b = px(from + Math.sign(to - from) * (k + 1));
+ d += `M${a} ${y - 10}Q${(a + b) / 2} ${y - size * .9} ${b} ${y - 10}`;
+ }
+ trail.setAttribute('d', d);
+ put(trail, { o: 0 }); run(trail, { o: .9 }, t0 + steps * dur, .3);
+ (run === tw ? prog : fxp)(q => {
+ const s = q * steps, k = Math.min(steps - 1, Math.floor(s)), f = s - k;
+ const a = px(from + Math.sign(to - from) * k), b = px(from + Math.sign(to - from) * (k + 1));
+ put(dot, { x: a + (b - a) * f, y: y - size * .02 - Math.sin(Math.PI * f) * size * .7 });
+ }, t0, steps * dur, lin);
+ } };
+}
+
+/* ---------- balance scale for equations (ch24, ch25) ---------- */
+// A balance scale. Its pans hang from the beam ends; tilt(deg, t0) rocks it (positive: left side down).
+function balance(p, { x = 800, y = 330, L = 300 } = {}) {
+ const g = G(p, { o: 0 });
+ path(g, `M${x} ${y}L${x - 50} ${y + 330}H${x + 50}Z`, { stroke: COL.dim, 'stroke-width': 3, fill: mix(COL.board, COL.dim, .15) });
+ const beam = G(g, { x, y });
+ path(beam, `M${-L} 0H${L}`, { stroke: COL.chalk, 'stroke-width': 6 });
+ mk('circle', { r: 10, fill: COL.chalk }, beam);
+ const pan = side => {
+ const pg = G(g, { x: x + side * L, y });
+ path(pg, 'M0 0L-90 110M0 0L90 110', { stroke: COL.dim, 'stroke-width': 2 });
+ path(pg, 'M-110 110Q0 150 110 110Z', { stroke: side < 0 ? COL.whole : COL.nat, 'stroke-width': 3, fill: mix(COL.board, side < 0 ? COL.whole : COL.nat, .2) });
+ return pg;
+ };
+ const Lp = pan(-1), Rp = pan(1);
+ let angle = 0;
+ const place = a => {
+ const r = a * Math.PI / 180, dx = L * Math.cos(r), dy = L * Math.sin(r);
+ put(beam, { r: -a }); put(Lp, { x: x - dx, y: y + dy }); put(Rp, { x: x + dx, y: y - dy });
+ };
+ return {
+ g, L: Lp, R: Rp,
+ // Content sits on a pan: text or math at (0, 90) in pan coordinates.
+ load(side, parts, color, t0, size = 44) { const e = M(side < 0 ? Lp : Rp, parts, { y: 96, size, fill: color, o: 0 }); show(e, t0); return e; },
+ tilt(a, t0, run = prog) { const from = angle; angle = a; run(q => place(from + (a - from) * back(q)), t0, .9); },
+ };
+}
+/* ---------- algebra tiles (ch23, ch25) ---------- */
+const XL = 120, UN = 30; // length of x, size of 1
+const TS = { x2: [XL, XL, COL.real], x: [UN, XL, COL.whole], y: [UN, 90, COL.nat], one: [UN, UN, COL.int] };
+function atile(p, kind, x, y, neg = false, o = 0) {
+ const [w, h, c] = TS[kind], g = G(p, { x, y, o, s: o ? 1 : .6 });
+ mk('rect', { x: -w / 2, y: -h / 2, width: w, height: h, rx: 5, fill: neg ? COL.board : mix(COL.board, c, .55), stroke: neg ? COL.bad : c, 'stroke-width': neg ? 3.5 : 2.5, 'stroke-dasharray': neg ? '7 5' : '' }, g);
+ g.kind = kind; g.neg = neg;
+ return g;
+}
+const popIn = (els, t0, step = .08) => els.forEach((e, i) => tw(e, { o: 1, s: 1 }, t0 + i * step, .35, back));
+// n tiles of a kind in a row starting at x.
+const tileRow = (p, kind, n, x, y, neg = false, gap = 12) => Array.from({ length: n }, (_, i) => atile(p, kind, x + i * (TS[kind][0] + gap), y, neg));
+// Pair each negative tile with a positive one: they move together and vanish.
+function cancel(pos, negs, t0) {
+ negs.forEach((n, i) => {
+ const a = pos[i];
+ tw(n, { x: st(a).x, y: st(a).y }, t0 + i * .3, .6);
+ tw(n, { o: 0, s: .5 }, t0 + i * .3 + .7, .3); tw(a, { o: 0, s: .5 }, t0 + i * .3 + .7, .3);
+ });
+}
+/* ---------- inequality graphs (ch26, ch27) ---------- */
+// Solution ray on the number line: endpoint v, closed or open circle, dir +1 (right) or −1 (left).
+function ray(p, v, closed, dir, t0, color = COL.task, run = tw) {
+ const end = X(dir > 0 ? 5.7 : -5.7), g = G(p, { o: 1 });
+ const line = path(g, `M${X(v)} ${Y0}H${end}`, { stroke: color, 'stroke-width': 7 }, { d: 0 });
+ const head = path(g, `M${end - 18 * dir} ${Y0 - 13}L${end} ${Y0}L${end - 18 * dir} ${Y0 + 13}`, { stroke: color, 'stroke-width': 6 }, { o: 0 });
+ const dot = G(g, { x: X(v), y: Y0, s: 0, o: 0 });
+ mk('circle', { r: 13, fill: closed ? color : COL.board, stroke: color, 'stroke-width': 4 }, dot);
+ run(dot, { s: 1, o: 1 }, t0, .4, back);
+ run(line, { d: 1 }, t0 + .3, .8); run(head, { o: 1 }, t0 + 1, .2);
+ return g;
+}
+// Segment between a and b on the number line, each end open or closed.
+function segment(p, a, b, ca, cb, t0, color = COL.task, run = tw) {
+ const g = G(p, { o: 1 });
+ const line = path(g, `M${X(a)} ${Y0}H${X(b)}`, { stroke: color, 'stroke-width': 7 }, { d: 0 });
+ const ends = [[a, ca], [b, cb]].map(([v, c]) => {
+ const d = G(g, { x: X(v), y: Y0, s: 0, o: 0 });
+ mk('circle', { r: 13, fill: c ? color : COL.board, stroke: color, 'stroke-width': 4 }, d);
+ run(d, { s: 1, o: 1 }, t0, .4, back);
+ return d;
+ });
+ run(line, { d: 1 }, t0 + .3, .8);
+ g.parentNode.appendChild(g); ends.forEach(e => g.appendChild(e));
+ return g;
+}
+/* ---------- equation steps (ch25 onward) ---------- */
+// One line of an equation or inequality with its sign at xEq, so a column of steps lines up. note: grey hint on the right.
+function eqLine(p, L, R, y, t0, { xEq = 760, fill = COL.chalk, size = 50, note, sym = '=', symFill, noteX = 1180 } = {}) {
+ const g = G(p, { o: 0 });
+ M(g, [].concat(L), { x: xEq - size * .6, y, size, fill, anchor: 'end' });
+ M(g, [sym], { x: xEq, y, size, fill: symFill || fill });
+ M(g, [].concat(R), { x: xEq + size * .6, y, size, fill, anchor: 'start' });
+ if (note) T(g, note, { x: noteX, y: y - 8, size: 26, fill: COL.task, weight: 600 });
+ show(g, t0);
+ return g;
+}
+/* ---------- data on a number line: dot plots (unit 7) ---------- */
+// Axis for data from lo to hi drawn between x0 and x1 at baseline y; every: label every n-th tick.
+// shape 'x' draws line-plot crosses instead of dots.
+// Returns D: D.V(value) -> x; D.dot(v, color, t0) stacks a dot above v; D.mark(v, color, t0, label) is a
+// balance triangle under the axis that can slide with D.slide(mark, v, t0).
+function dataLine(p, { lo, hi, x0 = 200, x1 = 1400, y = 600, step = 1, every = 1, t0 = .1, r = 13, size = 22, shape = 'dot' }) {
+ const V = v => x0 + (v - lo) / (hi - lo) * (x1 - x0), g = G(p, { o: 0 });
+ path(g, `M${x0 - 24} ${y}H${x1 + 24}`, { stroke: COL.dim, 'stroke-width': 3 });
+ for (let v = lo, i = 0; v <= hi + 1e-9; v += step, i++) {
+ path(g, `M${V(v)} ${y - 7}V${y + 7}`, { stroke: COL.dim, 'stroke-width': 2 });
+ if (i % every === 0) T(g, num(+v.toFixed(6)), { x: V(v), y: y + 26 + size, size, fill: COL.dim, font: MATH, anchor: 'middle' });
+ }
+ show(g, t0);
+ const D = {
+ g, V, y, r, count: {},
+ top: v => y - 6 - r - ((D.count[v] || 1) - 1) * (2 * r + 5),
+ dot(v, color, t0, { run = tw, into = p, from } = {}) {
+ D.count[v] = (D.count[v] || 0) + 1;
+ let d;
+ if (shape === 'x') { d = G(into); path(d, `M${-r * .75} ${-r * .75}L${r * .75} ${r * .75}M${r * .75} ${-r * .75}L${-r * .75} ${r * .75}`, { stroke: color, 'stroke-width': 5 }); }
+ else d = mk('circle', { r, fill: color, stroke: COL.board, 'stroke-width': 2 }, into);
+ put(d, { x: V(v), y: D.top(v), s: 0, o: 0 });
+ if (from !== undefined) { put(d, { y: from, s: 1 }); run(d, { o: 1 }, t0, .2); run(d, { y: D.top(v) }, t0, .7, back); }
+ else run(d, { s: 1, o: 1 }, t0, .45, back);
+ return d;
+ },
+ dots: (vals, color, t0, gap = .15, opts) => vals.map((v, i) => D.dot(v, color, t0 + i * gap, opts)),
+ mark(v, color, t0, label, { run = tw, into = p } = {}) {
+ const m = G(into, { x: V(v), y, o: 0 });
+ path(m, 'M0 4L-17 30H17Z', { fill: color, stroke: COL.board, 'stroke-width': 2 });
+ if (label) T(m, label, { y: 64 + size, size: 24, fill: color, weight: 600, anchor: 'middle' });
+ run(m, { o: 1 }, t0, .4);
+ return m;
+ },
+ slide: (m, v, t0, run = tw, dur = 1.2) => run(m, { x: V(v) }, t0, dur),
+ // Bracket above the data from a to b at height yb, with a label.
+ span(a, b, yb, label, color, t0, { run = tw, into = p } = {}) {
+ const g = G(into), l = path(g, `M${V(a)} ${yb + 12}V${yb}H${V(b)}V${yb + 12}`, { stroke: color, 'stroke-width': 3 }, { d: 0 });
+ run(l, { d: 1 }, t0, .6);
+ const t = M(g, [label], { x: (V(a) + V(b)) / 2, y: yb - 14, size: 28, fill: color, o: 0 });
+ run(t, { o: 1 }, t0 + .4, .4);
+ return g;
+ },
+ };
+ return D;
+}
+/* ---------- chance: number cubes, coins, spinners (unit 7) ---------- */
+// A number cube face showing n pips, centred on (x, y).
+const PIPS = { 1: [[0, 0]], 2: [[-1, -1], [1, 1]], 3: [[-1, -1], [0, 0], [1, 1]], 4: [[-1, -1], [1, -1], [-1, 1], [1, 1]],
+ 5: [[-1, -1], [1, -1], [0, 0], [-1, 1], [1, 1]], 6: [[-1, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [1, 1]] };
+function die(p, n, x, y, s = 96, o = 0) {
+ const g = G(p, { x, y, o, s: o ? 1 : .6 });
+ g._box = mk('rect', { x: -s / 2, y: -s / 2, width: s, height: s, rx: s * .18, fill: mix(COL.board, COL.chalk, .1), stroke: COL.chalk, 'stroke-width': 3 }, g);
+ PIPS[n].forEach(([a, b]) => mk('circle', { cx: a * s * .26, cy: b * s * .26, r: s * .085, fill: COL.chalk }, g));
+ return g;
+}
+// Spinner with equal sections; pointer starts straight up. land(k) is the rotation that points at section k.
+const SPIN = [COL.whole, COL.nat, COL.int, COL.whole, COL.irr, COL.nat, COL.whole, COL.int];
+function spinner(p, cx, cy, r, t0, cols = SPIN) {
+ const g = G(p, { x: cx, y: cy, o: 0 }), n = cols.length, secs = [];
+ cols.forEach((c, i) => {
+ const a1 = (-90 + i * 360 / n) * Math.PI / 180, a2 = (-90 + (i + 1) * 360 / n) * Math.PI / 180;
+ secs.push(path(g, `M0 0L${r * Math.cos(a1)} ${r * Math.sin(a1)}A${r} ${r} 0 0 1 ${r * Math.cos(a2)} ${r * Math.sin(a2)}Z`,
+ { fill: mix(COL.board, c, .7), stroke: COL.board, 'stroke-width': 3 }));
+ });
+ mk('circle', { r, fill: 'none', stroke: COL.chalk, 'stroke-width': 3 }, g);
+ const ptr = G(g);
+ path(ptr, `M0 ${r * .12}V${-r * .78}M-14 ${-r * .66}L0 ${-r * .8}L14 ${-r * .66}`, { stroke: COL.chalk, 'stroke-width': 7 });
+ mk('circle', { r: 12, fill: COL.chalk }, g);
+ show(g, t0);
+ return { g, secs, ptr, land: k => (k + .5) * 360 / n };
+}
+// Outline some spinner sections: a bright border that fades in.
+function outline(p, sp, ks, color, t0, run = tw) {
+ return ks.map(k => { const e = sp.secs[k].cloneNode(); e.setAttribute('fill', 'none'); e.setAttribute('stroke', color); e.setAttribute('stroke-width', 7); sp.g.insertBefore(e, sp.ptr); put(e, { o: 0 }); run(e, { o: 1 }, t0, .4); return e; });
+}
+// A coin face.
+function coin(p, side, x, y, t0, r = 34, run = tw) {
+ const g = G(p, { x, y, s: .5, o: 0 });
+ mk('circle', { r, fill: mix(COL.board, side === 'H' ? COL.int : COL.rat, .5), stroke: side === 'H' ? COL.int : COL.rat, 'stroke-width': 3 }, g);
+ T(g, side, { y: r * .36, size: r, fill: COL.chalk, weight: 700, anchor: 'middle' });
+ run(g, { s: 1, o: 1 }, t0, .45, back);
+ return g;
+}
+/* ---------- scaled axes for data and real-world graphs (ch41 onward) ---------- */
+// Axes with a scale on each; returns value -> pixel maps. ybreak draws a zigzag when y does not start at 0.
+function axes(p, { x0, y0, w, h, xs: [xlo, xhi, xst], ys: [ylo, yhi, yst], xl, yl, t0, ybreak }) {
+ const PX = v => x0 + (v - xlo) / (xhi - xlo) * w, PY = v => y0 - (v - ylo) / (yhi - ylo) * h, g = G(p, { o: 0 });
+ let d = '';
+ for (let v = xlo + xst; v <= xhi + 1e-9; v += xst) d += `M${PX(v)} ${y0}V${y0 - h}`;
+ for (let v = ylo + yst; v <= yhi + 1e-9; v += yst) d += `M${x0} ${PY(v)}H${x0 + w}`;
+ mk('path', { d, stroke: COL.chalk, 'stroke-opacity': .1, 'stroke-width': 1.5, fill: 'none' }, g);
+ path(g, `M${x0} ${y0 - h - 20}V${y0}H${x0 + w + 20}`, { stroke: COL.chalk, 'stroke-width': 3 });
+ if (ybreak) path(g, `M${x0 - 10} ${y0 - 22}L${x0 + 10} ${y0 - 30}M${x0 - 10} ${y0 - 34}L${x0 + 10} ${y0 - 42}`, { stroke: COL.chalk, 'stroke-width': 3 });
+ for (let v = xlo; v <= xhi + 1e-9; v += xst) T(g, String(v), { x: PX(v), y: y0 + 30, size: 20, fill: COL.dim, font: MATH, anchor: 'middle' });
+ for (let v = ylo; v <= yhi + 1e-9; v += yst) T(g, String(v), { x: x0 - 14, y: PY(v) + 7, size: 20, fill: COL.dim, font: MATH, anchor: 'end' });
+ T(g, xl, { x: x0 + w / 2, y: y0 + 66, size: 24, fill: COL.dim, anchor: 'middle' });
+ T(g, yl, { x: x0, y: y0 - h - 36, size: 24, fill: COL.dim, anchor: 'middle' });
+ show(g, t0);
+ return { PX, PY };
+}
+/* ---------- area grids for multiplying and factoring polynomials (ch51 onward) ---------- */
+// Area grid from (x0, y0): column widths ws, row heights hs, factor terms along the top and the left side.
+function areaGrid(p, x0, y0, ws, hs, colLab, rowLab, t0, { size = 40 } = {}) {
+ const xs = [x0], ys = [y0];
+ ws.forEach(w => xs.push(xs.at(-1) + w)); hs.forEach(h => ys.push(ys.at(-1) + h));
+ let d = '';
+ xs.forEach(x => { d += `M${x} ${y0}V${ys.at(-1)}`; }); ys.forEach(y => { d += `M${x0} ${y}H${xs.at(-1)}`; });
+ draw(path(p, d, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .9);
+ colLab.forEach((l, j) => show(M(p, [].concat(l), { x: (xs[j] + xs[j + 1]) / 2, y: y0 - 22, size, fill: COL.whole, o: 0 }), t0 + .3 + j * .15));
+ rowLab.forEach((l, i) => show(M(p, [].concat(l), { x: x0 - 24, y: (ys[i] + ys[i + 1]) / 2 + size * .35, size, fill: COL.nat, anchor: 'end', o: 0 }), t0 + .3 + i * .15));
+ const box = (i, j, pad) => ({ x: xs[j] + pad, y: ys[i] + pad, width: xs[j + 1] - xs[j] - 2 * pad, height: ys[i + 1] - ys[i] - 2 * pad });
+ return {
+ xs, ys,
+ cell(i, j, parts, t0, { fill = COL.chalk, tint, run = tw, into = p } = {}) {
+ if (tint) { const r = put(mk('rect', { ...box(i, j, 3), fill: tint }, into), { o: 0 }); into.insertBefore(r, into.firstChild); run(r, { o: .3 }, t0, .4); }
+ const e = M(into, [].concat(parts), { x: (xs[j] + xs[j + 1]) / 2, y: (ys[i] + ys[i + 1]) / 2 + size * .35, size, fill, o: 0, s: .6 });
+ run(e, { o: 1, s: 1 }, t0, .4, back);
+ return e;
+ },
+ ring(i, j, color, t0, run = tw, into = p) { const r = put(mk('rect', { ...box(i, j, 8), rx: 12, fill: 'none', stroke: color, 'stroke-width': 4.5 }, into), { o: 0 }); run(r, { o: 1 }, t0, .3); return r; },
+ };
+}
+// A curved arrow from (x1, y1) to (x2, y2) bending up (h < 0) or down (h > 0).
+function arc(p, x1, y1, x2, y2, h, color, t0, run = tw) {
+ const mx = (x1 + x2) / 2, l = path(p, `M${x1} ${y1}Q${mx} ${y1 + h} ${x2} ${y2}`, { stroke: color, 'stroke-width': 3.5 }, { d: 0 });
+ run(l, { d: 1 }, t0, .5);
+ return l;
+}
+
+/* ---------- built-up fractions with math above and below the bar (ch60 onward) ---------- */
+// Width of math parts at a size, without leaving anything on the stage.
+function mathW(parts, size) { const e = M(scene, [].concat(parts), { size, o: 0 }), w = e._w; e.remove(); return w; }
+// A built-up fraction whose top and bottom are math parts (they may hold radicals); bar on y. Returns { g, w, t, b, x0 }.
+function frac(p, top, bot, x, y, t0, { size = 56, fill = COL.chalk, anchor = 'start', topFill, botFill } = {}) {
+ const g = G(p, { o: 0 });
+ const w = Math.max(mathW(top, size), mathW(bot, size)) + size * .3;
+ const x0 = anchor === 'middle' ? x - w / 2 : x;
+ const t = M(g, [].concat(top), { x: x0 + w / 2, y: y - size * .25, size, fill: topFill || fill });
+ const b = M(g, [].concat(bot), { x: x0 + w / 2, y: y + size * 1.05, size, fill: botFill || fill });
+ path(g, `M${x0} ${y}H${x0 + w}`, { stroke: fill, 'stroke-width': size * .05 });
+ if (t0 !== undefined) show(g, t0);
+ return { g, w, t, b, x0 };
+}
+
+/* ---------- coordinate plane (unit 6 onward) ---------- */
+// Grid centred on the origin at (cx, cy); u pixels per unit; x from x0 to x1, y from y0 to y1.
+// Returns { g, PX, PY, u, ... } with helpers to plot points, walk to a point, and draw lines.
+// The grid stays in p; marks go into P.layer (set it to the current panel so marks clear with the step) or opts.into.
+function plane(p, { cx = 800, cy = 450, u = 50, x0 = -6, x1 = 6, y0 = -6, y1 = 6, t0 = .1, labels = true, step = 1 } = {}) {
+ const PX = x => cx + x * u, PY = y => cy - y * u, g = G(p, { o: 0 });
+ let d = '';
+ for (let x = x0; x <= x1; x++) if (x) d += `M${PX(x)} ${PY(y0)}V${PY(y1)}`;
+ for (let y = y0; y <= y1; y++) if (y) d += `M${PX(x0)} ${PY(y)}H${PX(x1)}`;
+ mk('path', { d, stroke: COL.chalk, 'stroke-opacity': .1, 'stroke-width': 1.5, fill: 'none' }, g);
+ const ax = { stroke: COL.chalk, 'stroke-width': 3 };
+ path(g, `M${PX(x0 - .5)} ${cy}H${PX(x1 + .5)}M${PX(x1 + .5) - 14} ${cy - 9}L${PX(x1 + .5)} ${cy}L${PX(x1 + .5) - 14} ${cy + 9}`, ax);
+ path(g, `M${cx} ${PY(y0 - .5)}V${PY(y1 + .5)}M${cx - 9} ${PY(y1 + .5) + 14}L${cx} ${PY(y1 + .5)}L${cx + 9} ${PY(y1 + .5) + 14}`, ax);
+ T(g, 'x', { x: PX(x1 + .5) + 10, y: cy + 30, size: 28, fill: COL.dim, font: MATH, anchor: 'middle' }).setAttribute('font-style', 'italic');
+ T(g, 'y', { x: cx - 26, y: PY(y1 + .5) + 10, size: 28, fill: COL.dim, font: MATH, anchor: 'middle' }).setAttribute('font-style', 'italic');
+ if (labels) {
+ for (let x = x0; x <= x1; x += step) if (x) T(g, num(x), { x: PX(x), y: cy + 26, size: 18, fill: COL.dim, font: MATH, anchor: 'middle' });
+ for (let y = y0; y <= y1; y += step) if (y) T(g, num(y), { x: cx - 12, y: PY(y) + 6, size: 18, fill: COL.dim, font: MATH, anchor: 'end' });
+ }
+ show(g, t0, .5);
+ const P = {
+ g, PX, PY, u, cx, cy, x0, x1, y0, y1, layer: null,
+ dot(x, y, color, t0, { r = 10, label, run = tw, dx = 14, dy = -14, anchor = 'start', into = P.layer || p, open = false } = {}) {
+ const d = G(into, { x: PX(x), y: PY(y), s: 0, o: 0 });
+ mk('circle', open ? { r, fill: COL.board, stroke: color, 'stroke-width': 3.5 } : { r, fill: color, stroke: COL.board, 'stroke-width': 2 }, d);
+ run(d, { s: 1, o: 1 }, t0, .4, back);
+ if (label) { const l = M(into, [label], { x: PX(x) + dx, y: PY(y) + dy, size: 26, fill: color, anchor, o: 0 }); run(l, { o: 1 }, t0 + .2, .3); }
+ return d;
+ },
+ // Walk from the origin: along x, then along y, drawing arrows; then a dot.
+ walk(x, y, t0, { cx: colX = COL.whole, cy: colY = COL.nat, run = tw, color = COL.task, label, into = P.layer || p } = {}) {
+ const a = path(into, `M${PX(0)} ${PY(0)}H${PX(x)}`, { stroke: colX, 'stroke-width': 5 }, { d: 0 });
+ const b = path(into, `M${PX(x)} ${PY(0)}V${PY(y)}`, { stroke: colY, 'stroke-width': 5 }, { d: 0 });
+ run(a, { d: 1 }, t0, .3 + Math.abs(x) * .12, lin);
+ run(b, { d: 1 }, t0 + .4 + Math.abs(x) * .12, .3 + Math.abs(y) * .12, lin);
+ return P.dot(x, y, color, t0 + .8 + (Math.abs(x) + Math.abs(y)) * .12, { run, label, into });
+ },
+ // Arrow from (xa, ya) to (xb, yb) with an optional label beside its middle.
+ arrow(xa, ya, xb, yb, color, t0, { label, run = tw, into = P.layer || p } = {}) {
+ const a = [PX(xa), PY(ya)], b = [PX(xb), PY(yb)], L = Math.hypot(b[0] - a[0], b[1] - a[1]), ux = (b[0] - a[0]) / L, uy = (b[1] - a[1]) / L;
+ const l = path(into, `M${a[0]} ${a[1]}L${b[0]} ${b[1]}M${b[0] - 12 * ux - 8 * uy} ${b[1] - 12 * uy + 8 * ux}L${b[0]} ${b[1]}L${b[0] - 12 * ux + 8 * uy} ${b[1] - 12 * uy - 8 * ux}`, { stroke: color, 'stroke-width': 4 }, { d: 0 });
+ run(l, { d: 1 }, t0, .5);
+ if (label !== undefined) {
+ const vert = Math.abs(uy) > Math.abs(ux);
+ const t = M(into, [label], { x: (a[0] + b[0]) / 2 + (vert ? -24 : 0), y: (a[1] + b[1]) / 2 + (vert ? 9 : -12), size: 26, fill: color, anchor: vert ? 'end' : 'middle', o: 0 });
+ run(t, { o: 1 }, t0 + .3, .3);
+ }
+ return l;
+ },
+ // One slope step from (x, y): rise first (irr green), then run (real violet).
+ stair(x, y, rise, runX, t0, { run = tw, into = P.layer || p, labels = true } = {}) {
+ P.arrow(x, y, x, y + rise, COL.irr, t0, { label: labels ? num(rise) : undefined, run, into });
+ P.arrow(x, y + rise, x + runX, y + rise, COL.real, t0 + .6, { label: labels ? num(runX) : undefined, run, into });
+ },
+ // Shade the region where every a·x + b·y ≥ c in the list holds, clipped to the grid.
+ region(list, color, t0, { run = tw, into = P.layer || p, o = .22 } = {}) {
+ let pts = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]];
+ for (const [a, b, c] of list) {
+ const f = ([x, y]) => a * x + b * y - c, next = [];
+ pts.forEach((v, i) => {
+ const w = pts[(i + 1) % pts.length], fv = f(v), fw = f(w);
+ if (fv >= 0) next.push(v);
+ if (fv * fw < 0) { const t = fv / (fv - fw); next.push([v[0] + t * (w[0] - v[0]), v[1] + t * (w[1] - v[1])]); }
+ });
+ pts = next;
+ }
+ const e = path(into, pts.length ? 'M' + pts.map(([x, y]) => `${PX(x)} ${PY(y)}`).join('L') + 'Z' : '', { fill: color, stroke: 'none' }, { o: 0 });
+ into.insertBefore(e, into.firstChild);
+ run(e, { o }, t0, .6);
+ return e;
+ },
+ half: (a, b, c, color, t0, opts) => P.region([[a, b, c]], color, t0, opts),
+ // Graph of y = f(x) for x from xa to xb, drawn on; the part outside the grid's y range is cut off.
+ fn(f, xa, xb, color, t0, { run = tw, w = 4, into = P.layer || p, n = 160, dur = 1.2 } = {}) {
+ let d = '', pen = false;
+ for (let i = 0; i <= n; i++) {
+ const x = xa + (xb - xa) * i / n, y = f(x), inside = y >= y0 - .5 && y <= y1 + .5;
+ if (inside) { d += `${pen ? 'L' : 'M'}${PX(x).toFixed(1)} ${PY(y).toFixed(1)}`; pen = true; } else pen = false;
+ }
+ const l = path(into, d, { stroke: color, 'stroke-width': w }, { d: 0 });
+ run(l, { d: 1 }, t0, dur);
+ return l;
+ },
+ // Line through two points, extended to the edge of the grid.
+ line(xa, ya, xb, yb, color, t0, { run = tw, w = 4, dash, into = P.layer || p } = {}) {
+ const dx = xb - xa, dy = yb - ya, ts = [];
+ const clip = (t, v, lo, hi) => { if (v >= lo - 1e-9 && v <= hi + 1e-9) ts.push(t); };
+ if (dx) { for (const X of [x0, x1]) { const t = (X - xa) / dx; clip(t, ya + t * dy, y0, y1); } }
+ if (dy) { for (const Y of [y0, y1]) { const t = (Y - ya) / dy; clip(t, xa + t * dx, x0, x1); } }
+ const t1 = Math.min(...ts), t2 = Math.max(...ts);
+ // A dashed line fades in: drawing it on would need the dash array for the reveal.
+ const l = path(into, `M${PX(xa + t1 * dx)} ${PY(ya + t1 * dy)}L${PX(xa + t2 * dx)} ${PY(ya + t2 * dy)}`, { stroke: color, 'stroke-width': w, ...(dash ? { 'stroke-dasharray': dash } : {}) }, dash ? { o: 0 } : { d: 0 });
+ run(l, dash ? { o: 1 } : { d: 1 }, t0, dash ? .6 : 1);
+ return l;
+ },
+ };
+ return P;
+}
+// Question: pick a grid point. ans = [x, y]; no(x, y) explains a wrong pick. Arrows move a cursor, Enter picks.
+// test(x, y), when given, accepts any point it approves; ans is then the point Show answer uses.
+const pickPoint = (P, ans, yes, no, onRight, test) => (body, api) => {
+ const L = qlayer();
+ let cur = [0, 0], locked = false;
+ const cursor = G(L, { x: P.PX(0), y: P.PY(0) });
+ mk('circle', { r: 16, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, cursor);
+ let tag = null;
+ const moveTo = (x, y) => {
+ cur = [Math.max(P.x0, Math.min(P.x1, x)), Math.max(P.y0, Math.min(P.y1, y))];
+ put(cursor, { x: P.PX(cur[0]), y: P.PY(cur[1]) });
+ tag?.remove();
+ tag = M(L, [`(${num(cur[0])}, ${num(cur[1])})`], { x: P.PX(cur[0]) + 22, y: P.PY(cur[1]) - 18, size: 24, fill: COL.task, anchor: 'start' });
+ };
+ moveTo(0, 0);
+ const pick = () => {
+ if (locked) return;
+ const [x, y] = cur;
+ if (test ? test(x, y) : x === ans[0] && y === ans[1]) { P.dot(x, y, COL.good, 0, { run: fx, into: L }); onRight?.(); api.grade(true, typeof yes === 'function' ? yes(x, y) : yes); }
+ else { const d = P.dot(x, y, COL.bad, 0, { run: fx, r: 8, into: L }); fx(d, { o: 0 }, 1.2, .4); shakeFx(cursor); api.grade(false, no(x, y)); }
+ };
+ const hit = mk('rect', { x: P.PX(P.x0 - .5), y: P.PY(P.y1 + .5), width: (P.x1 - P.x0 + 1) * P.u, height: (P.y1 - P.y0 + 1) * P.u, fill: 'transparent' }, L);
+ L.insertBefore(hit, L.firstChild);
+ hit.style.cursor = 'crosshair';
+ hit.addEventListener('click', e => {
+ if (locked) return;
+ const s = $('stage'), pt = s.createSVGPoint(); pt.x = e.clientX; pt.y = e.clientY;
+ const q = pt.matrixTransform(s.getScreenCTM().inverse());
+ moveTo(Math.round((q.x - P.cx) / P.u), Math.round((P.cy - q.y) / P.u));
+ pick();
+ });
+ return {
+ reveal() { moveTo(...ans); P.dot(ans[0], ans[1], COL.good, 0, { run: fx, into: L }); onRight?.(); return typeof yes === 'function' ? yes(...ans) : yes; },
+ lock() { locked = true; },
+ hint: [kbd('←'), kbd('↑'), kbd('↓'), kbd('→'), translate('hintMove'), kbd('Enter'), translate('hintChooseOrClickGrid')],
+ key(e) {
+ if (locked) return false;
+ const d = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] }[e.key];
+ if (d) { moveTo(cur[0] + d[0], cur[1] + d[1]); return true; }
+ if (e.key === 'Enter') { pick(); return true; }
+ return false;
+ },
+ };
+};
+/* ---------- signed numbers: number-line moves and plus/minus tiles ---------- */
+const POS = COL.whole, NEG = COL.nat; // positive: blue, negative: coral
+// Integer number line from lo to hi with arrows at both ends, drawn into S.line.
+function numberLine(t0 = .1, lo = -8, hi = 8) {
+ const L = S.line;
+ draw(path(L, `M${X(lo - .7)} ${Y0}H${X(hi + .7)}`, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), t0, .8);
+ for (const [x, d] of [[X(hi + .7), 1], [X(lo - .7), -1]]) {
+ show(path(L, `M${x - 15 * d} ${Y0 - 10}L${x} ${Y0}L${x - 15 * d} ${Y0 + 10}`, { stroke: COL.chalk, 'stroke-width': 3 }, { o: 0 }), t0 + .7, .3);
+ }
+ for (let v = lo; v <= hi; v++) show(tick(v), t0 + .2 + Math.abs(v) * .04, .4);
+}
+// A move along the number line from a to b, drawn as an arrow at height y. run = tw (lesson) or fx (answer).
+function move(p, a, b, y, t0, run = tw) {
+ const x1 = X(a), x2 = X(b), d = Math.sign(b - a), color = d > 0 ? POS : NEG;
+ const dur = .35 + Math.abs(b - a) * .09;
+ const line = path(p, `M${x1} ${y}H${x2}`, { stroke: color, 'stroke-width': 5 }, { d: 0 });
+ const head = path(p, `M${x2 - 15 * d} ${y - 11}L${x2} ${y}L${x2 - 15 * d} ${y + 11}`, { stroke: color, 'stroke-width': 5 }, { o: 0 });
+ const lab = T(p, (d > 0 ? '+' : '−') + Math.abs(b - a), { x: (x1 + x2) / 2, y: y - 16, size: 28, fill: color, font: MATH, anchor: 'middle', o: 0 });
+ const drop = path(p, `M${x2} ${y + 12}V${Y0 - 14}`, { stroke: color, 'stroke-width': 2, 'stroke-dasharray': '5 6' }, { o: 0 });
+ run(line, { d: 1 }, t0, dur, lin); run(head, { o: 1 }, t0 + dur - .1, .15);
+ run(lab, { o: 1 }, t0 + .2, .3); run(drop, { o: .8 }, t0 + dur, .3);
+}
+function landDot(p, v, t0, color = COL.chalk, run = tw) {
+ const g = G(p, { x: X(v), y: Y0, s: 0, o: 0 });
+ mk('circle', { r: 12, fill: color, stroke: COL.board, 'stroke-width': 2 }, g);
+ run(g, { s: 1, o: 1 }, t0, .45, back);
+ return g;
+}
+function tile(p, sign, x, y, o = 0) {
+ const c = sign > 0 ? POS : NEG, g = G(p, { x, y, o, s: o ? 1 : .6 });
+ mk('rect', { x: -27, y: -27, width: 54, height: 54, rx: 10, fill: mix(COL.board, c, .45), stroke: c, 'stroke-width': 2.5 }, g);
+ M(g, [sign > 0 ? '+' : '−'], { y: 13, size: 40 });
+ return g;
+}
+const tiles = (p, n, sign, x0, y, gap = 70) => Array.from({ length: n }, (_, i) => tile(p, sign, x0 + i * gap, y));
+const popAll = (els, t0, step = .08) => els.forEach((e, i) => tw(e, { o: 1, s: 1 }, t0 + i * step, .35, back));
+// Circle each plus/minus pair, then let the pairs vanish: they make zero.
+function cancelPairs(p, tops, bottoms, t0) {
+ tops.forEach((a, i) => {
+ const b = bottoms[i], x = st(a).x, y1 = st(a).y, y2 = st(b).y;
+ const ring = put(mk('rect', { rx: 18, fill: 'none', stroke: COL.dim, 'stroke-width': 2.5, 'stroke-dasharray': '8 6' }, p),
+ { o: 0, a_x: x - 38, a_y: y1 - 38, a_width: 76, a_height: y2 - y1 + 76 });
+ tw(ring, { o: 1 }, t0 + i * .2, .3);
+ for (const e of [a, b, ring]) tw(e, { o: 0, ...(e === ring ? {} : { s: .5 }) }, t0 + 1.4 + i * .1, .4);
+ });
+}
+function brace(p, a, b, y, label, color, t0) {
+ const x1 = X(a), x2 = X(b);
+ draw(path(p, `M${x1} ${y - 10}V${y}H${x2}V${y - 10}`, { stroke: color, 'stroke-width': 3 }, { d: 0 }), t0, .6);
+ show(T(p, label, { x: (x1 + x2) / 2, y: y + 34, size: 26, fill: color, anchor: 'middle', o: 0 }), t0 + .4);
+}
+
+/* ---------- number map geometry ---------- */
+const RINGS = {
+ real: { cx: 640, cy: 470, rx: 610, ry: 390, lx: 640, ly: 128 },
+ rat: { cx: 500, cy: 480, rx: 400, ry: 320, lx: 500, ly: 202 },
+ int: { cx: 500, cy: 510, rx: 300, ry: 250, lx: 500, ly: 302 },
+ whole: { cx: 500, cy: 540, rx: 210, ry: 180, lx: 500, ly: 400 },
+ nat: { cx: 500, cy: 570, rx: 125, ry: 110, lx: 500, ly: 500 },
+ irr: { cx: 1060, cy: 480, rx: 140, ry: 170, lx: 1060, ly: 360 },
+};
+const CHAIN = { nat: ['nat', 'whole', 'int', 'rat', 'real'], whole: ['whole', 'int', 'rat', 'real'], int: ['int', 'rat', 'real'], rat: ['rat', 'real'], irr: ['irr', 'real'], real: ['real'] };
+const ell = r => `M${r.cx} ${r.cy - r.ry}A${r.rx} ${r.ry} 0 1 1 ${r.cx} ${r.cy + r.ry}A${r.rx} ${r.ry} 0 1 1 ${r.cx} ${r.cy - r.ry}`;
+const inRing = (k, x, y) => { const r = RINGS[k]; return ((x - r.cx) / r.rx) ** 2 + ((y - r.cy) / r.ry) ** 2 <= 1; };
+function regionAt(x, y) {
+ for (const k of ['nat', 'whole', 'int', 'rat', 'irr', 'real']) if (inRing(k, x, y)) return k;
+ return null;
+}
+function buildVenn(parent, hidden) {
+ const out = {};
+ for (const k of ['real', 'rat', 'int', 'whole', 'nat', 'irr']) {
+ const r = RINGS[k], g = G(parent);
+ const fill = path(g, ell(r), { fill: mix(COL.board, COL[k], k === 'real' ? .1 : .16), stroke: 'none' }, { o: hidden ? 0 : 1 });
+ const stroke = path(g, ell(r), { stroke: COL[k], 'stroke-width': 3 }, hidden ? { d: 0, 'a_stroke-width': 3 } : { 'a_stroke-width': 3 });
+ const lab = T(g, NAME[k], { x: r.lx, y: r.ly, size: 26, fill: COL[k], weight: 600, anchor: 'middle', o: hidden ? 0 : 1 });
+ out[k] = { g, fill, stroke, lab };
+ }
+ return out;
+}
+function glow(key, t0) {
+ const s = S.ring[key].stroke;
+ tw(s, { 'a_stroke-width': 9 }, t0, .22, out); tw(s, { 'a_stroke-width': 3 }, t0 + .25, .5);
+}
+function glowRun(key, t0) { CHAIN[key].forEach((k, i) => glow(k, t0 + i * .3)); }
+const glowFx = (key, delay = 0) => CHAIN[key].forEach((k, i) => {
+ const s = S.ring[k].stroke;
+ fx(s, { 'a_stroke-width': 9 }, delay + i * .28, .22, out); fx(s, { 'a_stroke-width': 3 }, delay + i * .28 + .25, .5);
+});
+function popDotFx(key, v, label) {
+ const L = S.q || qlayer();
+ const g = G(L, { x: X(v), y: Y0, s: 0, o: 0 });
+ mk('circle', { r: 7, fill: COL[key], stroke: COL.board, 'stroke-width': 2 }, g);
+ fx(g, { s: 1, o: 1 }, 0, .45, back);
+ if (label) fx(M(L, label, { x: X(v) + 10, y: Y0 + 56, size: 28, fill: COL[key], o: 0 }), { o: 1 }, .3, .4);
+}
+function hopsFx(n) {
+ for (let k = 1; k <= -n; k++) {
+ const a = X(1 - k), b = X(-k);
+ fx(path(S.q, `M${a} ${Y0 - 12}Q${(a + b) / 2} ${Y0 - 84} ${b} ${Y0 - 12}`, { stroke: COL.int, 'stroke-width': 3 }, { d: 0 }), { d: 1 }, (k - 1) * .35, .35, lin);
+ }
+ floatText(translate('stepsLeftOfZero', { n: -n }), X(n / 2), Y0 - 100, COL.int);
+}
+const FAMILIES = ['nat', 'whole', 'int', 'rat', 'irr', 'real'];
+const FAM_COLS = FAMILIES.map(k => [k, k === 'int' ? translate('integerColumn') : NAME[k], COL[k]]);
+const RING_KEYS = ['nat', 'whole', 'int', 'rat', 'irr', 'real']; // number keys 1–6 in sorting questions
+// Drag number chips into the stage number map. items: [parts, smallest ring, explanation].
+const slot = (k, n) => {
+ if (k === 'real') return [[940, 210], [1000, 760], [820, 800]][n % 3]; // inside Real, outside every other ring
+ const r = RINGS[k];
+ return [r.lx + [-72, 72, 0][n % 3], r.ly + 50 + 56 * Math.floor(n / 2)];
+};
+const plain = parts => parts.map(p => typeof p === 'string' ? p : p.ov !== undefined ? p.ov + ' repeating' : p.tex !== undefined ? p.tex : p.f ? p.f.join('/') : p.sup !== undefined ? '^' + p.sup : (p.i ? p.i : '') + '√' + (p.r.f ? p.r.f.join('/') : p.r)).join('');
+const sorter = (items, trayXY) => (body, api) => {
+ const L = qlayer();
+ const bg = mk('rect', { width: 1600, height: 900, fill: 'transparent' }, L);
+ const svg = $('stage');
+ const pt = e => { const p = svg.createSVGPoint(); p.x = e.clientX; p.y = e.clientY; return p.matrixTransform(svg.getScreenCTM().inverse()); };
+ let sel = null, drag = null, locked = false;
+ const label = c => c.setAttribute('aria-label', c.region ? translate('chipPlaced', { x: c.say, ring: NAME[c.region] }) : translate('chipNotPlaced', { x: c.say }));
+ const outline = (c, colr, w = 2.5) => { c._rect.setAttribute('stroke', colr); c._rect.setAttribute('stroke-width', w); };
+ const choose = c => {
+ if (sel) outline(sel, COL.chalk);
+ sel = c;
+ if (sel) { outline(sel, COL.task, 4); L.append(sel); }
+ };
+ const select = c => choose(sel === c ? null : c);
+ // Number badges next to the ring names, for keys 1–6.
+ RING_KEYS.forEach((k, i) => {
+ const r = RINGS[k], g = G(L, { x: r.lx - uiW(NAME[k], 26) / 2 - 24, y: r.ly - 9 });
+ g.style.pointerEvents = 'none';
+ mk('circle', { r: 14, fill: COL.board, stroke: COL[k], 'stroke-width': 1.5 }, g);
+ T(g, String(i + 1), { y: 6.5, size: 18, fill: COL[k], anchor: 'middle', weight: 600 });
+ });
+ const place = (c, x, y) => {
+ c.region = regionAt(x, y);
+ if (!c.region) [x, y] = c.home;
+ put(c, { x, y });
+ outline(c, COL.chalk);
+ c.querySelector('.mark')?.remove();
+ if (sel === c) sel = null;
+ label(c);
+ };
+ const chips = items.map(([parts, answer, why], i) => {
+ const [x, y] = trayXY(i);
+ const c = chip(L, parts, COL.chalk, { x, y, size: 32 });
+ Object.assign(c, { answer, why, home: [x, y], region: null, say: plain(parts) });
+ c.classList.add('tok');
+ c.setAttribute('tabindex', 0);
+ c.setAttribute('role', 'button');
+ label(c);
+ c.addEventListener('pointerdown', e => {
+ if (locked) return;
+ e.preventDefault();
+ const p = pt(e);
+ drag = { dx: p.x - st(c).x, dy: p.y - st(c).y, sx: p.x, sy: p.y, moved: false };
+ L.append(c); // re-parent before capturing: moving a node drops its capture
+ c.setPointerCapture(e.pointerId);
+ });
+ c.addEventListener('pointermove', e => {
+ if (!drag) return;
+ const p = pt(e);
+ if (Math.hypot(p.x - drag.sx, p.y - drag.sy) > 6) drag.moved = true;
+ if (drag.moved) put(c, { x: p.x - drag.dx, y: p.y - drag.dy });
+ });
+ c.addEventListener('pointerup', () => {
+ if (!drag) return;
+ const moved = drag.moved;
+ drag = null;
+ if (moved) place(c, st(c).x, st(c).y); else select(c);
+ });
+ // A cancelled drag (a system gesture, a lost capture) drops the chip where it is instead of leaving it stuck to no pointer.
+ c.addEventListener('lostpointercapture', () => {
+ if (!drag) return;
+ const moved = drag.moved;
+ drag = null;
+ if (moved) place(c, st(c).x, st(c).y);
+ });
+ keyAct(c, () => { if (!locked) select(c); });
+ return c;
+ });
+ bg.addEventListener('pointerup', e => { if (sel && !locked) { const p = pt(e); place(sel, p.x, p.y); } });
+ return {
+ check() {
+ let right = 0;
+ const notes = h('ul');
+ for (const c of chips) {
+ c.querySelector('.mark')?.remove();
+ if (!c.region) { notes.append(h('li', '', translate('notPlacedYet', { x: c.say }))); continue; }
+ const ok = c.region === c.answer;
+ right += ok;
+ outline(c, ok ? COL.good : COL.bad, 4);
+ if (ok) { pulseFx(c, 1.25); glowFx(c.answer, right * .15); } else shakeFx(c);
+ const w = +c._rect.getAttribute('width');
+ T(c, ok ? '✓' : '✗', { x: w / 2 + 4, y: -16, size: 26, fill: ok ? COL.good : COL.bad, weight: 700 }).classList.add('mark');
+ if (!ok) notes.append(h('li', '', c.region === 'real'
+ ? translate('realRingIsEmpty', { x: c.say })
+ : c.why));
+ }
+ const all = right === chips.length;
+ api.grade(all, all ? [] : [translate('ringsRight', { r: right, n: chips.length }), notes], { right, total: chips.length });
+ },
+ reveal() {
+ const count = {};
+ chips.forEach((c, i) => {
+ const n = count[c.answer] = (count[c.answer] ?? -1) + 1;
+ const [x, y] = slot(c.answer, n);
+ c.region = c.answer;
+ c.querySelector('.mark')?.remove();
+ outline(c, COL.good, 4);
+ fx(c, { x, y }, i * .12, .8);
+ });
+ return translate('ringsShown');
+ },
+ lock() { locked = true; choose(null); },
+ hint: [kbd('←'), kbd('→'), translate('hintPickNumber'), kbd('1'), '–', kbd('6'), translate('hintPickRing')],
+ key(e) {
+ if (locked) return false;
+ const d = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;
+ if (d) {
+ const i = sel ? chips.indexOf(sel) : d > 0 ? -1 : 0;
+ choose(chips[(i + d + chips.length) % chips.length]);
+ return true;
+ }
+ const ring = RING_KEYS[+e.key - 1];
+ if (!ring || !sel) return false;
+ const c = sel;
+ place(c, ...slot(ring, chips.filter(x => x.region === ring && x !== c).length));
+ choose(chips.find(x => !x.region) || null);
+ return true;
+ },
+ };
+};
diff --git a/site/shooting-an-elephant/lib/puppets.js b/site/shooting-an-elephant/lib/puppets.js
new file mode 100644
index 0000000..b5de915
--- /dev/null
+++ b/site/shooting-an-elephant/lib/puppets.js
@@ -0,0 +1,235 @@
+/* puppets.js — this film's cut-out puppets, drawn in SVG (no pictures): Burmese townspeople, the officer, the elephant.
+ One black card per figure with a thin cream rim round its whole outline, in the manner of Lotte Reiniger: the parts
+ are plain black shapes, and the rim (and the slightly uneven, boiling edge) comes from a filter on an unscaled wrapper,
+ so joints never show and the rim is the same width at any size.
+ Each builder draws its figure in its own units (feet on y = 0; people face right, the elephant faces left) and returns
+ { g, pose(t) }: pose sets the joints for a time t (seconds), a pure function of the clock like everything in the engine.
+ PUP.mount(parent, figure, x, y, k, flip) places it; PUP.defs(svg) adds the filters once (pupRim0..2, for boiling). */
+'use strict';
+const PUP = (() => {
+ const NS = 'http://www.w3.org/2000/svg', CARD = '#07100b', RIM = '#f3ede0';
+ const el = (tag, a, parent) => { const e = document.createElementNS(NS, tag); for (const k in a) e.setAttribute(k, a[k]); if (parent) parent.appendChild(e); return e; };
+ function defs(svg) {
+ if (svg.querySelector('#pupRim0')) return;
+ const d = el('defs', {}, svg);
+ [4, 11, 23].forEach((seed, i) => {
+ const f = el('filter', { id: `pupRim${i}`, x: '-10%', y: '-10%', width: '120%', height: '120%' }, d);
+ // every part is the same black: make the alpha solid first, so the joints' anti-aliased seams vanish
+ const ct = el('feComponentTransfer', { in: 'SourceAlpha', result: 'a' }, f);
+ el('feFuncA', { type: 'discrete', tableValues: '0 1 1 1 1' }, ct);
+ el('feFlood', { 'flood-color': CARD, result: 'ink' }, f);
+ el('feComposite', { in: 'ink', in2: 'a', operator: 'in', result: 'solid' }, f);
+ el('feTurbulence', { type: 'fractalNoise', baseFrequency: .03, numOctaves: 3, seed, result: 'n' }, f);
+ el('feDisplacementMap', { in: 'solid', in2: 'n', scale: 4, result: 'cut' }, f);
+ el('feMorphology', { in: 'cut', operator: 'dilate', radius: 2.4, result: 'fat' }, f);
+ el('feFlood', { 'flood-color': RIM, result: 'c' }, f);
+ el('feComposite', { in: 'c', in2: 'fat', operator: 'in', result: 'rim' }, f);
+ const m = el('feMerge', {}, f); el('feMergeNode', { in: 'rim' }, m); el('feMergeNode', { in: 'cut' }, m);
+ });
+ }
+ // place a figure: an outer group carries the filter (unscaled, so the rim keeps its width), the figure's own g the scale
+ // (filter: false puts it straight into parent, for a crowd whose shared group carries one filter: cheaper)
+ function mount(parent, fig, x, y, k, flip = false, filter = true) {
+ const w = filter ? el('g', { filter: 'url(#pupRim0)' }, parent) : parent;
+ w.appendChild(fig.g);
+ fig.g.setAttribute('transform', `translate(${x},${y}) scale(${flip ? -k : k},${k})`);
+ fig.wrap = w;
+ return fig;
+ }
+ const boilAt = (target, t) => (target.wrap || target).setAttribute('filter', `url(#pupRim${Math.floor(t * 12) % 3})`);
+ // a part: a group turning about its pivot (px, py), holding plain black shapes
+ function part(parent, d, px = 0, py = 0) {
+ const g = el('g', {}, parent);
+ el('path', { d, fill: CARD }, g);
+ g.set = (a = 0, dx = 0, dy = 0) => g.setAttribute('transform', `translate(${dx.toFixed(1)},${dy.toFixed(1)}) rotate(${a.toFixed(2)} ${px} ${py})`);
+ return g;
+ }
+ const wave = (t, f, ph = 0) => Math.sin((t * f + ph) * 2 * Math.PI);
+
+ /* ---------- a Burmese townsman or townswoman, in profile, about 1000 units tall ----------
+ kind: 'man' (short hair), 'bun' (a man's hair knot), 'turban' (gaung baung), 'monk' (shaved head, robe),
+ 'woman' (hair in a bun), 'boy' (smaller, shorts). act: 'walk' | 'stand' | 'laugh' | 'point' | 'cheer'.
+ prop: what he or she carries, which is most of what makes a silhouette: 'parasol', 'basket' (on the head),
+ 'pole' (a carrying pole with two baskets), 'bowl' (a monk's alms bowl), 'staff', 'child' (on the shoulders).
+ The head and the arms hang from the body, so a lean carries them; the body turns about the hips. */
+ function person(parent, { kind = 'man', act = 'walk', prop = '', speed = 1, phase = 0 } = {}) {
+ const g = el('g', {}, parent), monk = kind === 'monk', boy = kind === 'boy';
+ const foot = dx => `L${-6 + dx} -64L${-4 + dx} -16L${30 + dx} -7C${37 + dx} -5 ${37 + dx} 0 ${30 + dx} 0L${-32 + dx} 0C${-36 + dx} -12 ${-34 + dx} -42 ${-30 + dx} -64`;
+ const top = boy ? -330 : -300;
+ const legB = part(g, `M-24 ${top}L0 ${top}L-2 -64` + foot(0) + 'Z', -10, top);
+ const legF = part(g, `M-2 ${top}L22 ${top}L22 -64` + foot(24) + 'Z', 10, top);
+ // the body (a jacket with sloping shoulders over a longyi flaring a little to the hem, its knot at the front of the
+ // waist; a monk's robe; the boy's shirt and shorts), turning about the hips
+ const body = monk
+ ? 'M-34 -846C-10 -854 22 -852 38 -840C56 -760 64 -620 66 -470C68 -330 70 -180 74 -44H-70C-66 -180-64 -330-62 -470C-60 -640-56 -780-34 -846Z'
+ : boy
+ ? 'M-30 -846C-10 -852 20 -850 34 -838C46 -790 50 -700 52 -620C54 -580 54 -545 52 -510L56 -340H-52L-54 -510C-58 -560-58 -650-52 -730C-48 -790-42 -832-30 -846Z'
+ : 'M-30 -846C-10 -852 20 -850 34 -838C46 -800 52 -720 54 -640C56 -590 58 -540 56 -512C58 -470 54 -400 58 -300C62 -200 66 -110 70 -42H-66C-64 -110-62 -200-60 -300C-58 -400-60 -470-58 -512C-60 -560-60 -650-54 -720C-50 -780-44 -830-30 -846ZM50 -520C66 -524 76 -510 72 -494C68 -480 52 -480 48 -492Z';
+ const torso = part(g, body, 0, top);
+ // arms hang from the shoulder: thin, tapering to the wrist, a hand; the far one behind the body
+ const arm = dx => `M${-15 + dx} -828C${-23 + dx} -760 ${-25 + dx} -680 ${-21 + dx} -600C${-19 + dx} -560 ${-15 + dx} -520 ${-13 + dx} -482C${-15 + dx} -462 ${-7 + dx} -444 ${5 + dx} -446C${17 + dx} -448 ${19 + dx} -466 ${13 + dx} -482C${15 + dx} -560 ${17 + dx} -680 ${19 + dx} -800Z`;
+ const armB = part(torso, arm(0), 2, -828); torso.insertBefore(armB, torso.firstChild);
+ // the head, small, in profile: crown, brow, nose, lips, chin; hair, a knot, a cloth, or nothing
+ const head = part(torso, 'M-45 -965C-40 -995 -5 -1004 20 -998C45 -992 58 -970 58 -945L70 -925L60 -920C64 -910 62 -905 56 -902C58 -895 54 -888 48 -884C40 -874 25 -870 12 -872L10 -840H-22L-24 -870C-44 -880 -55 -910 -55 -935C-55 -950 -52 -960 -45 -965Z', 0, -845);
+ const ink = (d, host) => el('path', { d, fill: CARD }, host);
+ if (kind === 'bun' || kind === 'woman') ink('M-50 -972C-72 -976 -80 -952 -68 -938C-56 -926 -40 -932 -38 -950Z', head);
+ if (kind === 'turban') ink('M-58 -948C-58 -992 -18 -1018 22 -1004C44 -996 58 -980 58 -960C30 -972 -12 -970 -58 -948ZM20 -1002C36 -1024 64 -1024 72 -1002C58 -1000 46 -994 38 -986Z', head);
+ if (kind === 'man') ink('M-55 -935C-58 -978 -30 -1004 8 -1002C32 -1000 50 -988 56 -968C30 -978 -10 -976 -36 -952Z', head);
+ const armF = part(torso, arm(22), 24, -828);
+ // the props
+ let sway = null, child = null;
+ if (prop === 'parasol') { // a paper parasol over the shoulder, its ribs showing as notches in the rim
+ ink('M30 -560L44 -560L46 -1190L32 -1190Z', torso);
+ ink('M-150 -1110C-90 -1230 160 -1250 230 -1120C200 -1128 180 -1110 160 -1124C130 -1112 110 -1124 90 -1112C60 -1124 40 -1110 20 -1122C-10 -1110 -30 -1124 -60 -1112C-90 -1122 -110 -1108 -150 -1110Z', torso);
+ ink('M30 -1240C30 -1262 46 -1262 46 -1240L44 -1190H32Z', torso);
+ }
+ if (prop === 'basket') ink('M-74 -1000C-74 -1012 74 -1012 74 -1000L60 -1100C60 -1112 -60 -1112 -60 -1100Z', head);
+ if (prop === 'pole') { // a bamboo pole on the shoulder, a basket hanging from each end, swinging
+ ink('M-300 -850C-100 -864 100 -864 300 -850L300 -836C100 -850 -100 -850 -300 -836Z', torso);
+ sway = [-1, 1].map(sx => {
+ const b = el('g', {}, torso), x = sx * 290;
+ ink(`M${x - 3} -846L${x + 3} -846L${x + 40} -650L${x + 34} -648L${x} -820L${x - 34} -648L${x - 40} -650Z`, b);
+ ink(`M${x - 70} -650H${x + 70}L${x + 56} -560C${x + 40} -540 ${x - 40} -540 ${x - 56} -560Z`, b);
+ b.px = x; return b;
+ });
+ }
+ if (prop === 'bowl') ink('M40 -590C40 -520 150 -520 150 -590Z', torso);
+ if (prop === 'staff') ink('M30 -470L42 -470L74 0L62 0Z', armF);
+ if (prop === 'child') { // a small child astride the shoulders, arms up
+ child = person(torso, { kind: 'boy', act: 'cheer', phase: phase + .3 });
+ child.g.setAttribute('transform', 'translate(-6,-700) scale(.42)');
+ }
+ if (boy) g.setAttribute('transform', 'scale(.72)');
+ const fixed = { parasol: [-62, 0], bowl: [-58, -40], staff: [8, 0], basket: [-168, 0], pole: [-150, 10] }[prop];
+ function pose(t) {
+ const tt = t * speed + phase;
+ let s, bob;
+ if (act === 'walk') {
+ s = wave(tt, 1.6); bob = -9 * Math.abs(wave(tt, 1.6, .25));
+ legF.set(15 * s, 0, bob); legB.set(-15 * s, 0, bob); torso.set(1.5, 0, bob);
+ armF.set(-16 * s); armB.set(16 * s); head.set(2 * s);
+ } else if (act === 'laugh') { // bent forward, shaking, the head thrown back on the beat
+ s = wave(tt, 3.2);
+ torso.set(8 + 4 * s); head.set(-20 + 14 * s); armF.set(-26 + 12 * s); armB.set(30 - 8 * s); legF.set(0); legB.set(0);
+ } else if (act === 'point') {
+ s = wave(tt, 2.4);
+ torso.set(-3); armF.set(-96 + 6 * s); head.set(-6 + 4 * s); armB.set(12); legF.set(0); legB.set(0);
+ } else if (act === 'cheer') { // both arms up, bouncing
+ s = wave(tt, 2.6); bob = -14 * Math.abs(s);
+ torso.set(0, 0, bob); armF.set(-150 + 12 * s); armB.set(-110 - 14 * s); head.set(-8); legF.set(0, 0, bob); legB.set(0, 0, bob);
+ } else { torso.set(1); head.set(0); armF.set(0); armB.set(0); legF.set(0); legB.set(0); }
+ if (fixed) { armF.set(fixed[0]); if (fixed[1]) armB.set(fixed[1]); }
+ if (sway) sway.forEach((b, k) => b.setAttribute('transform', `rotate(${(6 * Math.sin(tt * 6 + k)).toFixed(2)} ${b.px} -846)`));
+ if (child) child.pose(t);
+ }
+ pose(0);
+ return { g, pose };
+ }
+
+ /* ---------- the officer: very tall and thin, pith helmet, shirt and shorts, long socks, the rifle; about 1150 tall,
+ facing right. act: 'walk' | 'stand'; lower(t), 0..1, brings the rifle down from the shoulder (0) to hang muzzle-down in his hand (1). */
+ function officer(parent, { act = 'walk', speed = 1, phase = 0, lower = () => 0 } = {}) {
+ const g = el('g', {}, parent);
+ const legB = part(g, 'M-20 -470C-22 -300-18 -150-16 -60L-20 -22C-20 -8-12 0 0 0H58C66 0 64-14 52-18L18-30C22 -150 24 -300 20 -470Z', 0, -470);
+ const armB = part(g, 'M-2 -920C-16 -840-22 -740-18 -650C-16 -626 0 -620 10 -634C16 -730 20 -830 24 -904Z', 8, -910);
+ const torso = part(g, 'M-38 -948C-6 -964 28 -962 46 -946L54 -660C56 -620 50 -580 46 -560L52 -450H-46L-42 -560C-50 -600-54 -650-52 -700Z', 0, 0);
+ const legF = part(g, 'M-4 -470C-6 -300-2 -150 0 -60L-4 -22C-4 -8 6 0 18 0H80C88 0 86-14 74-18L38-30C42 -150 44 -300 40 -470Z', 18, -470);
+ const head = part(g, 'M-26 -1092C14 -1100 46 -1074 48 -1030L62 -1004C64 -998 58 -994 52 -994C54 -986 52 -980 46 -978C48 -968 44 -958 34 -954C24 -942 8 -938 -6 -940L-6 -950H-30C-52 -968 -58 -1010 -52 -1046C-48 -1070 -40 -1086 -26 -1092Z', 0, -950);
+ el('path', { d: 'M-86 -1066C-80 -1078 -54 -1088 -36 -1092C-42 -1156 -6 -1192 32 -1184C72 -1174 88 -1130 80 -1090C98 -1086 112 -1078 116 -1066C72 -1072 -46 -1074 -86 -1066Z', fill: CARD }, head);
+ // the front arm and the rifle, which turn together about the shoulder
+ const armF = el('g', {}, g);
+ el('path', { d: 'M10 -920C-2 -850-2 -780 12 -720C20 -700 38 -702 44 -720C38 -780 38 -850 42 -910Z', fill: CARD }, armF);
+ const rifle = el('g', {}, armF); // turns about the hand (30, -712)
+ el('path', { d: 'M-26 -1300L-14 -1304L46 -780L60 -712C66 -682 58 -654 42 -650L20 -646L26 -722L32 -782Z', fill: CARD }, rifle);
+ function pose(t) {
+ const tt = t * speed + phase, l = Math.max(0, Math.min(1, lower(t)));
+ if (act === 'walk') {
+ const s = wave(tt, 1.3), bob = -11 * Math.abs(wave(tt, 1.3, .25));
+ legF.set(16 * s, 0, bob); legB.set(-16 * s, 0, bob); armB.set(18 * s, 0, bob); torso.set(0, 0, bob); head.set(0, 0, bob);
+ armF.setAttribute('transform', `translate(0,${bob.toFixed(1)}) rotate(${(-4 * s - 18 * l).toFixed(2)} 26 -910)`);
+ rifle.setAttribute('transform', `rotate(${(150 * l).toFixed(2)} 30 -712)`);
+ } else {
+ legF.set(0); legB.set(0); armB.set(0); torso.set(0); head.set(5 * l);
+ armF.setAttribute('transform', `rotate(${(-18 * l).toFixed(2)} 26 -910)`);
+ rifle.setAttribute('transform', `rotate(${(150 * l).toFixed(2)} 30 -712)`);
+ }
+ }
+ pose(0);
+ return { g, pose };
+ }
+
+ /* ---------- the elephant, facing left; 1050 tall at the back, feet on y = 0 (proportions measured from a reference
+ silhouette: the back highest just behind the middle, the domed head high at the front, legs four tenths of the height)
+ act: 'stand' | 'graze' | 'walk'. Grazing runs a 4.5 s cycle from its own t = 0: the trunk reaches down and tears up
+ grass (0–1.4 s), swings it up and beats it against the near foreleg's knee twice (1.4–3.0 s), curls it into the mouth
+ (3.0–4.5 s); beats(t) gives the times of the two blows in the current cycle, for a sound. */
+ function elephant(parent, { act = 'graze', phase = 0 } = {}) {
+ const g = el('g', {}, parent);
+ // a leg: a column thick at the top, a knee, a little taper, a broad flat foot
+ // a leg: broad at the top, a slight knee, narrow at the ankle, a broad flat foot (measured from the reference)
+ const leg = (x, top, w, hock = 0) => {
+ const k = top * .5, a = -110, wk = w * .86, wa = w * .64, wf = w * 1.06;
+ return `M${x - w / 2} ${top}C${x - w / 2 - 6} ${top * .78} ${x - wk / 2 - 8 + hock} ${k - 40} ${x - wk / 2 + hock} ${k}C${x - wk / 2 + 6 + hock} ${k * .6} ${x - wa / 2 + hock} ${a - 30} ${x - wa / 2 + hock} ${a}C${x - wa / 2 - 6 + hock} -56 ${x - wf / 2 - 2 + hock} -30 ${x - wf / 2 - 6 + hock} -14C${x - wf / 2 - 8 + hock} -4 ${x - wf / 2 + 4 + hock} 0 ${x - wf / 2 + 16 + hock} 0H${x + wf / 2 + hock}C${x + wf / 2 + 12 + hock} 0 ${x + wf / 2 + 12 + hock} -12 ${x + wf / 2 + 6 + hock} -26C${x + wa / 2 + 8 + hock} -50 ${x + wa / 2 + hock} -80 ${x + wa / 2 + hock} ${a}C${x + wa / 2 + 2 + hock} ${a - 60} ${x + wk / 2 + hock} ${k * .6} ${x + wk / 2 + 4 + hock} ${k}C${x + wk / 2 + 10} ${k - 40} ${x + w / 2 + 6} ${top * .78} ${x + w / 2} ${top}Z`;
+ };
+ const farFore = part(g, leg(-110, -470, 150), -110, -470), farHind = part(g, leg(300, -480, 170, 20), 300, -480);
+ const tail = part(g, 'M636 -700C664 -600 690 -470 694 -330C696 -300 690 -290 684 -300C676 -420 650 -560 616 -680ZM680 -330C664 -290 668 -230 690 -208C712 -224 718 -284 700 -334Z', 630, -700);
+ // the body: the back rising from the neck to its height behind the middle, round over the rump, the belly hanging low
+ const body = part(g, 'M-430 -1012C-300 -1010 -220 -1030 -120 -1042C0 -1056 120 -1052 240 -1028C380 -1000 500 -948 586 -858C634 -806 652 -730 652 -650C652 -580 630 -520 590 -480C520 -440 440 -426 340 -420C240 -414 140 -414 40 -432C-60 -450 -160 -470 -260 -484C-360 -500 -430 -540 -470 -620C-500 -700 -500 -880 -430 -1012Z', 0, 0);
+ const nearHind = part(g, leg(500, -560, 200, 26), 500, -560);
+ const nearFore = part(g, leg(-230, -520, 170), -230, -520);
+ // the head: the double dome high at the front, the brow, the trunk's root, the jaw; the small eye
+ const head = part(g, 'M-420 -960C-450 -1016 -510 -1046 -572 -1036C-640 -1024 -692 -966 -712 -884C-726 -820 -730 -730 -720 -664C-712 -612 -684 -580 -642 -572C-592 -562 -540 -580 -500 -620C-466 -654 -436 -704 -426 -770Z', -560, -760);
+ // the ear: a broad, ragged fan over the side of the neck (Asian: smaller than an African's)
+ const ear = part(head, 'M-560 -930C-500 -956 -430 -940 -406 -870C-392 -820 -404 -760 -440 -712C-458 -688 -470 -704 -484 -690C-506 -700 -520 -686 -540 -700C-560 -760 -574 -840 -560 -930Z', -560, -920);
+ // the trunk: seven segments hanging from the root, each a tapering card turning about its upper end; widths overlap
+ // so the joints vanish under the rim filter
+ const segs = [], L = [110, 104, 98, 92, 84, 76, 70], W = [118, 100, 86, 74, 62, 52, 44];
+ let host = head;
+ for (let i = 0; i < L.length; i++) {
+ const w0 = W[i] / 2, w1 = (W[i + 1] || 36) / 2, l = L[i];
+ const s = el('g', {}, host);
+ el('path', { d: `M${-w0} ${-w0 * .6}C${-w0} ${l * .5} ${-w1} ${l * .8} ${-w1} ${l + 10}H${w1}C${w1} ${l * .8} ${w0} ${l * .5} ${w0} ${-w0 * .6}Z`, fill: CARD }, s);
+ el('circle', { cx: 0, cy: l, r: w1 + 1, fill: CARD }, s);
+ segs.push(s); host = s;
+ }
+ el('path', { d: `M-18 ${L[6]}C-26 ${L[6] + 26} -14 ${L[6] + 46} 0 ${L[6] + 46}C14 ${L[6] + 46} 26 ${L[6] + 26} 18 ${L[6]}Z`, fill: CARD }, segs[6]);
+ const grass = el('g', { opacity: 0 }, segs[6]); // a tuft of grass the trunk carries
+ for (let i = 0; i < 11; i++) el('path', { d: `M0 ${L[6] + 34}q${-60 + i * 11} ${40 + (i % 3) * 18} ${-80 + i * 16} ${120 + (i % 4) * 18}`, stroke: CARD, 'stroke-width': 9, fill: 'none', 'stroke-linecap': 'round' }, grass);
+ const ROOT = [-694, -652]; // inside the head's outline, so the trunk's first joint never shows
+ const curl = A => segs.forEach((s, i) => s.setAttribute('transform', `${i ? `translate(0,${L[i - 1]})` : `translate(${ROOT[0]},${ROOT[1]})`} rotate(${A[i].toFixed(2)})`));
+ const ease = q => q * q * (3 - 2 * q), mix = (a, b, q) => a.map((v, i) => v + (b[i] - v) * q);
+ const DOWN = [6, 4, 3, 2, 2, 4, 8], REACH = [16, 10, 6, 4, 2, -2, -8], LIFT = [-30, -26, -22, -18, -14, -10, -8], KNEE = [-6, 22, 34, 34, 30, 22, 16], MOUTH = [22, 38, 50, 56, 54, 46, 40];
+ const keys = [[0, DOWN], [1.0, REACH], [1.4, DOWN], [1.8, LIFT], [2.1, KNEE], [2.4, LIFT], [2.7, KNEE], [3.4, MOUTH], [4.2, DOWN], [4.5, DOWN]];
+ const trunkAt = c => { for (let i = 1; i < keys.length; i++) if (c <= keys[i][0]) { const [a, A] = keys[i - 1], [b, B] = keys[i]; return mix(A, B, ease((c - a) / (b - a))); } return DOWN; };
+ function pose(t) {
+ const tt = t + phase;
+ if (act === 'graze') {
+ const c = ((tt % 4.5) + 4.5) % 4.5;
+ curl(trunkAt(c));
+ grass.setAttribute('opacity', c > .95 && c < 3.6 ? 1 : 0);
+ head.set(c > 3 && c < 4 ? 4 * Math.sin(Math.PI * (c - 3)) : 1.5 * wave(tt, .3));
+ ear.set(5 * wave(tt, .45)); tail.set(6 * wave(tt, .4));
+ nearFore.set(c > 2 && c < 2.9 ? 2 : 0); body.set(0); nearHind.set(0); farFore.set(0); farHind.set(0);
+ } else if (act === 'walk') {
+ const s = wave(tt, 1.1);
+ nearFore.set(9 * s); farHind.set(9 * s); nearHind.set(-9 * s); farFore.set(-9 * s);
+ curl(mix(DOWN, REACH, .4 + .3 * s)); head.set(2 * s); ear.set(6 * s); tail.set(8 * s); body.set(0, 0, -6 * Math.abs(s));
+ } else { curl(DOWN); head.set(0); ear.set(4 * wave(tt, .5)); tail.set(5 * wave(tt, .4)); }
+ }
+ const beats = t => { const c = (((t + phase) % 4.5) + 4.5) % 4.5; return [2.1, 2.7].map(b => t - c + b); };
+ pose(0);
+ return { g, pose, beats };
+ }
+ function hut(parent, { door = true } = {}) {
+ const g = el('g', {}, parent), ink = d => el('path', { d, fill: CARD }, g);
+ for (const x of [-330, -110, 110, 330]) ink(`M${x - 14} 0L${x - 10} -260H${x + 10}L${x + 14} 0Z`); // stilts
+ ink('M-380 -250H380V-284H-380Z'); // the platform
+ ink('M-140 -250L-40 -250L-120 -40L-150 -40ZM-150 -40H-100V-26H-150Z'); // a ladder
+ el('path', { d: 'M-340 -284V-560H340V-284Z' + (door ? 'M40 -290V-480H150V-290Z' : ''), fill: CARD, 'fill-rule': 'evenodd' }, g); // the walls, a doorway cut in them
+ let fringe = 'M-440 -520';
+ for (let x = -440; x <= 440; x += 40) fringe += `L${x + 20} ${-505 + (x / 40 % 2 ? 6 : -4)}L${x + 40} -520`;
+ ink(`${fringe}L60 -900C40 -910 20 -910 0 -904L-440 -520Z`); // the roof, its eave ragged
+ return { g, pose: () => {} };
+ }
+ return { person, officer, elephant, hut, mount, defs, boilAt, el };
+})();
diff --git a/site/shooting-an-elephant/lib/shapes.js b/site/shooting-an-elephant/lib/shapes.js
new file mode 100644
index 0000000..d0ed830
--- /dev/null
+++ b/site/shooting-an-elephant/lib/shapes.js
@@ -0,0 +1,2 @@
+// silhouettes as SVG paths (tools/shooting-an-elephant/vectorize.py)
+window.SHAPES = {"elephant": {"w": 1363, "h": 981, "d": "M552.0 978.5C534.5 978.7 501.0 978.7 485.0 977.5C469.0 976.3 461.6 973.4 456.0 971.5C450.4 969.6 451.9 968.6 451.5 966.0C451.1 963.4 451.7 960.2 453.5 956.0C455.3 951.8 460.7 945.0 462.5 941.0C464.3 937.0 459.2 938.3 464.5 932.0C469.8 925.7 488.5 909.5 494.5 903.0C500.5 896.5 499.0 897.0 500.5 893.0C502.0 889.0 503.2 883.5 503.5 879.0C503.8 874.5 504.3 872.3 502.5 866.0C500.7 859.7 494.8 848.2 492.5 841.0C490.2 833.8 491.3 840.8 488.5 823.0C485.7 805.2 479.0 755.5 475.5 734.0C472.0 712.5 469.4 701.4 467.5 694.0C465.6 686.6 472.4 684.8 464.0 689.5C455.6 694.2 427.4 714.6 417.0 722.5C406.6 730.4 404.9 732.9 401.5 737.0C398.1 741.1 397.0 743.8 396.5 747.0C396.0 750.2 396.7 752.0 398.5 756.0C400.3 760.0 404.7 764.3 407.5 771.0C410.3 777.7 413.3 790.5 415.5 796.0C417.7 801.5 418.5 798.5 420.5 804.0C422.5 809.5 424.7 822.2 427.5 829.0C430.3 835.8 436.1 841.8 437.5 845.0C438.9 848.2 436.9 848.1 436.0 848.5C435.1 848.9 433.7 846.5 432.0 847.5C430.3 848.5 427.6 853.8 426.0 854.5C424.4 855.2 425.2 856.8 422.5 852.0C419.8 847.2 414.0 837.0 409.5 826.0C405.0 815.0 398.6 793.6 395.5 786.0C392.4 778.4 392.5 780.5 391.0 780.5C389.5 780.5 387.2 784.4 386.5 786.0C385.8 787.6 385.5 784.7 386.5 790.0C387.5 795.3 390.7 811.2 392.5 818.0C394.3 824.8 393.3 823.7 397.5 831.0C401.7 838.3 413.7 854.5 417.5 862.0C421.3 869.5 420.3 871.5 420.5 876.0C420.7 880.5 421.1 884.8 418.5 889.0C415.9 893.2 413.1 896.8 405.0 901.5C396.9 906.2 382.0 913.2 370.0 917.5C358.0 921.8 343.7 925.2 333.0 927.5C322.3 929.8 314.2 930.8 306.0 931.5C297.8 932.2 289.8 932.1 284.0 931.5C278.2 930.9 273.9 930.4 271.5 928.0C269.1 925.6 269.0 920.8 269.5 917.0C270.0 913.2 273.5 909.2 274.5 905.0C275.5 900.8 273.0 899.0 275.5 892.0C278.0 885.0 286.2 873.0 289.5 863.0C292.8 853.0 294.7 841.5 295.5 832.0C296.3 822.5 295.7 816.0 294.5 806.0C293.3 796.0 289.5 783.2 288.5 772.0C287.5 760.8 287.8 749.2 288.5 739.0C289.2 728.8 293.1 717.2 292.5 711.0C291.9 704.8 286.8 703.1 285.0 701.5C283.2 699.9 283.8 702.8 282.0 701.5C280.2 700.2 275.6 694.1 274.0 693.5C272.4 692.9 273.8 696.3 272.5 698.0C271.2 699.7 267.4 702.4 266.0 703.5C264.6 704.6 265.2 705.0 264.0 704.5C262.8 704.0 260.2 700.8 259.0 700.5C257.8 700.2 256.4 701.8 256.5 703.0C256.6 704.2 259.3 706.3 259.5 708.0C259.7 709.7 257.0 710.3 257.5 713.0C258.0 715.7 261.9 721.6 262.5 724.0C263.1 726.4 262.4 728.9 261.0 727.5C259.6 726.1 256.4 717.1 254.0 715.5C251.6 713.9 246.9 715.4 246.5 718.0C246.1 720.6 251.7 728.5 251.5 731.0C251.3 733.5 246.0 731.5 245.5 733.0C245.0 734.5 248.5 736.5 248.5 740.0C248.5 743.5 245.5 751.2 245.5 754.0C245.5 756.8 248.8 755.5 248.5 757.0C248.2 758.5 244.2 761.3 243.5 763.0C242.8 764.7 244.8 766.1 244.5 767.0C244.2 767.9 244.2 770.6 242.0 768.5C239.8 766.4 233.2 756.4 231.0 754.5C228.8 752.6 228.6 754.6 228.5 757.0C228.4 759.4 230.7 766.5 230.5 769.0C230.3 771.5 227.8 770.7 227.5 772.0C227.2 773.3 228.8 775.8 228.5 777.0C228.2 778.2 226.8 779.4 226.0 779.5C225.2 779.6 226.1 776.1 224.0 777.5C221.9 778.9 215.2 784.4 213.5 788.0C211.8 791.6 214.0 796.7 213.5 799.0C213.0 801.3 210.8 798.8 210.5 802.0C210.2 805.2 211.8 814.8 211.5 818.0C211.2 821.2 208.3 817.5 208.5 821.0C208.7 824.5 212.0 830.3 212.5 839.0C213.0 847.7 211.3 865.2 211.5 873.0C211.7 880.8 213.7 883.8 213.5 886.0C213.3 888.2 211.5 888.2 210.5 886.0C209.5 883.8 208.8 875.9 207.5 873.0C206.2 870.1 205.6 868.8 203.0 868.5C200.4 868.2 194.1 871.2 192.0 871.5C189.9 871.8 190.2 870.9 190.5 870.0C190.8 869.1 193.4 867.1 193.5 866.0C193.6 864.9 192.7 863.2 191.0 863.5C189.3 863.8 184.6 865.6 183.5 868.0C182.4 870.4 185.4 868.4 184.5 878.0C183.6 887.6 179.7 925.0 178.0 925.5C176.3 926.0 176.2 893.2 174.5 881.0C172.8 868.8 168.3 858.2 167.5 852.0C166.7 845.8 170.2 847.4 169.5 844.0C168.8 840.6 164.8 831.8 163.0 831.5C161.2 831.2 159.1 838.9 158.5 842.0C157.9 845.1 159.8 848.2 159.5 850.0C159.2 851.8 156.7 852.2 156.5 853.0C156.3 853.8 158.5 853.7 158.5 855.0C158.5 856.3 158.0 858.5 156.5 861.0C155.0 863.5 150.2 866.7 149.5 870.0C148.8 873.3 153.3 878.3 152.5 881.0C151.7 883.7 146.4 883.8 144.5 886.0C142.6 888.2 142.0 893.3 141.0 894.5C140.0 895.7 139.2 895.6 138.5 893.0C137.8 890.4 137.7 882.0 136.5 879.0C135.3 876.0 132.0 876.0 131.5 875.0C131.0 874.0 133.8 875.7 133.5 873.0C133.2 870.3 130.6 861.8 129.5 859.0C128.4 856.2 128.8 855.2 127.0 856.5C125.2 857.8 121.1 859.8 118.5 867.0C115.9 874.2 113.5 887.7 111.5 900.0C109.5 912.3 107.8 934.2 106.5 941.0C105.2 947.8 103.5 949.5 103.5 941.0C103.5 932.5 105.2 902.3 106.5 890.0C107.8 877.7 110.5 877.7 111.5 867.0C112.5 856.3 112.0 833.3 112.5 826.0C113.0 818.7 115.1 824.6 114.5 823.0C113.9 821.4 110.7 816.2 109.0 816.5C107.3 816.8 104.8 822.9 104.5 825.0C104.2 827.1 107.8 827.2 107.5 829.0C107.2 830.8 103.0 828.0 102.5 836.0C102.0 844.0 104.6 869.9 104.5 877.0C104.4 884.1 102.8 878.7 102.0 878.5C101.2 878.3 100.4 878.9 99.5 876.0C98.6 873.1 97.4 863.9 96.5 861.0C95.6 858.1 94.9 858.4 94.0 858.5C93.1 858.6 92.2 862.0 91.0 861.5C89.8 861.0 88.2 856.0 87.0 855.5C85.8 855.0 84.8 858.2 84.0 858.5C83.2 858.8 82.8 859.6 82.5 857.0C82.2 854.4 82.9 845.8 82.5 843.0C82.1 840.2 81.2 840.2 80.0 840.5C78.8 840.8 76.1 844.1 75.0 844.5C73.9 844.9 73.1 845.2 73.5 843.0C73.9 840.8 77.3 834.3 77.5 831.0C77.7 827.7 74.3 825.7 74.5 823.0C74.7 820.3 77.5 819.8 78.5 815.0C79.5 810.2 81.2 798.1 80.5 794.0C79.8 789.9 75.9 789.9 74.0 790.5C72.1 791.1 70.1 796.6 69.0 797.5C67.9 798.4 66.9 797.9 67.5 796.0C68.1 794.1 72.3 788.5 72.5 786.0C72.7 783.5 68.8 782.4 68.5 781.0C68.2 779.6 70.1 777.8 71.0 777.5C71.9 777.2 72.9 779.8 74.0 779.5C75.1 779.2 77.2 777.9 77.5 776.0C77.8 774.1 76.5 770.0 75.5 768.0C74.5 766.0 70.0 768.2 71.5 764.0C73.0 759.8 82.8 746.9 84.5 743.0C86.2 739.1 85.9 737.1 82.0 740.5C78.1 743.9 64.8 759.9 61.0 763.5C57.2 767.1 54.8 768.6 59.5 762.0C64.2 755.4 84.9 730.8 89.5 724.0C94.1 717.2 88.2 721.6 87.0 721.5C85.8 721.4 83.4 722.1 82.0 723.5C80.6 724.9 79.5 728.5 78.5 730.0C77.5 731.5 76.7 732.3 76.0 732.5C75.3 732.7 74.4 732.2 74.5 731.0C74.6 729.8 75.2 726.8 76.5 725.0C77.8 723.2 80.0 723.2 82.5 720.0C85.0 716.8 90.8 709.0 91.5 706.0C92.2 703.0 85.8 704.3 86.5 702.0C87.2 699.7 92.8 696.3 95.5 692.0C98.2 687.7 105.9 681.9 102.5 676.0C99.1 670.1 82.8 663.0 75.0 656.5C67.2 650.0 63.2 646.9 55.5 637.0C47.8 627.1 36.2 611.7 28.5 597.0C20.8 582.3 13.8 563.3 9.5 549.0C5.2 534.7 3.8 523.5 2.5 511.0C1.2 498.5 -0.2 491.0 1.5 474.0C3.2 457.0 4.7 438.2 12.5 409.0C20.3 379.8 40.2 329.3 48.5 299.0C56.8 268.7 58.3 242.8 62.5 227.0C66.7 211.2 66.0 215.5 73.5 204.0C81.0 192.5 98.3 175.8 107.5 158.0C116.7 140.2 123.7 109.8 128.5 97.0C133.3 84.2 126.9 91.9 136.5 81.0C146.1 70.1 175.1 41.2 186.0 31.5C196.9 21.8 196.0 25.2 202.0 22.5C208.0 19.8 214.3 17.0 222.0 15.5C229.7 14.0 239.7 13.2 248.0 13.5C256.3 13.8 256.2 13.7 272.0 17.5C287.8 21.3 326.0 32.7 343.0 36.5C360.0 40.3 367.7 40.2 374.0 40.5C380.3 40.8 376.2 38.5 381.0 38.5C385.8 38.5 391.0 41.5 403.0 40.5C415.0 39.5 435.2 36.5 453.0 32.5C470.8 28.5 485.3 19.3 510.0 16.5C534.7 13.7 570.7 17.5 601.0 15.5C631.3 13.5 664.8 6.8 692.0 4.5C719.2 2.2 746.7 1.7 764.0 1.5C781.3 1.3 784.3 2.2 796.0 3.5C807.7 4.8 814.7 5.5 834.0 9.5C853.3 13.5 892.2 23.5 912.0 27.5C931.8 31.5 940.0 30.8 953.0 33.5C966.0 36.2 974.2 38.3 990.0 43.5C1005.8 48.7 1032.3 58.3 1048.0 64.5C1063.7 70.7 1071.3 74.2 1084.0 80.5C1096.7 86.8 1108.7 91.8 1124.0 102.5C1139.3 113.2 1161.1 131.1 1176.0 144.5C1190.9 157.9 1204.9 173.4 1213.5 183.0C1222.1 192.6 1220.5 190.2 1227.5 202.0C1234.5 213.8 1248.5 239.0 1255.5 254.0C1262.5 269.0 1265.7 280.0 1269.5 292.0C1273.3 304.0 1275.7 311.7 1278.5 326.0C1281.3 340.3 1282.7 339.8 1286.5 378.0C1290.3 416.2 1296.8 509.5 1301.5 555.0C1306.2 600.5 1310.7 626.8 1314.5 651.0C1318.3 675.2 1319.5 686.7 1324.5 700.0C1329.5 713.3 1339.7 722.5 1344.5 731.0C1349.3 739.5 1352.0 745.8 1353.5 751.0C1355.0 756.2 1352.8 758.3 1353.5 762.0C1354.2 765.7 1357.0 763.3 1357.5 773.0C1358.0 782.7 1356.2 811.7 1356.5 820.0C1356.8 828.3 1359.3 821.2 1359.5 823.0C1359.7 824.8 1357.3 829.0 1357.5 831.0C1357.7 833.0 1360.0 831.2 1360.5 835.0C1361.0 838.8 1361.4 849.8 1360.5 854.0C1359.6 858.2 1358.8 862.5 1355.0 860.5C1351.2 858.5 1343.6 849.9 1337.5 842.0C1331.4 834.1 1323.0 821.3 1318.5 813.0C1314.0 804.7 1312.8 797.0 1310.5 792.0C1308.2 787.0 1306.3 787.3 1304.5 783.0C1302.7 778.7 1300.8 773.0 1299.5 766.0C1298.2 759.0 1297.0 754.3 1296.5 741.0C1296.0 727.7 1295.7 696.7 1296.5 686.0C1297.3 675.3 1308.0 718.2 1301.5 677.0C1295.0 635.8 1265.4 479.9 1257.5 439.0C1249.6 398.1 1255.0 432.3 1254.0 431.5C1253.0 430.7 1252.2 429.6 1251.5 434.0C1250.8 438.4 1249.8 448.0 1249.5 458.0C1249.2 468.0 1248.7 481.0 1249.5 494.0C1250.3 507.0 1253.3 520.8 1254.5 536.0C1255.7 551.2 1256.3 570.3 1256.5 585.0C1256.7 599.7 1256.3 612.0 1255.5 624.0C1254.7 636.0 1251.8 646.0 1251.5 657.0C1251.2 668.0 1251.8 677.2 1253.5 690.0C1255.2 702.8 1258.5 720.3 1261.5 734.0C1264.5 747.7 1265.8 753.7 1271.5 772.0C1277.2 790.3 1291.3 825.2 1295.5 844.0C1299.7 862.8 1294.3 870.5 1296.5 885.0C1298.7 899.5 1306.5 921.5 1308.5 931.0C1310.5 940.5 1309.2 937.8 1308.5 942.0C1307.8 946.2 1306.6 951.9 1304.5 956.0C1302.4 960.1 1298.8 964.2 1296.0 966.5C1293.2 968.8 1296.0 968.2 1288.0 969.5C1280.0 970.8 1267.0 973.7 1248.0 974.5C1229.0 975.3 1190.8 975.2 1174.0 974.5C1157.2 973.8 1153.1 971.9 1147.0 970.5C1140.9 969.1 1139.1 968.4 1137.5 966.0C1135.9 963.6 1136.3 960.0 1137.5 956.0C1138.7 952.0 1143.2 945.7 1144.5 942.0C1145.8 938.3 1142.2 939.3 1145.5 934.0C1148.8 928.7 1160.2 916.5 1164.5 910.0C1168.8 903.5 1170.0 899.7 1171.5 895.0C1173.0 890.3 1173.3 890.5 1173.5 882.0C1173.7 873.5 1174.0 860.2 1172.5 844.0C1171.0 827.8 1167.8 802.8 1164.5 785.0C1161.2 767.2 1157.2 750.3 1152.5 737.0C1147.8 723.7 1140.9 712.6 1136.5 705.0C1132.1 697.4 1130.8 696.2 1126.0 691.5C1121.2 686.8 1113.4 673.9 1108.0 676.5C1102.6 679.1 1098.6 691.4 1093.5 707.0C1088.4 722.6 1081.3 750.2 1077.5 770.0C1073.7 789.8 1071.7 809.8 1070.5 826.0C1069.3 842.2 1072.0 854.7 1070.5 867.0C1069.0 879.3 1062.2 889.3 1061.5 900.0C1060.8 910.7 1067.0 921.7 1066.5 931.0C1066.0 940.3 1060.9 950.8 1058.5 956.0C1056.1 961.2 1054.8 960.9 1052.0 962.5C1049.2 964.1 1050.3 964.5 1042.0 965.5C1033.7 966.5 1020.3 968.2 1002.0 968.5C983.7 968.8 947.7 968.0 932.0 967.5C916.3 967.0 915.2 966.7 908.0 965.5C900.8 964.3 892.9 962.2 889.0 960.5C885.1 958.8 885.2 956.6 884.5 955.0C883.8 953.4 882.7 956.5 884.5 951.0C886.3 945.5 889.2 931.7 895.5 922.0C901.8 912.3 914.7 903.5 922.5 893.0C930.3 882.5 933.7 882.7 942.5 859.0C951.3 835.3 969.0 774.2 975.5 751.0C982.0 727.8 980.3 728.7 981.5 720.0C982.7 711.3 983.0 706.8 982.5 699.0C982.0 691.2 980.8 680.7 978.5 673.0C976.2 665.3 973.3 660.3 968.5 653.0C963.7 645.7 954.7 636.5 949.5 629.0C944.3 621.5 941.2 612.9 937.5 608.0C933.8 603.1 930.8 601.2 927.0 599.5C923.2 597.8 927.5 597.5 915.0 597.5C902.5 597.5 872.5 600.3 852.0 599.5C831.5 598.7 808.7 595.2 792.0 592.5C775.3 589.8 773.7 589.7 752.0 583.5C730.3 577.3 681.5 560.7 662.0 555.5C642.5 550.3 640.1 552.2 635.0 552.5C629.9 552.8 633.1 552.2 631.5 557.0C629.9 561.8 629.3 572.5 625.5 581.0C621.7 589.5 612.0 600.2 608.5 608.0C605.0 615.8 605.7 616.3 604.5 628.0C603.3 639.7 601.8 635.8 601.5 678.0C601.2 720.2 601.7 844.2 602.5 881.0C603.3 917.8 603.0 890.8 606.5 899.0C610.0 907.2 620.2 921.2 623.5 930.0C626.8 938.8 626.7 946.2 626.5 952.0C626.3 957.8 624.2 961.8 622.5 965.0C620.8 968.2 621.4 969.6 616.0 971.5C610.6 973.4 600.7 975.3 590.0 976.5C579.3 977.7 569.5 978.3 552.0 978.5ZM313.5 667.0C327.5 654.2 364.0 594.0 377.5 573.0C391.0 552.0 390.2 554.3 394.5 541.0C398.8 527.7 402.0 504.8 403.5 493.0C405.0 481.2 404.8 476.2 403.5 470.0C402.2 463.8 398.4 459.6 395.5 456.0C392.6 452.4 389.8 450.4 386.0 448.5C382.2 446.6 381.2 450.5 373.0 444.5C364.8 438.5 345.2 418.2 337.0 412.5C328.8 406.8 328.5 409.2 324.0 410.5C319.5 411.8 318.7 416.2 310.0 420.5C301.3 424.8 281.5 432.8 272.0 436.5C262.5 440.2 264.3 440.0 253.0 442.5C241.7 445.0 214.6 447.8 204.0 451.5C193.4 455.2 195.2 456.9 189.5 465.0C183.8 473.1 172.8 493.0 169.5 500.0C166.2 507.0 168.8 505.1 169.5 507.0C170.2 508.9 172.4 511.2 174.0 511.5C175.6 511.8 177.0 507.3 179.0 508.5C181.0 509.7 183.8 517.3 186.0 518.5C188.2 519.7 190.8 515.8 192.0 515.5C193.2 515.2 193.6 516.1 193.5 517.0C193.4 517.9 191.2 519.8 191.5 521.0C191.8 522.2 192.6 523.8 195.0 524.5C197.4 525.2 203.0 525.8 206.0 525.5C209.0 525.2 211.0 521.3 213.0 522.5C215.0 523.7 216.0 531.7 218.0 532.5C220.0 533.3 223.4 527.9 225.0 527.5C226.6 527.1 227.6 529.1 227.5 530.0C227.4 530.9 224.6 531.9 224.5 533.0C224.4 534.1 224.8 536.2 227.0 536.5C229.2 536.8 235.7 534.3 238.0 534.5C240.3 534.7 238.8 537.0 241.0 537.5C243.2 538.0 248.8 536.6 251.0 537.5C253.2 538.4 254.6 541.4 254.5 543.0C254.4 544.6 250.8 545.9 250.5 547.0C250.2 548.1 252.0 549.7 253.0 549.5C254.0 549.3 256.2 546.9 256.5 546.0C256.8 545.1 254.6 544.6 254.5 544.0C254.4 543.4 254.7 542.5 256.0 542.5C257.3 542.5 262.1 542.9 262.5 544.0C262.9 545.1 256.8 546.8 258.5 549.0C260.2 551.2 270.0 555.2 272.5 557.0C275.0 558.8 274.0 558.8 273.5 560.0C273.0 561.2 267.8 562.5 269.5 564.0C271.2 565.5 281.3 567.2 283.5 569.0C285.7 570.8 283.5 573.2 282.5 575.0C281.5 576.8 276.2 577.8 277.5 580.0C278.8 582.2 289.7 585.5 290.5 588.0C291.3 590.5 282.5 592.5 282.5 595.0C282.5 597.5 289.7 601.0 290.5 603.0C291.3 605.0 287.3 605.7 287.5 607.0C287.7 608.3 291.7 609.8 291.5 611.0C291.3 612.2 286.7 612.8 286.5 614.0C286.3 615.2 290.9 616.1 290.5 618.0C290.1 619.9 285.6 624.4 284.0 625.5C282.4 626.6 281.9 624.1 281.0 624.5C280.1 624.9 278.1 626.9 278.5 628.0C278.9 629.1 280.8 627.7 283.5 631.0C286.2 634.3 292.8 644.8 294.5 648.0C296.2 651.2 290.3 646.8 293.5 650.0C296.7 653.2 299.5 679.8 313.5 667.0ZM132.5 556.0C134.8 555.8 137.8 555.2 138.5 553.0C139.2 550.8 136.0 545.8 136.5 543.0C137.0 540.2 140.2 537.4 141.5 536.0C142.8 534.6 143.2 533.8 144.0 534.5C144.8 535.2 145.2 539.9 146.0 540.5C146.8 541.1 148.6 539.1 148.5 538.0C148.4 536.9 144.5 535.7 145.5 534.0C146.5 532.3 153.3 529.3 154.5 528.0C155.7 526.7 152.5 526.8 152.5 526.0C152.5 525.2 154.3 524.7 154.5 523.0C154.7 521.3 155.0 518.5 153.5 516.0C152.0 513.5 147.2 510.3 145.5 508.0C143.8 505.7 143.8 510.7 143.5 502.0C143.2 493.3 143.7 465.2 143.5 456.0C143.3 446.8 143.1 448.9 142.5 447.0C141.9 445.1 142.2 442.0 140.0 444.5C137.8 447.0 132.9 455.1 129.5 462.0C126.1 468.9 122.2 476.3 119.5 486.0C116.8 495.7 114.0 508.7 113.5 520.0C113.0 531.3 115.6 547.9 116.5 554.0C117.4 560.1 117.6 556.4 119.0 556.5C120.4 556.6 122.8 554.6 125.0 554.5C127.2 554.4 130.2 556.2 132.5 556.0ZM121.5 567.0C123.3 567.0 127.8 562.4 128.5 561.0C129.2 559.6 126.9 558.4 126.0 558.5C125.1 558.6 124.0 561.5 123.0 561.5C122.0 561.5 120.9 558.6 120.0 558.5C119.1 558.4 117.2 559.6 117.5 561.0C117.8 562.4 119.7 567.0 121.5 567.0ZM297.5 668.0C299.0 668.3 301.1 663.9 300.5 662.0C299.9 660.1 295.5 656.8 294.0 656.5C292.5 656.2 290.9 658.1 291.5 660.0C292.1 661.9 296.0 667.7 297.5 668.0ZM306.5 674.0C308.0 674.2 310.1 670.4 309.5 669.0C308.9 667.6 304.5 665.7 303.0 665.5C301.5 665.3 299.9 666.6 300.5 668.0C301.1 669.4 305.0 673.8 306.5 674.0ZM301.5 684.0C303.3 684.3 306.4 681.8 305.5 680.0C304.6 678.2 297.8 673.8 296.0 673.5C294.2 673.2 293.6 676.2 294.5 678.0C295.4 679.8 299.7 683.7 301.5 684.0ZM296.5 695.0C298.0 695.3 300.1 691.8 299.5 690.0C298.9 688.2 294.5 684.8 293.0 684.5C291.5 684.2 289.9 686.2 290.5 688.0C291.1 689.8 295.0 694.7 296.5 695.0ZM292.5 705.0C294.0 705.3 296.1 702.1 295.5 700.0C294.9 697.9 290.5 692.8 289.0 692.5C287.5 692.2 285.9 695.9 286.5 698.0C287.1 700.1 291.0 704.7 292.5 705.0ZM35.0 736.5C32.5 738.2 31.7 737.3 33.5 735.0C35.3 732.7 43.5 724.2 46.0 722.5C48.5 720.8 50.3 722.7 48.5 725.0C46.7 727.3 37.5 734.8 35.0 736.5ZM21.0 751.5C19.2 753.0 19.4 750.8 19.5 750.0C19.6 749.2 19.9 748.8 21.5 747.0C23.1 745.2 27.5 740.5 29.0 739.5C30.5 738.5 31.8 739.0 30.5 741.0C29.2 743.0 22.8 750.0 21.0 751.5ZM410.5 810.0C412.0 810.2 415.1 807.2 415.5 806.0C415.9 804.8 414.5 802.7 413.0 802.5C411.5 802.3 406.9 803.8 406.5 805.0C406.1 806.2 409.0 809.8 410.5 810.0ZM428.5 845.0C429.7 845.0 430.9 843.2 430.5 842.0C430.1 840.8 427.2 837.5 426.0 837.5C424.8 837.5 423.1 840.8 423.5 842.0C423.9 843.2 427.3 845.0 428.5 845.0ZM165.0 915.5C163.8 914.0 160.0 905.5 159.5 903.0C159.0 900.5 160.8 899.0 162.0 900.5C163.2 902.0 166.0 909.5 166.5 912.0C167.0 914.5 166.2 917.0 165.0 915.5Z"}, "man0": {"w": 259, "h": 478, "d": "M47.0 475.5C41.8 475.7 34.0 476.0 27.0 473.5C20.0 471.0 9.2 463.4 5.0 460.5C0.8 457.6 -0.2 461.2 1.5 456.0C3.2 450.8 12.5 436.2 15.5 429.0C18.5 421.8 19.3 417.5 19.5 413.0C19.7 408.5 15.7 412.2 16.5 402.0C17.3 391.8 21.5 366.3 24.5 352.0C27.5 337.7 32.5 333.7 34.5 316.0C36.5 298.3 35.2 263.5 36.5 246.0C37.8 228.5 41.9 217.6 42.5 211.0C43.1 204.4 46.5 212.2 40.0 206.5C33.5 200.8 9.9 183.2 3.5 177.0C-2.9 170.8 1.5 172.2 1.5 169.0C1.5 165.8 2.2 161.5 3.5 158.0C4.8 154.5 6.0 157.5 9.5 148.0C13.0 138.5 20.4 110.4 24.5 101.0C28.6 91.6 29.8 94.8 34.0 91.5C38.2 88.2 45.6 85.2 50.0 81.5C54.4 77.8 61.8 75.1 60.5 69.0C59.2 62.9 45.8 52.3 42.5 45.0C39.2 37.7 40.2 29.7 40.5 25.0C40.8 20.3 42.2 19.9 44.5 17.0C46.8 14.1 50.9 9.8 54.0 7.5C57.1 5.2 59.8 4.5 63.0 3.5C66.2 2.5 68.0 1.7 73.0 1.5C78.0 1.3 87.8 1.2 93.0 2.5C98.2 3.8 102.1 7.1 104.5 9.0C106.9 10.9 108.0 11.3 107.5 14.0C107.0 16.7 102.0 21.5 101.5 25.0C101.0 28.5 102.8 32.0 104.5 35.0C106.2 38.0 111.7 39.5 111.5 43.0C111.3 46.5 104.8 51.5 103.5 56.0C102.2 60.5 104.1 67.1 103.5 70.0C102.9 72.9 102.1 72.9 100.0 73.5C97.9 74.1 92.9 73.1 91.0 73.5C89.1 73.9 88.5 75.0 88.5 76.0C88.5 77.0 84.4 79.4 91.0 79.5C97.6 79.6 117.5 78.5 128.0 76.5C138.5 74.5 148.5 68.8 154.0 67.5C159.5 66.2 154.7 69.8 161.0 68.5C167.3 67.2 181.0 63.0 192.0 59.5C203.0 56.0 216.5 49.5 227.0 47.5C237.5 45.5 250.3 46.8 255.0 47.5C259.7 48.2 256.5 50.7 255.0 51.5C253.5 52.3 248.4 51.8 246.0 52.5C243.6 53.2 241.2 53.9 240.5 56.0C239.8 58.1 242.9 62.1 241.5 65.0C240.1 67.9 237.6 72.9 232.0 73.5C226.4 74.1 218.3 65.8 208.0 68.5C197.7 71.2 177.7 84.5 170.0 89.5C162.3 94.5 166.0 96.3 162.0 98.5C158.0 100.7 153.2 100.0 146.0 102.5C138.8 105.0 124.8 110.8 119.0 113.5C113.2 116.2 112.8 109.9 111.5 119.0C110.2 128.1 110.8 155.3 111.5 168.0C112.2 180.7 115.0 189.0 115.5 195.0C116.0 201.0 113.0 194.2 114.5 204.0C116.0 213.8 122.0 232.3 124.5 254.0C127.0 275.7 128.7 308.0 129.5 334.0C130.3 360.0 132.2 396.0 129.5 410.0C126.8 424.0 116.2 414.7 113.5 418.0C110.8 421.3 111.2 426.2 113.5 430.0C115.8 433.8 120.9 437.4 127.0 440.5C133.1 443.6 145.4 446.4 150.0 448.5C154.6 450.6 153.8 451.4 154.5 453.0C155.2 454.6 155.8 456.4 154.5 458.0C153.2 459.6 157.8 462.4 147.0 462.5C136.2 462.6 100.1 459.8 90.0 458.5C79.9 457.2 87.1 456.2 86.5 455.0C85.9 453.8 85.3 455.5 86.5 451.0C87.7 446.5 92.8 432.9 93.5 428.0C94.2 423.1 93.2 422.4 91.0 421.5C88.8 420.6 82.3 422.8 80.0 422.5C77.7 422.2 79.0 419.8 77.0 419.5C75.0 419.2 74.0 421.2 68.0 420.5C62.0 419.8 46.4 414.9 41.0 415.5C35.6 416.1 36.6 420.1 35.5 424.0C34.4 427.9 30.2 431.8 34.5 439.0C38.8 446.2 57.6 461.4 61.5 467.0C65.4 472.6 60.4 471.1 58.0 472.5C55.6 473.9 52.2 475.3 47.0 475.5ZM46.5 188.0C48.8 190.0 48.7 187.3 48.5 186.0C48.3 184.7 45.8 183.2 45.5 180.0C45.2 176.8 47.2 170.9 46.5 167.0C45.8 163.1 43.0 155.3 41.0 156.5C39.0 157.7 33.6 168.8 34.5 174.0C35.4 179.2 44.2 186.0 46.5 188.0Z"}, "man1": {"w": 194, "h": 400, "d": "M49.0 397.5C43.2 397.3 35.0 395.7 28.0 393.5C21.0 391.3 10.9 386.6 7.0 384.5C3.1 382.4 2.9 386.9 4.5 381.0C6.1 375.1 14.5 355.5 16.5 349.0C18.5 342.5 17.5 343.8 16.5 342.0C15.5 340.2 11.5 342.2 10.5 338.0C9.5 333.8 9.5 328.3 10.5 317.0C11.5 305.7 15.3 283.0 16.5 270.0C17.7 257.0 19.8 254.8 17.5 239.0C15.2 223.2 4.8 190.3 2.5 175.0C0.2 159.7 2.2 154.7 3.5 147.0C4.8 139.3 7.3 134.8 10.5 129.0C13.7 123.2 20.2 116.8 22.5 112.0C24.8 107.2 16.8 109.1 24.5 100.0C32.2 90.9 58.6 66.2 69.0 57.5C79.4 48.8 78.3 49.3 87.0 47.5C95.7 45.7 114.9 47.1 121.0 46.5C127.1 45.9 123.4 45.6 123.5 44.0C123.6 42.4 121.7 40.8 121.5 37.0C121.3 33.2 120.9 25.8 122.5 21.0C124.1 16.2 127.6 11.8 131.0 8.5C134.4 5.2 138.2 2.7 143.0 1.5C147.8 0.3 154.8 0.8 160.0 1.5C165.2 2.2 168.8 2.4 174.0 5.5C179.2 8.6 188.6 16.1 191.5 20.0C194.4 23.9 192.8 26.5 191.5 29.0C190.2 31.5 185.2 31.2 183.5 35.0C181.8 38.8 181.3 47.8 181.5 52.0C181.7 56.2 186.3 56.7 184.5 60.0C182.7 63.3 172.8 69.5 170.5 72.0C168.2 74.5 172.0 73.0 170.5 75.0C169.0 77.0 163.3 81.0 161.5 84.0C159.7 87.0 162.8 86.2 159.5 93.0C156.2 99.8 145.7 116.3 141.5 125.0C137.3 133.7 136.8 140.7 134.5 145.0C132.2 149.3 131.7 142.7 127.5 151.0C123.3 159.3 110.7 184.0 109.5 195.0C108.3 206.0 118.7 210.7 120.5 217.0C122.3 223.3 121.0 229.7 120.5 233.0C120.0 236.3 118.2 220.0 117.5 237.0C116.8 254.0 119.4 317.6 116.5 335.0C113.6 352.4 103.3 339.0 100.0 341.5C96.7 344.0 95.5 347.2 96.5 350.0C97.5 352.8 99.9 355.4 106.0 358.5C112.1 361.6 127.8 365.4 133.0 368.5C138.2 371.6 138.3 374.7 137.5 377.0C136.7 379.3 138.9 382.2 128.0 382.5C117.1 382.8 82.1 379.8 72.0 378.5C61.9 377.2 67.2 378.8 67.5 375.0C67.8 371.2 72.9 360.1 73.5 356.0C74.1 351.9 76.8 351.9 71.0 350.5C65.2 349.1 44.9 347.2 39.0 347.5C33.1 347.8 36.1 349.8 35.5 352.0C34.9 354.2 33.2 357.6 35.5 361.0C37.8 364.4 44.6 369.4 49.0 372.5C53.4 375.6 58.8 376.9 62.0 379.5C65.2 382.1 67.4 386.1 68.5 388.0C69.6 389.9 69.4 389.9 68.5 391.0C67.6 392.1 66.2 393.4 63.0 394.5C59.8 395.6 54.8 397.7 49.0 397.5ZM96.5 185.0C99.2 181.8 101.3 162.5 103.5 155.0C105.7 147.5 108.8 143.0 109.5 140.0C110.2 137.0 107.7 138.5 107.5 137.0C107.3 135.5 108.8 132.4 108.5 131.0C108.2 129.6 109.5 126.2 106.0 128.5C102.5 130.8 91.4 139.8 87.5 145.0C83.6 150.2 82.5 155.2 82.5 160.0C82.5 164.8 85.2 169.8 87.5 174.0C89.8 178.2 93.8 188.2 96.5 185.0Z"}, "man2": {"w": 163, "h": 488, "d": "M52.0 485.5C47.2 485.8 41.0 486.7 34.0 484.5C27.0 482.3 14.8 475.2 10.0 472.5C5.2 469.8 6.2 469.6 5.5 468.0C4.8 466.4 3.8 466.5 5.5 463.0C7.2 459.5 12.5 453.3 15.5 447.0C18.5 440.7 22.5 429.7 23.5 425.0C24.5 420.3 21.7 421.8 21.5 419.0C21.3 416.2 20.7 417.5 22.5 408.0C24.3 398.5 28.8 375.5 32.5 362.0C36.2 348.5 42.2 337.5 44.5 327.0C46.8 316.5 46.2 306.5 46.5 299.0C46.8 291.5 47.3 286.3 46.5 282.0C45.7 277.7 42.2 279.5 41.5 273.0C40.8 266.5 44.3 254.8 42.5 243.0C40.7 231.2 32.8 212.2 30.5 202.0C28.2 191.8 29.8 186.8 28.5 182.0C27.2 177.2 23.3 179.0 22.5 173.0C21.7 167.0 23.8 153.5 23.5 146.0C23.2 138.5 21.0 134.7 20.5 128.0C20.0 121.3 19.7 111.3 20.5 106.0C21.3 100.7 22.5 99.8 25.5 96.0C28.5 92.2 35.8 86.7 38.5 83.0C41.2 79.3 41.4 75.9 41.5 74.0C41.6 72.1 42.6 72.2 39.0 71.5C35.4 70.8 24.2 70.5 20.0 69.5C15.8 68.5 16.6 67.9 14.0 65.5C11.4 63.1 6.6 58.1 4.5 55.0C2.4 51.9 2.0 50.5 1.5 47.0C1.0 43.5 -0.2 39.2 1.5 34.0C3.2 28.8 8.6 20.6 11.5 16.0C14.4 11.4 15.9 8.9 19.0 6.5C22.1 4.1 26.8 1.2 30.0 1.5C33.2 1.8 35.0 7.2 38.0 8.5C41.0 9.8 45.2 8.7 48.0 9.5C50.8 10.3 51.8 12.8 55.0 13.5C58.2 14.2 64.6 13.1 67.0 13.5C69.4 13.9 69.2 14.9 69.5 16.0C69.8 17.1 67.8 18.3 68.5 20.0C69.2 21.7 73.0 23.5 73.5 26.0C74.0 28.5 71.4 33.1 71.5 35.0C71.6 36.9 72.9 37.2 74.0 37.5C75.1 37.8 76.6 35.2 78.0 36.5C79.4 37.8 81.9 42.6 82.5 45.0C83.1 47.4 83.3 48.3 81.5 51.0C79.7 53.7 73.0 58.0 71.5 61.0C70.0 64.0 70.9 66.6 72.5 69.0C74.1 71.4 77.2 73.6 81.0 75.5C84.8 77.4 91.1 78.1 95.0 80.5C98.9 82.9 101.1 80.9 104.5 90.0C107.9 99.1 112.8 126.3 115.5 135.0C118.2 143.7 119.2 138.7 120.5 142.0C121.8 145.3 123.3 151.0 123.5 155.0C123.7 159.0 120.8 161.3 121.5 166.0C122.2 170.7 125.7 175.5 127.5 183.0C129.3 190.5 129.3 200.5 132.5 211.0C135.7 221.5 144.5 238.2 146.5 246.0C148.5 253.8 146.0 254.5 144.5 258.0C143.0 261.5 138.2 257.0 137.5 267.0C136.8 277.0 140.2 292.3 140.5 318.0C140.8 343.7 140.2 403.1 139.5 421.0C138.8 438.9 138.6 424.4 136.0 425.5C133.4 426.6 126.8 426.1 124.0 427.5C121.2 428.9 120.2 432.1 119.5 434.0C118.8 435.9 117.4 436.4 119.5 439.0C121.6 441.6 126.9 446.8 132.0 449.5C137.1 452.2 145.2 453.2 150.0 455.5C154.8 457.8 158.8 461.1 160.5 463.0C162.2 464.9 162.1 465.4 160.5 467.0C158.9 468.6 161.8 472.2 151.0 472.5C140.2 472.8 106.1 469.9 96.0 468.5C85.9 467.1 90.2 468.2 90.5 464.0C90.8 459.8 96.8 447.6 97.5 443.0C98.2 438.4 99.8 437.9 95.0 436.5C90.2 435.1 77.3 435.8 69.0 434.5C60.7 433.2 50.1 427.6 45.0 428.5C39.9 429.4 39.6 436.6 38.5 440.0C37.4 443.4 33.8 442.8 38.5 449.0C43.2 455.2 62.4 471.4 66.5 477.0C70.6 482.6 65.4 481.1 63.0 482.5C60.6 483.9 56.8 485.2 52.0 485.5ZM56.5 209.0C57.5 208.7 59.0 208.0 59.5 205.0C60.0 202.0 60.6 195.6 59.5 191.0C58.4 186.4 54.5 179.3 53.0 177.5C51.5 175.7 50.9 178.2 50.5 180.0C50.1 181.8 50.0 183.5 50.5 188.0C51.0 192.5 52.5 203.5 53.5 207.0C54.5 210.5 55.5 209.3 56.5 209.0Z"}, "man3": {"w": 268, "h": 558, "d": "M98.0 555.5C92.6 556.2 85.8 555.2 82.0 554.5C78.2 553.8 78.1 553.9 75.0 551.5C71.9 549.1 65.6 543.1 63.5 540.0C61.4 536.9 61.2 536.7 62.5 533.0C63.8 529.3 69.0 524.0 71.5 518.0C74.0 512.0 77.0 501.7 77.5 497.0C78.0 492.3 74.8 495.5 74.5 490.0C74.2 484.5 73.5 481.0 75.5 464.0C77.5 447.0 83.8 415.2 86.5 388.0C89.2 360.8 88.8 322.3 91.5 301.0C94.2 279.7 101.2 267.8 102.5 260.0C103.8 252.2 99.8 258.0 99.5 254.0C99.2 250.0 102.2 247.0 100.5 236.0C98.8 225.0 97.2 204.7 89.5 188.0C81.8 171.3 60.2 146.5 54.5 136.0C48.8 125.5 57.5 130.7 55.5 125.0C53.5 119.3 47.3 113.7 42.5 102.0C37.7 90.3 30.5 64.0 26.5 55.0C22.5 46.0 20.5 50.7 18.5 48.0C16.5 45.3 17.3 43.2 14.5 39.0C11.7 34.8 3.1 25.9 1.5 23.0C-0.1 20.1 3.8 21.1 5.0 21.5C6.2 21.9 7.9 25.2 9.0 25.5C10.1 25.8 11.9 24.6 11.5 23.0C11.1 21.4 7.3 17.8 6.5 16.0C5.7 14.2 5.9 12.9 6.5 12.0C7.1 11.1 8.8 10.1 10.0 10.5C11.2 10.9 13.1 14.1 14.0 14.5C14.9 14.9 15.6 14.2 15.5 13.0C15.4 11.8 13.6 8.6 13.5 7.0C13.4 5.4 13.8 3.5 15.0 3.5C16.2 3.5 18.8 5.2 20.5 7.0C22.2 8.8 23.8 13.7 25.0 14.5C26.2 15.3 27.2 13.8 27.5 12.0C27.8 10.2 26.2 5.8 26.5 4.0C26.8 2.2 27.5 -1.2 29.0 1.5C30.5 4.2 33.5 15.7 35.5 20.0C37.5 24.3 38.8 27.9 41.0 27.5C43.2 27.1 46.9 18.9 49.0 17.5C51.1 16.1 53.4 17.2 53.5 19.0C53.6 20.8 50.3 24.7 49.5 28.0C48.7 31.3 49.5 35.7 48.5 39.0C47.5 42.3 44.0 45.0 43.5 48.0C43.0 51.0 41.0 47.3 45.5 57.0C50.0 66.7 64.5 96.5 70.5 106.0C76.5 115.5 77.2 108.7 81.5 114.0C85.8 119.3 92.4 132.4 96.5 138.0C100.6 143.6 103.2 145.6 106.0 147.5C108.8 149.4 110.8 150.1 113.0 149.5C115.2 148.9 120.6 146.4 119.5 144.0C118.4 141.6 110.5 139.3 106.5 135.0C102.5 130.7 97.5 123.5 95.5 118.0C93.5 112.5 93.7 106.5 94.5 102.0C95.3 97.5 97.2 94.8 100.5 91.0C103.8 87.2 110.1 82.1 114.0 79.5C117.9 76.9 119.2 76.2 124.0 75.5C128.8 74.8 138.3 75.0 143.0 75.5C147.7 76.0 149.9 76.8 152.0 78.5C154.1 80.2 155.2 83.6 155.5 86.0C155.8 88.4 153.2 90.2 153.5 93.0C153.8 95.8 155.3 100.2 157.5 103.0C159.7 105.8 165.8 105.5 166.5 110.0C167.2 114.5 162.2 125.0 161.5 130.0C160.8 135.0 161.6 138.1 162.5 140.0C163.4 141.9 163.5 144.2 167.0 141.5C170.5 138.8 179.9 128.8 183.5 124.0C187.1 119.2 185.7 116.3 188.5 113.0C191.3 109.7 198.0 107.3 200.5 104.0C203.0 100.7 199.3 101.2 203.5 93.0C207.7 84.8 221.7 62.3 225.5 55.0C229.3 47.7 228.3 54.5 226.5 49.0C224.7 43.5 215.6 26.8 214.5 22.0C213.4 17.2 217.9 19.2 220.0 20.5C222.1 21.8 225.1 29.2 227.0 29.5C228.9 29.8 230.1 26.4 231.5 22.0C232.9 17.6 234.0 6.2 235.5 3.0C237.0 -0.2 239.8 1.5 240.5 3.0C241.2 4.5 239.2 10.1 239.5 12.0C239.8 13.9 240.7 15.7 242.0 14.5C243.3 13.3 245.8 6.8 247.5 5.0C249.2 3.2 251.0 3.3 252.0 3.5C253.0 3.7 253.8 4.4 253.5 6.0C253.2 7.6 250.6 11.4 250.5 13.0C250.4 14.6 251.6 16.1 253.0 15.5C254.4 14.9 257.6 9.8 259.0 9.5C260.4 9.2 261.6 12.2 261.5 14.0C261.4 15.8 258.6 18.6 258.5 20.0C258.4 21.4 260.1 22.4 261.0 22.5C261.9 22.6 263.2 19.9 264.0 20.5C264.8 21.1 267.1 23.2 265.5 26.0C263.9 28.8 257.0 33.3 254.5 37.0C252.0 40.7 252.8 44.0 250.5 48.0C248.2 52.0 244.7 51.7 240.5 61.0C236.3 70.3 229.8 93.8 225.5 104.0C221.2 114.2 216.2 117.2 214.5 122.0C212.8 126.8 221.7 122.2 215.5 133.0C209.3 143.8 184.7 169.7 177.5 187.0C170.3 204.3 173.3 221.8 172.5 237.0C171.7 252.2 171.3 265.3 172.5 278.0C173.7 290.7 177.3 295.2 179.5 313.0C181.7 330.8 184.2 355.3 185.5 385.0C186.8 414.7 189.8 472.0 187.5 491.0C185.2 510.0 174.2 496.2 171.5 499.0C168.8 501.8 168.9 504.2 171.5 508.0C174.1 511.8 181.4 518.2 187.0 521.5C192.6 524.8 200.8 525.4 205.0 527.5C209.2 529.6 211.2 532.2 212.5 534.0C213.8 535.8 213.4 536.6 212.5 538.0C211.6 539.4 210.9 541.6 207.0 542.5C203.1 543.4 194.7 544.0 189.0 543.5C183.3 543.0 179.8 540.5 173.0 539.5C166.2 538.5 152.6 539.1 148.0 537.5C143.4 535.9 144.9 534.4 145.5 530.0C146.1 525.6 150.5 515.2 151.5 511.0C152.5 506.8 151.9 506.4 151.5 505.0C151.1 503.6 152.1 502.6 149.0 502.5C145.9 502.4 136.0 504.5 133.0 504.5C130.0 504.5 136.7 503.5 131.0 502.5C125.3 501.5 105.2 497.4 99.0 498.5C92.8 499.6 94.4 505.4 93.5 509.0C92.6 512.6 91.8 515.7 93.5 520.0C95.2 524.3 100.2 531.2 103.5 535.0C106.8 538.8 111.7 540.5 113.5 543.0C115.3 545.5 117.1 547.9 114.5 550.0C111.9 552.1 103.4 554.8 98.0 555.5Z"}, "man4": {"w": 175, "h": 473, "d": "M52.0 470.5C46.2 470.8 38.3 470.5 31.0 468.5C23.7 466.5 12.2 460.8 8.0 458.5C3.8 456.2 5.4 457.8 5.5 455.0C5.6 452.2 7.2 445.7 8.5 442.0C9.8 438.3 12.5 437.3 13.5 433.0C14.5 428.7 16.0 420.0 14.5 416.0C13.0 412.0 6.0 428.3 4.5 409.0C3.0 389.7 6.0 331.5 5.5 300.0C5.0 268.5 1.2 237.2 1.5 220.0C1.8 202.8 5.0 204.0 7.5 197.0C10.0 190.0 15.2 183.0 16.5 178.0C17.8 173.0 14.7 170.2 15.5 167.0C16.3 163.8 18.0 168.8 21.5 159.0C25.0 149.2 32.5 119.3 36.5 108.0C40.5 96.7 42.2 95.4 45.5 91.0C48.8 86.6 53.2 83.4 56.0 81.5C58.8 79.6 59.6 81.4 62.0 79.5C64.4 77.6 71.8 74.1 70.5 70.0C69.2 65.9 57.7 58.5 54.5 55.0C51.3 51.5 52.3 51.2 51.5 49.0C50.7 46.8 49.5 45.7 49.5 42.0C49.5 38.3 50.2 31.2 51.5 27.0C52.8 22.8 54.9 19.9 57.5 17.0C60.1 14.1 60.9 12.1 67.0 9.5C73.1 6.9 87.6 1.8 94.0 1.5C100.4 1.2 103.2 6.2 105.5 8.0C107.8 9.8 107.5 10.3 107.5 12.0C107.5 13.7 104.2 14.9 105.5 18.0C106.8 21.1 112.8 28.2 115.0 30.5C117.2 32.8 117.2 32.2 119.0 31.5C120.8 30.8 123.5 27.2 126.0 26.5C128.5 25.8 130.8 25.8 134.0 27.5C137.2 29.2 142.8 32.9 145.5 37.0C148.2 41.1 149.5 46.7 150.5 52.0C151.5 57.3 148.7 60.5 151.5 69.0C154.3 77.5 164.0 93.5 167.5 103.0C171.0 112.5 171.8 121.5 172.5 126.0C173.2 130.5 172.8 128.6 171.5 130.0C170.2 131.4 168.4 133.9 165.0 134.5C161.6 135.1 154.7 132.5 151.0 133.5C147.3 134.5 147.3 139.7 143.0 140.5C138.7 141.3 129.2 138.3 125.0 138.5C120.8 138.7 121.5 141.2 118.0 141.5C114.5 141.8 109.6 134.1 104.0 140.5C98.4 146.9 88.4 168.6 84.5 180.0C80.6 191.4 81.7 203.3 80.5 209.0C79.3 214.7 74.0 197.0 77.5 214.0C81.0 231.0 96.5 279.3 101.5 311.0C106.5 342.7 108.2 387.3 107.5 404.0C106.8 420.7 99.2 408.2 97.5 411.0C95.8 413.8 95.4 417.4 97.5 421.0C99.6 424.6 103.4 428.9 110.0 432.5C116.6 436.1 131.8 439.8 137.0 442.5C142.2 445.2 140.9 447.4 141.5 449.0C142.1 450.6 141.9 450.8 140.5 452.0C139.1 453.2 143.9 456.4 133.0 456.5C122.1 456.6 85.2 453.6 75.0 452.5C64.8 451.4 71.9 452.4 71.5 450.0C71.1 447.6 71.7 441.5 72.5 438.0C73.3 434.5 75.8 432.0 76.5 429.0C77.2 426.0 76.9 421.9 76.5 420.0C76.1 418.1 75.8 417.6 74.0 417.5C72.2 417.4 68.7 419.5 66.0 419.5C63.3 419.5 62.8 417.7 58.0 417.5C53.2 417.3 41.1 416.9 37.0 418.5C32.9 420.1 33.6 424.2 33.5 427.0C33.4 429.8 34.4 432.1 36.5 435.0C38.6 437.9 40.7 440.5 46.0 444.5C51.3 448.5 65.2 455.3 68.5 459.0C71.8 462.7 68.8 464.6 66.0 466.5C63.2 468.4 57.8 470.2 52.0 470.5ZM123.5 93.0C126.9 94.2 125.3 93.5 125.5 91.0C125.7 88.5 125.6 81.2 124.5 78.0C123.4 74.8 121.8 72.2 119.0 71.5C116.2 70.8 110.6 72.4 108.0 73.5C105.4 74.6 104.4 76.8 103.5 78.0C102.6 79.2 102.2 80.1 102.5 81.0C102.8 81.9 101.5 81.5 105.0 83.5C108.5 85.5 120.1 91.8 123.5 93.0Z"}, "man5": {"w": 183, "h": 442, "d": "M61.0 439.5C55.3 439.5 45.1 439.6 38.0 436.5C30.9 433.4 19.2 429.6 18.5 421.0C17.8 412.4 31.2 393.7 33.5 385.0C35.8 376.3 31.8 376.8 32.5 369.0C33.2 361.2 34.7 351.2 37.5 338.0C40.3 324.8 48.8 305.2 49.5 290.0C50.2 274.8 43.2 255.2 41.5 247.0C39.8 238.8 40.8 243.0 39.5 241.0C38.2 239.0 34.5 240.8 33.5 235.0C32.5 229.2 36.5 215.3 33.5 206.0C30.5 196.7 20.8 188.7 15.5 179.0C10.2 169.3 2.7 155.5 1.5 148.0C0.3 140.5 7.7 137.3 8.5 134.0C9.3 130.7 -0.6 137.8 6.5 128.0C13.6 118.2 41.9 85.2 51.0 75.5C60.1 65.8 54.2 71.7 61.0 69.5C67.8 67.3 84.9 64.8 92.0 62.5C99.1 60.2 102.8 59.2 103.5 56.0C104.2 52.8 98.0 46.8 96.5 43.0C95.0 39.2 94.2 37.7 94.5 33.0C94.8 28.3 95.2 19.9 98.5 15.0C101.8 10.1 108.4 5.8 114.0 3.5C119.6 1.2 125.3 0.5 132.0 1.5C138.7 2.5 149.4 7.1 154.0 9.5C158.6 11.9 158.9 10.8 159.5 16.0C160.1 21.2 157.0 35.2 157.5 41.0C158.0 46.8 162.7 48.5 162.5 51.0C162.3 53.5 159.0 52.2 156.5 56.0C154.0 59.8 147.7 69.3 147.5 74.0C147.3 78.7 153.8 80.7 155.5 84.0C157.2 87.3 158.5 86.2 157.5 94.0C156.5 101.8 150.8 121.8 149.5 131.0C148.2 140.2 150.7 144.7 149.5 149.0C148.3 153.3 143.8 153.0 142.5 157.0C141.2 161.0 143.0 164.7 141.5 173.0C140.0 181.3 133.2 197.8 133.5 207.0C133.8 216.2 141.8 221.3 143.5 228.0C145.2 234.7 141.5 238.2 143.5 247.0C145.5 255.8 154.2 260.8 155.5 281.0C156.8 301.2 152.3 352.2 151.5 368.0C150.7 383.8 152.0 373.7 150.5 376.0C149.0 378.3 144.0 378.8 142.5 382.0C141.0 385.2 139.1 390.9 141.5 395.0C143.9 399.1 151.4 403.4 157.0 406.5C162.6 409.6 171.1 411.4 175.0 413.5C178.9 415.6 179.6 417.6 180.5 419.0C181.4 420.4 181.9 420.4 180.5 422.0C179.1 423.6 176.2 427.4 172.0 428.5C167.8 429.6 160.8 429.3 155.0 428.5C149.2 427.7 143.0 424.3 137.0 423.5C131.0 422.7 123.1 424.4 119.0 423.5C114.9 422.6 112.2 422.8 112.5 418.0C112.8 413.2 119.6 399.9 120.5 395.0C121.4 390.1 122.2 389.1 118.0 388.5C113.8 387.9 105.3 392.2 95.0 391.5C84.7 390.8 63.4 384.4 56.0 384.5C48.6 384.6 51.4 388.9 50.5 392.0C49.6 395.1 49.8 400.0 50.5 403.0C51.2 406.0 50.3 405.3 54.5 410.0C58.7 414.7 72.6 426.6 75.5 431.0C78.4 435.4 74.4 435.1 72.0 436.5C69.6 437.9 66.7 439.5 61.0 439.5ZM39.5 180.0C41.2 177.2 45.7 166.0 46.5 161.0C47.3 156.0 44.2 153.0 44.5 150.0C44.8 147.0 47.7 145.8 48.5 143.0C49.3 140.2 49.8 135.1 49.5 133.0C49.2 130.9 49.2 128.7 47.0 130.5C44.8 132.3 39.6 140.8 36.5 144.0C33.4 147.2 28.5 144.3 28.5 150.0C28.5 155.7 34.7 173.0 36.5 178.0C38.3 183.0 37.8 182.8 39.5 180.0ZM118.5 189.0C119.7 189.7 120.2 191.5 120.5 187.0C120.8 182.5 120.2 167.2 120.5 162.0C120.8 156.8 122.8 158.1 122.5 156.0C122.2 153.9 120.7 147.7 119.0 149.5C117.3 151.3 113.4 161.4 112.5 167.0C111.6 172.6 112.5 179.3 113.5 183.0C114.5 186.7 117.3 188.3 118.5 189.0Z"}, "man6": {"w": 208, "h": 462, "d": "M159.0 459.5C152.3 461.2 145.2 459.8 141.0 459.5C136.8 459.2 135.9 458.6 134.0 457.5C132.1 456.4 130.2 454.6 129.5 453.0C128.8 451.4 126.1 451.2 129.5 448.0C132.9 444.8 145.2 437.5 150.0 433.5C154.8 429.5 156.8 428.1 158.5 424.0C160.2 419.9 160.8 413.1 160.5 409.0C160.2 404.9 163.6 400.8 157.0 399.5C150.4 398.2 127.4 400.8 121.0 401.5C114.6 402.2 119.1 401.1 118.5 404.0C117.9 406.9 116.7 413.8 117.5 419.0C118.3 424.2 122.5 431.0 123.5 435.0C124.5 439.0 123.9 441.2 123.5 443.0C123.1 444.8 130.6 444.2 121.0 445.5C111.4 446.8 76.6 450.6 66.0 450.5C55.4 450.4 58.5 447.0 57.5 445.0C56.5 443.0 55.9 441.2 60.0 438.5C64.1 435.8 75.6 432.4 82.0 428.5C88.4 424.6 95.8 420.4 98.5 415.0C101.2 409.6 100.2 400.3 98.5 396.0C96.8 391.7 90.3 404.7 88.5 389.0C86.7 373.3 86.2 329.7 87.5 302.0C88.8 274.3 93.7 243.0 96.5 223.0C99.3 203.0 103.3 190.2 104.5 182.0C105.7 173.8 103.0 176.7 103.5 174.0C104.0 171.3 106.7 176.0 107.5 166.0C108.3 156.0 107.7 123.7 108.5 114.0C109.3 104.3 111.8 109.8 112.5 108.0C113.2 106.2 113.1 104.4 112.5 103.0C111.9 101.6 114.2 101.2 109.0 99.5C103.8 97.8 90.7 95.7 81.0 92.5C71.3 89.3 60.3 81.5 51.0 80.5C41.7 79.5 30.8 87.1 25.0 86.5C19.2 85.9 17.6 79.8 16.5 77.0C15.4 74.2 18.6 71.6 18.5 70.0C18.4 68.4 18.2 68.1 16.0 67.5C13.8 66.9 7.4 67.2 5.0 66.5C2.6 65.8 -2.5 64.0 1.5 63.0C5.5 62.0 13.2 58.8 29.0 60.5C44.8 62.2 79.0 71.2 96.0 73.5C113.0 75.8 124.8 74.8 131.0 74.5C137.2 74.2 133.5 73.2 133.5 72.0C133.5 70.8 133.2 68.2 131.0 67.5C128.8 66.8 122.2 67.9 120.0 67.5C117.8 67.1 117.9 67.8 117.5 65.0C117.1 62.2 118.8 55.7 117.5 51.0C116.2 46.3 109.5 40.7 109.5 37.0C109.5 33.3 116.2 31.3 117.5 29.0C118.8 26.7 116.3 26.0 117.5 23.0C118.7 20.0 121.9 14.1 124.5 11.0C127.1 7.9 129.9 6.1 133.0 4.5C136.1 2.9 139.8 2.0 143.0 1.5C146.2 1.0 148.5 0.8 152.0 1.5C155.5 2.2 160.8 3.8 164.0 5.5C167.2 7.2 169.4 9.1 171.5 12.0C173.6 14.9 176.0 18.2 176.5 23.0C177.0 27.8 177.2 35.2 174.5 41.0C171.8 46.8 162.8 54.2 160.5 58.0C158.2 61.8 157.4 61.8 160.5 64.0C163.6 66.2 172.8 67.7 179.0 71.5C185.2 75.3 193.1 59.8 197.5 87.0C201.9 114.2 204.5 208.5 205.5 235.0C206.5 261.5 206.2 241.8 203.5 246.0C200.8 250.2 192.0 257.0 189.5 260.0C187.0 263.0 188.8 242.5 188.5 264.0C188.2 285.5 188.8 367.2 187.5 389.0C186.2 410.8 182.0 391.7 180.5 395.0C179.0 398.3 178.8 404.5 178.5 409.0C178.2 413.5 177.3 416.0 178.5 422.0C179.7 428.0 185.1 440.4 185.5 445.0C185.9 449.6 185.4 447.1 181.0 449.5C176.6 451.9 165.7 457.8 159.0 459.5Z"}, "man7": {"w": 134, "h": 447, "d": "M83.0 444.5C78.2 444.2 70.2 441.8 67.0 440.5C63.8 439.2 63.9 438.6 63.5 437.0C63.1 435.4 64.8 432.4 64.5 431.0C64.2 429.6 63.4 428.6 62.0 428.5C60.6 428.4 59.3 430.3 56.0 430.5C52.7 430.7 46.8 429.0 42.0 429.5C37.2 430.0 32.7 432.8 27.0 433.5C21.3 434.2 12.2 434.2 8.0 433.5C3.8 432.8 2.6 430.4 1.5 429.0C0.4 427.6 0.6 426.6 1.5 425.0C2.4 423.4 2.9 421.8 7.0 419.5C11.1 417.2 20.6 414.8 26.0 411.5C31.4 408.2 37.4 404.9 39.5 400.0C41.6 395.1 40.2 386.2 38.5 382.0C36.8 377.8 31.2 377.0 29.5 375.0C27.8 373.0 29.3 385.3 28.5 370.0C27.7 354.7 24.0 307.7 24.5 283.0C25.0 258.3 28.8 239.0 31.5 222.0C34.2 205.0 39.2 189.5 40.5 181.0C41.8 172.5 39.2 173.7 39.5 171.0C39.8 168.3 42.3 167.2 42.5 165.0C42.7 162.8 40.3 160.5 40.5 158.0C40.7 155.5 43.9 153.8 43.5 150.0C43.1 146.2 40.2 136.2 38.0 135.5C35.8 134.8 32.2 143.5 30.0 145.5C27.8 147.5 26.8 147.5 25.0 147.5C23.2 147.5 20.8 147.4 19.0 145.5C17.2 143.6 15.2 139.9 14.5 136.0C13.8 132.1 13.0 131.5 14.5 122.0C16.0 112.5 22.3 89.5 23.5 79.0C24.7 68.5 20.5 64.7 21.5 59.0C22.5 53.3 27.7 50.8 29.5 45.0C31.3 39.2 31.2 29.2 32.5 24.0C33.8 18.8 35.4 16.9 37.5 14.0C39.6 11.1 41.6 8.6 45.0 6.5C48.4 4.4 53.5 2.2 58.0 1.5C62.5 0.8 68.0 1.5 72.0 2.5C76.0 3.5 78.8 4.2 82.0 7.5C85.2 10.8 89.9 16.8 91.5 22.0C93.1 27.2 92.5 34.2 91.5 39.0C90.5 43.8 87.7 48.0 85.5 51.0C83.3 54.0 79.7 54.8 78.5 57.0C77.3 59.2 78.1 62.4 78.5 64.0C78.9 65.6 78.9 66.2 81.0 66.5C83.1 66.8 87.0 64.7 91.0 65.5C95.0 66.3 101.1 69.2 105.0 71.5C108.9 73.8 112.1 76.2 114.5 79.0C116.9 81.8 116.7 70.5 119.5 88.0C122.3 105.5 129.5 159.8 131.5 184.0C133.5 208.2 132.0 222.3 131.5 233.0C131.0 243.7 129.8 243.8 128.5 248.0C127.2 252.2 125.0 250.0 123.5 258.0C122.0 266.0 119.8 277.5 119.5 296.0C119.2 314.5 121.3 356.0 121.5 369.0C121.7 382.0 122.0 371.8 120.5 374.0C119.0 376.2 114.0 378.3 112.5 382.0C111.0 385.7 111.5 391.7 111.5 396.0C111.5 400.3 111.2 402.5 112.5 408.0C113.8 413.5 122.2 423.2 119.5 429.0C116.8 434.8 102.1 439.9 96.0 442.5C89.9 445.1 87.8 444.8 83.0 444.5ZM66.5 429.0C69.8 427.6 78.5 422.3 83.0 418.5C87.5 414.7 91.8 410.9 93.5 406.0C95.2 401.1 94.1 392.4 93.5 389.0C92.9 385.6 95.4 385.9 90.0 385.5C84.6 385.1 66.2 385.9 61.0 386.5C55.8 387.1 58.9 385.8 58.5 389.0C58.1 392.2 57.7 401.5 58.5 406.0C59.3 410.5 62.7 412.5 63.5 416.0C64.3 419.5 63.0 424.8 63.5 427.0C64.0 429.2 63.2 430.4 66.5 429.0Z"}, "officer": {"w": 469, "h": 1480, "d": "M292.0 1477.5C279.7 1477.5 255.2 1477.2 242.0 1474.5C228.8 1471.8 220.5 1462.2 213.0 1461.5C205.5 1460.8 200.7 1469.0 197.0 1470.5C193.3 1472.0 197.3 1471.2 191.0 1470.5C184.7 1469.8 165.8 1468.1 159.0 1466.5C152.2 1464.9 151.8 1470.2 150.5 1461.0C149.2 1451.8 149.5 1426.3 151.5 1411.0C153.5 1395.7 160.7 1382.0 162.5 1369.0C164.3 1356.0 162.8 1340.3 162.5 1333.0C162.2 1325.7 160.5 1327.7 160.5 1325.0C160.5 1322.3 165.8 1344.5 162.5 1317.0C159.2 1289.5 144.3 1191.3 140.5 1160.0C136.7 1128.7 140.2 1134.7 139.5 1129.0C138.8 1123.3 137.0 1127.5 136.5 1126.0C136.0 1124.5 135.2 1128.0 136.5 1120.0C137.8 1112.0 142.2 1086.2 144.5 1078.0C146.8 1069.8 146.5 1084.5 150.5 1071.0C154.5 1057.5 164.8 1014.5 168.5 997.0C172.2 979.5 171.8 975.5 172.5 966.0C173.2 956.5 172.8 950.7 172.5 940.0C172.2 929.3 172.5 909.2 170.5 902.0C168.5 894.8 162.3 906.7 160.5 897.0C158.7 887.3 159.0 860.3 159.5 844.0C160.0 827.7 164.3 811.3 163.5 799.0C162.7 786.7 157.0 781.3 154.5 770.0C152.0 758.7 149.3 745.7 148.5 731.0C147.7 716.3 147.2 699.3 149.5 682.0C151.8 664.7 163.0 647.3 162.5 627.0C162.0 606.7 149.2 572.7 146.5 560.0C143.8 547.3 146.0 553.7 146.5 551.0C147.0 548.3 149.0 550.2 149.5 544.0C150.0 537.8 150.7 521.5 149.5 514.0C148.3 506.5 144.3 504.8 142.5 499.0C140.7 493.2 139.8 489.7 138.5 479.0C137.2 468.3 136.7 449.5 134.5 435.0C132.3 420.5 127.0 404.0 125.5 392.0C124.0 380.0 124.3 373.0 125.5 363.0C126.7 353.0 129.0 342.3 132.5 332.0C136.0 321.7 138.7 313.0 146.5 301.0C154.3 289.0 189.5 289.5 179.5 260.0C169.5 230.5 109.5 156.7 86.5 124.0C63.5 91.3 49.0 74.8 41.5 64.0C34.0 53.2 42.3 61.0 41.5 59.0C40.7 57.0 41.4 57.8 36.5 52.0C31.6 46.2 16.8 28.2 12.0 24.5C7.2 20.8 9.2 29.2 8.0 29.5C6.8 29.8 4.4 27.9 4.5 26.0C4.6 24.1 9.0 21.0 8.5 18.0C8.0 15.0 1.8 10.8 1.5 8.0C1.2 5.2 3.6 0.1 7.0 1.5C10.4 2.9 17.5 15.5 22.0 16.5C26.5 17.5 31.1 8.4 34.0 7.5C36.9 6.6 39.4 9.2 39.5 11.0C39.6 12.8 34.8 15.7 34.5 18.0C34.2 20.3 17.1 1.8 37.5 25.0C57.9 48.2 135.0 138.2 157.0 157.5C179.0 176.8 167.8 149.4 169.5 141.0C171.2 132.6 167.7 115.2 167.5 107.0C167.3 98.8 167.5 97.7 168.5 92.0C169.5 86.3 170.7 79.5 173.5 73.0C176.3 66.5 179.7 59.3 185.5 53.0C191.3 46.7 204.8 39.3 208.5 35.0C212.2 30.7 207.2 28.9 207.5 27.0C207.8 25.1 208.4 24.8 210.0 23.5C211.6 22.2 214.8 20.2 217.0 19.5C219.2 18.8 220.8 18.2 223.0 19.5C225.2 20.8 225.3 26.2 230.0 27.5C234.7 28.8 245.5 27.0 251.0 27.5C256.5 28.0 258.5 28.7 263.0 30.5C267.5 32.3 273.9 35.8 278.0 38.5C282.1 41.2 282.4 41.1 287.5 47.0C292.6 52.9 303.7 66.3 308.5 74.0C313.3 81.7 310.6 86.9 316.5 93.0C322.4 99.1 339.0 106.8 344.0 110.5C349.0 114.2 347.0 113.2 346.5 115.0C346.0 116.8 346.5 118.3 341.0 121.5C335.5 124.7 315.4 127.9 313.5 134.0C311.6 140.1 327.2 153.2 329.5 158.0C331.8 162.8 329.5 161.0 327.5 163.0C325.5 165.0 319.3 165.5 317.5 170.0C315.7 174.5 317.5 185.7 316.5 190.0C315.5 194.3 312.2 192.7 311.5 196.0C310.8 199.3 314.1 206.4 312.5 210.0C310.9 213.6 307.6 216.1 302.0 217.5C296.4 218.9 283.4 217.8 279.0 218.5C274.6 219.2 276.2 218.6 275.5 222.0C274.8 225.4 275.5 235.3 274.5 239.0C273.5 242.7 271.5 240.3 269.5 244.0C267.5 247.7 261.3 255.3 262.5 261.0C263.7 266.7 273.2 272.5 276.5 278.0C279.8 283.5 274.0 283.2 282.5 294.0C291.0 304.8 317.0 328.3 327.5 343.0C338.0 357.7 342.1 375.1 345.5 382.0C348.9 388.9 346.4 385.1 348.0 384.5C349.6 383.9 352.7 379.3 355.0 378.5C357.3 377.7 360.1 377.9 362.0 379.5C363.9 381.1 364.1 385.6 366.5 388.0C368.9 390.4 374.7 392.2 376.5 394.0C378.3 395.8 376.3 397.3 377.5 399.0C378.7 400.7 382.5 402.3 383.5 404.0C384.5 405.7 382.2 407.0 383.5 409.0C384.8 411.0 390.7 413.0 391.5 416.0C392.3 419.0 386.2 422.8 388.5 427.0C390.8 431.2 401.7 436.3 405.5 441.0C409.3 445.7 401.3 443.8 411.5 455.0C421.7 466.2 464.8 491.6 466.5 508.0C468.2 524.4 430.6 544.9 422.0 553.5C413.4 562.1 417.0 558.3 415.0 559.5C413.0 560.7 415.1 567.8 410.0 560.5C404.9 553.2 391.4 525.2 384.5 516.0C377.6 506.8 375.8 512.6 368.5 505.0C361.2 497.4 348.7 473.5 341.0 470.5C333.3 467.5 325.2 481.4 322.5 487.0C319.8 492.6 324.7 498.5 324.5 504.0C324.3 509.5 320.5 516.2 321.5 520.0C322.5 523.8 328.8 521.7 330.5 527.0C332.2 532.3 331.7 546.0 331.5 552.0C331.3 558.0 331.2 559.8 329.5 563.0C327.8 566.2 322.8 569.0 321.5 571.0C320.2 573.0 320.5 570.3 321.5 575.0C322.5 579.7 325.2 583.2 327.5 599.0C329.8 614.8 334.2 647.5 335.5 670.0C336.8 692.5 336.7 697.2 335.5 734.0C334.3 770.8 330.6 864.2 328.5 891.0C326.4 917.8 327.2 893.8 323.0 894.5C318.8 895.2 307.0 894.5 303.0 895.5C299.0 896.5 301.8 899.7 299.0 900.5C296.2 901.3 288.8 899.9 286.0 900.5C283.2 901.1 285.1 896.1 282.5 904.0C279.9 911.9 273.2 936.2 270.5 948.0C267.8 959.8 267.2 965.8 266.5 975.0C265.8 984.2 267.0 996.2 266.5 1003.0C266.0 1009.8 264.7 1011.8 263.5 1016.0C262.3 1020.2 262.2 1022.5 259.5 1028.0C256.8 1033.5 250.7 1041.2 247.5 1049.0C244.3 1056.8 241.2 1069.7 240.5 1075.0C239.8 1080.3 243.3 1072.3 243.5 1081.0C243.7 1089.7 242.5 1118.0 241.5 1127.0C240.5 1136.0 240.0 1114.0 237.5 1135.0C235.0 1156.0 228.2 1226.2 226.5 1253.0C224.8 1279.8 226.3 1287.2 227.5 1296.0C228.7 1304.8 232.0 1302.2 233.5 1306.0C235.0 1309.8 236.2 1315.8 236.5 1319.0C236.8 1322.2 234.8 1322.3 235.5 1325.0C236.2 1327.7 239.8 1332.5 240.5 1335.0C241.2 1337.5 239.2 1337.3 239.5 1340.0C239.8 1342.7 241.0 1347.5 242.5 1351.0C244.0 1354.5 240.6 1352.6 248.5 1361.0C256.4 1369.4 279.9 1393.2 290.0 1401.5C300.1 1409.8 300.5 1408.7 309.0 1410.5C317.5 1412.3 333.9 1410.8 341.0 1412.5C348.1 1414.2 349.6 1418.6 351.5 1421.0C353.4 1423.4 351.3 1424.7 352.5 1427.0C353.7 1429.3 358.1 1432.8 358.5 1435.0C358.9 1437.2 357.0 1438.7 355.0 1440.5C353.0 1442.3 346.9 1443.6 346.5 1446.0C346.1 1448.4 351.3 1452.5 352.5 1455.0C353.7 1457.5 353.8 1459.6 353.5 1461.0C353.2 1462.4 357.2 1461.2 351.0 1463.5C344.8 1465.8 325.8 1472.2 316.0 1474.5C306.2 1476.8 304.3 1477.5 292.0 1477.5ZM199.5 208.0C203.2 209.8 202.5 202.2 201.5 198.0C200.5 193.8 195.2 185.9 193.5 183.0C191.8 180.1 192.9 180.4 191.0 180.5C189.1 180.6 183.9 182.4 182.0 183.5C180.1 184.6 176.6 182.9 179.5 187.0C182.4 191.1 195.8 206.2 199.5 208.0ZM185.5 249.0C187.8 250.8 188.2 247.1 186.5 244.0C184.8 240.9 177.3 232.3 175.0 230.5C172.7 228.7 170.8 229.9 172.5 233.0C174.2 236.1 183.2 247.2 185.5 249.0ZM318.5 410.0C319.8 409.5 323.2 406.4 322.5 404.0C321.8 401.6 315.8 396.3 314.0 395.5C312.2 394.7 311.4 397.1 311.5 399.0C311.6 400.9 313.3 405.2 314.5 407.0C315.7 408.8 317.2 410.5 318.5 410.0ZM365.5 485.0C368.5 488.0 369.2 487.4 367.5 483.0C365.8 478.6 358.0 461.5 355.0 458.5C352.0 455.5 347.8 460.6 349.5 465.0C351.2 469.4 362.5 482.0 365.5 485.0Z"}, "cow": {"w": 407, "h": 326, "d": "M241.0 323.5C237.0 323.8 224.8 322.4 221.0 321.5C217.2 320.6 218.9 320.6 218.5 318.0C218.1 315.4 219.3 308.7 218.5 306.0C217.7 303.3 213.7 308.8 213.5 302.0C213.3 295.2 217.3 274.3 217.5 265.0C217.7 255.7 215.0 257.3 214.5 246.0C214.0 234.7 215.8 205.9 214.5 197.0C213.2 188.1 210.8 193.4 207.0 192.5C203.2 191.6 201.0 190.5 192.0 191.5C183.0 192.5 161.0 196.2 153.0 198.5C145.0 200.8 147.8 206.2 144.0 205.5C140.2 204.8 135.5 197.8 130.0 194.5C124.5 191.2 115.7 188.2 111.0 185.5C106.3 182.8 104.0 179.7 102.0 178.5C100.0 177.3 101.4 176.6 99.0 178.5C96.6 180.4 90.0 186.5 87.5 190.0C85.0 193.5 85.2 198.6 84.0 199.5C82.8 200.4 81.2 195.6 80.0 195.5C78.8 195.4 78.9 193.8 76.5 199.0C74.1 204.2 68.0 218.7 65.5 227.0C63.0 235.3 61.5 240.8 61.5 249.0C61.5 257.2 63.8 268.3 65.5 276.0C67.2 283.7 68.0 288.3 71.5 295.0C75.0 301.7 84.8 312.1 86.5 316.0C88.2 319.9 84.9 318.1 82.0 318.5C79.1 318.9 72.2 319.1 69.0 318.5C65.8 317.9 63.8 317.4 62.5 315.0C61.2 312.6 63.0 306.7 61.5 304.0C60.0 301.3 55.7 305.2 53.5 299.0C51.3 292.8 50.1 274.1 48.5 267.0C46.9 259.9 45.2 257.8 44.0 256.5C42.8 255.2 41.9 255.6 41.5 259.0C41.1 262.4 41.0 270.7 41.5 277.0C42.0 283.3 41.5 289.7 44.5 297.0C47.5 304.3 57.6 316.6 59.5 321.0C61.4 325.4 58.9 323.1 56.0 323.5C53.1 323.9 45.6 324.1 42.0 323.5C38.4 322.9 35.9 322.6 34.5 320.0C33.1 317.4 34.2 310.8 33.5 308.0C32.8 305.2 31.2 304.3 30.0 303.5C28.8 302.7 26.9 308.1 26.5 303.0C26.1 297.9 27.8 283.0 27.5 273.0C27.2 263.0 25.6 248.6 24.5 243.0C23.4 237.4 22.0 239.7 21.0 239.5C20.0 239.3 19.2 239.8 18.5 242.0C17.8 244.2 18.1 249.9 16.5 253.0C14.9 256.1 11.0 260.0 9.0 260.5C7.0 261.0 5.6 258.8 4.5 256.0C3.4 253.2 2.8 251.3 2.5 244.0C2.2 236.7 1.2 222.5 2.5 212.0C3.8 201.5 9.5 200.7 10.5 181.0C11.5 161.3 8.2 111.3 8.5 94.0C8.8 76.7 11.0 81.2 12.5 77.0C14.0 72.8 13.8 72.9 17.5 69.0C21.2 65.1 25.8 57.9 35.0 53.5C44.2 49.1 65.0 44.3 73.0 42.5C81.0 40.7 74.8 41.0 83.0 42.5C91.2 44.0 104.5 49.2 122.0 51.5C139.5 53.8 172.7 56.3 188.0 56.5C203.3 56.7 205.7 55.0 214.0 52.5C222.3 50.0 232.2 43.3 238.0 41.5C243.8 39.7 242.7 39.3 249.0 41.5C255.3 43.7 269.2 52.3 276.0 54.5C282.8 56.7 285.7 55.2 290.0 54.5C294.3 53.8 299.4 51.8 302.0 50.5C304.6 49.2 304.9 48.6 305.5 47.0C306.1 45.4 304.9 42.4 305.5 41.0C306.1 39.6 306.4 38.4 309.0 38.5C311.6 38.6 317.3 42.0 321.0 41.5C324.7 41.0 328.9 36.9 331.0 35.5C333.1 34.1 333.1 35.2 333.5 33.0C333.9 30.8 331.4 27.2 333.5 22.0C335.6 16.8 343.5 4.5 346.0 1.5C348.5 -1.5 348.1 2.6 348.5 4.0C348.9 5.4 349.3 6.8 348.5 10.0C347.7 13.2 343.6 20.6 343.5 23.0C343.4 25.4 345.7 26.0 348.0 24.5C350.3 23.0 356.2 17.2 357.5 14.0C358.8 10.8 355.4 6.8 355.5 5.0C355.6 3.2 356.8 3.0 358.0 3.5C359.2 4.0 361.6 5.4 362.5 8.0C363.4 10.6 364.7 14.7 363.5 19.0C362.3 23.3 356.0 30.2 355.5 34.0C355.0 37.8 357.7 38.8 360.5 42.0C363.3 45.2 369.3 48.0 372.5 53.0C375.7 58.0 376.2 65.5 379.5 72.0C382.8 78.5 388.7 87.0 392.5 92.0C396.3 97.0 400.7 98.5 402.5 102.0C404.3 105.5 404.8 109.6 403.5 113.0C402.2 116.4 397.2 120.6 395.0 122.5C392.8 124.4 392.3 124.2 390.0 124.5C387.7 124.8 383.7 125.2 381.0 124.5C378.3 123.8 378.3 120.8 374.0 120.5C369.7 120.2 360.2 122.7 355.0 122.5C349.8 122.3 347.4 117.9 343.0 119.5C338.6 121.1 332.8 127.4 328.5 132.0C324.2 136.6 320.5 141.3 317.5 147.0C314.5 152.7 313.7 160.2 310.5 166.0C307.3 171.8 305.2 175.2 298.5 182.0C291.8 188.8 277.1 202.1 270.0 206.5C262.9 210.9 258.8 207.8 256.0 208.5C253.2 209.2 254.8 205.1 253.5 211.0C252.2 216.9 250.3 236.0 248.5 244.0C246.7 252.0 243.5 253.0 242.5 259.0C241.5 265.0 242.0 273.8 242.5 280.0C243.0 286.2 242.7 289.8 245.5 296.0C248.3 302.2 257.6 313.1 259.5 317.0C261.4 320.9 259.4 319.1 257.0 319.5C254.6 319.9 247.7 318.8 245.0 319.5C242.3 320.2 245.0 323.2 241.0 323.5ZM22.5 213.0C24.5 211.5 28.5 206.0 30.5 200.0C32.5 194.0 35.8 188.8 34.5 177.0C33.2 165.2 25.1 137.9 22.5 129.0C19.9 120.1 20.0 124.0 19.0 123.5C18.0 123.0 17.1 114.1 16.5 126.0C15.9 137.9 15.2 181.2 15.5 195.0C15.8 208.8 17.3 206.0 18.5 209.0C19.7 212.0 20.5 214.5 22.5 213.0Z"}, "hut": {"w": 481, "h": 522, "d": "M380.0 519.5C377.2 520.2 367.9 519.9 365.0 519.5C362.1 519.1 362.4 521.8 362.5 517.0C362.6 512.2 365.2 505.8 365.5 491.0C365.8 476.2 365.4 439.2 364.5 428.0C363.6 416.8 362.4 424.2 360.0 423.5C357.6 422.8 352.3 422.2 350.0 423.5C347.7 424.8 348.0 431.5 346.0 431.5C344.0 431.5 344.5 424.8 338.0 423.5C331.5 422.2 312.8 422.9 307.0 423.5C301.2 424.1 304.8 425.4 303.5 427.0C302.2 428.6 300.3 425.0 299.5 433.0C298.7 441.0 298.3 465.2 298.5 475.0C298.7 484.8 302.5 488.3 300.5 492.0C298.5 495.7 288.3 492.8 286.5 497.0C284.7 501.2 290.2 513.2 289.5 517.0C288.8 520.8 285.3 519.5 282.0 519.5C278.7 519.5 271.2 532.2 269.5 517.0C267.8 501.8 271.8 443.4 271.5 428.0C271.2 412.6 270.6 425.2 268.0 424.5C265.4 423.8 258.4 423.2 256.0 423.5C253.6 423.8 253.2 424.2 253.5 426.0C253.8 427.8 257.2 432.4 257.5 434.0C257.8 435.6 257.2 437.2 255.0 435.5C252.8 433.8 259.5 425.5 244.0 423.5C228.5 421.5 176.9 422.6 162.0 423.5C147.1 424.4 155.9 419.4 154.5 429.0C153.1 438.6 153.3 470.7 153.5 481.0C153.7 491.3 155.6 488.9 155.5 491.0C155.4 493.1 155.6 493.1 153.0 493.5C150.4 493.9 142.6 493.9 140.0 493.5C137.4 493.1 137.6 492.9 137.5 491.0C137.4 489.1 139.2 492.8 139.5 482.0C139.8 471.2 140.6 435.8 139.5 426.0C138.4 416.2 138.2 418.5 133.0 423.5C127.8 428.5 112.8 443.9 108.5 456.0C104.2 468.1 107.2 486.2 107.5 496.0C107.8 505.8 111.2 511.2 110.5 515.0C109.8 518.8 105.9 518.1 103.0 518.5C100.1 518.9 95.1 518.1 93.0 517.5C90.9 516.9 90.6 517.2 90.5 515.0C90.4 512.8 92.2 518.8 92.5 504.0C92.8 489.2 92.9 439.4 92.5 426.0C92.1 412.6 91.9 424.1 90.0 423.5C88.1 422.9 82.9 423.1 81.0 422.5C79.1 421.9 78.8 421.6 78.5 420.0C78.2 418.4 79.8 414.7 79.5 413.0C79.2 411.3 77.0 411.2 76.5 410.0C76.0 408.8 75.2 407.7 76.5 406.0C77.8 404.3 83.0 419.8 84.5 400.0C86.0 380.2 85.8 306.2 85.5 287.0C85.2 267.8 83.8 284.6 83.0 284.5C82.2 284.4 83.2 287.5 81.0 286.5C78.8 285.5 73.3 278.8 70.0 278.5C66.7 278.2 64.3 284.3 61.0 284.5C57.7 284.7 52.8 279.5 50.0 279.5C47.2 279.5 45.8 284.1 44.0 284.5C42.2 284.9 39.9 282.9 39.5 282.0C39.1 281.1 41.6 279.9 41.5 279.0C41.4 278.1 40.8 276.1 39.0 276.5C37.2 276.9 33.2 282.0 31.0 281.5C28.8 281.0 28.8 273.7 26.0 273.5C23.2 273.3 16.7 281.3 14.0 280.5C11.3 279.7 11.7 269.3 10.0 268.5C8.3 267.7 5.2 274.6 4.0 275.5C2.8 276.4 2.4 275.4 2.5 274.0C2.6 272.6 4.7 269.0 4.5 267.0C4.3 265.0 -1.7 268.8 1.5 262.0C4.7 255.2 16.3 236.0 23.5 226.0C30.7 216.0 38.5 209.8 44.5 202.0C50.5 194.2 55.0 185.0 59.5 179.0C64.0 173.0 69.3 169.0 71.5 166.0C73.7 163.0 70.0 164.2 72.5 161.0C75.0 157.8 84.3 149.8 86.5 147.0C88.7 144.2 78.5 153.5 85.5 144.0C92.5 134.5 117.5 104.2 128.5 90.0C139.5 75.8 147.0 65.2 151.5 59.0C156.0 52.8 155.0 54.3 155.5 53.0C156.0 51.7 149.7 56.8 154.5 51.0C159.3 45.2 179.8 25.2 184.5 18.0C189.2 10.8 181.6 10.8 182.5 8.0C183.4 5.2 186.8 1.2 190.0 1.5C193.2 1.8 191.7 0.5 202.0 9.5C212.3 18.5 228.8 33.2 252.0 55.5C275.2 77.8 309.0 112.8 341.0 143.5C373.0 174.2 422.2 218.8 444.0 239.5C465.8 260.2 465.8 261.1 471.5 268.0C477.2 274.9 477.8 278.3 478.5 281.0C479.2 283.7 475.8 283.0 475.5 284.0C475.2 285.0 477.1 285.9 476.5 287.0C475.9 288.1 473.4 289.6 472.0 290.5C470.6 291.4 469.0 292.5 468.0 292.5C467.0 292.5 467.7 290.2 466.0 290.5C464.3 290.8 460.0 294.3 458.0 294.5C456.0 294.7 455.8 291.7 454.0 291.5C452.2 291.3 448.8 293.8 447.0 293.5C445.2 293.2 444.3 289.7 443.0 289.5C441.7 289.3 440.7 292.5 439.0 292.5C437.3 292.5 434.3 289.7 433.0 289.5C431.7 289.3 432.0 291.8 431.0 291.5C430.0 291.2 429.3 288.5 427.0 287.5C424.7 286.5 419.2 285.3 417.0 285.5C414.8 285.7 415.9 289.1 414.0 288.5C412.1 287.9 407.2 283.8 405.5 282.0C403.8 280.2 404.8 277.8 404.0 277.5C403.2 277.2 402.5 280.5 401.0 280.5C399.5 280.5 396.4 277.6 395.0 277.5C393.6 277.4 393.1 261.8 392.5 280.0C391.9 298.2 391.5 368.3 391.5 387.0C391.5 405.7 391.3 390.0 392.5 392.0C393.7 394.0 398.2 395.8 398.5 399.0C398.8 402.2 386.5 393.3 394.5 411.0C402.5 428.7 438.7 488.7 446.5 505.0C454.3 521.3 441.7 507.0 441.5 509.0C441.3 511.0 445.1 515.4 445.5 517.0C445.9 518.6 446.2 518.5 444.0 518.5C441.8 518.5 440.8 529.0 432.5 517.0C424.2 505.0 400.8 457.8 394.0 446.5C387.2 435.2 391.8 441.1 391.5 449.0C391.2 456.9 394.5 485.7 392.5 494.0C390.5 502.3 381.3 495.5 379.5 499.0C377.7 502.5 381.4 511.6 381.5 515.0C381.6 518.4 382.8 518.8 380.0 519.5ZM363.5 336.0C368.9 335.4 366.2 343.2 366.5 333.0C366.8 322.8 366.8 285.2 365.5 275.0C364.2 264.8 360.6 271.8 359.0 271.5C357.4 271.2 357.0 273.7 356.0 273.5C355.0 273.3 354.5 270.5 353.0 270.5C351.5 270.5 349.0 273.5 347.0 273.5C345.0 273.5 343.5 270.3 341.0 270.5C338.5 270.7 334.1 272.9 332.0 274.5C329.9 276.1 328.9 270.2 328.5 280.0C328.1 289.8 328.6 323.6 329.5 333.0C330.4 342.4 328.3 336.0 334.0 336.5C339.7 337.0 358.1 336.6 363.5 336.0ZM111.5 442.0C113.8 440.0 120.9 431.1 122.5 428.0C124.1 424.9 122.9 424.2 121.0 423.5C119.1 422.8 113.1 423.1 111.0 423.5C108.9 423.9 108.9 423.2 108.5 426.0C108.1 428.8 108.0 437.3 108.5 440.0C109.0 442.7 109.2 444.0 111.5 442.0Z"}, "stall": {"w": 509, "h": 463, "d": "M466.0 460.5C463.9 460.9 458.1 460.9 456.0 460.5C453.9 460.1 453.9 460.9 453.5 458.0C453.1 455.1 455.8 446.3 453.5 443.0C451.2 439.7 441.8 443.7 439.5 438.0C437.2 432.3 446.6 420.4 439.5 409.0C432.4 397.6 432.1 376.4 397.0 369.5C361.9 362.6 272.5 367.8 229.0 367.5C185.5 367.2 159.6 361.2 136.0 367.5C112.4 373.8 95.9 398.1 87.5 405.0C79.1 411.9 85.8 403.5 85.5 409.0C85.2 414.5 85.9 432.8 85.5 438.0C85.1 443.2 84.9 440.1 83.0 440.5C81.1 440.9 75.9 440.9 74.0 440.5C72.1 440.1 71.8 441.9 71.5 438.0C71.2 434.1 72.8 420.9 72.5 417.0C72.2 413.1 72.2 413.2 70.0 414.5C67.8 415.8 61.2 417.6 59.5 425.0C57.8 432.4 61.8 453.1 59.5 459.0C57.2 464.9 48.7 460.7 46.0 460.5C43.3 460.3 43.6 478.2 43.5 458.0C43.4 437.8 46.8 359.5 45.5 339.0C44.2 318.5 37.2 338.2 35.5 335.0C33.8 331.8 33.8 323.7 35.5 320.0C37.2 316.3 43.7 315.5 45.5 313.0C47.3 310.5 46.2 336.3 46.5 305.0C46.8 273.7 47.8 155.4 47.5 125.0C47.2 94.6 46.9 122.8 45.0 122.5C43.1 122.2 38.0 123.8 36.0 123.5C34.0 123.2 34.3 120.5 33.0 120.5C31.7 120.5 29.5 123.7 28.0 123.5C26.5 123.3 25.3 119.7 24.0 119.5C22.7 119.3 21.5 123.2 20.0 122.5C18.5 121.8 16.3 116.2 15.0 115.5C13.7 114.8 12.6 118.8 12.0 118.5C11.4 118.2 12.6 115.2 11.5 114.0C10.4 112.8 6.3 113.2 5.5 111.0C4.7 108.8 7.2 104.2 6.5 101.0C5.8 97.8 -0.7 98.5 1.5 92.0C3.7 85.5 16.2 68.3 19.5 62.0C22.8 55.7 22.0 55.8 21.5 54.0C21.0 52.2 16.2 53.0 16.5 51.0C16.8 49.0 22.8 44.2 23.5 42.0C24.2 39.8 18.7 42.2 20.5 38.0C22.3 33.8 32.6 20.9 34.5 17.0C36.4 13.1 34.2 15.2 32.0 14.5C29.8 13.8 23.0 14.8 21.5 13.0C20.0 11.2 18.6 5.4 23.0 3.5C27.4 1.6 25.0 1.5 48.0 1.5C71.0 1.5 108.3 1.5 161.0 3.5C213.7 5.5 315.8 11.8 364.0 13.5C412.2 15.2 432.2 13.3 450.0 13.5C467.8 13.7 466.9 13.9 471.0 14.5C475.1 15.1 473.9 15.4 474.5 17.0C475.1 18.6 475.7 22.2 474.5 24.0C473.3 25.8 464.7 21.8 467.5 28.0C470.3 34.2 487.5 54.8 491.5 61.0C495.5 67.2 490.5 63.0 491.5 65.0C492.5 67.0 496.8 71.2 497.5 73.0C498.2 74.8 494.0 72.7 495.5 76.0C497.0 79.3 505.3 89.5 506.5 93.0C507.7 96.5 502.8 95.7 502.5 97.0C502.2 98.3 505.2 100.0 504.5 101.0C503.8 102.0 499.6 101.6 498.5 103.0C497.4 104.4 498.6 108.9 498.0 109.5C497.4 110.1 497.0 107.2 495.0 106.5C493.0 105.8 488.3 105.0 486.0 105.5C483.7 106.0 482.2 109.2 481.0 109.5C479.8 109.8 480.5 107.5 479.0 107.5C477.5 107.5 473.5 109.5 472.0 109.5C470.5 109.5 470.8 107.4 470.0 107.5C469.2 107.6 467.9 76.2 467.5 110.0C467.1 143.8 465.7 275.2 467.5 310.0C469.3 344.8 476.5 315.2 478.5 319.0C480.5 322.8 481.2 329.7 479.5 333.0C477.8 336.3 470.2 324.7 468.5 339.0C466.8 353.3 469.5 399.2 469.5 419.0C469.5 438.8 469.1 451.1 468.5 458.0C467.9 464.9 468.1 460.1 466.0 460.5ZM384.5 140.0C388.2 140.0 392.6 129.1 395.0 126.5C397.4 123.9 397.2 124.7 399.0 124.5C400.8 124.3 404.4 125.8 406.0 125.5C407.6 125.2 408.1 125.6 408.5 123.0C408.9 120.4 409.9 113.4 408.5 110.0C407.1 106.6 402.1 102.9 400.0 102.5C397.9 102.1 397.0 107.0 396.0 107.5C395.0 108.0 394.8 105.5 394.0 105.5C393.2 105.5 392.3 107.8 391.0 107.5C389.7 107.2 388.5 103.3 386.0 103.5C383.5 103.7 378.5 108.3 376.0 108.5C373.5 108.7 372.7 104.5 371.0 104.5C369.3 104.5 367.3 108.2 366.0 108.5C364.7 108.8 364.2 105.8 363.0 106.5C361.8 107.2 359.2 110.2 358.5 113.0C357.8 115.8 358.1 120.9 358.5 123.0C358.9 125.1 359.4 125.4 361.0 125.5C362.6 125.6 366.0 123.3 368.0 123.5C370.0 123.7 370.2 123.8 373.0 126.5C375.8 129.2 380.8 140.0 384.5 140.0ZM272.5 279.0C281.3 278.5 293.6 256.8 301.0 250.5C308.4 244.2 313.3 242.8 317.0 241.5C320.7 240.2 320.0 240.7 323.0 242.5C326.0 244.3 331.7 250.3 335.0 252.5C338.3 254.7 339.7 252.7 343.0 255.5C346.3 258.3 352.2 267.9 355.0 269.5C357.8 271.1 359.9 269.2 359.5 265.0C359.1 260.8 352.8 248.8 352.5 244.0C352.2 239.2 356.8 237.8 357.5 236.0C358.2 234.2 356.1 234.1 356.5 233.0C356.9 231.9 358.9 229.6 360.0 229.5C361.1 229.4 361.8 232.7 363.0 232.5C364.2 232.3 365.5 228.7 367.0 228.5C368.5 228.3 369.7 232.8 372.0 231.5C374.3 230.2 379.2 222.2 381.0 220.5C382.8 218.8 381.5 222.5 383.0 221.5C384.5 220.5 387.5 215.2 390.0 214.5C392.5 213.8 394.3 218.5 398.0 217.5C401.7 216.5 409.2 209.5 412.0 208.5C414.8 207.5 414.0 211.3 415.0 211.5C416.0 211.7 416.7 209.3 418.0 209.5C419.3 209.7 420.7 210.2 423.0 212.5C425.3 214.8 429.2 221.2 432.0 223.5C434.8 225.8 438.4 225.1 439.5 226.0C440.6 226.9 437.7 227.0 438.5 229.0C439.3 231.0 443.7 235.7 444.5 238.0C445.3 240.3 443.3 241.8 443.5 243.0C443.7 244.2 445.8 243.5 445.5 245.0C445.2 246.5 440.6 247.8 441.5 252.0C442.4 256.2 449.0 267.8 451.0 270.5C453.0 273.2 453.1 278.8 453.5 268.0C453.9 257.2 455.0 218.0 453.5 206.0C452.0 194.0 446.0 200.7 444.5 196.0C443.0 191.3 443.0 182.3 444.5 178.0C446.0 173.7 452.0 177.0 453.5 170.0C455.0 163.0 455.0 142.5 453.5 136.0C452.0 129.5 445.7 132.7 444.5 131.0C443.3 129.3 446.7 129.3 446.5 126.0C446.3 122.7 445.2 114.6 443.5 111.0C441.8 107.4 438.2 104.9 436.0 104.5C433.8 104.1 431.8 108.7 430.0 108.5C428.2 108.3 427.8 103.2 425.0 103.5C422.2 103.8 415.4 106.8 413.5 110.0C411.6 113.2 412.9 120.2 413.5 123.0C414.1 125.8 415.1 126.1 417.0 126.5C418.9 126.9 422.4 124.8 425.0 125.5C427.6 126.2 430.2 128.2 432.5 131.0C434.8 133.8 437.2 138.3 438.5 142.0C439.8 145.7 440.5 148.7 440.5 153.0C440.5 157.3 439.7 164.3 438.5 168.0C437.3 171.7 434.3 173.2 433.5 175.0C432.7 176.8 434.9 176.8 433.5 179.0C432.1 181.2 427.6 186.8 425.0 188.5C422.4 190.2 419.8 188.7 418.0 189.5C416.2 190.3 417.7 193.7 414.0 193.5C410.3 193.3 400.2 190.4 396.0 188.5C391.8 186.6 389.9 184.1 388.5 182.0C387.1 179.9 388.4 177.9 387.5 176.0C386.6 174.1 385.2 169.5 383.0 170.5C380.8 171.5 377.3 179.0 374.5 182.0C371.7 185.0 370.4 187.1 366.0 188.5C361.6 189.9 352.2 190.7 348.0 190.5C343.8 190.3 343.4 189.2 341.0 187.5C338.6 185.8 335.7 183.0 333.5 180.0C331.3 177.0 330.2 169.0 328.0 169.5C325.8 170.0 323.7 179.0 320.5 183.0C317.3 187.0 312.8 191.1 309.0 193.5C305.2 195.9 300.3 197.3 298.0 197.5C295.7 197.7 297.3 195.3 295.0 194.5C292.7 193.7 287.2 193.9 284.0 192.5C280.8 191.1 277.8 188.4 275.5 186.0C273.2 183.6 271.2 181.0 270.5 178.0C269.8 175.0 272.0 170.8 271.5 168.0C271.0 165.2 267.8 162.8 267.5 161.0C267.2 159.2 269.3 159.2 269.5 157.0C269.7 154.8 267.3 151.8 268.5 148.0C269.7 144.2 273.8 137.4 276.5 134.0C279.2 130.6 283.1 128.8 285.0 127.5C286.9 126.2 286.7 126.2 288.0 126.5C289.3 126.8 291.8 129.4 293.0 129.5C294.2 129.6 295.1 128.2 295.5 127.0C295.9 125.8 296.1 123.4 295.5 122.0C294.9 120.6 293.2 118.4 292.0 118.5C290.8 118.6 288.9 122.1 288.0 122.5C287.1 122.9 286.4 121.9 286.5 121.0C286.6 120.1 288.6 118.1 288.5 117.0C288.4 115.9 287.1 113.6 286.0 114.5C284.9 115.4 283.7 122.0 282.0 122.5C280.3 123.0 277.8 117.5 276.0 117.5C274.2 117.5 273.7 122.3 271.0 122.5C268.3 122.7 264.3 118.3 260.0 118.5C255.7 118.7 248.3 123.3 245.0 123.5C241.7 123.7 242.2 119.3 240.0 119.5C237.8 119.7 234.2 124.7 232.0 124.5C229.8 124.3 229.0 118.3 227.0 118.5C225.0 118.7 222.7 125.2 220.0 125.5C217.3 125.8 213.2 120.7 211.0 120.5C208.8 120.3 209.7 124.5 207.0 124.5C204.3 124.5 198.0 120.3 195.0 120.5C192.0 120.7 191.8 125.5 189.0 125.5C186.2 125.5 181.5 120.5 178.0 120.5C174.5 120.5 170.7 125.5 168.0 125.5C165.3 125.5 164.5 120.5 162.0 120.5C159.5 120.5 155.3 125.5 153.0 125.5C150.7 125.5 149.5 120.7 148.0 120.5C146.5 120.3 145.7 124.7 144.0 124.5C142.3 124.3 140.3 119.5 138.0 119.5C135.7 119.5 132.3 124.0 130.0 124.5C127.7 125.0 125.7 122.2 124.0 122.5C122.3 122.8 122.0 126.7 120.0 126.5C118.0 126.3 114.0 121.7 112.0 121.5C110.0 121.3 109.0 125.2 108.0 125.5C107.0 125.8 107.2 123.5 106.0 123.5C104.8 123.5 102.7 126.0 101.0 125.5C99.3 125.0 97.3 120.8 96.0 120.5C94.7 120.2 94.0 123.3 93.0 123.5C92.0 123.7 91.2 121.1 90.0 121.5C88.8 121.9 86.4 107.9 85.5 126.0C84.6 144.1 84.5 210.0 84.5 230.0C84.5 250.0 84.9 242.9 85.5 246.0C86.1 249.1 86.8 249.1 88.0 248.5C89.2 247.9 90.0 244.8 93.0 242.5C96.0 240.2 100.5 237.2 106.0 234.5C111.5 231.8 121.0 226.5 126.0 226.5C131.0 226.5 133.3 233.3 136.0 234.5C138.7 235.7 140.3 233.0 142.0 233.5C143.7 234.0 144.3 236.7 146.0 237.5C147.7 238.3 149.5 236.5 152.0 238.5C154.5 240.5 158.1 246.9 161.0 249.5C163.9 252.1 167.9 252.2 169.5 254.0C171.1 255.8 167.9 256.8 170.5 260.0C173.1 263.2 179.2 274.6 185.0 273.5C190.8 272.4 200.5 257.0 205.0 253.5C209.5 250.0 209.2 254.2 212.0 252.5C214.8 250.8 219.2 245.0 222.0 243.5C224.8 242.0 226.3 242.0 229.0 243.5C231.7 245.0 234.8 250.8 238.0 252.5C241.2 254.2 242.2 249.1 248.0 253.5C253.8 257.9 263.7 279.5 272.5 279.0ZM327.5 143.0C332.5 142.2 338.8 126.9 342.0 123.5C345.2 120.1 345.3 122.0 347.0 122.5C348.7 123.0 350.8 126.2 352.0 126.5C353.2 126.8 354.2 126.8 354.5 124.0C354.8 121.2 354.1 112.8 353.5 110.0C352.9 107.2 351.8 107.6 351.0 107.5C350.2 107.4 350.0 109.5 349.0 109.5C348.0 109.5 346.3 107.2 345.0 107.5C343.7 107.8 342.0 111.2 341.0 111.5C340.0 111.8 340.0 109.7 339.0 109.5C338.0 109.3 337.2 109.5 335.0 110.5C332.8 111.5 328.5 115.3 326.0 115.5C323.5 115.7 321.8 111.2 320.0 111.5C318.2 111.8 316.2 116.8 315.0 117.5C313.8 118.2 314.0 115.2 313.0 115.5C312.0 115.8 310.2 119.2 309.0 119.5C307.8 119.8 307.2 117.1 306.0 117.5C304.8 117.9 302.4 120.2 301.5 122.0C300.6 123.8 300.2 126.6 300.5 128.0C300.8 129.4 302.1 130.6 303.0 130.5C303.9 130.4 304.5 127.8 306.0 127.5C307.5 127.2 308.4 125.9 312.0 128.5C315.6 131.1 322.5 143.8 327.5 143.0ZM63.5 273.0C65.7 271.2 71.8 284.5 73.5 260.0C75.2 235.5 74.9 149.1 73.5 126.0C72.1 102.9 67.2 121.7 65.0 121.5C62.8 121.3 61.4 101.2 60.5 125.0C59.6 148.8 59.5 239.7 59.5 264.0C59.5 288.3 59.8 269.5 60.5 271.0C61.2 272.5 61.3 274.8 63.5 273.0ZM62.5 312.0C64.5 311.5 71.4 310.6 71.5 307.0C71.6 303.4 64.8 292.8 63.0 290.5C61.2 288.2 61.1 290.8 60.5 293.0C59.9 295.2 59.7 301.2 59.5 304.0C59.3 306.8 59.0 308.7 59.5 310.0C60.0 311.3 60.5 312.5 62.5 312.0ZM185.5 308.0C187.6 307.6 188.4 308.2 187.5 306.0C186.6 303.8 182.5 294.5 180.0 294.5C177.5 294.5 173.3 303.7 172.5 306.0C171.7 308.3 172.8 308.2 175.0 308.5C177.2 308.8 183.4 308.4 185.5 308.0ZM278.5 308.0C280.8 307.6 281.6 308.2 280.5 306.0C279.4 303.8 274.7 294.5 272.0 294.5C269.3 294.5 265.3 303.7 264.5 306.0C263.7 308.3 264.7 308.2 267.0 308.5C269.3 308.8 276.2 308.4 278.5 308.0ZM360.5 308.0C361.6 307.6 362.9 307.2 362.5 306.0C362.1 304.8 359.5 300.5 358.0 300.5C356.5 300.5 353.8 304.7 353.5 306.0C353.2 307.3 354.8 308.2 356.0 308.5C357.2 308.8 359.4 308.4 360.5 308.0ZM432.5 361.0C437.6 360.8 439.2 361.8 440.5 358.0C441.8 354.2 440.9 341.8 440.5 338.0C440.1 334.2 441.9 335.8 438.0 335.5C434.1 335.2 421.0 335.2 417.0 336.5C413.0 337.8 415.3 343.5 414.0 343.5C412.7 343.5 412.7 337.7 409.0 336.5C405.3 335.3 395.2 336.1 392.0 336.5C388.8 336.9 386.5 335.2 389.5 339.0C392.5 342.8 402.8 355.8 410.0 359.5C417.2 363.2 427.4 361.2 432.5 361.0ZM63.5 408.0C65.5 407.2 70.0 403.7 71.5 401.0C73.0 398.3 72.5 398.8 72.5 392.0C72.5 385.2 71.3 368.8 71.5 360.0C71.7 351.2 73.6 342.9 73.5 339.0C73.4 335.1 72.2 336.9 71.0 336.5C69.8 336.1 67.9 335.1 66.0 336.5C64.1 337.9 60.6 333.4 59.5 345.0C58.4 356.6 58.8 395.5 59.5 406.0C60.2 416.5 61.5 408.8 63.5 408.0ZM119.5 359.0C128.8 355.8 139.9 342.8 143.5 339.0C147.1 335.2 150.2 336.9 141.0 336.5C131.8 336.1 97.2 336.1 88.0 336.5C78.8 336.9 85.9 335.8 85.5 339.0C85.1 342.2 85.1 352.8 85.5 356.0C85.9 359.2 82.3 358.0 88.0 358.5C93.7 359.0 110.2 362.2 119.5 359.0ZM372.5 360.0C386.0 360.0 375.8 360.2 377.0 359.5C378.2 358.8 382.5 359.8 379.5 356.0C376.5 352.2 364.1 339.8 359.0 336.5C353.9 333.2 351.7 334.0 349.0 336.5C346.3 339.0 344.8 351.5 343.0 351.5C341.2 351.5 348.7 339.0 338.0 336.5C327.3 334.0 289.2 336.1 279.0 336.5C268.8 336.9 276.6 337.9 276.5 339.0C276.4 340.1 278.4 342.1 278.5 343.0C278.6 343.9 278.2 345.2 277.0 344.5C275.8 343.8 273.2 339.0 271.0 338.5C268.8 338.0 266.5 341.8 264.0 341.5C261.5 341.2 265.2 337.3 256.0 336.5C246.8 335.7 217.3 336.0 209.0 336.5C200.7 337.0 207.0 339.5 206.0 339.5C205.0 339.5 208.3 337.0 203.0 336.5C197.7 336.0 182.6 333.2 174.0 336.5C165.4 339.8 154.7 352.2 151.5 356.0C148.3 359.8 132.6 358.9 155.0 359.5C177.4 360.1 263.8 359.8 286.0 359.5C308.2 359.2 286.3 357.5 288.0 357.5C289.7 357.5 281.9 359.1 296.0 359.5C310.1 359.9 359.0 360.0 372.5 360.0ZM438.5 386.0C441.2 387.7 440.2 387.0 440.5 384.0C440.8 381.0 441.1 371.2 440.5 368.0C439.9 364.8 439.8 364.8 437.0 364.5C434.2 364.2 426.6 365.8 424.0 366.5C421.4 367.2 421.4 367.8 421.5 369.0C421.6 370.2 421.7 371.2 424.5 374.0C427.3 376.8 435.8 384.3 438.5 386.0ZM88.5 387.0C92.5 384.3 106.4 372.6 109.5 369.0C112.6 365.4 110.6 365.9 107.0 365.5C103.4 365.1 91.6 365.9 88.0 366.5C84.4 367.1 85.9 365.9 85.5 369.0C85.1 372.1 85.0 382.0 85.5 385.0C86.0 388.0 84.5 389.7 88.5 387.0Z"}};
diff --git a/site/shooting-an-elephant/lib/units.css b/site/shooting-an-elephant/lib/units.css
new file mode 100644
index 0000000..e9c62cb
--- /dev/null
+++ b/site/shooting-an-elephant/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/shooting-an-elephant/lib/units.js b/site/shooting-an-elephant/lib/units.js
new file mode 100644
index 0000000..e9e8c27
--- /dev/null
+++ b/site/shooting-an-elephant/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/shooting-an-elephant/lib/volume.css b/site/shooting-an-elephant/lib/volume.css
new file mode 100644
index 0000000..106dd36
--- /dev/null
+++ b/site/shooting-an-elephant/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: var(--hover, #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/shooting-an-elephant/lib/volume.js b/site/shooting-an-elephant/lib/volume.js
new file mode 100644
index 0000000..4ea3a55
--- /dev/null
+++ b/site/shooting-an-elephant/lib/volume.js
@@ -0,0 +1,23 @@
+/* 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();
+ const apply = () => {
+ input.style.setProperty('--volume', +input.value * 100 + '%');
+ if (P.audio) P.audio.volume = +input.value;
+ };
+ // the volume carries over to the next chapter; a muted slider does not, so a new visit always has sound
+ try { const v = +localStorage.getItem('papermorph:volume'); if (v) { input.value = v; apply(); } } catch {}
+ input.oninput = () => { apply(); try { localStorage.setItem('papermorph:volume', input.value); } catch {} };
+}