An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(site): LRRH meadow set, three oaks, new poses, listen-and-find wiring
yzr56282f72b626
diff --git a/site/little-red-riding-hood/ch01/index.html b/site/little-red-riding-hood/ch01/index.htmlindex 959adb4..3223f33 100644--- a/site/little-red-riding-hood/ch01/index.html+++ b/site/little-red-riding-hood/ch01/index.html@@ -19,6 +19,7 @@<script src="audio/en/mouths.js"></script><script src="audio/en/shots.js"></script><script src="../lib/shared.js"></script>+<script src="../lib/find.js"></script><script src="scene1.js"></script><script src="scene2.js"></script><script src="scene3.js"></script>@@ -38,13 +39,16 @@ const CHAPTER = { number: 1, title: 'Little Red Riding Hood', minutes: 4, langua// A picture book: captions are on unless the reader turned them off.try { if (localStorage.getItem('captions') === null) setCaptions(true, false); } catch {}+// The meadow stop is "listen and find" (lib/find.js): Red asks for one thing at a time; every thing in the picture+// answers a tap with its name. Only things that move are asked for; a found flower flies into her bouquet.+const FIND_MEADOW = ['flower', 'butterfly', 'bird'].map((w, i) => ({ word: w, clip: 'q-' + w + (i ? '' : '1') }));/* ---------- beats: [id, title, run(m, D), extra] ---------- */const BEATS = [['scene1', 'Home', (m, D) => scene1(panel(0), D), { lead: false, pre: PRE1 }],['scene2', 'Into the woods', (m, D) => scene2(panel(0), D), { lead: false, pre: PRE2 }],['scene3', 'Good morning', (m, D) => scene3(panel(0), D), { lead: false, pre: PRE3 }],['scene4', 'Flowers', (m, D) => scene4(panel(0), D), { lead: false, pre: PRE4 }],- ['scene4w', 'In the meadow', (m, D) => scene4w(panel(0), D), { lead: false, pre: PRE4W, ask: done => tapWords(MEADOW_THINGS, done) }],+ ['scene4w', 'In the meadow', (m, D) => scene4w(panel(0), D), { lead: false, pre: PRE4W, ask: done => findWords(MEADOW_THINGS, FIND_MEADOW, done), video: PRE4W + TIMINGS.scene4w.dur }],['scene5', 'Knock, knock', (m, D) => scene5(panel(0), D), { lead: false, pre: PRE5 }],['scene6', 'The wardrobe', (m, D) => scene6(panel(0), D), { lead: false, pre: PRE6 }],['scene7', 'The open door', (m, D) => scene7(panel(0), D), { lead: false, pre: PRE7 }],@@ -60,7 +64,8 @@ const BEATS = [[['m1-home', ['scene1', 'scene2']], ['m2-wolf', ['scene3', 'scene4', 'scene4w', 'scene5']],['m3-chimney', ['scene6', 'scene7', 'scene8', 'scene9']], ['m4-ending', ['scene10', 'scene11']]].forEach(([n, beats]) => music(`audio/bgm/${n}.mp3`, beats, +(new URLSearchParams(location.search).get('bgm') || .6)));-paperWarm(g => { redPuppet(g); motherPuppet(g); wolfPuppet(g); grandmaPuppet(g); woodcutterPuppet(g); door(g); smoke(g, 0, 0); });+paperWarm(g => { redPuppet(g); motherPuppet(g); wolfPuppet(g); grandmaPuppet(g); woodcutterPuppet(g); door(g); smoke(g, 0, 0);+ birdProp(g); butterflyProp(g); FLOWER_COLS.forEach(c => flowerProp(g, c)); cloudProp(g); sunProp(g); granCapProp(g); basketProp(g); });boot();</script></body>diff --git a/site/little-red-riding-hood/ch01/scene4w.js b/site/little-red-riding-hood/ch01/scene4w.jsindex fc6a428..816812c 100644--- a/site/little-red-riding-hood/ch01/scene4w.js+++ b/site/little-red-riding-hood/ch01/scene4w.js@@ -7,29 +7,7 @@ const PRE4W = 1.2, CAM4W = { x: 3250, y: 480, z: 1.2 };let MEADOW_THINGS = [];// A screen point of the fixed view, in the world of its k = 1 plane (where hit shapes and puppets go).const meadowAt = (sx, sy) => [CAM4W.x + (sx - 800) / CAM4W.z, CAM4W.y + (sy - 450) / CAM4W.z];-function birdProp(parent) {- const g = mk('g', {}, parent), body = mk('g', {}, g);- body.innerHTML = `<g filter="url(#paper)"><path d="M-30,4 L-52,-6 L-50,12 Z" fill="#3f5f8a"/><ellipse cx="0" cy="0" rx="30" ry="21" fill="#5b82b8"/>- <ellipse cx="6" cy="8" rx="17" ry="11" fill="#f1e2c4"/></g>`;- const head = mk('g', {}, body);- head.innerHTML = `<g filter="url(#paper)"><circle cx="24" cy="-18" r="15" fill="#5b82b8"/><path d="M37,-21 L50,-16 L37,-12 Z" fill="#efae48"/></g><circle cx="29" cy="-21" r="3.2" fill="#22150e"/>`;- const wing = prop(body, `<g filter="url(#paper)"><path d="M-14,-6 Q4,-22 18,-4 Q2,10 -14,-6 Z" fill="#3f5f8a"/></g>`);- const legs = prop(g, `<path d="M-4,18 l-3,14 M8,18 l2,14" stroke="#c98a3c" stroke-width="3"/>`);- bakeAll(g);- return { g, pose(x, y, s, { peck = 0, flap = 0, look = 0 } = {}) {- tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); vis(legs, !flap);- tf(body, `translate(0,${flap ? -14 : 0}) rotate(${(peck * 28).toFixed(1)},10,10)`);- tf(head, `rotate(${(look * 10).toFixed(1)},24,-8)`);- tf(wing, flap ? `rotate(${flap > 0 ? -50 : 20},-14,-6)` : '');- } };-}-function butterflyProp(parent) {- const g = mk('g', {}, parent), wings = [-1, 1].map(d => prop(g, `<g filter="url(#paper)"><path d="M0,0 C${12 * d},-34 ${44 * d},-30 ${36 * d},-6 C${32 * d},6 ${12 * d},4 0,0 Z" fill="#e88ab0"/>- <path d="M0,2 C${16 * d},8 ${30 * d},16 ${20 * d},30 C${10 * d},32 ${2 * d},18 0,2 Z" fill="#efae48"/><circle cx="${22 * d}" cy="-14" r="5" fill="#f6efe0"/></g>`));- prop(g, `<g filter="url(#paper)"><rect x="-3.5" y="-16" width="7" height="34" rx="3.5" fill="#3b2a1e"/></g><path d="M-2,-15 q-6,-12 -12,-14 M2,-15 q6,-12 12,-14" stroke="#3b2a1e" stroke-width="2" fill="none"/>`);- mk('circle', { r: 40, fill: 'transparent' }, g); // a finger-sized target even when the wings are shut- return { g, pose(x, y, s, open) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); wings.forEach(w => tf(w, `scale(${open},1)`)); } };-}+// birdProp and butterflyProp live in lib/shared.js (the meadow props).function scene4w(p, D) {const cam = paperCam(p, 'forest', CAM4W), st = cam.stage;// the set's own clouds sit at the very top of this view: one more, lower and drifting, is the one to tapdiff --git a/site/little-red-riding-hood/img/puppets/05f741e8.webp b/site/little-red-riding-hood/img/puppets/05f741e8.webpnew file mode 100644index 0000000..539a2d8Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/05f741e8.webp differdiff --git a/site/little-red-riding-hood/img/puppets/06696574.webp b/site/little-red-riding-hood/img/puppets/06696574.webpnew file mode 100644index 0000000..72d7e81Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/06696574.webp differdiff --git a/site/little-red-riding-hood/img/puppets/0a0d0d5b.webp b/site/little-red-riding-hood/img/puppets/0a0d0d5b.webpnew file mode 100644index 0000000..a300bb9Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/0a0d0d5b.webp differdiff --git a/site/little-red-riding-hood/img/puppets/0bfe47d6.webp b/site/little-red-riding-hood/img/puppets/0bfe47d6.webpnew file mode 100644index 0000000..4a2c109Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/0bfe47d6.webp differdiff --git a/site/little-red-riding-hood/img/puppets/2409216d.webp b/site/little-red-riding-hood/img/puppets/2409216d.webpnew file mode 100644index 0000000..6a5ff8eBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/2409216d.webp differdiff --git a/site/little-red-riding-hood/img/puppets/27beb629.webp b/site/little-red-riding-hood/img/puppets/27beb629.webpnew file mode 100644index 0000000..061c4a2Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/27beb629.webp differdiff --git a/site/little-red-riding-hood/img/puppets/2ddf8c86.webp b/site/little-red-riding-hood/img/puppets/2ddf8c86.webpnew file mode 100644index 0000000..70483c0Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/2ddf8c86.webp differdiff --git a/site/little-red-riding-hood/img/puppets/2e7edc08.webp b/site/little-red-riding-hood/img/puppets/2e7edc08.webpnew file mode 100644index 0000000..4be896aBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/2e7edc08.webp differdiff --git a/site/little-red-riding-hood/img/puppets/2f9eac17.webp b/site/little-red-riding-hood/img/puppets/2f9eac17.webpnew file mode 100644index 0000000..ab62eabBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/2f9eac17.webp differdiff --git a/site/little-red-riding-hood/img/puppets/41acda97.webp b/site/little-red-riding-hood/img/puppets/41acda97.webpnew file mode 100644index 0000000..6c1a0abBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/41acda97.webp differdiff --git a/site/little-red-riding-hood/img/puppets/4bb38ff7.webp b/site/little-red-riding-hood/img/puppets/4bb38ff7.webpnew file mode 100644index 0000000..2496fa9Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/4bb38ff7.webp differdiff --git a/site/little-red-riding-hood/img/puppets/528517ce.webp b/site/little-red-riding-hood/img/puppets/528517ce.webpnew file mode 100644index 0000000..6948b31Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/528517ce.webp differdiff --git a/site/little-red-riding-hood/img/puppets/5fe30de5.webp b/site/little-red-riding-hood/img/puppets/5fe30de5.webpnew file mode 100644index 0000000..96270e2Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/5fe30de5.webp differdiff --git a/site/little-red-riding-hood/img/puppets/64ff091d.webp b/site/little-red-riding-hood/img/puppets/64ff091d.webpnew file mode 100644index 0000000..29b86f9Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/64ff091d.webp differdiff --git a/site/little-red-riding-hood/img/puppets/927fea02.webp b/site/little-red-riding-hood/img/puppets/927fea02.webpnew file mode 100644index 0000000..a479500Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/927fea02.webp differdiff --git a/site/little-red-riding-hood/img/puppets/92d8cc94.webp b/site/little-red-riding-hood/img/puppets/92d8cc94.webpnew file mode 100644index 0000000..5ffebe7Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/92d8cc94.webp differdiff --git a/site/little-red-riding-hood/img/puppets/a0472d62.webp b/site/little-red-riding-hood/img/puppets/a0472d62.webpnew file mode 100644index 0000000..78723d4Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/a0472d62.webp differdiff --git a/site/little-red-riding-hood/img/puppets/afe83b21.webp b/site/little-red-riding-hood/img/puppets/afe83b21.webpnew file mode 100644index 0000000..629419cBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/afe83b21.webp differdiff --git a/site/little-red-riding-hood/img/puppets/afec31f7.webp b/site/little-red-riding-hood/img/puppets/afec31f7.webpnew file mode 100644index 0000000..1db1c20Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/afec31f7.webp differdiff --git a/site/little-red-riding-hood/img/puppets/b10b33f5.webp b/site/little-red-riding-hood/img/puppets/b10b33f5.webpnew file mode 100644index 0000000..b6146adBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/b10b33f5.webp differdiff --git a/site/little-red-riding-hood/img/puppets/baked.js b/site/little-red-riding-hood/img/puppets/baked.jsindex 88a7b9b..4500edb 100644--- a/site/little-red-riding-hood/img/puppets/baked.js+++ b/site/little-red-riding-hood/img/puppets/baked.js@@ -1 +1 @@-window.BAKED = {"a1f9044e": "a1f9044e.webp", "a82cdd39": "a82cdd39.webp", "1fb78fa0": "1fb78fa0.webp", "2fccaa46": "2fccaa46.webp", "2b4def45": "2b4def45.webp", "61e4b434": "61e4b434.webp", "2f3361cb": "2f3361cb.webp", "38a61d82": "38a61d82.webp", "0b6d5850": "0b6d5850.webp", "972a2990": "972a2990.webp", "8fb85b5f": "8fb85b5f.webp", "47303142": "47303142.webp", "e8abb9cc": "e8abb9cc.webp", "6560b54b": "6560b54b.webp", "dfd0994b": "dfd0994b.webp", "637b3242": "637b3242.webp", "9a8e7995": "9a8e7995.webp", "d558d360": "d558d360.webp", "b60600e6": "b60600e6.webp", "67b96c62": "67b96c62.webp", "e07c2616": "e07c2616.webp", "68aacc3b": "68aacc3b.webp", "26ce673f": "26ce673f.webp", "1927ca5f": "1927ca5f.webp", "00b9c591": "00b9c591.webp", "38efed4a": "38efed4a.webp", "4fe02087": "4fe02087.webp", "91989f79": "91989f79.webp", "50555d75": "50555d75.webp", "00691678": "00691678.webp", "7db58c86": "7db58c86.webp", "430e8217": "430e8217.webp", "325e0ec0": "325e0ec0.webp", "b18f7823": "b18f7823.webp", "dd67ea8f": "dd67ea8f.webp", "052d3885": "052d3885.webp", "b31a1c3e": "b31a1c3e.webp", "0e0bbf87": "0e0bbf87.webp", "aa69cfd0": "aa69cfd0.webp", "a55d2d0b": "a55d2d0b.webp", "b260c6d9": "b260c6d9.webp", "8fa5a67a": "8fa5a67a.webp", "df4c9f52": "df4c9f52.webp", "15348a3e": "15348a3e.webp", "66522ec1": "66522ec1.webp", "8c773887": "8c773887.webp", "01ece229": "01ece229.webp", "afce0caf": "afce0caf.webp", "249d4211": "249d4211.webp", "268183d8": "268183d8.webp", "89dd7be0": "89dd7be0.webp", "3d022f6e": "3d022f6e.webp", "ad77d9d1": "ad77d9d1.webp", "17cb9a67": "17cb9a67.webp", "f44de40f": "f44de40f.webp", "49d81387": "49d81387.webp", "7f6aeb8e": "7f6aeb8e.webp", "90c16dfc": "90c16dfc.webp", "c8022302": "c8022302.webp", "c3ae56b8": "c3ae56b8.webp", "0995fa4a": "0995fa4a.webp", "65b40bba": "65b40bba.webp", "890768cc": "890768cc.webp", "45adb00b": "45adb00b.webp", "bd410b97": "bd410b97.webp", "07e43fe2": "07e43fe2.webp", "893c17b4": "893c17b4.webp", "96ed815a": "96ed815a.webp", "d88870bd": "d88870bd.webp", "aae7782d": "aae7782d.webp", "9c2a38c7": "9c2a38c7.webp", "317f0998": "317f0998.webp", "e0aa53c1": "e0aa53c1.webp", "bd496b6b": "bd496b6b.webp", "b1b68679": "b1b68679.webp", "6bb05552": "6bb05552.webp", "a4c7fe84": "a4c7fe84.webp", "49216877": "49216877.webp", "87b38e88": "87b38e88.webp", "fb74c845": "fb74c845.webp", "21871651": "21871651.webp", "048622bd": "048622bd.webp", "b10b1ba3": "b10b1ba3.webp", "76af3a6a": "76af3a6a.webp", "5e199298": "5e199298.webp", "02233c08": "02233c08.webp", "bbcfa223": "bbcfa223.webp", "ae02425a": "ae02425a.webp", "22b330d8": "22b330d8.webp", "b244328f": "b244328f.webp", "448070af": "448070af.webp", "f00e0a82": "f00e0a82.webp", "5591793f": "5591793f.webp", "a49022ab": "a49022ab.webp", "abc36243": "abc36243.webp", "c549a7dc": "c549a7dc.webp", "c72a7a0e": "c72a7a0e.webp", "ee7be279": "ee7be279.webp", "9a93ee7b": "9a93ee7b.webp", "b4cfc9e6": "b4cfc9e6.webp", "8084dbe5": "8084dbe5.webp", "9e818400": "9e818400.webp", "b47df80a": "b47df80a.webp", "cda48047": "cda48047.webp", "c831602c": "c831602c.webp", "de04d2a6": "de04d2a6.webp", "b624a6da": "b624a6da.webp", "b4b2a03f": "b4b2a03f.webp", "f4f12b0b": "f4f12b0b.webp", "cb722cbc": "cb722cbc.webp", "019a6eb5": "019a6eb5.webp", "5ce62f06": "5ce62f06.webp", "cfeeae59": "cfeeae59.webp", "08d278c9": "08d278c9.webp", "cc5293e9": "cc5293e9.webp", "00ed75c0": "00ed75c0.webp", "737fcf0d": "737fcf0d.webp", "d1098e28": "d1098e28.webp", "fccaed6b": "fccaed6b.webp", "04825ab7": "04825ab7.webp", "9f11fb36": "9f11fb36.webp", "1818c0b0": "1818c0b0.webp", "fd80fc06": "fd80fc06.webp", "fe24cdc6": "fe24cdc6.webp", "5002f3c2": "5002f3c2.webp", "a1accb5b": "a1accb5b.webp", "d1475779": "d1475779.webp", "8b92daf9": "8b92daf9.webp", "9e03257b": "9e03257b.webp", "84ee8e9d": "84ee8e9d.webp", "73eea61d": "73eea61d.webp", "710d33cc": "710d33cc.webp", "2386ed1e": "2386ed1e.webp", "63f9861f": "63f9861f.webp", "ad50f310": "ad50f310.webp", "e499397a": "e499397a.webp", "61c35daa": "61c35daa.webp", "7f72bf1e": "7f72bf1e.webp", "6e064772": "6e064772.webp", "d80c5e29": "d80c5e29.webp", "6718ece9": "6718ece9.webp", "54724fde": "54724fde.webp", "d03b1c7d": "d03b1c7d.webp", "1df26c50": "1df26c50.webp", "9bcf915c": "9bcf915c.webp", "0ade0161": "0ade0161.webp", "c354be41": "c354be41.webp", "9867d25c": "9867d25c.webp", "626efa6b": "626efa6b.webp", "285d009c": "285d009c.webp", "7053431d": "7053431d.webp", "f3801f21": "f3801f21.webp", "de2885ae": "de2885ae.webp", "08df1e8a": "08df1e8a.webp", "0576a387": "0576a387.webp", "859db3f7": "859db3f7.webp", "354020c0": "354020c0.webp", "607172c1": "607172c1.webp", "aad5bc13": "aad5bc13.webp", "6e2848e9": "6e2848e9.webp", "a1924c9f": "a1924c9f.webp", "c8d7da0b": "c8d7da0b.webp", "9cd763ef": "9cd763ef.webp", "84ee16b4": "84ee16b4.webp", "53ebd337": "53ebd337.webp", "b5d79c5d": "b5d79c5d.webp", "57e7a7c6": "57e7a7c6.webp", "3968ce36": "3968ce36.webp"};+window.BAKED = {"a1f9044e": "a1f9044e.webp", "a82cdd39": "a82cdd39.webp", "1fb78fa0": "1fb78fa0.webp", "2fccaa46": "2fccaa46.webp", "2b4def45": "2b4def45.webp", "61e4b434": "61e4b434.webp", "2f3361cb": "2f3361cb.webp", "38a61d82": "38a61d82.webp", "0b6d5850": "0b6d5850.webp", "972a2990": "972a2990.webp", "8fb85b5f": "8fb85b5f.webp", "47303142": "47303142.webp", "e8abb9cc": "e8abb9cc.webp", "6560b54b": "6560b54b.webp", "dfd0994b": "dfd0994b.webp", "637b3242": "637b3242.webp", "9a8e7995": "9a8e7995.webp", "d558d360": "d558d360.webp", "b60600e6": "b60600e6.webp", "67b96c62": "67b96c62.webp", "e07c2616": "e07c2616.webp", "68aacc3b": "68aacc3b.webp", "26ce673f": "26ce673f.webp", "1927ca5f": "1927ca5f.webp", "00b9c591": "00b9c591.webp", "38efed4a": "38efed4a.webp", "4fe02087": "4fe02087.webp", "91989f79": "91989f79.webp", "50555d75": "50555d75.webp", "00691678": "00691678.webp", "7db58c86": "7db58c86.webp", "430e8217": "430e8217.webp", "325e0ec0": "325e0ec0.webp", "b18f7823": "b18f7823.webp", "dd67ea8f": "dd67ea8f.webp", "052d3885": "052d3885.webp", "b31a1c3e": "b31a1c3e.webp", "0e0bbf87": "0e0bbf87.webp", "aa69cfd0": "aa69cfd0.webp", "a55d2d0b": "a55d2d0b.webp", "b260c6d9": "b260c6d9.webp", "8fa5a67a": "8fa5a67a.webp", "df4c9f52": "df4c9f52.webp", "15348a3e": "15348a3e.webp", "66522ec1": "66522ec1.webp", "8c773887": "8c773887.webp", "01ece229": "01ece229.webp", "afce0caf": "afce0caf.webp", "249d4211": "249d4211.webp", "268183d8": "268183d8.webp", "89dd7be0": "89dd7be0.webp", "3d022f6e": "3d022f6e.webp", "ad77d9d1": "ad77d9d1.webp", "17cb9a67": "17cb9a67.webp", "f44de40f": "f44de40f.webp", "49d81387": "49d81387.webp", "7f6aeb8e": "7f6aeb8e.webp", "90c16dfc": "90c16dfc.webp", "c8022302": "c8022302.webp", "c3ae56b8": "c3ae56b8.webp", "0995fa4a": "0995fa4a.webp", "65b40bba": "65b40bba.webp", "890768cc": "890768cc.webp", "45adb00b": "45adb00b.webp", "bd410b97": "bd410b97.webp", "07e43fe2": "07e43fe2.webp", "893c17b4": "893c17b4.webp", "96ed815a": "96ed815a.webp", "d88870bd": "d88870bd.webp", "aae7782d": "aae7782d.webp", "9c2a38c7": "9c2a38c7.webp", "317f0998": "317f0998.webp", "e0aa53c1": "e0aa53c1.webp", "bd496b6b": "bd496b6b.webp", "b1b68679": "b1b68679.webp", "6bb05552": "6bb05552.webp", "a4c7fe84": "a4c7fe84.webp", "49216877": "49216877.webp", "87b38e88": "87b38e88.webp", "fb74c845": "fb74c845.webp", "21871651": "21871651.webp", "048622bd": "048622bd.webp", "b10b1ba3": "b10b1ba3.webp", "76af3a6a": "76af3a6a.webp", "5e199298": "5e199298.webp", "02233c08": "02233c08.webp", "bbcfa223": "bbcfa223.webp", "ae02425a": "ae02425a.webp", "22b330d8": "22b330d8.webp", "b244328f": "b244328f.webp", "448070af": "448070af.webp", "f00e0a82": "f00e0a82.webp", "5591793f": "5591793f.webp", "a49022ab": "a49022ab.webp", "abc36243": "abc36243.webp", "c549a7dc": "c549a7dc.webp", "c72a7a0e": "c72a7a0e.webp", "ee7be279": "ee7be279.webp", "9a93ee7b": "9a93ee7b.webp", "b4cfc9e6": "b4cfc9e6.webp", "8084dbe5": "8084dbe5.webp", "9e818400": "9e818400.webp", "b47df80a": "b47df80a.webp", "cda48047": "cda48047.webp", "c831602c": "c831602c.webp", "de04d2a6": "de04d2a6.webp", "b624a6da": "b624a6da.webp", "b4b2a03f": "b4b2a03f.webp", "f4f12b0b": "f4f12b0b.webp", "cb722cbc": "cb722cbc.webp", "019a6eb5": "019a6eb5.webp", "5ce62f06": "5ce62f06.webp", "cfeeae59": "cfeeae59.webp", "08d278c9": "08d278c9.webp", "cc5293e9": "cc5293e9.webp", "00ed75c0": "00ed75c0.webp", "737fcf0d": "737fcf0d.webp", "d1098e28": "d1098e28.webp", "fccaed6b": "fccaed6b.webp", "04825ab7": "04825ab7.webp", "9f11fb36": "9f11fb36.webp", "1818c0b0": "1818c0b0.webp", "fd80fc06": "fd80fc06.webp", "fe24cdc6": "fe24cdc6.webp", "5002f3c2": "5002f3c2.webp", "a1accb5b": "a1accb5b.webp", "d1475779": "d1475779.webp", "8b92daf9": "8b92daf9.webp", "9e03257b": "9e03257b.webp", "84ee8e9d": "84ee8e9d.webp", "73eea61d": "73eea61d.webp", "710d33cc": "710d33cc.webp", "2386ed1e": "2386ed1e.webp", "63f9861f": "63f9861f.webp", "ad50f310": "ad50f310.webp", "e499397a": "e499397a.webp", "61c35daa": "61c35daa.webp", "7f72bf1e": "7f72bf1e.webp", "6e064772": "6e064772.webp", "d80c5e29": "d80c5e29.webp", "6718ece9": "6718ece9.webp", "54724fde": "54724fde.webp", "d03b1c7d": "d03b1c7d.webp", "1df26c50": "1df26c50.webp", "9bcf915c": "9bcf915c.webp", "0ade0161": "0ade0161.webp", "c354be41": "c354be41.webp", "9867d25c": "9867d25c.webp", "626efa6b": "626efa6b.webp", "285d009c": "285d009c.webp", "7053431d": "7053431d.webp", "f3801f21": "f3801f21.webp", "de2885ae": "de2885ae.webp", "08df1e8a": "08df1e8a.webp", "0576a387": "0576a387.webp", "859db3f7": "859db3f7.webp", "354020c0": "354020c0.webp", "607172c1": "607172c1.webp", "aad5bc13": "aad5bc13.webp", "6e2848e9": "6e2848e9.webp", "a1924c9f": "a1924c9f.webp", "c8d7da0b": "c8d7da0b.webp", "9cd763ef": "9cd763ef.webp", "84ee16b4": "84ee16b4.webp", "53ebd337": "53ebd337.webp", "b5d79c5d": "b5d79c5d.webp", "57e7a7c6": "57e7a7c6.webp", "3968ce36": "3968ce36.webp", "5fe30de5": "5fe30de5.webp", "2f9eac17": "2f9eac17.webp", "f4a5aa7c": "f4a5aa7c.webp", "a0472d62": "a0472d62.webp", "f24ca299": "f24ca299.webp", "4bb38ff7": "4bb38ff7.webp", "92d8cc94": "92d8cc94.webp", "528517ce": "528517ce.webp", "bf067038": "bf067038.webp", "41acda97": "41acda97.webp", "e399a941": "e399a941.webp", "0a0d0d5b": "0a0d0d5b.webp", "bee14083": "bee14083.webp", "bdbf9ccc": "bdbf9ccc.webp", "2e7edc08": "2e7edc08.webp", "d09825d1": "d09825d1.webp", "927fea02": "927fea02.webp", "05f741e8": "05f741e8.webp", "2ddf8c86": "2ddf8c86.webp", "f47a6891": "f47a6891.webp", "06696574": "06696574.webp", "afec31f7": "afec31f7.webp", "afe83b21": "afe83b21.webp", "be187059": "be187059.webp", "c208277b": "c208277b.webp", "0bfe47d6": "0bfe47d6.webp", "27beb629": "27beb629.webp", "2409216d": "2409216d.webp", "64ff091d": "64ff091d.webp", "b10b33f5": "b10b33f5.webp"};diff --git a/site/little-red-riding-hood/img/puppets/bdbf9ccc.webp b/site/little-red-riding-hood/img/puppets/bdbf9ccc.webpnew file mode 100644index 0000000..25ce47fBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/bdbf9ccc.webp differdiff --git a/site/little-red-riding-hood/img/puppets/be187059.webp b/site/little-red-riding-hood/img/puppets/be187059.webpnew file mode 100644index 0000000..67ae965Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/be187059.webp differdiff --git a/site/little-red-riding-hood/img/puppets/bee14083.webp b/site/little-red-riding-hood/img/puppets/bee14083.webpnew file mode 100644index 0000000..dc73b8cBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/bee14083.webp differdiff --git a/site/little-red-riding-hood/img/puppets/bf067038.webp b/site/little-red-riding-hood/img/puppets/bf067038.webpnew file mode 100644index 0000000..3e4d0c9Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/bf067038.webp differdiff --git a/site/little-red-riding-hood/img/puppets/c208277b.webp b/site/little-red-riding-hood/img/puppets/c208277b.webpnew file mode 100644index 0000000..ac0d29bBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/c208277b.webp differdiff --git a/site/little-red-riding-hood/img/puppets/d09825d1.webp b/site/little-red-riding-hood/img/puppets/d09825d1.webpnew file mode 100644index 0000000..b1d8f75Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/d09825d1.webp differdiff --git a/site/little-red-riding-hood/img/puppets/e399a941.webp b/site/little-red-riding-hood/img/puppets/e399a941.webpnew file mode 100644index 0000000..1e0be5aBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/e399a941.webp differdiff --git a/site/little-red-riding-hood/img/puppets/f24ca299.webp b/site/little-red-riding-hood/img/puppets/f24ca299.webpnew file mode 100644index 0000000..55dda7dBinary files /dev/null and b/site/little-red-riding-hood/img/puppets/f24ca299.webp differdiff --git a/site/little-red-riding-hood/img/puppets/f47a6891.webp b/site/little-red-riding-hood/img/puppets/f47a6891.webpnew file mode 100644index 0000000..0ddfae2Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/f47a6891.webp differdiff --git a/site/little-red-riding-hood/img/puppets/f4a5aa7c.webp b/site/little-red-riding-hood/img/puppets/f4a5aa7c.webpnew file mode 100644index 0000000..3078766Binary files /dev/null and b/site/little-red-riding-hood/img/puppets/f4a5aa7c.webp differdiff --git a/site/little-red-riding-hood/img/sets/grandmaOut/fore-soft.webp b/site/little-red-riding-hood/img/sets/grandmaOut/fore-soft.webpindex d2202eb..61be742 100644Binary files a/site/little-red-riding-hood/img/sets/grandmaOut/fore-soft.webp and b/site/little-red-riding-hood/img/sets/grandmaOut/fore-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/grandmaOut/fore.webp b/site/little-red-riding-hood/img/sets/grandmaOut/fore.webpindex bf84295..e78e9b5 100644Binary files a/site/little-red-riding-hood/img/sets/grandmaOut/fore.webp and b/site/little-red-riding-hood/img/sets/grandmaOut/fore.webp differdiff --git a/site/little-red-riding-hood/img/sets/grandmaOut/house-soft.webp b/site/little-red-riding-hood/img/sets/grandmaOut/house-soft.webpindex 12837e3..a3e73d4 100644Binary files a/site/little-red-riding-hood/img/sets/grandmaOut/house-soft.webp and b/site/little-red-riding-hood/img/sets/grandmaOut/house-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/grandmaOut/house.webp b/site/little-red-riding-hood/img/sets/grandmaOut/house.webpindex eb8dd08..3061ebc 100644Binary files a/site/little-red-riding-hood/img/sets/grandmaOut/house.webp and b/site/little-red-riding-hood/img/sets/grandmaOut/house.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/far-soft.webp b/site/little-red-riding-hood/img/sets/meadow/far-soft.webpnew file mode 100644index 0000000..c6d5526Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/far-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/far.webp b/site/little-red-riding-hood/img/sets/meadow/far.webpnew file mode 100644index 0000000..631a680Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/far.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/fore-soft.webp b/site/little-red-riding-hood/img/sets/meadow/fore-soft.webpnew file mode 100644index 0000000..9735d04Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/fore-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/fore.webp b/site/little-red-riding-hood/img/sets/meadow/fore.webpnew file mode 100644index 0000000..0cbf0bbBinary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/fore.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/house-soft.webp b/site/little-red-riding-hood/img/sets/meadow/house-soft.webpnew file mode 100644index 0000000..0441d69Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/house-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/house.webp b/site/little-red-riding-hood/img/sets/meadow/house.webpnew file mode 100644index 0000000..96ba04fBinary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/house.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/mid-soft.webp b/site/little-red-riding-hood/img/sets/meadow/mid-soft.webpnew file mode 100644index 0000000..6883c50Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/mid-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/mid.webp b/site/little-red-riding-hood/img/sets/meadow/mid.webpnew file mode 100644index 0000000..ff41abbBinary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/mid.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/sky-soft.webp b/site/little-red-riding-hood/img/sets/meadow/sky-soft.webpnew file mode 100644index 0000000..c0982caBinary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/sky-soft.webp differdiff --git a/site/little-red-riding-hood/img/sets/meadow/sky.webp b/site/little-red-riding-hood/img/sets/meadow/sky.webpnew file mode 100644index 0000000..8cdb005Binary files /dev/null and b/site/little-red-riding-hood/img/sets/meadow/sky.webp differdiff --git a/site/little-red-riding-hood/img/sets/sets.js b/site/little-red-riding-hood/img/sets/sets.jsindex 9a0d413..0006016 100644--- a/site/little-red-riding-hood/img/sets/sets.js+++ b/site/little-red-riding-hood/img/sets/sets.js@@ -1 +1 @@-window.SETS = {"home": [{"name": "sky", "k": 0.15, "box": [-400, -300, 3000, 1300], "soft": true}, {"name": "far", "k": 0.35, "box": [-400, 300, 3000, 700], "soft": true}, {"name": "mid", "k": 0.65, "box": [-400, 280, 3000, 720], "soft": true}, {"name": "house", "k": 1, "box": [-300, -620, 2900, 1620], "soft": true}, {"name": "fore", "k": 1.3, "box": [-400, 860, 3100, 140], "soft": true}], "homeOut": [{"name": "sky", "k": 0.2, "box": [-200, -100, 2000, 1100], "soft": true}, {"name": "far", "k": 0.4, "box": [-200, 280, 2000, 720], "soft": true}, {"name": "mid", "k": 0.7, "box": [-200, 320, 2000, 680], "soft": true}, {"name": "ground", "k": 1, "box": [-200, 640, 2000, 360], "soft": true}], "forest": [{"name": "sky", "k": 0.15, "box": [-200, -200, 2600, 1200], "soft": true}, {"name": "far", "k": 0.35, "box": [-200, 280, 3300, 720], "soft": true}, {"name": "mid", "k": 0.65, "box": [-200, 300, 4100, 700], "soft": true}, {"name": "house", "k": 1, "box": [-200, 690, 5000, 310], "soft": true}, {"name": "fore", "k": 1.3, "box": [-200, 860, 6200, 140], "soft": true}], "forestRev": [{"name": "far", "k": 0.4, "box": [-200, -100, 2000, 1100], "soft": true}, {"name": "house", "k": 1, "box": [-200, 300, 2000, 700], "soft": true}], "grandmaOut": [{"name": "sky", "k": 0.15, "box": [-300, -200, 2800, 1200], "soft": true}, {"name": "far", "k": 0.35, "box": [-300, 280, 2900, 720], "soft": true}, {"name": "mid", "k": 0.65, "box": [-300, 300, 3300, 700], "soft": true}, {"name": "inside", "k": 1, "box": [970, 430, 580, 380], "soft": false}, {"name": "house", "k": 1, "box": [-300, -560, 3300, 1560], "soft": true}, {"name": "fore", "k": 1.3, "box": [-300, 860, 3800, 140], "soft": true}], "room": [{"name": "wall", "k": 0.9, "box": [-200, -100, 3400, 940], "soft": true}, {"name": "house", "k": 1, "box": [-200, 360, 3400, 640], "soft": true}], "roomA": [{"name": "house", "k": 1, "box": [-200, -100, 2000, 1100], "soft": true}], "roomB": [{"name": "house", "k": 1, "box": [-200, -100, 2000, 1100], "soft": true}]};+window.SETS = {"home": [{"name": "sky", "k": 0.15, "box": [-400, -300, 3000, 1300], "soft": true}, {"name": "far", "k": 0.35, "box": [-400, 300, 3000, 700], "soft": true}, {"name": "mid", "k": 0.65, "box": [-400, 280, 3000, 720], "soft": true}, {"name": "house", "k": 1, "box": [-300, -620, 2900, 1620], "soft": true}, {"name": "fore", "k": 1.3, "box": [-400, 860, 3100, 140], "soft": true}], "homeOut": [{"name": "sky", "k": 0.2, "box": [-200, -100, 2000, 1100], "soft": true}, {"name": "far", "k": 0.4, "box": [-200, 280, 2000, 720], "soft": true}, {"name": "mid", "k": 0.7, "box": [-200, 320, 2000, 680], "soft": true}, {"name": "ground", "k": 1, "box": [-200, 640, 2000, 360], "soft": true}], "forest": [{"name": "sky", "k": 0.15, "box": [-200, -200, 2600, 1200], "soft": true}, {"name": "far", "k": 0.35, "box": [-200, 280, 3300, 720], "soft": true}, {"name": "mid", "k": 0.65, "box": [-200, 300, 4100, 700], "soft": true}, {"name": "house", "k": 1, "box": [-200, 690, 5000, 310], "soft": true}, {"name": "fore", "k": 1.3, "box": [-200, 860, 6200, 140], "soft": true}], "forestRev": [{"name": "far", "k": 0.4, "box": [-200, -100, 2000, 1100], "soft": true}, {"name": "house", "k": 1, "box": [-200, 300, 2000, 700], "soft": true}], "grandmaOut": [{"name": "sky", "k": 0.15, "box": [-300, -200, 2800, 1200], "soft": true}, {"name": "far", "k": 0.35, "box": [-300, 280, 2900, 720], "soft": true}, {"name": "mid", "k": 0.65, "box": [-300, 300, 3300, 700], "soft": true}, {"name": "inside", "k": 1, "box": [970, 430, 580, 380], "soft": false}, {"name": "house", "k": 1, "box": [-300, -560, 3300, 1560], "soft": true}, {"name": "fore", "k": 1.3, "box": [-300, 860, 3800, 140], "soft": true}], "room": [{"name": "wall", "k": 0.9, "box": [-200, -100, 3400, 940], "soft": true}, {"name": "house", "k": 1, "box": [-200, 360, 3400, 640], "soft": true}], "roomA": [{"name": "house", "k": 1, "box": [-200, -100, 2000, 1100], "soft": true}], "roomB": [{"name": "house", "k": 1, "box": [-200, -100, 2000, 1100], "soft": true}], "meadow": [{"name": "sky", "k": 0.15, "box": [-300, -200, 3400, 1200], "soft": true}, {"name": "far", "k": 0.35, "box": [-300, 280, 3700, 720], "soft": true}, {"name": "mid", "k": 0.65, "box": [-300, 300, 4200, 700], "soft": true}, {"name": "house", "k": 1, "box": [-300, 400, 5000, 600], "soft": true}, {"name": "fore", "k": 1.3, "box": [-400, 820, 5600, 180], "soft": true}]};diff --git a/site/little-red-riding-hood/lib/cast.js b/site/little-red-riding-hood/lib/cast.jsindex e8742b1..154e525 100644--- a/site/little-red-riding-hood/lib/cast.js+++ b/site/little-red-riding-hood/lib/cast.js@@ -34,14 +34,33 @@ function bouquetPose(P, id, n, rot, x, y) {for (let i = 0; i < 7; i++) vis(P[id + i], i < n);}-const REST_RED = { x: 0, y: 0, s: 1, turn: 1, near: 0, far: 0, kNear: 0, kFar: 0, cape: 3, ua: -8, fa: -78, basket: true, swing: 0, headR: 0, nod: 0, head: 'P', mouth: 'X', shut: false, hop: 0, rua: 6, rfa: -4, lua: -6, lfa: 4, bouquet: 0 };+/* Red. Feet at y 170 (hipOn(gy, s)). Keys besides the common ones (x y s turn near far kNear kFar ua fa rua rfa lua lfa+ head headR nod mouth shut hop):+ cape the back of the cape, degrees (3 at rest; more flies out behind her)+ basket the basket in the near hand; swing rocks it (degrees). bouquet 0 … 7: flowers in the bunch, one by one+ lean bends her at the waist (profile), degrees forward: 60–80 to reach the ground+ fua, ffa the far arm (profile), shoulder and elbow like ua/fa; null hides it (it hangs behind her at rest).+ To pick: lean 70, fua -20, ffa -10 puts the far hand at the grass; then up again+ held a flower in the far hand (a FLOWER_COLS colour, or null), the one she has just picked+ brow worried brows (0 none, 1 worried, more is more); shown only while not 0, so earlier shots keep their faces+ wink the screen-right eye shut on the front face (the wink to us)+ crouch 0 … 1, a duck: knees up, hip down, feet kept on the ground (add ua -150 for arms over her head)+ Picking a flower (flowerProp at s ≈ 1.25 × hers, a step in front of her): { lean: 60, crouch: .7, fua: -50, ffa: 10 }+ brings the far hand to its head; then held: col and back up to { lean: 15, fua: -100, ffa: -50 } to show it. */+const REST_RED = { x: 0, y: 0, s: 1, turn: 1, near: 0, far: 0, kNear: 0, kFar: 0, cape: 3, ua: -8, fa: -78, basket: true, swing: 0, headR: 0, nod: 0, head: 'P', mouth: 'X', shut: false, hop: 0, rua: 6, rfa: -4, lua: -6, lfa: 4, bouquet: 0,+ lean: 0, fua: null, ffa: -10, held: null, brow: 0, wink: false, crouch: 0 };function redPuppet(parent) {const g = mk('g', {}, parent);g.innerHTML = `<g data-p="body">- <g data-p="capeB" filter="url(#paper)"><path d="M-12,-138 C-46,-118 -78,-30 -100,50 Q-40,64 14,44 L22,-118 Z" fill="#a92a27"/></g>+ <g data-p="upperB"><g data-p="capeB" filter="url(#paper)"><path d="M-12,-138 C-46,-118 -78,-30 -100,50 Q-40,64 14,44 L22,-118 Z" fill="#a92a27"/></g></g>${legPiece('legF', '#d8d1c2', '#2b1a10')}${legPiece('legN', '#f2ede1', '#3a2418')}<g filter="url(#paper)"><path d="M-38,-46 L38,-46 C48,0 58,30 64,56 Q0,70 -64,56 C-58,30 -48,0 -38,-46 Z" fill="#2d4f86"/></g><g filter="url(#paper)"><path d="M6,-42 L36,-42 C44,0 50,30 54,52 Q30,60 8,58 Z" fill="#f4efe2"/></g>+ <g data-p="upper">+ <g data-p="armF"><g filter="url(#paper)"><rect x="-4.5" y="-134" width="17" height="62" rx="8" fill="#ddd5c4"/></g>+ <g data-p="foreF"><g filter="url(#paper)"><rect x="-2" y="-80" width="12" height="54" rx="6" fill="#e9c2a4"/><circle cx="4" cy="-26" r="9" fill="#e9c2a4"/></g>+ <g data-p="heldF"><g filter="url(#paper)"><path d="M4,-26 l14,-40" stroke="#4f7a34" stroke-width="3"/></g><circle data-p="heldC" cx="18" cy="-70" r="10" fill="#d6493f"/><circle cx="18" cy="-70" r="3.4" fill="#efae48"/></g>+ ${pinAt(4, -76)}</g>${pinAt(4, -128)}</g><g filter="url(#paper)"><path d="M-28,-128 L26,-128 L34,-42 L-34,-42 Z" fill="#2d4f86"/><rect x="-8" y="-150" width="16" height="28" fill="#f6d2b5"/></g><g filter="url(#paper)"><path d="M-30,-152 Q5,-160 28,-140 L36,-94 Q0,-84 -50,-88 Q-48,-122 -30,-152 Z" fill="#c8322f"/></g><g data-p="headP"><g filter="url(#paper)">@@ -52,11 +71,12 @@ function redPuppet(parent) {<circle cx="31" cy="-176" r="8.5" fill="#ef9a8a" opacity=".8"/><g class="eyeO"><ellipse cx="34" cy="-198" rx="4.5" ry="6.2" fill="#22150e"/></g><g class="eyeC"><path d="M29,-197 Q34,-193 39,-197" fill="none" stroke="#22150e" stroke-width="2.4" stroke-linecap="round"/></g>+ <path data-p="browP" d="M26,-208 L41,-207" stroke="#3b2210" stroke-width="3.8" stroke-linecap="round"/><use class="mouth" href="#mX" transform="translate(41,-172) scale(.85)"/></g>${pinAt(0, -146)}</g><g data-p="arm"><g filter="url(#paper)"><rect x="6" y="-134" width="17" height="64" rx="8" fill="#f4efe2"/></g><g data-p="fore"><g filter="url(#paper)"><rect x="8.5" y="-80" width="12" height="54" rx="6" fill="#f6d2b5"/><circle cx="14.5" cy="-26" r="9" fill="#f6d2b5"/></g>${basketSVG(0, 0)}${bouquetSVG(14.5, -26, 'bq')}${pinAt(14.5, -76)}</g>- ${pinAt(14.5, -128)}</g></g>+ ${pinAt(14.5, -128)}</g></g></g><g data-p="bodyF"><g filter="url(#paper)"><path d="M-36,-140 L36,-140 L72,50 Q0,64 -72,50 Z" fill="#a92a27"/></g><g filter="url(#paper)"><rect x="-21" y="46" width="16" height="114" rx="7" fill="#f2ede1"/><rect x="5" y="46" width="16" height="114" rx="7" fill="#f2ede1"/>@@ -73,14 +93,20 @@ function redPuppet(parent) {<path d="M-38,-200 Q0,-246 38,-200 Q20,-212 0,-210 Q-20,-212 -38,-200 Z" fill="#6b3b22"/><path d="M-61,-192 C-61,-264 61,-264 61,-192 C50,-238 -50,-238 -61,-192 Z" fill="#b02c29"/><circle cx="-23" cy="-176" r="8" fill="#ef9a8a" opacity=".8"/><circle cx="23" cy="-176" r="8" fill="#ef9a8a" opacity=".8"/>- <g class="eyeO"><ellipse cx="-14" cy="-196" rx="4.5" ry="6.2" fill="#22150e"/><ellipse cx="14" cy="-196" rx="4.5" ry="6.2" fill="#22150e"/></g>- <g class="eyeC"><path d="M-19,-195 Q-14,-191 -9,-195 M9,-195 Q14,-191 19,-195" fill="none" stroke="#22150e" stroke-width="2.4" stroke-linecap="round"/></g>+ <g class="eyeO"><ellipse cx="-14" cy="-196" rx="4.5" ry="6.2" fill="#22150e"/></g><g class="eyeO" data-p="eyeRO"><ellipse cx="14" cy="-196" rx="4.5" ry="6.2" fill="#22150e"/></g>+ <g class="eyeC"><path d="M-19,-195 Q-14,-191 -9,-195" fill="none" stroke="#22150e" stroke-width="2.4" stroke-linecap="round"/></g><g class="eyeC" data-p="eyeRC"><path d="M9,-195 Q14,-191 19,-195" fill="none" stroke="#22150e" stroke-width="2.4" stroke-linecap="round"/></g>+ <path data-p="browL" d="M-22,-207 L-7,-206" stroke="#3b2210" stroke-width="3.4" stroke-linecap="round"/><path data-p="browR" d="M7,-206 L22,-207" stroke="#3b2210" stroke-width="3.4" stroke-linecap="round"/><use class="mouth" href="#mX" transform="translate(0,-166)"/></g></g>`;bakeAll(g);const P = pieces(g);return { g, pose(o, f) {o = { ...REST_RED, ...o };const j = k => jit(f, k), front = o.head === 'F' || Math.abs(o.turn) < .55;+ if (o.crouch) { // the hip sinks as far as the folded legs shorten, so the feet stay on the ground+ const c = o.crouch, r = Math.PI / 180, n = { near: o.near - 62 * c, far: o.far - 50 * c, kNear: o.kNear + 104 * c, kFar: o.kFar + 100 * c };+ const reach = (a, k) => 86 * Math.cos(a * r) + 86 * Math.cos((a + k) * r), drop = 172 - Math.max(reach(n.near, n.kNear), reach(n.far, n.kFar));+ o = { ...o, ...n, hop: o.hop + Math.max(0, drop) * o.s };+ }tf(g, `translate(${(o.x + j(1) * .8).toFixed(1)},${(o.y + o.hop + j(2) * .6).toFixed(1)}) scale(${o.s}) rotate(${(j(3) * .5).toFixed(2)})`);tf(P.body, `scale(${o.turn.toFixed(3)},1)`); vis(P.body, !front); vis(P.bodyF, front);armsF(P, o, j, 30, -126, 54);@@ -88,7 +114,7 @@ function redPuppet(parent) {bouquetPose(P, 'bqF', o.bouquet, -(o.lua + o.lfa), -30, -26);tf(P.legN, `rotate(${(o.near + j(4) * .6).toFixed(2)})`); tf(P.legNk, `rotate(${o.kNear.toFixed(2)},0,86)`);tf(P.legF, `rotate(${(o.far + j(5) * .6).toFixed(2)})`); tf(P.legFk, `rotate(${o.kFar.toFixed(2)},0,86)`);- tf(P.capeB, `rotate(${(o.cape + j(6) * .5).toFixed(2)},-12,-138)`);+ tf(P.capeB, `rotate(${(o.cape - .75 * o.lean + j(6) * .5).toFixed(2)},-12,-138)`); // bent over, the cape still hangsconst ua = o.ua + j(7) * .6, fa = o.fa + j(8) * .6;tf(P.arm, `rotate(${ua.toFixed(2)},14.5,-128)`); tf(P.fore, `rotate(${fa.toFixed(2)},14.5,-76)`);tf(P.basket, `rotate(${(-(ua + fa) + o.swing).toFixed(2)},14.5,-64)`); vis(P.basket, o.basket);@@ -97,6 +123,14 @@ function redPuppet(parent) {const hr = `translate(0,${o.nod.toFixed(1)}) rotate(${(o.headR + j(9) * .7).toFixed(2)},0,-146)`;tf(P.headP, hr); tf(P.headF, hr);face(front ? P.headF : P.headP, o);+ const bend = `rotate(${o.lean.toFixed(2)},0,-44)`; tf(P.upper, bend); tf(P.upperB, bend);+ vis(P.armF, o.fua !== null);+ if (o.fua !== null) { tf(P.armF, `rotate(${(o.fua + j(10) * .6).toFixed(2)},4,-128)`); tf(P.foreF, `rotate(${(o.ffa + j(11) * .6).toFixed(2)},4,-76)`); }+ vis(P.heldF, !!o.held); if (o.held) { P.heldC.setAttribute('fill', o.held); tf(P.heldF, `rotate(${(-(o.fua || 0) - o.ffa - o.lean).toFixed(2)},4,-26)`); }+ for (const k of ['browP', 'browL', 'browR']) vis(P[k], o.brow !== 0);+ tf(P.browP, `rotate(${(-16 * o.brow).toFixed(1)},26,-208)`);+ tf(P.browL, `rotate(${(-16 * o.brow).toFixed(1)},-22,-207)`); tf(P.browR, `rotate(${(16 * o.brow).toFixed(1)},22,-207)`);+ if (front && o.wink && !o.shut) { vis(P.eyeRO, false); vis(P.eyeRC, true); }} };}@@ -207,8 +241,17 @@ const REST = { x: 0, y: 0, s: 1, turn: 1, near: 0, far: 0, kNear: 0, kFar: 0, lehead: 'P', headR: 0, nod: 0, mouth: 'X', shut: false, hop: 0, brow: 0 };/* ---------- the wolf: grey, a flat cap and a red bow tie, more polite than he should be ----------- Feet at y 200. jaw follows the mouth cue unless given; cap 'on' | 'hand' | 'off'; night (Grandma's nightcap),- glasses; ears twitch with `ear`; look moves the pupils. */+ Feet at y 200 (hipOn(gy, s, 200)), upright or on all fours. Keys besides the common ones (lean bends him forward):+ jaw 0 … 1, follows the mouth cue unless given; tail (degrees); ear twitches (-1 … 1); look moves the pupils+ cap 'on' | 'hand' (off in his paw, for the bow) | 'off'; night: Grandma's nightcap; glasses+ flap the nightcap's tail, degrees (on twos while he runs: 25 * onTwos(q))+ run on all fours: the distance run so far, in his own units (route(q, keys, s).d), or null upright. The paws+ are planted by it: they stay put on the ground while the body passes over (a gallop, one stride 220 units),+ so give the real distance and the gait matches any speed. With run set, also:+ skid 0 … 1, braking: front legs braced forward, hind legs under him, rump down (feet slide: that is the skid)+ crouch 0 … 1, low to the ground, legs folded, ready to spring+ stretch 0 … 1, in the air: front legs reaching forward, hind legs back (move y yourself for the arc)+ The head on all fours takes cap, night, glasses, jaw/mouth, ear, look, brow, shut, headR, flap like the upright one. */const FUR = '#8a8178', FUR2 = '#6b635b', ARM = '#787067', BELLY = '#d3cabc', NOSE = '#2a2420';const wolfHeadP = `<g data-p="headP"><g filter="url(#paper)">@@ -223,8 +266,8 @@ const wolfHeadP = `<g data-p="headP"><g class="eyeO"><circle data-p="pupilP" cx="44" cy="-216" r="4.6" fill="${NOSE}"/></g><g class="eyeC"><ellipse cx="42" cy="-218" rx="11" ry="9" fill="${FUR}"/><path d="M32,-215 Q42,-210 52,-215" stroke="${NOSE}" stroke-width="2.6" fill="none"/></g><path data-p="browP" d="M30,-233 L54,-229" stroke="${FUR2}" stroke-width="5" stroke-linecap="round"/>- <g data-p="nightP" filter="url(#paper)"><path d="M-36,-228 C-32,-278 34,-288 54,-236 Z" fill="#f6efe0"/><path d="M-30,-258 C-70,-268 -92,-238 -96,-212" stroke="#f6efe0" stroke-width="16" fill="none" stroke-linecap="round"/>- <circle cx="-98" cy="-206" r="9" fill="#e8b4a6"/><path d="M-38,-230 Q8,-222 56,-236" stroke="#e8b4a6" stroke-width="6" fill="none"/></g>+ <g data-p="nightP"><g data-p="nightTailP" filter="url(#paper)"><path d="M-30,-258 C-70,-268 -92,-238 -96,-212" stroke="#f6efe0" stroke-width="16" fill="none" stroke-linecap="round"/><circle cx="-98" cy="-206" r="9" fill="#e8b4a6"/></g>+ <g filter="url(#paper)"><path d="M-36,-228 C-32,-278 34,-288 54,-236 Z" fill="#f6efe0"/><path d="M-38,-230 Q8,-222 56,-236" stroke="#e8b4a6" stroke-width="6" fill="none"/></g></g><g data-p="earP" filter="url(#paper)"><path d="M-16,-236 L-8,-294 L24,-240 Z" fill="${FUR}"/><path d="M-8,-244 L-3,-280 L14,-246 Z" fill="#e8b4a6"/></g><g data-p="capP" filter="url(#paper)"><path d="M-34,-238 C-22,-264 42,-266 54,-238 L80,-234 C76,-226 54,-226 42,-228 L-34,-228 Z" fill="#6e4a30"/><path d="M-30,-236 h76" stroke="#5a3b24" stroke-width="3"/></g><g data-p="glassesP"><circle cx="44" cy="-216" r="13" fill="#ffffff" fill-opacity=".18" stroke="#3a2a1a" stroke-width="3"/><path d="M31,-218 L-4,-224" stroke="#3a2a1a" stroke-width="3"/></g>@@ -241,15 +284,35 @@ const wolfHeadF = `<g data-p="headF"><g class="eyeC"><path d="M-30,-222 a11,9 0 0 1 22,0 Z M8,-222 a11,9 0 0 1 22,0 Z" fill="${FUR}"/><path d="M-29,-221 Q-19,-216 -9,-221 M9,-221 Q19,-216 29,-221" stroke="${NOSE}" stroke-width="2.6" fill="none"/></g><path data-p="browL" d="M-32,-240 L-8,-236" stroke="${FUR2}" stroke-width="5" stroke-linecap="round"/><path data-p="browR" d="M8,-236 L32,-240" stroke="${FUR2}" stroke-width="5" stroke-linecap="round"/>- <g data-p="nightF" filter="url(#paper)"><path d="M-50,-236 C-48,-300 48,-300 50,-236 Q0,-252 -50,-236 Z" fill="#f6efe0"/><path d="M30,-284 C70,-300 90,-270 92,-240" stroke="#f6efe0" stroke-width="16" fill="none" stroke-linecap="round"/>- <circle cx="93" cy="-234" r="9" fill="#e8b4a6"/><path d="M-50,-238 Q0,-254 50,-238" stroke="#e8b4a6" stroke-width="6" fill="none"/></g>+ <g data-p="nightF"><g data-p="nightTailF" filter="url(#paper)"><path d="M30,-284 C70,-300 90,-270 92,-240" stroke="#f6efe0" stroke-width="16" fill="none" stroke-linecap="round"/><circle cx="93" cy="-234" r="9" fill="#e8b4a6"/></g>+ <g filter="url(#paper)"><path d="M-50,-236 C-48,-300 48,-300 50,-236 Q0,-252 -50,-236 Z" fill="#f6efe0"/><path d="M-50,-238 Q0,-254 50,-238" stroke="#e8b4a6" stroke-width="6" fill="none"/></g></g><g data-p="earsF" filter="url(#paper)"><path d="M-46,-238 L-36,-302 L-8,-252 Z M46,-238 L36,-302 L8,-252 Z" fill="${FUR}"/><path d="M-38,-246 L-34,-288 L-18,-254 Z M38,-246 L34,-288 L18,-254 Z" fill="#e8b4a6"/></g><g data-p="capF" filter="url(#paper)"><path d="M-46,-248 C-44,-288 44,-288 46,-248 Q0,-238 -46,-248 Z" fill="#6e4a30"/><path d="M-40,-246 Q0,-232 40,-246 L44,-240 Q0,-226 -44,-240 Z" fill="#5a3b24"/></g><g data-p="glassesF"><circle cx="-19" cy="-222" r="14" fill="#ffffff" fill-opacity=".18" stroke="#3a2a1a" stroke-width="3"/><circle cx="19" cy="-222" r="14" fill="#ffffff" fill-opacity=".18" stroke="#3a2a1a" stroke-width="3"/><path d="M-5,-222 h10" stroke="#3a2a1a" stroke-width="3"/></g></g>`;const bowTie = (x, y) => `<g filter="url(#paper)"><path d="M${x},${y} l-14,-9 v18 Z M${x},${y} l14,-9 v18 Z" fill="#c8322f"/><circle cx="${x}" cy="${y}" r="4.5" fill="#a82626"/></g>`;const capInHand = (x, y, id) => `<g data-p="${id}" filter="url(#paper)"><path d="M${x - 30},${y + 10} C${x - 22},${y - 14} ${x + 22},${y - 14} ${x + 30},${y + 10} Z" fill="#6e4a30"/></g>`;-const REST_WOLF = { ...REST, tail: 0, jaw: null, cap: 'on', night: false, glasses: false, ear: 0, look: 0 };+const REST_WOLF = { ...REST, tail: 0, jaw: null, cap: 'on', night: false, glasses: false, ear: 0, look: 0, flap: 0, run: null, skid: 0, crouch: 0, stretch: 0 };+// On all fours: legs hang from hips at (±78, 58), thigh 68 to the knee, 84 knee to sole; paws on y 200.+const RUN4 = { stride: 220, stance: .45, hip: 58, T: 68, S: 84, legs: [['hindN', -78, 0], ['hindF', -66, .08], ['foreN', 78, .5], ['foreF', 90, .58]] };+// Two-segment leg reaching for (tx, ty) from its hip: thigh angle a and knee bend k, degrees (knee forward).+function legIK(tx, ty, T = RUN4.T, S = RUN4.S) {+ const D = Math.min(T + S - .01, Math.hypot(tx, ty)), phi = Math.atan2(tx, ty);+ const b = Math.acos((T * T + D * D - S * S) / (2 * T * D)), c = Math.acos((T * T + S * S - D * D) / (2 * T * S));+ return { a: -(phi + b) * 180 / Math.PI, k: 180 - c * 180 / Math.PI };+}+const wolfRunSVG = () => {+ const leg = (id, x, fur) => `<g transform="translate(${x},${RUN4.hip})">${legPiece(id, fur, NOSE, RUN4.T + 8, RUN4.S - 4, 24)}</g>`;+ return `<g data-p="bodyR">+ <g data-p="tailR" filter="url(#paper)"><path d="M-96,10 C-140,0 -180,-10 -206,-34 C-178,-30 -160,-44 -168,-66 C-136,-44 -110,-20 -90,-8 Z" fill="${FUR}"/><path d="M-206,-34 C-196,-46 -180,-58 -168,-66 C-176,-50 -190,-40 -206,-34 Z" fill="${BELLY}"/></g>+ ${leg('hindF', -66, FUR2)}${leg('foreF', 90, FUR2)}+ <g filter="url(#paper)"><path d="M-110,30 C-112,-10 -70,-22 0,-20 C60,-20 104,-30 122,6 C130,40 110,80 70,84 L-80,84 C-104,80 -110,56 -110,30 Z" fill="${FUR}"/>+ <path d="M-70,84 C-40,62 40,60 80,84 Z" fill="${BELLY}"/></g>+ ${leg('hindN', -78, FUR)}${leg('foreN', 78, FUR)}+ ${bowTie(118, 30)}+ <g transform="translate(96,150)">${wolfHeadP.replace(/data-p="(\w+)"/g, 'data-p="$1R"')}</g>+ </g>`;+};function wolfPuppet(parent) {return puppet(parent, `<g data-p="body"><g data-p="tail" filter="url(#paper)"><path d="M-30,-30 C-80,-40 -130,-30 -150,-70 C-120,-60 -96,-80 -110,-110 C-70,-80 -40,-70 -24,-50 Z" fill="${FUR}"/><path d="M-150,-70 C-140,-80 -126,-96 -110,-110 C-118,-90 -134,-76 -150,-70 Z" fill="${BELLY}"/></g>@@ -273,7 +336,37 @@ function wolfPuppet(parent) {${frontArm('lArm', -38, -140, ARM, ARM, 60, 58)}${frontArm('rArm', 38, -140, ARM, ARM, 60, 58, capInHand(38, -26, 'capHandF'))}</g>- ${wolfHeadF}`, REST_WOLF, (P, o, j, g) => {+ ${wolfHeadF}+ ${wolfRunSVG()}`, REST_WOLF, (P, o, j, g) => {+ tf(P.nightTailP, `rotate(${o.flap.toFixed(1)},-30,-258)`); tf(P.nightTailF, `rotate(${(-o.flap).toFixed(1)},30,-284)`); tf(P.nightTailPR, `rotate(${o.flap.toFixed(1)},-30,-258)`);+ const four = o.run !== null && o.run !== undefined;+ vis(P.bodyR, four);+ if (four) {+ vis(P.body, false); vis(P.bodyF, false); vis(P.headF, false);+ tf(g, `translate(${(o.x + j(1) * .8).toFixed(1)},${(o.y + o.hop + j(2) * .6).toFixed(1)}) scale(${o.s}) rotate(${(j(3) * .5).toFixed(2)})`);+ const R = RUN4, ph = o.run / R.stride, moving = 1 - Math.max(o.skid, o.crouch, o.stretch);+ const bob = -7 * Math.sin(4 * Math.PI * ph) * moving, low = 46 * o.crouch, tilt = -10 * o.skid + 4 * o.crouch;+ tf(P.bodyR, `scale(${o.turn < 0 ? -1 : 1},1) translate(0,${(bob + low).toFixed(1)}) rotate(${(tilt + o.lean * .2).toFixed(2)},0,40)`);+ R.legs.forEach(([id, hx, off], i) => {+ const u = ((ph + off) % 1 + 1) % 1, half = R.stride * R.stance / 2, ty = 200 - R.hip - bob - low;+ let tx, lift = 0;+ if (u < R.stance) tx = half - 2 * half * (u / R.stance);+ else { const v = (u - R.stance) / (1 - R.stance); tx = -half + 2 * half * ease(v); lift = 46 * Math.sin(Math.PI * v); }+ const fore = hx > 0, gait = legIK(tx, ty - lift);+ const brace = fore ? legIK(70, ty) : legIK(-12, ty), tuck = legIK(fore ? 10 : -6, ty), fly = fore ? { a: -62, k: 10 } : { a: 58, k: 20 };+ let a = gait.a, k = gait.k;+ for (const [w, p] of [[o.skid, brace], [o.crouch, tuck], [o.stretch, fly]]) if (w) { a += (p.a - a) * w; k += (p.k - k) * w; }+ tf(P[id], `rotate(${(a + j(30 + i) * .8).toFixed(2)})`); tf(P[id + 'k'], `rotate(${k.toFixed(2)},0,${R.T})`);+ });+ tf(P.tailR, `rotate(${(o.tail + j(6) * 1.2).toFixed(2)},-96,10)`);+ tf(P.headPR, `translate(0,${o.nod.toFixed(1)}) rotate(${(o.headR + j(9) * .7).toFixed(2)},8,-160)`);+ const jaw = o.jaw ?? JAW[o.mouth || 'X'] ?? 0;+ tf(P.jawPR, `rotate(${(jaw * 30).toFixed(1)},30,-184)`); tf(P.earPR, `rotate(${(o.ear * 14).toFixed(1)},4,-238)`);+ tf(P.browPR, `rotate(${(-10 * o.brow).toFixed(1)},42,-231)`); P.pupilPR.setAttribute('cx', 44 + 3 * o.look);+ vis(P.capPR, o.cap === 'on'); vis(P.nightPR, o.night); vis(P.glassesPR, o.glasses);+ face(P.headPR, o);+ return;+ }const { front } = common(P, o, j, g, { neck: [8, -160], sh: [15.5, -140], el: [15.5, -82], fsh: [38, -140], fup: 60, knee: 96 });tf(P.tail, `rotate(${(o.tail + j(6) * 1.2).toFixed(2)},-30,-40)`);const jaw = o.jaw ?? JAW[o.mouth || 'X'] ?? 0;@@ -289,16 +382,23 @@ function wolfPuppet(parent) {}/* ---------- Grandma: small and round, nightcap, glasses and a lilac shawl ----------- Feet at y 196. umbrella: held in her near hand (pointing along the forearm). */+ Feet at y 196 (hipOn(gy, s, 196)). Keys besides the common ones:+ cap, glasses on her head (true/false); off, they are granCapProp / granGlassesProp in shared.js+ umbrella held in her near hand, along the forearm (raise it: ua -150, fa -30)+ blush 0 … 1, pink cheeks (her recovery at the table)+ crouch 0 … 1, a squash: the gown folds down, everything above sinks (before a hop and on landing);+ the hop itself is her x, y on an arc, e.g. y - 130 * Math.sin(Math.PI * u)+ lean bends her forward at the waist (profile) */const SKIN_G = '#f2cfb4', GOWN = '#f1ece0', SHAWL = '#8a6a9a', HAIR_G = '#cfc8be';const umbrellaSVG = (x, y, id) => `<g data-p="${id}" filter="url(#paper)"><rect x="${x - 2.5}" y="${y - 6}" width="5" height="118" fill="#5a3b24"/><path d="M${x},${y + 24} L${x + 15},${y + 92} L${x},${y + 112} L${x - 15},${y + 92} Z" fill="#3f5f8a"/><path d="M${x},${y - 6} q-14,-4 -14,10" stroke="#5a3b24" stroke-width="5" fill="none"/></g>`;-const REST_GRAN = { ...REST, cap: true, glasses: true, umbrella: false, blush: 0 };+const REST_GRAN = { ...REST, cap: true, glasses: true, umbrella: false, blush: 0, crouch: 0 };function grandmaPuppet(parent) {const ink = '#22150e';return puppet(parent, `<g data-p="body"><g filter="url(#paper)"><path d="M14,184 h28 q12,0 12,8 v5 h-40 z M-16,184 h24 q10,0 10,8 v5 h-34 z" fill="#8a6a9a"/></g>- <g filter="url(#paper)"><path d="M-42,-14 L40,-14 C52,60 62,140 70,190 Q0,202 -70,190 C-62,140 -54,60 -42,-14 Z" fill="${GOWN}"/><path d="M-68,184 Q0,198 68,184" stroke="#d8cfbf" stroke-width="5" fill="none"/></g>+ <g data-p="skirt"><g filter="url(#paper)"><path d="M-42,-14 L40,-14 C52,60 62,140 70,190 Q0,202 -70,190 C-62,140 -54,60 -42,-14 Z" fill="${GOWN}"/><path d="M-68,184 Q0,198 68,184" stroke="#d8cfbf" stroke-width="5" fill="none"/></g></g>+ <g data-p="upper"><g filter="url(#paper)"><path d="M-32,-140 L28,-140 L40,-10 L-42,-10 Z" fill="${GOWN}"/><rect x="-8" y="-166" width="16" height="30" fill="${SKIN_G}"/></g><g filter="url(#paper)"><path d="M-42,-152 Q0,-166 34,-146 L46,-88 Q0,-74 -54,-82 Q-52,-120 -42,-152 Z" fill="${SHAWL}"/></g><g data-p="headP">@@ -316,14 +416,16 @@ function grandmaPuppet(parent) {${pinAt(0, -162)}</g><g data-p="arm"><g filter="url(#paper)"><rect x="7" y="-140" width="17" height="58" rx="8" fill="${GOWN}"/></g><g data-p="fore"><g filter="url(#paper)"><rect x="9.5" y="-88" width="13" height="56" rx="6" fill="${SKIN_G}"/><circle cx="16" cy="-30" r="9.5" fill="${SKIN_G}"/></g>- ${umbrellaSVG(16, -30, 'umbP')}${pinAt(16, -84)}</g>${pinAt(16, -134)}</g></g>+ ${umbrellaSVG(16, -30, 'umbP')}${pinAt(16, -84)}</g>${pinAt(16, -134)}</g></g></g><g data-p="bodyF"><g filter="url(#paper)"><ellipse cx="-16" cy="194" rx="13" ry="7" fill="#8a6a9a"/><ellipse cx="16" cy="194" rx="13" ry="7" fill="#8a6a9a"/></g>- <g filter="url(#paper)"><path d="M-44,-14 L44,-14 C56,60 66,140 74,190 Q0,202 -74,190 C-66,140 -56,60 -44,-14 Z" fill="${GOWN}"/></g>+ <g data-p="skirtF"><g filter="url(#paper)"><path d="M-44,-14 L44,-14 C56,60 66,140 74,190 Q0,202 -74,190 C-66,140 -56,60 -44,-14 Z" fill="${GOWN}"/></g></g>+ <g data-p="upperF"><g filter="url(#paper)"><path d="M-36,-140 L36,-140 L44,-10 L-44,-10 Z" fill="${GOWN}"/><rect x="-8" y="-166" width="16" height="30" fill="${SKIN_G}"/></g>${frontArm('lArm', -34, -136, GOWN, SKIN_G, 52, 54)}${frontArm('rArm', 34, -136, GOWN, SKIN_G, 52, 54, umbrellaSVG(34, -34, 'umbF'))}<g filter="url(#paper)"><path d="M-48,-152 Q0,-170 48,-152 L58,-92 Q0,-74 -58,-92 Z" fill="${SHAWL}"/></g>+ </g></g><g data-p="headF"><g filter="url(#paper)"><circle cx="-38" cy="-206" r="16" fill="${HAIR_G}"/><circle cx="38" cy="-206" r="16" fill="${HAIR_G}"/><circle cx="0" cy="-200" r="42" fill="${SKIN_G}"/>@@ -338,7 +440,9 @@ function grandmaPuppet(parent) {<g data-p="capF" filter="url(#paper)"><path d="M-54,-206 C-54,-276 54,-276 54,-206 Q0,-232 -54,-206 Z" fill="#f6efe0"/><path d="M-54,-206 Q0,-232 54,-206" stroke="#e8c4d0" stroke-width="7" fill="none" stroke-dasharray="7 5"/></g></g>`, REST_GRAN, (P, o, j, g) => {common(P, o, j, g, { neck: [0, -162], sh: [16, -134], el: [16, -84], fsh: [34, -136], fup: 52, knee: 0 });- tf(P.browP, `rotate(${(-12 * o.brow).toFixed(1)},28,-220)`);+ const sq = .22 * o.crouch, dy = 204 * sq, fold = `translate(0,190) scale(1,${(1 - sq).toFixed(3)}) translate(0,-190)`;+ tf(P.skirt, fold); tf(P.skirtF, fold); tf(P.upper, `translate(0,${dy.toFixed(1)}) rotate(${o.lean.toFixed(2)})`); tf(P.upperF, `translate(0,${dy.toFixed(1)})`);+ tf(P.headF, `translate(0,${(o.nod + dy).toFixed(1)}) rotate(${(o.headR + j(9) * .7).toFixed(2)},0,-162)`);tf(P.browL, `translate(0,${(-4 * Math.max(0, o.brow)).toFixed(1)}) rotate(${(-12 * o.brow).toFixed(1)},-8,-217)`);tf(P.browR, `translate(0,${(-4 * Math.max(0, o.brow)).toFixed(1)}) rotate(${(12 * o.brow).toFixed(1)},8,-217)`);for (const k of ['blushP', 'blushF1', 'blushF2']) P[k].setAttribute('opacity', (.35 + .5 * o.blush).toFixed(2));diff --git a/site/little-red-riding-hood/lib/find.js b/site/little-red-riding-hood/lib/find.jsnew file mode 100644index 0000000..c2687f2--- /dev/null+++ b/site/little-red-riding-hood/lib/find.js@@ -0,0 +1,179 @@+/* find.js — "listen and find", the book's point-and-read stops (2026-10-31; to move into the engine beside tapWords).+ findWords(things, asks, done, opts): a character asks for one thing at a time ("Can you find the bird? Touch it!").+ Every thing in the picture answers a tap: a wrong one hops and says its own name, then the short question comes+ again ("Where's the bird?"). Nothing is ever called wrong; each miss helps more: at the second the thing asked for+ shakes at once, from the third paper stars circle it and it keeps shaking. A tap on nothing leaves a paper ripple+ (two of them count as a miss). A tap that lands inside the asked thing's box counts as finding it, even where a+ smaller thing's box lies on top. Nobody finds it for `giveUpAfter` s: the character says "Look! There it is!", the+ thing hops and counts as found, so a child who never taps is never stuck. After the last one, the praise line, and+ the film goes on by itself. A new tap cuts off whatever was being said, so lines never pile up.+ things: [{ g, word, side?, clip?, talk? }] as for tapWords (talk: the clip is the character's voice, e.g. 'q-me'+ for the character itself); asks: [{ word, clip, again? }] in order (again defaults to 'r-' + word);+ opts.end: the praise clip; opts.there: the give-up clip.+ While the character speaks, FIND.saying names its clip: a scene poses its mouth with findMouth(), and can turn its+ eyes to FIND.target (the thing asked for) or findSaw() (the thing just found, until the next question). The lines+ are captioned, from their timings, when captions are on. */+'use strict';+// The engine keeps a scene living while tapWords waits; it does not for another ask. So find.js remembers each+// scene's frame function (stopClock, paper.js) and draws it on past the beat's end while the page waits.+const FIND_CLOCKS = [];+{ const run = stopClock; stopClock = (D, draw) => { while (FIND_CLOCKS.length && FIND_CLOCKS[0].gen !== P.gen) FIND_CLOCKS.shift(); FIND_CLOCKS.push({ gen: P.gen, D, draw, f: -1 }); run(D, draw); }; }+const FIND = { saying: null, t0: 0, target: null, found: null, foundAt: -1e9 }, FIND_SEEN = .9; // until the next question starts+const findMouth = () => FIND.saying ? mouthAt(FIND.saying, performance.now() / 1000 - FIND.t0) : 'X';+const findSaw = () => performance.now() / 1000 - FIND.foundAt < FIND_SEEN ? FIND.found : null;+const FIND_SIDES = { above: 0, below: 1, right: 2, left: 3 };++function findWords(things, asks, done, { end = 'q-done', there = 'q-there', hintAfter = 5, giveUpAfter = 20, minBox = 120 } = {}) {+ const gen = P.gen, stage = $('stage'), lang = CHAPTER.language || 'en';+ const clip = name => { const a = new Audio(`audio/${lang}/${name}.mp3`); a.preload = 'auto'; a.clipName = name; return a; };+ const list = things.filter(t => t.word && t.g instanceof SVGGraphicsElement && stage.contains(t.g))+ .map(t => ({ ...t, a: clip(t.clip || 'w-' + t.word.toLowerCase().replace(/ /g, '-')) }));+ const qs = asks.map(q => ({ ...q, a: clip(q.clip), again: clip(q.again || 'r-' + q.word) }));+ const praise = clip(end), help = clip(there), chime = new Audio('audio/sfx/chime.mp3');+ const L = mk('g', { class: 'findw' }, stage);+ let on = false, alive = true, k = 0, word = null, lastAct = 0, askedAt = 0, wiggling = null, playing = null;+ let misses = 0, blanks = 0, turn = 0, stars = null;+ const now = () => performance.now();+ const box = t => {+ const s = stage.getBoundingClientRect(), r = t.g.getBoundingClientRect(), kx = SW / s.width, ky = SH / s.height;+ return { x: (r.left - s.left) * kx, y: (r.top - s.top) * ky, w: r.width * kx, h: r.height * ky };+ };+ const hitBox = t => { const b = box(t), w = Math.max(minBox, b.w), hh = Math.max(minBox, b.h); return { x: b.x + (b.w - w) / 2, y: b.y + (b.h - hh) / 2, w, h: hh }; };+ const place = () => { for (const t of list) { const b = hitBox(t); for (const [key, v] of Object.entries({ x: b.x, y: b.y, width: b.w, height: b.h })) t.hit.setAttribute(key, v.toFixed(1)); } };+ const stagePoint = e => { const s = stage.getBoundingClientRect(); return [(e.clientX - s.left) * SW / s.width, (e.clientY - s.top) * SH / s.height]; };+ const want = () => list.find(t => t.word === qs[k]?.word);++ // one sound at a time, ducking the music like a tapped word; the character's own lines move its mouth and are+ // captioned; resolves when the sound ends+ const caption = a => {+ if (typeof captions === 'undefined' || !captions) return;+ const line = (TIMINGS[a.clipName]?.cues || []).map(c => c[1]).join(' ');+ $('caption').textContent = line; $('caption').hidden = !line;+ };+ const say = (a, talk = false) => new Promise(ok => {+ if (!alive) return ok();+ playing?.pause(); playing = a;+ a.currentTime = 0; a.volume = +($('volume')?.value ?? 1);+ FIND.saying = talk ? a.clipName : null; FIND.t0 = now() / 1000;+ if (talk) caption(a);+ a.onended = () => { if (SND.word === a) SND.word = null; if (FIND.saying === a.clipName) FIND.saying = null; if (talk) { $('caption').hidden = true; } ok(); };+ SND.word = a;+ a.play().catch(ok);+ });+ let wordTimer = 0;+ const hideWord = (after = 1500) => { clearTimeout(wordTimer); const w = word; wordTimer = setTimeout(() => w?.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 300 }).finished.then(() => w.remove()), after); };+ // the word beside its thing, on its `side` or wherever it fits, as tapWords places it+ const showWord = t => {+ word?.remove(); clearTimeout(wordTimer);+ word = h('div', 'card word', t.word); word.setAttribute('aria-hidden', 'true');+ $('ui').append(word);+ const b = box(t), w = word.offsetWidth, hh = word.offsetHeight, gap = 30, m = 16, cx = b.x + (b.w - w) / 2, cy = b.y + (b.h - hh) / 2;+ const spots = [[cx, b.y - hh - gap], [cx, b.y + b.h + gap], [b.x + b.w + gap, cy], [b.x - w - gap, cy]];+ const [x, y] = t.side in FIND_SIDES ? spots[FIND_SIDES[t.side]] : spots.find(([x, y], i) => i < 2 ? y >= m && y + hh <= SH - m : x >= m && x + w <= SW - m) || spots[0];+ Object.assign(word.style, { left: Math.max(m, Math.min(SW - m - w, x)) + 'px', top: Math.max(m, Math.min(SH - m - hh, y)) + 'px' });+ };+ const hop = t => t.g.animate([{ translate: '0 0' }, { translate: '0 -22px', offset: .3 }, { translate: '0 0' }], { duration: 450, easing: 'ease-out' });+ // the hint: a big side-to-side shake (translate, so a scene can copy it onto a picture it moves itself, the mill's wheel)+ const wiggle = t => {+ if (wiggling) return;+ wiggling = t.g.animate([{ translate: '0 0' }, { translate: '-20px -6px' }, { translate: '20px 0' }, { translate: '-16px -4px' }, { translate: '12px 0' }, { translate: '0 0' }], { duration: 750 });+ wiggling.onfinish = () => { wiggling = null; lastAct = now() - (hintAfter - (misses >= 3 ? 0 : 2.5)) * 1000; };+ };+ // paper stars close round the thing asked for, from the third miss until it is found+ const starsOn = t => {+ if (stars) return;+ stars = mk('g', { 'pointer-events': 'none' }, L.parentNode);+ stars.innerHTML = Array.from({ length: 6 }, () => `<path d="M0,-28 L8,-8 L28,-8 L12,6 L18,26 L0,14 L-18,26 L-12,6 L-28,-8 L-8,-8 Z" fill="#f4c542" stroke="#b8862a" stroke-width="3"/>`).join('');+ stars.t = t;+ };+ const starsOff = () => { stars?.remove(); stars = null; };++ const ask = async () => {+ lastAct = askedAt = now();+ window.FIND_STATE = { k, of: qs.length }; // for tests+ FIND.target = want()?.g || null;+ if (k >= qs.length) {+ on = false; word?.remove(); FIND.target = null;+ await say(praise, true);+ setTimeout(() => { if (alive && P.gen === gen) { window.FIND_STATE.done = true; done(); } }, 900);+ return;+ }+ await say(qs[k].a, true);+ lastAct = askedAt = now();+ };+ const found = async (t, given) => {+ on = false; starsOff(); turn++;+ hop(t); showWord(t);+ if (given) await say(help, true);+ await say(t.a); hideWord(600);+ FIND.found = t.g; FIND.foundAt = now() / 1000;+ chime.currentTime = 0; chime.volume = .5 * +($('volume')?.value ?? 1); chime.play().catch(() => {});+ await new Promise(r => setTimeout(r, 700));+ if (!alive) return;+ k++; misses = blanks = 0; on = true; ask();+ };+ const miss = async (t, my) => {+ misses++;+ const w = want();+ if (misses >= 2 && w) wiggle(w);+ if (misses >= 3 && w) starsOn(w);+ if (t) { await say(t.a, !!t.talk); if (my !== turn) return; hideWord(); }+ await new Promise(r => setTimeout(r, 250));+ if (my === turn && alive && on) say(qs[k].again, true);+ };+ // every tap: inside the asked thing's box it is found, whatever lies on top; else the thing tapped, or nothing+ const press = (e, t) => {+ e.preventDefault();+ if (!on || !alive) return;+ lastAct = now();+ const [x, y] = stagePoint(e), w = want(), b = w && hitBox(w);+ if (b && x >= b.x && x <= b.x + b.w && y >= b.y && y <= b.y + b.h) return found(w);+ if (t) { const my = ++turn; hop(t); showWord(t); return miss(t, my); }+ const r = mk('circle', { cx: x, cy: y, r: 10, fill: 'none', stroke: '#fbf6ea', 'stroke-width': 4, 'pointer-events': 'none' }, L.parentNode);+ r.animate([{ r: 10, opacity: .9 }, { r: 46, opacity: 0 }], { duration: 500, easing: 'ease-out' }).finished.then(() => r.remove());+ if (++blanks % 2 === 0) miss(null, ++turn);+ };+ const enable = () => {+ on = true;+ const bg = mk('rect', { x: 0, y: 0, width: SW, height: SH, fill: 'transparent', style: 'pointer-events:all' }, L);+ bg.addEventListener('pointerdown', e => press(e, null));+ for (const t of list) {+ t.hit = mk('rect', { fill: 'transparent', style: 'cursor:pointer;pointer-events:all;outline:none', 'aria-label': t.word, role: 'button' }, L);+ t.hit.addEventListener('pointerdown', e => press(e, t));+ }+ // smaller things on top, so a bird in front of a tree can be reached+ [...list].sort((a, b) => box(b).w * box(b).h - box(a).w * box(a).h).forEach(t => L.append(t.hit));+ place();+ P.keys = e => e.key === 'Enter' ? (done(), true) : false;+ ask();+ };+ const cleanup = () => {+ alive = false; L.remove(); word?.remove(); starsOff();+ for (const a of [...list.map(t => t.a), ...qs.map(q => q.a), ...qs.map(q => q.again), praise, help]) a.pause();+ if (SND.word) SND.word = null;+ Object.assign(FIND, { saying: null, target: null, found: null });+ };+ P.cleanup.push(cleanup);+ let waitFrom = 0;+ const tick = () => {+ if (!alive) return;+ if (P.gen !== gen) { cleanup(); return; }+ // the scene lives on while the page waits: its frame function at D + the seconds waited, on its own 12 fps steps+ if (P.waiting) {+ waitFrom ||= now();+ for (const c of FIND_CLOCKS) if (c.gen === gen) {+ const q = c.D + (now() - waitFrom) / 1000, f = Math.floor(q * FPS + 1e-6);+ if (f !== c.f) { c.f = f; c.draw(f / FPS, f); }+ }+ }+ if (P.waiting && !on && k === 0 && !list[0].hit) enable();+ if (list[0]?.hit) place();+ if (stars) { const b = box(stars.t), cx = b.x + b.w / 2, cy = b.y + b.h / 2, R = Math.max(b.w, b.h) * .38 + 24, a0 = now() / 900;+ [...stars.children].forEach((st, i) => { const a = a0 + i * Math.PI / 3; st.setAttribute('transform', `translate(${(cx + R * Math.cos(a)).toFixed(1)},${(cy + R * .8 * Math.sin(a)).toFixed(1)}) rotate(${(a * 60).toFixed(0)})`); }); }+ const w = want();+ if (on && w && now() - askedAt > giveUpAfter * 1000) found(w, true);+ else if (on && w && now() - lastAct > hintAfter * 1000) wiggle(w);+ requestAnimationFrame(tick);+ };+ requestAnimationFrame(tick);+}diff --git a/site/little-red-riding-hood/lib/shared.js b/site/little-red-riding-hood/lib/shared.jsindex 2798764..d014da8 100644--- a/site/little-red-riding-hood/lib/shared.js+++ b/site/little-red-riding-hood/lib/shared.js@@ -54,3 +54,110 @@ function roomProps(cam, order) {r.front = slot();return r;}++/* ---------- props: the meadow's things (scenes 4 and 4w) and the inserts ----------+ Each returns { g, pose(...) }: g is the group to tap or hide (vis), pose places it in the world of the stage it was+ built in. Nothing here is in a set, so it can move, be picked and answer a tap. All are baked like puppet pieces. */+// The bird (on a branch, the ground or the wing): pose(x, y, s, { peck 0…1, flap -1 | 0 | 1 (wings on twos), look -1…1 }).+function birdProp(parent) {+ const g = mk('g', {}, parent), body = mk('g', {}, g);+ body.innerHTML = `<g filter="url(#paper)"><path d="M-30,4 L-52,-6 L-50,12 Z" fill="#3f5f8a"/><ellipse cx="0" cy="0" rx="30" ry="21" fill="#5b82b8"/>+ <ellipse cx="6" cy="8" rx="17" ry="11" fill="#f1e2c4"/></g>`;+ const head = mk('g', {}, body);+ head.innerHTML = `<g filter="url(#paper)"><circle cx="24" cy="-18" r="15" fill="#5b82b8"/><path d="M37,-21 L50,-16 L37,-12 Z" fill="#efae48"/></g><circle cx="29" cy="-21" r="3.2" fill="#22150e"/>`;+ const wing = prop(body, `<g filter="url(#paper)"><path d="M-14,-6 Q4,-22 18,-4 Q2,10 -14,-6 Z" fill="#3f5f8a"/></g>`);+ const legs = prop(g, `<path d="M-4,18 l-3,14 M8,18 l2,14" stroke="#c98a3c" stroke-width="3"/>`);+ bakeAll(g);+ return { g, pose(x, y, s, { peck = 0, flap = 0, look = 0 } = {}) {+ tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); vis(legs, !flap);+ tf(body, `translate(0,${flap ? -14 : 0}) rotate(${(peck * 28).toFixed(1)},10,10)`);+ tf(head, `rotate(${(look * 10).toFixed(1)},24,-8)`);+ tf(wing, flap ? `rotate(${flap > 0 ? -50 : 20},-14,-6)` : '');+ } };+}+// A butterfly: pose(x, y, s, open), open 1 … 0 … 1 the wings (on twos: [1, .7, .35, .7][Math.floor(q * FPS / 2) % 4]).+function butterflyProp(parent) {+ const g = mk('g', {}, parent), wings = [-1, 1].map(d => prop(g, `<g filter="url(#paper)"><path d="M0,0 C${12 * d},-34 ${44 * d},-30 ${36 * d},-6 C${32 * d},6 ${12 * d},4 0,0 Z" fill="#e88ab0"/>+ <path d="M0,2 C${16 * d},8 ${30 * d},16 ${20 * d},30 C${10 * d},32 ${2 * d},18 0,2 Z" fill="#efae48"/><circle cx="${22 * d}" cy="-14" r="5" fill="#f6efe0"/></g>`));+ prop(g, `<g filter="url(#paper)"><rect x="-3.5" y="-16" width="7" height="34" rx="3.5" fill="#3b2a1e"/></g><path d="M-2,-15 q-6,-12 -12,-14 M2,-15 q6,-12 12,-14" stroke="#3b2a1e" stroke-width="2" fill="none"/>`);+ mk('circle', { r: 40, fill: 'transparent' }, g); // a finger-sized target even when the wings are shut+ return { g, pose(x, y, s, open) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); wings.forEach(w => tf(w, `scale(${open},1)`)); } };+}+// One flower to pick, as big as the meadow's fore flowers (the set's flowers stay where they are): drawn from its foot+// at (0, 0), its head at (0, -h). col: a FLOWER_COLS colour (cast.js), so it matches the bouquet it goes into.+// pose(x, y, s, { sway: degrees, on: true }); picked flowers: vis(f.g, false) and show Red's `held`.+function flowerProp(parent, col = '#d6493f', h = 70) {+ const g = mk('g', {}, parent), head = mk('g', {}, g);+ prop(g, `<g filter="url(#paper)"><path d="M0,0 C-4,${-h * .4} 4,${-h * .7} 0,${-h}" stroke="#4f7a34" stroke-width="4" fill="none"/>+ <path d="M0,${-h * .3} q-14,-4 -18,-14 q12,0 18,14 Z M0,${-h * .5} q14,-4 17,-13 q-12,0 -17,13 Z" fill="#5b8a3e"/></g>`);+ prop(head, `<g filter="url(#paper)">${[0, 1, 2, 3, 4].map(i => { const a = i * 1.2566 - 1.57; return `<circle cx="${(12 * Math.cos(a)).toFixed(1)}" cy="${(-h + 12 * Math.sin(a)).toFixed(1)}" r="9.5" fill="${col}"/>`; }).join('')}+ <circle cx="0" cy="${-h}" r="7" fill="#efae48"/></g>`);+ mk('circle', { cy: -h, r: 30, fill: 'transparent' }, g); // a finger-sized target+ return { g, pose(x, y, s = 1, { sway = 0, on = true } = {}) { vis(g, on); tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); tf(head, `rotate(${sway.toFixed(1)},0,0)`); } };+}+// A cloud that drifts (the one to tap; the sets' own clouds are baked): pose(x, y, s).+function cloudProp(parent) {+ const g = mk('g', {}, parent);+ prop(g, `<g filter="url(#paper)"><circle cx="-40" cy="10" r="30" fill="#fbf4e2"/><circle cx="0" cy="-8" r="40" fill="#fbf4e2"/>+ <circle cx="45" cy="8" r="32" fill="#fbf4e2"/><rect x="-70" y="10" width="148" height="30" rx="15" fill="#fbf4e2"/></g>`);+ mk('rect', { x: -80, y: -56, width: 170, height: 106, rx: 40, fill: 'transparent' }, g);+ return { g, pose(x, y, s = 1) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); } };+}+// The sun, with paper rays that turn slowly: pose(x, y, s, spin degrees). The meadow set has none of its own.+function sunProp(parent) {+ const g = mk('g', {}, parent), rays = mk('g', {}, g);+ prop(rays, `<g filter="url(#paper)">${Array.from({ length: 10 }, (_, i) => `<path d="M-9,-78 L0,-104 L9,-78 Z" fill="#f3c560" transform="rotate(${i * 36})"/>`).join('')}</g>`);+ prop(g, `<g filter="url(#paper)"><circle r="66" fill="#efae48"/><circle r="50" fill="#f3c560"/></g>`);+ return { g, pose(x, y, s = 1, spin = 0) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); tf(rays, `rotate(${spin.toFixed(1)})`); } };+}+// Grandma's nightcap and glasses on their own (they drop off as she hops, the wolf picks them up; the glasses also fly+// off the wolf at "EAT"): drawn at their size on her head (puppet scale 1; give the puppet's s). pose(x, y, s, rot).+function granCapProp(parent) {+ const g = mk('g', {}, parent), c = mk('g', {}, g);+ prop(c, `<g filter="url(#paper)"><path d="M-48,26 C-48,-26 46,-30 54,22 Q4,4 -48,26 Z" fill="#f6efe0"/><path d="M-48,26 Q4,4 54,22" stroke="#e8c4d0" stroke-width="7" fill="none" stroke-dasharray="7 5"/></g>`);+ return { g, pose(x, y, s = .55, rot = 0) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); tf(c, `rotate(${rot.toFixed(1)})`); } };+}+function granGlassesProp(parent) {+ const g = mk('g', {}, parent), c = mk('g', {}, g);+ c.innerHTML = '<circle cx="-14" r="12" fill="#ffffff" fill-opacity=".15" stroke="#7a5a2a" stroke-width="2.6"/><circle cx="14" r="12" fill="#ffffff" fill-opacity=".15" stroke="#7a5a2a" stroke-width="2.6"/><path d="M-2,0 h4 M-26,-2 l-10,-4 M26,-2 l10,-4" stroke="#7a5a2a" stroke-width="2.6"/>';+ return { g, pose(x, y, s = .55, rot = 0) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`); tf(c, `rotate(${rot.toFixed(1)})`); } };+}+// The basket for the insert in scene 1 ("cake and apple juice"): the cloth folded back on the cake and the bottle.+// About 300 wide at s 1, its foot at (0, 0); open 0 (the checked cloth over everything) … 1 (cloth off to the left).+function basketProp(parent) {+ const g = mk('g', {}, parent), cloth = mk('g', {}, g);+ prop(g, `<g filter="url(#paper)"><path d="M-110,-150 Q0,-330 110,-150" fill="none" stroke="#8a5a2a" stroke-width="16"/></g>+ <g filter="url(#paper)"><rect x="18" y="-250" width="44" height="120" rx="10" fill="#e9a43a"/><rect x="28" y="-282" width="24" height="40" rx="6" fill="#e9a43a"/>+ <rect x="26" y="-292" width="28" height="14" rx="4" fill="#c8322f"/><rect x="22" y="-210" width="36" height="40" fill="#f6efe0"/><circle cx="40" cy="-190" r="11" fill="#d6493f"/><path d="M40,-201 q4,-8 10,-8" stroke="#4f7a34" stroke-width="3" fill="none"/></g>+ <g filter="url(#paper)"><path d="M-96,-150 L6,-150 L6,-196 Q-45,-214 -96,-196 Z" fill="#d9a85a"/><path d="M-96,-196 Q-45,-214 6,-196 Q-45,-180 -96,-196 Z" fill="#f6efe0"/>+ <path d="M-90,-186 h90" stroke="#c8322f" stroke-width="5" stroke-dasharray="10 7"/><circle cx="-45" cy="-208" r="9" fill="#c8322f"/></g>+ <g filter="url(#paper)"><path d="M-130,-160 L130,-160 L108,0 L-108,0 Z" fill="#b07a3e"/><path d="M-124,-112 L124,-112 M-116,-58 L116,-58" stroke="#8a5a2a" stroke-width="6"/>+ <path d="M-70,-160 L-64,0 M0,-160 L0,0 M70,-160 L64,0" stroke="#8a5a2a" stroke-width="4"/></g>`);+ prop(cloth, `<g filter="url(#paper)"><path d="M-138,-150 Q-128,-262 0,-272 Q128,-262 138,-150 L124,-118 Q0,-138 -124,-118 Z" fill="url(#check)"/></g>`);+ return { g, pose(x, y, s = 1, open = 1) { tf(g, `translate(${x.toFixed(1)},${y.toFixed(1)}) scale(${s})`);+ tf(cloth, open > 0 ? `translate(${(-190 * open).toFixed(1)},${(120 * open).toFixed(1)}) rotate(${(-28 * open).toFixed(1)},-138,-150)` : ''); } };+}++/* ---------- moving puppets along the ground ---------- */+// keys [[t, x], …] on the scene clock, eased between keys (Little Horse's route). Returns x, the distance travelled in+// the puppet's own units (d: the wolf's `run: d` plants his paws with it) and stand (1 at rest, 0 moving).+function route(q, keys, s = 1) {+ let x = keys[0][1], d = 0, moving = false, since = 1e9;+ for (let i = 1; i < keys.length; i++) {+ const [t0, a] = keys[i - 1], [t1, b] = keys[i];+ if (q >= t1) { d += Math.abs(b - a) / s; x = b; if (a !== b) since = q - t1; continue; }+ if (q > t0 && a !== b) { const u = ease((q - t0) / (t1 - t0)); x = a + (b - a) * u; d += Math.abs(b - a) * u / s; moving = true; since = 0; }+ break;+ }+ const start = keys.find((k, i) => i && keys[i - 1][1] !== k[1] && q >= keys[i - 1][0] && q < k[0]);+ const into = start ? q - keys[keys.indexOf(start) - 1][0] : 1e9;+ const stand = moving ? Math.max(0, 1 - into / .25) : Math.min(1, since / .25);+ return { x, d, stand };+}+// One big, deliberate step forward (Red stepping off the path onto the grass), u 0 … 1 over the step: the near knee+// lifts high, the foot comes down ahead and the hip follows. Spread it into a pose: red.pose({ ...bigStep(u), x: x0 + s * bigStep(u).d, … }).+function bigStep(u, L = 166, reach = 30) {+ const e = ease(u), lift = Math.sin(Math.PI * Math.min(1, u * 1.25));+ const near = -reach * Math.sin(Math.PI * e / 2) - 40 * lift * (1 - e), far = reach * e * .7;+ return { near, far, kNear: 75 * lift, kFar: 0, d: 2 * L * Math.sin(reach * Math.PI / 360) * e * 1.6, drop: 0 };+}