An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(pandemic-shorts): ch02 Too Late, first cut
yzr825ed5787935
diff --git a/site/pandemic-shorts/ch02/audio/bgm/ep2.mp3 b/site/pandemic-shorts/ch02/audio/bgm/ep2.mp3new file mode 100644index 0000000..da98368Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/bgm/ep2.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/.speed b/site/pandemic-shorts/ch02/audio/en/.speednew file mode 100644index 0000000..b123147--- /dev/null+++ b/site/pandemic-shorts/ch02/audio/en/.speed@@ -0,0 +1 @@+1.1\ No newline at end of filediff --git a/site/pandemic-shorts/ch02/audio/en/america.mp3 b/site/pandemic-shorts/ch02/audio/en/america.mp3new file mode 100644index 0000000..c2e4bc3Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/america.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/bergamo.mp3 b/site/pandemic-shorts/ch02/audio/en/bergamo.mp3new file mode 100644index 0000000..ea2a1d9Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/bergamo.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/card.mp3 b/site/pandemic-shorts/ch02/audio/en/card.mp3new file mode 100644index 0000000..9d2ffbbBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/card.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/codogno.mp3 b/site/pandemic-shorts/ch02/audio/en/codogno.mp3new file mode 100644index 0000000..43fdb8fBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/codogno.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/end.mp3 b/site/pandemic-shorts/ch02/audio/en/end.mp3new file mode 100644index 0000000..c96e991Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/end.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/genes.mp3 b/site/pandemic-shorts/ch02/audio/en/genes.mp3new file mode 100644index 0000000..aaca947Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/genes.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/hook.mp3 b/site/pandemic-shorts/ch02/audio/en/hook.mp3new file mode 100644index 0000000..4dc8a08Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/hook.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/lock.mp3 b/site/pandemic-shorts/ch02/audio/en/lock.mp3new file mode 100644index 0000000..1e0851dBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/lock.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/newyork.mp3 b/site/pandemic-shorts/ch02/audio/en/newyork.mp3new file mode 100644index 0000000..da9e7eeBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/newyork.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/pandemic.mp3 b/site/pandemic-shorts/ch02/audio/en/pandemic.mp3new file mode 100644index 0000000..fd1a81aBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/pandemic.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/rome.mp3 b/site/pandemic-shorts/ch02/audio/en/rome.mp3new file mode 100644index 0000000..63eaecfBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/en/rome.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/en/timings.js b/site/pandemic-shorts/ch02/audio/en/timings.jsnew file mode 100644index 0000000..3580232--- /dev/null+++ b/site/pandemic-shorts/ch02/audio/en/timings.js@@ -0,0 +1 @@+window.TIMINGS = {"hook": {"dur": 4.906, "marks": {"italy": 0.0, "stopped": 0.218, "china": 1.636, "still": 2.473, "first": 3.545}, "cues": [[0.0, "Italy stopped every flight from China."], [2.382, "It still became Europe's first big outbreak."]]}, "card": {"dur": 2.736, "marks": {"series": 0.0, "two": 0.982, "late": 1.891}, "cues": [[0.0, "The Pandemic."], [0.982, "Part two:"], [1.891, "too late."]]}, "rome": {"dur": 7.386, "marks": {"jan31": 0.0, "cases": 1.945, "rome": 4.455, "same": 5.309, "flights": 6.327}, "cues": [[0.0, "January 31st."], [1.582, "Italy's first two cases:"], [3.273, "Chinese tourists in Rome."], [5.164, "That same day, the flights stop."]]}, "codogno": {"dur": 6.347, "marks": {"enough": 0.145, "feb21": 1.382, "cluster": 2.945, "codogno": 4.264, "town": 4.891, "lomb": 5.582}, "cues": [[0.0, "It wasn't enough."], [1.291, "On February 21st, a cluster turns up in Codogno, a small town in Lombardy."]]}, "lock": {"dur": 8.622, "marks": {"eleven": 0.182, "lomb": 2.018, "mar9": 2.964, "italy": 4.091, "sixty": 4.873, "first": 6.927}, "cues": [[0.091, "Eleven towns sealed."], [1.927, "Then Lombardy."], [2.782, "On March 9th, all of Italy:"], [4.873, "sixty million people, the first nation to lock down."]]}, "pandemic": {"dur": 4.073, "marks": {"two": 0.0, "who": 1.218, "pandemic": 3.127}, "cues": [[0.0, "Two days later, the World Health Organization calls it a pandemic."]]}, "bergamo": {"dur": 8.343, "marks": {"bergamo": 0.127, "army": 0.873, "coffins": 2.273, "soon": 4.236, "shut": 5.491, "more": 6.764, "china": 7.673}, "cues": [[0.0, "In Bergamo, army trucks carry away the coffins the city can't bury."], [4.236, "Soon, the country that shut out China has more deaths than China."]]}, "newyork": {"dur": 6.074, "marks": {"atl": 0.436, "ny": 1.236, "mar1": 3.018, "been": 4.782, "weeks": 5.127}, "cues": [[0.0, "Across the Atlantic, New York finds its first case on March 1st."], [4.073, "But the virus had been there for weeks."]]}, "genes": {"dur": 5.309, "marks": {"genes": 1.164, "asia": 3.673, "europe": 4.709}, "cues": [[0.0, "When scientists read its genes, most cases traced back not to Asia, but to Europe."]]}, "america": {"dur": 8.425, "marks": {"endmar": 0.218, "us": 1.164, "any": 3.345, "trucks": 4.818, "bodies": 6.836}, "cues": [[0.0, "By the end of March, America has more confirmed cases than any other country."], [4.818, "Refrigerated trucks wait outside hospitals, for the bodies."]]}, "end": {"dur": 5.815, "marks": {"door": 0.0, "inside": 2.436, "next": 4.109}, "cues": [[0.0, "Shutting the door doesn't help once the virus is already inside."], [4.109, "Next:"], [4.382, "the world stops."]]}};diff --git a/site/pandemic-shorts/ch02/audio/sfx/bang.mp3 b/site/pandemic-shorts/ch02/audio/sfx/bang.mp3new file mode 100644index 0000000..bca3598Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/sfx/bang.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/sfx/door.mp3 b/site/pandemic-shorts/ch02/audio/sfx/door.mp3new file mode 100644index 0000000..7bc110bBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/sfx/door.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/sfx/thud.mp3 b/site/pandemic-shorts/ch02/audio/sfx/thud.mp3new file mode 100644index 0000000..41e5a96Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/sfx/thud.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/sfx/tick.mp3 b/site/pandemic-shorts/ch02/audio/sfx/tick.mp3new file mode 100644index 0000000..2e1e687Binary files /dev/null and b/site/pandemic-shorts/ch02/audio/sfx/tick.mp3 differdiff --git a/site/pandemic-shorts/ch02/audio/sfx/whoosh.mp3 b/site/pandemic-shorts/ch02/audio/sfx/whoosh.mp3new file mode 100644index 0000000..6c63e5eBinary files /dev/null and b/site/pandemic-shorts/ch02/audio/sfx/whoosh.mp3 differdiff --git a/site/pandemic-shorts/ch02/index.html b/site/pandemic-shorts/ch02/index.htmlnew file mode 100644index 0000000..6c193c5--- /dev/null+++ b/site/pandemic-shorts/ch02/index.html@@ -0,0 +1,350 @@+<!doctype html>+<html lang="en" data-stage="portrait">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>The Pandemic · 2 · Too Late</title>+<link rel="stylesheet" href="../lib/engine.css">+<link rel="expect" href="#bar" blocking="render">+</head>+<body>+<script src="../lib/engine.js"></script>+<script src="audio/en/timings.js"></script>+<script src="../img/art.js"></script>+<script src="../img/ch02-art.js"></script>+<script src="../img/geo-lite.js"></script>+<script src="../img/spread.js"></script>+<script src="../lib/icons.js"></script>+<script src="../lib/shorts.js"></script>+<script src="../lib/pandemic.js"></script>+<script src="lombardy.js"></script>+<script>+'use strict';+const CHAPTER = { number: 2, title: 'Too Late', minutes: 1.5, language: 'en', next: '../ch03/' };++/* ---------- this episode's pieces ---------- */+const ROME = CITIES.Rome, BEIJING = CITIES.Beijing, CODOGNO = CITIES.Codogno, NYC = CITIES['New York'];+const ITALY_V = { lon: 12.4, lat: 42.2, H: .105 }; // the whole of Italy in the upright frame+const lerpV = (a, b, q) => ({ lon: a.lon + (b.lon - a.lon) * q, lat: a.lat + (b.lat - a.lat) * q, H: a.H * (b.H / a.H) ** q });+// Italy's rings (GEO_LITE 50m, delta hundredths of a degree) in lon/lat+const ITALY = GEO_LITE.lod[1].ITA.map(r => { const o = []; let x = 0, y = 0; for (let i = 0; i < r.length; i += 2) { x += r[i]; y += r[i + 1]; o.push([x / 100, y / 100]); } return o; })+ .filter(r => r.length > 30);+// ink hatching for a lockdown (red is the virus only); on the stage's defs, which survive a seek+if (!document.getElementById('ep2hatch')) {+ const pt = mk('pattern', { id: 'ep2hatch', width: 14, height: 14, patternUnits: 'userSpaceOnUse', patternTransform: 'rotate(45)' }, PDEFS);+ mk('rect', { width: 4, height: 14, fill: MAPINK, opacity: .55 }, pt);+}+// an area on the map, re-projected each frame from M's view: ink hatching and an ink border, shown at t0+function zone(g, M, rings, D, t0, { fill = 'url(#ep2hatch)', stroke = MAPINK, sw = 3 } = {}) {+ const e = mk('path', { fill, stroke, 'stroke-width': sw, 'stroke-linejoin': 'round', opacity: 0 }, g);+ clockRun(t => e.setAttribute('d', rings.map(r => 'M' + r.map(ll => M.xy(ll, t)).filter(Boolean).map(p => p[0].toFixed(1) + ' ' + p[1].toFixed(1)).join('L') + 'Z').join('')), D, { tail: true });+ show(e, t0, .35, lin);+ return e;+}+// a circle of km radius around a point, as a ring of lon/lat+const circle = ([lon, lat], km) => [...Array(40)].map((_, i) => { const a = i / 40 * 2 * Math.PI; return [lon + km / 111 / Math.cos(lat * DEG) * Math.cos(a), lat + km / 111 * Math.sin(a)]; });+// a flight from a to b on the map: a dashed ink arc drawn from t0 over dur with a plane at its head; cut at tCut+const PLANE = 'M0 -5L22 -5L34 -18L40 -18L32 -5L44 -5L50 -12L54 -12L50 0L54 12L50 12L44 5L32 5L40 18L34 18L22 5L0 5Z';+function flight(g, M, a, b, t0, dur, D, tCut) {+ const e = G(g, {}), line = mk('path', { fill: 'none', stroke: MAPINK, 'stroke-width': 4, 'stroke-dasharray': '12 9', 'stroke-linecap': 'round' }, e);+ const pl = G(e, {}); mk('path', { d: PLANE, fill: MAPINK, transform: 'translate(-27 0)' }, pl);+ clockRun(t => {+ const A = M.xy(a, t), B = M.xy(b, t), q = smooth(ramp01(t, t0, t0 + dur));+ if (!A || !B) return;+ const lift = Math.hypot(B[0] - A[0], B[1] - A[1]) * .3, mx = (A[0] + B[0]) / 2, my = (A[1] + B[1]) / 2 - lift;+ const at = u => [(1 - u) ** 2 * A[0] + 2 * u * (1 - u) * mx + u * u * B[0], (1 - u) ** 2 * A[1] + 2 * u * (1 - u) * my + u * u * B[1]];+ let d = `M${A[0].toFixed(1)} ${A[1].toFixed(1)}`;+ for (let i = 1; i <= 40 * q; i++) { const p = at(i / 40); d += `L${p[0].toFixed(1)} ${p[1].toFixed(1)}`; }+ line.setAttribute('d', d);+ const h = at(q), h2 = at(Math.min(1, q + .01));+ put(pl, { x: h[0], y: h[1], r: Math.atan2(h2[1] - h[1], h2[0] - h[0]) * 180 / Math.PI, o: t < tCut && q < 1 ? 1 : 0 });+ line.setAttribute('opacity', t < tCut ? 1 : .35);+ }, D, { tail: true });+ return e;+}+// case dots scattered around a point: n of them, popping in from t0 over dur+const cluster = ([lon, lat], km, n, t0, dur, seed, r = 6) => { const R = seeded(seed); return [...Array(n)].map((_, i) => { const a = R() * 2 * Math.PI, d = km * Math.sqrt(R()) / 111; return [lon + d * Math.cos(a) / Math.cos(lat * DEG), lat + d * Math.sin(a), t0 + dur * i / n, r]; }); };+// a date in the corner of a map shot+const dateChip = (s, str, t0) => label(s, str, CX - 20, 250, t0, { size: 46, fill: MAPINK, colour: MAPLAND });++// shot() leaves its whip/swipe blur filter on the group after the slide, and Firefox then filters every frame of a+// map under it: take the filter off once the slide is done+function cut(p, t0, t1, o = {}) {+ const g = shot(p, t0, t1, o), f = g.getAttribute('filter');+ if (f) prog(q => q >= 1 ? g.removeAttribute('filter') : g.setAttribute('filter', f), t0, .3, lin);+ return g;+}++/* ---------- beats ---------- */+const OPEN_PRE = .3;+const BEATS = [+ // 0. The hook, the point: a flight from China already crossing the paper map; cut; Italy lights up anyway+ ['hook', 'The hook', (m, D) => {+ const p = panel(0);+ const s = cut(p, 0, undefined, { bg: NIGHT });+ const cn = m('china'), still = m('still'), V0 = { lon: 58, lat: 40, H: .85 }, V1 = { lon: 11.6, lat: 43.4, H: .12 };+ const view = t => lerpV(V0, V1, soft(ramp01(t, cn + .5, still + 1.2)) * .97 + .03 * ramp01(t, 0, cn + .5));+ const M = paperMap(s, D, view, {+ lit: (c, t) => c === 'ITA' ? .5 * ramp01(t, still, still + .4) : 0,+ dots: [...cluster(CODOGNO, 90, 18, still + .1, .9, 3, 7), ...cluster([12.3, 45.4], 60, 6, still + .4, .6, 5, 6)],+ cities: [['Beijing', 0, 'l'], ['Rome', 0, 'l']],+ });+ flight(s, M, BEIJING, ROME, -.6, 1.9, D, cn);+ hide(label(s, 'Flights from China', CX - 20, 250, 0, { size: 60, fill: MAPINK, colour: MAPLAND }), still - .1, .2);+ const st = stamp(s, 'FLIGHTS STOPPED', CX - 20, 780, cn, { size: 84, colour: MAPINK, r: -7 });+ hide(st, still - .1, .2);+ sfx('hook', still, 'whoosh', .5);+ word(s, "Europe's first", CX - 20, 1120, m('first'), { size: 120, fill: LIGHT, stroke: DARK });+ word(s, 'big outbreak', CX - 20, 1250, m('first') + .3, { size: 110, fill: RED, stroke: DARK });+ sfx('hook', m('first') + .3, 'thud', 1.2);+ }, { pre: OPEN_PRE }],++ // 1. Which series, which episode+ ['card', 'The series', (m, D) => {+ const p = panel(0);+ const s = cut(p, 0, undefined, { bg: DARK, swipe: true });+ seriesCard(s, 0, 2, m('two') + .2);+ }],++ // 2. The date: the first two cases in Rome, and the flights stop the same day+ ['rome', 'Rome', (m, D) => {+ const p = panel(0);+ const sm = m('same'), cs = m('cases');+ let s = cut(p, 0, sm, { bg: NIGHT, whip: true });+ const view = t => lerpV({ lon: 12.4, lat: 42.6, H: .1 }, { lon: 12.5, lat: 42.0, H: .07 }, soft(ramp01(t, 0, sm + .3)));+ paperMap(s, sm + .3, view, { dots: [[ROME[0] + .35, ROME[1] + .2, cs + .1, 8], [ROME[0] - .3, ROME[1] - .25, cs + .35, 8]], cities: [['Rome', m('rome'), 'l']], on: [0, sm + .3] });+ dateChip(s, '31 January 2020', 0);+ sfx('rome', cs + .1, 'tick', 1); sfx('rome', cs + .35, 'tick', 1);+ word(s, 'First two cases', CX - 20, 1120, cs, { size: 110, fill: LIGHT, stroke: DARK });+ label(s, 'Chinese tourists in Rome', CX - 20, 1245, m('rome'), { size: 52, fill: DARK, colour: LIGHT });+ srcTag(s, 'Wikipedia, COVID-19 pandemic in Italy', 50, 150, 0);+ s = cut(p, sm, undefined, { whip: true });+ photo(s, 'ep2-departures', sm, D + .6, { s0: 1.04, s1: 1.16, dy: 40, dim: .15 });+ label(s, 'The same day', CX - 20, 250, sm + .05, { size: 56 });+ word(s, 'Every flight from China', CX - 20, 1090, sm + .2, { size: 92, fill: LIGHT, stroke: DARK });+ stamp(s, 'STOPPED', CX - 20, 1240, m('flights'), { size: 110, colour: MARK, r: -6 });+ }],++ // 3. It wasn't enough: three weeks on, a cluster in a small town in Lombardy+ ['codogno', 'Codogno', (m, D) => {+ const p = panel(0);+ const f21 = m('feb21'), tn = m('town');+ let s = cut(p, 0, tn, { bg: NIGHT });+ const LV = { lon: 9.75, lat: 45.25, H: .028 };+ const view = t => lerpV({ lon: 12.4, lat: 42.4, H: .095 }, LV, .12 * ramp01(t, 0, f21 - .1) + .88 * soft(ramp01(t, f21 - .1, f21 + 1.4)));+ const M = paperMap(s, tn + .3, view, { dots: cluster(CODOGNO, 14, 16, m('cluster'), 1.3, 9, 6), cities: [['Codogno', m('codogno') - .1], ['Milan', f21 + 1.2]], on: [0, tn + .3] });+ flight(s, M, BEIJING, ROME, -9, 1, tn + .3, -1); // the cut line from the hook, faint, as Italy is seen again+ hide(word(s, "It wasn't enough", CX - 20, 250, 0, { size: 100, fill: LIGHT, stroke: DARK }), f21 - .1, .15);+ dateChip(s, '21 February 2020', f21);+ word(s, 'A cluster', CX - 20, 1200, m('cluster'), { size: 120, fill: RED, stroke: DARK });+ for (let k = 0; k < 4; k++) sfx('codogno', m('cluster') + k * .3, 'tick', .6);+ s = cut(p, tn, undefined, { whip: true });+ photo(s, 'ep2-codogno', tn, D + .6, { s0: 1.05, s1: 1.14, dy: -30, dim: .1 });+ word(s, 'Codogno', CX - 20, 260, tn + .05, { size: 130, fill: LIGHT, stroke: DARK });+ label(s, 'A small town in Lombardy', CX - 20, 1220, tn + .2, { size: 54 });+ }],++ // 4. The red zone grows: eleven towns, Lombardy, all of Italy; sixty million, the first nation to lock down+ ['lock', 'Lockdown', (m, D) => {+ const p = panel(0);+ const tm = 1.55, lb = m('lomb'), it = m('italy'), sx = m('sixty'), fr = m('first');+ let s = cut(p, 0, tm);+ photo(s, 'ep2-checkpoint', 0, tm + .3, { s0: 1.08, s1: 1.18, dim: .1 });+ counter(s, 11, CX - 20, 1100, 0, { size: 240, fill: LIGHT, dur: .7 });+ word(s, 'towns sealed', CX - 20, 1230, .15, { size: 100, fill: LIGHT, stroke: DARK });+ label(s, '22 February 2020', CX - 20, 250, .1, { size: 46 });+ s = cut(p, tm, undefined, { bg: NIGHT, whip: true });+ const Z = { lon: 9.75, lat: 45.2, H: .03 }, L = { lon: 9.85, lat: 45.55, H: .052 };+ const view = t => {+ const a = soft(ramp01(t, lb - .25, lb + .9)), b = soft(ramp01(t, it - .3, it + 1.1));+ const v = b ? lerpV(L, { ...ITALY_V, H: .1 }, b) : lerpV(Z, L, a);+ return { ...v, H: v.H * .82 ** ramp01(t, it + 1.1, D + .6) }; // still pushing while the numbers land+ };+ const M = paperMap(s, D, view, { dots: cluster(CODOGNO, 14, 16, -1, .1, 9, 6), cities: [['Codogno', tm], ['Milan', lb + .5]], on: [tm - .05, D + 1] });+ const zg = G(s, {});+ hide(zone(zg, M, [circle([9.7, 45.18], 11)], D, tm + .1, { stroke: RED }), it, .4);+ hide(zone(zg, M, [LOMBARDY], D, lb), it + .5, .4);+ zone(zg, M, ITALY, D, it);+ sfx('lock', lb, 'thud', .8); sfx('lock', it, 'thud', 1.2);+ hide(label(s, 'Lombardy', CX - 20, 250, lb + .1, { size: 56, fill: MAPINK, colour: MAPLAND }), m('mar9') - .1, .15);+ dateChip(s, '9 March 2020', m('mar9'));+ const box = G(s, { o: 0 });+ rect(box, 60, 940, 740, 340, { fill: DARK, opacity: .88, rx: 8 });+ show(box, sx - .15, .2);+ counter(box, 60e6, CX - 20, 1070, sx, { size: 130, fill: LIGHT, dur: 1.1 });+ T(box, 'PEOPLE', { x: CX - 20, y: 1135, size: 44, fill: MUTED, font: SANS, weight: 500, anchor: 'middle' }).setAttribute('letter-spacing', '.14em');+ word(box, 'First nation to lock down', CX - 20, 1235, fr, { size: 70, fill: MARK });+ srcTag(s, 'Wikipedia, COVID-19 pandemic in Italy', 50, 150, tm);+ }],++ // 5. Two days later the WHO says the word, as the map pulls out to a world of red dots+ ['pandemic', 'Pandemic', (m, D) => {+ const p = panel(0);+ const s = cut(p, 0, undefined, { bg: NIGHT, whip: true });+ const view = t => ({ ...lerpV({ ...ITALY_V, H: .1 }, { lon: 40, lat: 28, H: 1.08 }, soft(ramp01(t, 0, 1.5))), dy: -300 * soft(ramp01(t, .4, 1.5)) });+ const list = SPREAD.filter(r => r[3] <= '2020-03-11');+ paperMap(s, D, view, { lit: c => c === 'ITA' ? .5 : 0, dots: list.map((r, i) => [r[1], r[2], .3 + 2 * i / list.length, 6]) });+ const zi = G(s, {}), Mi = { xy: (ll, t) => mapXY(ll, view(t)) };+ hide(zone(zi, Mi, ITALY, D, -1), .6, .4);+ dateChip(s, '11 March 2020', 0);+ const card = G(s, { x: 0, y: 420, o: 0 });+ rect(card, 70, 840, 720, 420, { fill: '#efe9da', rx: 6 });+ T(card, 'WORLD HEALTH ORGANIZATION', { x: 110, y: 905, size: 28, fill: '#6a6258', font: SANS, weight: 500 }).setAttribute('letter-spacing', '.16em');+ ['“COVID-19 can be', 'characterized as a'].forEach((l, i) => T(card, l, { x: 110, y: 995 + i * 70, size: 58, fill: '#2a2521', font: SERIF, weight: 500 }));+ const hl = rect(card, 102, 1092, 0, 76, { fill: MARK, opacity: .85 });+ const pw = T(card, 'pandemic.”', { x: 110, y: 1150, size: 70, fill: '#2a2521', font: SERIF, weight: 600 });+ prog(q => hl.setAttribute('width', q * (pw.getComputedTextLength() + 16)), m('pandemic') - .05, .45, out);+ T(card, 'Opening remarks, 11 March 2020 · who.int', { x: 110, y: 1225, size: 24, fill: '#6a6258', font: SERIF }).setAttribute('font-style', 'italic');+ tw(card, { y: 0, o: 1 }, m('who') - .2, .45, out);+ sfx('pandemic', m('who') - .2, 'whoosh', .4);+ }],++ // 6. Bergamo: army trucks with the coffins; then the country that shut out China passes China+ ['bergamo', 'Bergamo', (m, D) => {+ const p = panel(0);+ const cf = m('coffins'), sn = m('soon'), mo = m('more');+ let s = cut(p, 0, cf, { whip: true });+ photo(s, 'ep2-convoy', 0, cf + .3, { s0: 1.0, s1: 1.14, dy: -40, dim: .1 });+ label(s, 'Bergamo · March 2020', CX - 20, 250, 0, { size: 52 });+ word(s, 'Army trucks', CX - 20, 1180, m('army'), { size: 140, fill: LIGHT, stroke: DARK });+ sfx('bergamo', m('army'), 'thud', .7);+ s = cut(p, cf, sn);+ photo(s, 'ep2-coffins', cf, sn + .3, { s0: 1.12, s1: 1.0, dim: .1 });+ word(s, 'Too many to bury', CX - 20, 1180, cf + .1, { size: 110, fill: LIGHT, stroke: DARK });+ s = cut(p, sn, undefined, { bg: DARK, swipe: true });+ label(s, 'Reported deaths', CX - 20, 260, sn + .05, { size: 56, fill: LIGHT, colour: DARK });+ const base = 1060, hC = 560;+ rect(s, 110, base, 640, 4, { fill: MUTED });+ bar(s, 170, base, 220, hC, 1, MUTED, sn + .15, .5);+ const it = rect(s, 470, base, 220, 0, { fill: RED });+ prog(q => { const h = hC * (.82 * q + .2 * smooth(ramp01(q, .7, 1))); it.setAttribute('y', base - h); it.setAttribute('height', h); }, sn + .4, mo + .4 - sn, lin);+ const dash = mk('path', { d: `M130 ${base - hC}H730`, stroke: LIGHT, 'stroke-width': 3, 'stroke-dasharray': '10 8', opacity: 0 }, s);+ show(dash, mo - .2, .2);+ T(s, 'CHINA', { x: 280, y: base + 70, size: 54, fill: MUTED, font: SANS, weight: 600, anchor: 'middle' });+ T(s, 'ITALY', { x: 580, y: base + 70, size: 54, fill: LIGHT, font: SANS, weight: 600, anchor: 'middle' });+ label(s, 'Shut out China', 580, 400, m('shut'), { size: 44, fill: MARK, colour: DARK });+ word(s, 'More than China', CX - 20, 1250, m('china'), { size: 100, fill: RED });+ sfx('bergamo', mo, 'thud', 1.1);+ srcTag(s, 'Wikipedia, COVID-19 pandemic', 50, 150, sn);+ }],++ // 7. Across the Atlantic: New York's first case, and the virus there for weeks before it+ ['newyork', 'New York', (m, D) => {+ const p = panel(0);+ const s = cut(p, 0, undefined, { bg: NIGHT });+ const ny = m('ny'), tH = ny + .1, bn = m('been');+ const view = t => {+ const a = soft(ramp01(t, 0, ny + .3));+ return { lon: 12 + (NYC[0] + 1 - 12) * a, lat: 43 + (NYC[1] - 43) * a + 8 * Math.sin(Math.PI * a), H: .12 * (.05 / .12) ** a * 12 ** Math.sin(Math.PI * a), gain: 1.15, dotScale: .05 };+ };+ Globe.clearMarks(); Globe.dot(...NYC);+ globeShot(s, D, view, (i, t) => ramp01(t, ny - .2, ny), null, { on: [0, tH + .5] });+ sfx('newyork', .1, 'whoosh', .7);+ const mp = G(s, { o: 0 }); show(mp, tH, .4, lin);+ const R = seeded(4), early = [...Array(14)].map((_, i) => [NYC[0] + (R() - .5) * 1.1, NYC[1] + (R() - .5) * .7, bn + .1 + i * .07, 4]);+ paperMap(mp, D, t => ({ ...view(t), lon: view(t).lon + .3 * ramp01(t, tH, D), H: view(t).H * .7 ** ramp01(t, tH, D) }), { dots: [[...NYC, m('mar1'), 9], ...early], cities: [['New York', ny + .3, 'l']], on: [tH - .05, D + 1] });+ hide(label(s, 'Across the Atlantic', CX - 20, 250, m('atl'), { size: 52 }), m('mar1') - .1, .1);+ const d1 = dateChip(s, '1 March 2020', m('mar1'));+ word(s, 'First case', CX - 20, 1150, m('mar1') + .1, { size: 130, fill: LIGHT, stroke: DARK });+ hide(d1, bn, .05, lin);+ const d2 = dateChip(s, 'February', bn); hide(d2, bn + .45, .05, lin);+ dateChip(s, 'January', bn + .45);+ word(s, 'There for weeks', CX - 20, 1270, m('weeks'), { size: 90, fill: RED, stroke: DARK });+ srcTag(s, 'Wikipedia, COVID-19 pandemic in New York City', 50, 150, m('mar1'));+ }],++ // 8. The genes: a strip of the genome; the arcs into New York, Asia's struck, Europe's red+ ['genes', 'The genes', (m, D) => {+ const p = panel(0);+ const as = m('asia'), eu = m('europe'), tm = as - .3;+ let s = cut(p, 0, tm, { bg: DARK, whip: true });+ // SARS-CoV-2 reference sequence NC_045512.2 (NCBI), bases 1-600, running past+ const SEQ = 'ATTAAAGGTTTATACCTTCCCAGGTAACAAACCAACCAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTGTCACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGACAGGACACGAGTAACTCGTCTATCTTCTGCAGGCTGCTTACGGTTTCGTCCGTGTTGCAGCCGATCATCAGCACATCTAGGTTTCGTCCGGGTGTGACCGAAAGGTAAGATGGAGAGCCTTGTCCCTGGTTTCAACGAGAAAACACACGTCCAACTCAGTTTGCCTGTTTTACAGGTTCGCGACGTGCTCGTACGTGGCTTTGGAGACTCCGTGGAGGAGGTCTTATCAGAGGCACGTCAACATCTTAAAGATGGCACTTGTGGCTTAGTAGAAGTTGAAAAAGGCGTTTTGCCTCAACTTGAACAGCCCTATGTGTTCATCAAACGTTCGGATGCTCGAACTGCACCTCATGGTCATGTTATGGTTGAGCTGGTAGCAGAACTCGAAGGCATTCAGTACGGTCGTAGTGGTGAGACACTTGGTGTCCTTGTCCCTCATGTGGG';+ const rows = G(s, {}), PER = 22;+ for (let r = 0; r < 26; r++) { // one text a row (a text a letter is 570 nodes, too many for Firefox)+ const t = T(rows, SEQ.substr(r * PER, PER), { x: 70, y: 340 + r * 52, size: 40, fill: [LIGHT, MUTED, MARK, '#7fb0b3'][r % 4], font: 'ui-monospace, Menlo, monospace', weight: 600 });+ t.setAttribute('letter-spacing', '.3em');+ }+ tw(rows, { y: -340 }, 0, tm + .3, lin);+ rect(s, 0, 0, W, 330, { fill: DARK }); rect(s, 0, 1300, W, 300, { fill: DARK, opacity: .85 });+ word(s, 'Read its genes', CX - 20, 250, m('genes'), { size: 120, fill: LIGHT });+ srcTag(s, 'SARS-CoV-2 reference genome NC_045512.2 · NCBI', 50, 150, 0);+ s = cut(p, tm, undefined, { bg: NIGHT, whip: true });+ const view = () => ({ lon: 21, lat: 51, H: 1.08 });+ const EU = ['London', 'Paris', 'Milan', 'Madrid', 'Berlin'].map(n => CITIES[n]);+ const M = paperMap(s, D, view, { dots: [[...NYC, -1, 8]], routes: EU.map((ll, i) => [ll, NYC, eu - .1 + i * .1, .7]), cities: [['New York', -1]], on: [tm - .05, D + 1] });+ // Asia's arc, grey, crossed out+ const A = M.xy(CITIES.Wuhan, 0), B = M.xy(NYC, 0), mx = (A[0] + B[0]) / 2, my = Math.min(A[1], B[1]) - 330;+ const arc = mk('path', { d: `M${A[0]} ${A[1]}Q${mx} ${my} ${B[0]} ${B[1]}`, fill: 'none', stroke: '#8a919c', 'stroke-width': 5, 'stroke-dasharray': '1400', 'stroke-dashoffset': 1400 }, s);+ prog(q => arc.setAttribute('stroke-dashoffset', 1400 * (1 - q)), tm + .1, .7, out);+ tw(arc, { o: .45 }, eu, .3);+ const X = G(s, { x: mx, y: (my + Math.min(A[1], B[1])) / 2 + 10, o: 0, s: 1.6 });+ mk('path', { d: 'M-34 -34L34 34M34 -34L-34 34', stroke: MAPINK, 'stroke-width': 12, 'stroke-linecap': 'round' }, X);+ tw(X, { o: 1, s: 1 }, as + .45, .15, out); sfx('genes', as + .45, 'bang', .8);+ label(s, 'Not Asia', 640, A[1] + 90, as, { size: 48, fill: '#8a919c', colour: DARK });+ word(s, 'Most cases', CX - 20, 270, tm + .1, { size: 110, fill: LIGHT });+ word(s, 'From Europe', CX - 20, 1230, eu, { size: 140, fill: RED, stroke: DARK });+ sfx('genes', eu, 'whoosh', .6);+ srcTag(s, 'Wikipedia, COVID-19 pandemic in New York City', 50, 150, tm);+ }],++ // 9. End of March: America first in confirmed cases; refrigerated trucks for the bodies+ ['america', 'America', (m, D) => {+ const p = panel(0);+ const tr = m('trucks'), us = m('us');+ let s = cut(p, 0, tr, { bg: NIGHT, whip: true });+ const view = t => lerpV({ lon: -60, lat: 45, H: .5 }, { lon: -96, lat: 40, H: .27 }, soft(ramp01(t, 0, 1.4)));+ paperMap(s, tr + .3, view, { lit: (c, t) => c === 'USA' ? .6 * ramp01(t, us, us + .4) : c === 'ITA' ? .5 : 0, dots: [[...NYC, -1, 9]], on: [0, tr + .3] });+ dateChip(s, 'End of March 2020', 0);+ word(s, 'Most confirmed cases', CX - 20, 1150, m('any') - .3, { size: 96, fill: LIGHT, stroke: DARK });+ label(s, 'of any country', CX - 20, 1250, m('any'), { size: 52, fill: RED, colour: LIGHT });+ sfx('america', us, 'thud', 1);+ srcTag(s, 'Wikipedia, COVID-19 pandemic', 50, 150, 0);+ s = cut(p, tr, undefined, { whip: true });+ found(s, 'morgue-trucks-nyc', 'Mortuary trucks, New York, 21 April 2020 · Archer West, CC BY 4.0', tr, D + .6, { s0: 1.05, s1: 1.2, dx: -30, dim: .12 });+ word(s, 'Refrigerated trucks', CX - 20, 260, tr + .1, { size: 100, fill: LIGHT, stroke: DARK });+ word(s, 'For the bodies', CX - 20, 1200, m('bodies'), { size: 120, fill: LIGHT, stroke: DARK });+ }],++ // 10. The end answers the hook: the door shuts, the red is already inside; next, the world stops+ ['end', 'Too late', (m, D) => {+ const p = panel(0);+ const ins = m('inside'), nx = m('next');+ let s = cut(p, 0, nx, { bg: DARK, swipe: true });+ // a doorway onto the paper map of the world outside; the door swings shut on it+ const dx = 230, dy = 380, dw = 400, dh = 700;+ const clip = 'ep2door';+ mk('rect', { x: dx, y: dy, width: dw, height: dh }, mk('clipPath', { id: clip }, mk('defs', {}, s)));+ const out_ = G(s, {}); out_.setAttribute('clip-path', `url(#${clip})`);+ paperMap(out_, D, t => ({ lon: 60 - 6 * t, lat: 35, H: .8 }), { lit: c => c === 'CHN' ? .5 : 0, on: [0, 1.5] });+ rect(s, dx - 22, dy - 22, dw + 44, dh + 22, { fill: 'none', stroke: '#5a4636', 'stroke-width': 22 });+ const door = rect(s, dx, dy, 0, dh, { fill: '#3a2c22', stroke: '#241a13', 'stroke-width': 4 });+ const knob = mk('circle', { cx: dx + dw - 40, cy: dy + dh / 2, r: 12, fill: MARK, opacity: 0 }, s);+ prog(q => door.setAttribute('width', dw * q), .55, .9, io);+ show(knob, 1.4, .1, lin);+ sfx('end', 1.4, 'door', 1.2);+ rect(s, 0, dy + dh, W, H - dy - dh, { fill: '#14161b' }); // the floor of the room we are in+ // the red already in the room with us, spreading after the door is shut+ const R = seeded(17);+ for (let i = 0; i < 70; i++) {+ const x = 70 + R() * 720, y = 170 + R() * 1100, t0 = i < 12 ? 0 : 1.5 + (ins + .8 - 1.5) * Math.sqrt((i - 12) / 58);+ if (x > dx - 30 && x < dx + dw + 30 && y > dy - 30 && y < dy + dh) continue;+ const d = mk('circle', { cx: x, cy: y, r: 0, fill: RED }, s), h = mk('circle', { cx: x, cy: y, r: 0, fill: RED, opacity: .25 }, s);+ prog(q => { d.setAttribute('r', Math.max(0, 9 * back(q))); h.setAttribute('r', 20 * q); }, t0, .25, lin);+ }+ word(s, 'Shut the door', CX - 20, 260, 0, { size: 110, fill: LIGHT, stroke: DARK });+ word(s, 'Already inside', CX - 20, 1250, ins, { size: 130, fill: RED, stroke: DARK });+ sfx('end', ins, 'thud', 1.2);+ s = cut(p, nx, undefined, { bg: DARK, swipe: true });+ const tile = endCard(s, nx, 2);+ tw(tile, { s: 2.1 }, nx + .5, D + 1.6 - nx - .5, lin); // keeps moving while it holds+ prog(() => {}, D, 1.6, lin); // the next episode's card holds after the voice+ }],+].map(shortsBeat);++// One track for the whole episode; ?bgm= sets its level by ear (gain under the ducking to 30 %)+music('audio/bgm/ep2.mp3', undefined, +(new URLSearchParams(location.search).get('bgm') || .35), .05);+startPandemic();+</script>+</body>+</html>diff --git a/site/pandemic-shorts/ch02/lombardy.js b/site/pandemic-shorts/ch02/lombardy.jsnew file mode 100644index 0000000..2d1be05--- /dev/null+++ b/site/pandemic-shorts/ch02/lombardy.js@@ -0,0 +1,2 @@+// Lombardy outline, lon/lat, dissolved from Natural Earth 10m admin-1 (public domain), simplified to 0.01 deg+const LOMBARDY = [[8.732,46.107],[8.728,46.022],[8.591,45.915],[8.602,45.833],[8.565,45.799],[8.609,45.734],[8.649,45.717],[8.649,45.681],[8.677,45.673],[8.682,45.644],[8.665,45.636],[8.697,45.603],[8.717,45.523],[8.772,45.494],[8.832,45.408],[8.735,45.376],[8.757,45.357],[8.714,45.333],[8.703,45.305],[8.664,45.313],[8.626,45.357],[8.556,45.367],[8.498,45.292],[8.558,45.196],[8.557,45.165],[8.646,45.041],[8.669,45.025],[8.751,45.025],[8.85,45.058],[8.881,45.053],[8.882,45.001],[8.964,44.976],[8.977,44.933],[9.053,44.88],[9.06,44.837],[9.157,44.807],[9.202,44.732],[9.201,44.682],[9.242,44.683],[9.251,44.716],[9.293,44.694],[9.322,44.708],[9.306,44.759],[9.355,44.827],[9.358,44.856],[9.307,44.889],[9.303,44.913],[9.425,45.101],[9.501,45.103],[9.542,45.086],[9.539,45.124],[9.553,45.135],[9.59,45.113],[9.64,45.126],[9.637,45.094],[9.681,45.075],[9.752,45.082],[9.764,45.115],[9.834,45.068],[9.83,45.096],[9.896,45.092],[9.883,45.134],[9.923,45.13],[9.916,45.108],[9.987,45.129],[10.021,45.11],[10.072,45.038],[10.184,45.047],[10.35,44.984],[10.399,44.991],[10.444,44.937],[10.521,44.916],[10.601,44.922],[10.693,44.99],[10.754,44.977],[10.764,44.944],[10.889,44.913],[10.999,44.953],[11.083,44.962],[11.163,44.931],[11.28,44.943],[11.303,44.96],[11.421,44.95],[11.419,44.967],[11.273,45.034],[11.273,45.06],[11.196,45.063],[11.204,45.112],[11.162,45.12],[11.069,45.103],[11.048,45.123],[11.054,45.147],[11.002,45.155],[11.005,45.18],[10.987,45.197],[10.849,45.263],[10.795,45.307],[10.761,45.294],[10.74,45.316],[10.697,45.32],[10.718,45.361],[10.702,45.382],[10.702,45.423],[10.662,45.419],[10.643,45.448],[10.644,45.61],[10.845,45.834],[10.687,45.845],[10.665,45.812],[10.585,45.794],[10.523,45.841],[10.507,45.882],[10.52,45.917],[10.5,45.965],[10.459,45.985],[10.515,46.082],[10.557,46.112],[10.565,46.188],[10.59,46.233],[10.578,46.313],[10.528,46.343],[10.558,46.367],[10.619,46.375],[10.639,46.411],[10.625,46.455],[10.488,46.497],[10.452,46.547],[10.426,46.535],[10.295,46.551],[10.235,46.575],[10.234,46.618],[10.218,46.627],[10.088,46.604],[10.071,46.564],[10.033,46.533],[10.028,46.484],[10.044,46.467],[10.026,46.446],[10.133,46.414],[10.133,46.381],[10.092,46.329],[10.159,46.262],[10.146,46.243],[10.076,46.22],[10.043,46.221],[10.032,46.26],[9.978,46.298],[9.964,46.356],[9.918,46.371],[9.768,46.339],[9.72,46.351],[9.708,46.312],[9.674,46.292],[9.537,46.299],[9.483,46.357],[9.444,46.375],[9.435,46.498],[9.385,46.466],[9.351,46.498],[9.282,46.497],[9.238,46.437],[9.261,46.417],[9.275,46.331],[9.225,46.231],[9.181,46.204],[9.163,46.172],[9.091,46.138],[9.059,46.062],[9.002,46.039],[9.016,45.993],[8.98,45.964],[9.011,45.927],[9.063,45.899],[9.002,45.821],[8.94,45.835],[8.9,45.826],[8.912,45.883],[8.871,45.947],[8.768,45.983],[8.834,46.066],[8.809,46.09],[8.732,46.107]];diff --git a/site/pandemic-shorts/img/SOURCES.md b/site/pandemic-shorts/img/SOURCES.mdindex 769515b..53ca84f 100644--- a/site/pandemic-shorts/img/SOURCES.md+++ b/site/pandemic-shorts/img/SOURCES.md@@ -39,3 +39,12 @@ The code in this repository is MIT. The pictures and data here keep their own li| File | Source | Author | Licence ||---|---|---|---|| `geo-lite.js` | [Natural Earth](https://www.naturalearthdata.com/) 110m and 50m countries, 10m provinces and populated places, simplified (books/pandemic-shorts/geo-lite.py) | Natural Earth | Public domain |++## ch02 · Too Late++| File | Source | Author | Licence |+|---|---|---|---|+| `ep2-departures.webp`, `ep2-codogno.webp`, `ep2-checkpoint.webp`, `ep2-convoy.webp`, `ep2-coffins.webp` | AI illustration (openai/gpt-image-2.5-flare, low), prompts in books/pandemic-shorts/art/ch02/, costs in art/costs.tsv | generated | tagged "AI illustration" on screen |+| `ch02/lombardy.js` | Lombardy's outline dissolved from [Natural Earth](https://www.naturalearthdata.com/) 10m admin-1 provinces, simplified to 0.01° | Natural Earth | Public domain |+| genome strip (in `ch02/index.html`) | SARS-CoV-2 reference sequence [NC_045512.2](https://www.ncbi.nlm.nih.gov/nuccore/NC_045512.2), bases 1–572 | NCBI | Public domain (US government database) |+| WHO quote | [Director-General's opening remarks, 11 March 2020](https://www.who.int/news-room/speeches/item/who-director-general-s-opening-remarks-at-the-media-briefing-on-covid-19---11-march-2020) | WHO | quoted |diff --git a/site/pandemic-shorts/img/ch02-art.js b/site/pandemic-shorts/img/ch02-art.jsnew file mode 100644index 0000000..cabfd58--- /dev/null+++ b/site/pandemic-shorts/img/ch02-art.js@@ -0,0 +1 @@+Object.assign(window.ART, {"ep2-departures":[864,1536],"ep2-codogno":[864,1536],"ep2-checkpoint":[864,1536],"ep2-convoy":[864,1536],"ep2-coffins":[864,1536]});diff --git a/site/pandemic-shorts/img/ep2-checkpoint.webp b/site/pandemic-shorts/img/ep2-checkpoint.webpnew file mode 100644index 0000000..5d81278Binary files /dev/null and b/site/pandemic-shorts/img/ep2-checkpoint.webp differdiff --git a/site/pandemic-shorts/img/ep2-codogno.webp b/site/pandemic-shorts/img/ep2-codogno.webpnew file mode 100644index 0000000..3371228Binary files /dev/null and b/site/pandemic-shorts/img/ep2-codogno.webp differdiff --git a/site/pandemic-shorts/img/ep2-coffins.webp b/site/pandemic-shorts/img/ep2-coffins.webpnew file mode 100644index 0000000..d77b259Binary files /dev/null and b/site/pandemic-shorts/img/ep2-coffins.webp differdiff --git a/site/pandemic-shorts/img/ep2-convoy.webp b/site/pandemic-shorts/img/ep2-convoy.webpnew file mode 100644index 0000000..296758aBinary files /dev/null and b/site/pandemic-shorts/img/ep2-convoy.webp differdiff --git a/site/pandemic-shorts/img/ep2-departures.webp b/site/pandemic-shorts/img/ep2-departures.webpnew file mode 100644index 0000000..7fac709Binary files /dev/null and b/site/pandemic-shorts/img/ep2-departures.webp differ