Skip to content

A toolbox of film styles made in code for Claude Code: 66 ready to use, and your own. Each style is a style prompt plus a demo film made entirely in code by Claude Opus 5.5, with no video model. By Lemomo. · 一套用代码做片的风格工具箱:66 种现成风格,也能做出你自己的

Isometric Picture Book: a clean isometric world where the order things move in explains the idea, with narration and bilingual subtitles

lemomo-ai54732b9b6157
diff --git a/styles/isometric-picture-book/DEMO.md b/styles/isometric-picture-book/DEMO.md
new file mode 100644
index 0000000..d71a68c
--- /dev/null
+++ b/styles/isometric-picture-book/DEMO.md
@@ -0,0 +1,79 @@
+# Isometric Picture Book — our demo
+
+One example among many. Don't reuse its story, arc, shots, props or timings.
+
+Demo: *Seventy-Two Seats* 《七十二个座位》 (59.8 s, Chinese narration, bilingual subtitles) · `isometric-picture-book.mp4` · `isometric-picture-book.srt` · source in [`demo/`](demo/)
+
+## Story & structure
+
+Boarding a plane always takes ages, even when rows are called in order. The film shows why (one aisle: one person stopping to stow a bag stops everyone behind, and everyone called is heading for the same few rows), then a different order (window seats first, each person one row apart from the next in line) in which six people stow bags at once, and the cabin fills in nearly half the time.
+
+The two orders and both times come from a real test: Steffen & Hotchkiss (2012), a 12-row, six-abreast mock cabin with one 21-inch aisle and 72 passengers; back rows first in blocks took 6:54, window first and every other row 3:36 (sources and quotes in [`demo/FACTS.md`](demo/FACTS.md)). Gate B12, the aircraft and its livery are fictional; no airline appears.
+
+Arc: the question (why so long?) → the usual answer (back rows first) → why it jams (one aisle; one person stops, all wait; everyone heads for the same stretch) → 6:54 → what if the order changes? → window first, one row apart → six at once → 3:36 → the two times side by side → the real test and its 72 passengers → the answer: not crowds, one stretch of aisle → sign-off.
+
+Native moves spent: floor type (title, key words, numbers, sign-off); domino stand-up; lid off (twice); order lighting; order arrows; weave fill; bars on the ground; people as the sample; the jammed stretch lit as "stand here".
+
+## Shots
+
+30 fps, one shot per narration line; times are film times.
+
+| # | Time | Shot | Native move / note |
+|---|---|---|---|
+| 1 | 0.0–3.4 | apron: the aircraft rolls onto stand B12 from frame 0, the jet bridge docks; 七十二个座位 / SEVENTY-TWO SEATS lands on the stand; a baggage train in the background | title as floor type |
+| 2 | 3.4–8.6 | tilt down through the glass to the gate; the 9–12 排 sign lights; the front row of chairs stands up one by one and files into lane 1; 后排先上 | domino stand-up |
+| 3 | 8.6–12.0 | at the aircraft door the roof flips open on its far hinge, paper side up; the camera rises over 12 empty rows; a light runs down the aisle; 只有一条过道 | **signature 1**: lid off |
+| 4 | 12.0–16.3 | one whole incident in frame: a passenger (persimmon marker) lifts a case up onto the open bin, the line behind stops; 一人停 后面全等 | |
+| 5 | 16.3–21.8 | the whole cabin: rows 9–12 tinted, everyone called heads for that stretch and the line stalls back into the bridge; 挤在同一处 | |
+| 6 | 21.8–25.0 | time-lapse fill (rows 9–12, then 1–4, then 5–8); the timer stops red on 6:54; 6:54 全部坐满 | number held ≥ 2.5 s |
+| 7 | 25.0–27.6 | rewind empties the cabin; the new order lights seat by seat, window first and every other row; 换个顺序 | order lighting |
+| 8 | 27.6–31.8 | the gate: one straight line on numbered squares 12A 10A 8A 6A 4A 2A; 靠窗先上 / 隔开一排 | |
+| 9 | 31.8–38.5 | the lid flips open again; six people walk in, stop at every other row at once, lift six cases onto six bins, sit; then the remaining waves fill as a time-lapse, arrows branching into each group of rows; 六排同时放 | **signature 2**: weave fill |
+| 10 | 38.5–41.6 | the full cabin, same framing as shot 6; the timer on 3:36; 3:36 全部坐满 | number held ≥ 2.5 s |
+| 11 | 41.6–46.6 | pull out to the apron (0.55 s, the bars already drawing): 6:54 long in ink, 3:36 short in persimmon, each with a small cabin icon; held still 2.5 s, then a dashed bracket marks the time saved | **signature 3**: bars on the ground |
+| 12 | 46.6–51.6 | the bars fade as the camera pans: 72 passengers appear on the concrete in the cabin's own 12 × (3 + 3) layout; 2012 · 72 名乘客 | people as the sample |
+| 13 | 51.6–56.7 | back in the jammed cabin: the stretch of aisle where everyone waits is lit persimmon; 同一段过道 | callback |
+| 14 | 56.7–59.8 | the stand: LemoLab × Claude Opus 5.5 lands on the concrete and holds | end card |
+
+## Narration
+
+Thirteen lines, each starting with its shot (the start times below); the subtitle shows the same line, Chinese above and English below.
+
+| Line | Start (s) | 中文 | English |
+|---|---|---|---|
+| V01 | 0.45 | 每次登机,为什么总要排那么久? | Why does boarding always take so long? |
+| V02 | 3.70 | 让后排乘客先上,听起来很合理,后排坐好了,就不会挡着前排的路。 | Back rows first sounds sensible: once they sit down, they are out of everyone’s way. |
+| V03 | 8.78 | 可机舱里只有一条过道,窄得只够一个人走。 | But the cabin has one aisle, just wide enough for one person. |
+| V04 | 12.21 | 只要前面有一个人停下来放箱子,后面所有人都得干等着。 | When one person stops to stow a bag, everyone behind has to wait. |
+| V05 | 16.47 | 因为叫的都是相邻那几排,大家全挤在同一个地方,只能一个接一个来。 | They were called for the same few rows, so they crowd one spot and go one by one. |
+| V06 | 21.99 | 全部坐满,足足用了六分五十四秒。 | Filling every seat took a full 6 minutes 54 seconds. |
+| V07 | 25.34 | 那如果换个顺序呢? | What if we change the order? |
+| V08 | 27.79 | 让靠窗的人先上,而且前后两个人之间,刚好隔开一排。 | Window seats first, and each person sits one row apart from the next in line. |
+| V09 | 31.97 | 这样一来,六个人就能同时在六个不同的排数放箱子,谁也不挡谁的路。 | Now six people stow bags in six different rows at once, and nobody blocks anybody. |
+| V10 | 38.73 | 结果全部坐满,只花了三分三十六秒。 | Every seat was filled in just 3 minutes 36 seconds. |
+| V11 | 42.32 | 足足快了三分多钟,时间缩短了将近一半。 | More than three minutes faster: nearly half the time. |
+| V12 | 47.07 | 这是2012年,研究人员找来七十二名乘客做过的真实测试。 | This was a real test, run in 2012 with 72 passengers. |
+| V13 | 51.85 | 原来登机慢,根本不是因为人多,而是把所有人都堵在了同一段过道上。 | Boarding is slow not because of crowds, but because everyone is stuck in the same stretch of aisle. |
+
+- Chinese (the library film): edge-tts `zh-CN-XiaoxiaoNeural`, rate +25 %. The line lengths are written into `VO_DUR` in `film.js`, which builds the 14 shots from them.
+- English (`build.sh en`): edge-tts `en-US-AvaNeural`, rate +10 % (V02 and V08 at +25 %, V06 at +20 % to fit their shots), each line starting with its Chinese line; same picture, score and subtitles.
+- Spoken-only spellings (`say`, the subtitle text is unchanged): V05 has short pauses so 相邻 and 全挤 are clear; V12 reads the year as 二零一二年 (English: "twenty twelve"); English V02 has two short pauses. Speech check: `asr_check.py` with the medium Whisper models; `asr` fields give Whisper's spelling where it writes digits (6分54秒, 3分36秒, 2012, 72) and where it hears 全挤 as the near-homophone 拳击.
+
+## Score structure
+
+100 BPM, F major, under the voice. Opening F → B♭; the gate a pizzicato walk under the line; a harp sweep as the lid opens; a stuck pizzicato stab and a held cello D while the line waits; piano sixteenths for the time-lapse and a low Dm on 6:54; one second of score backwards for the rewind and a glockenspiel run as the seats light; a rising vibraphone F A C F at the second gate; one six-note vibraphone chord per wave in the weave with pizzicato and shaker under it; F with glockenspiel on 3:36; B♭ → Gm under the bars and C on the bracket; F/A under the 72 passengers, Dm under the callback, a long F under the sign-off. A soft cello root sustains under every shot and overlaps each cut. The music ducks 16 dB under the narration and lifts between lines. Mix: −16.0 LUFS integrated, true peak −2.1 dBFS before mux (English: −16.0 / −2.3).
+
+## Palette & props
+
+Palette as in STYLE.md §3 (paper, concrete, carpet, ink, persimmon accent, subject green, ginger markings). Props: a fictional rear-engined regional jet with a T-tail, white with two green bands; 12 rows of 3 + 3 green seats with cream headrest covers and low backs; overhead bins on the cut rims, one per row on the near side; a 7.5 m jet bridge with a glazed far wall and a low near wall; a gate with three painted lanes, group signs, a podium and three rows of pale green chairs; a baggage train on the service road; two time bars and a cabin-shaped formation of 72 people on the apron. People: 72, four tops, each with a rolling case.
+
+## End card
+
+On the stand, "LemoLab × Claude Opus 5.5" lands word by word in the floor-type serif and holds 3 s, fully inside the frame. The "LemoLab × Claude Opus 5.5" sign-off belongs to this library's demo only; a user's film carries no LemoLab credit and no copy of this card.
+
+## Build notes
+
+- `sh styles/isometric-picture-book/demo/build.sh` (Chinese, `isometric-picture-book.mp4`) or `build.sh en` (`isometric-picture-book-en.mp4`, reusing the rendered picture): fonts (downloaded from google/fonts, Noto Serif SC subset by `tools/subset.py`) → sample packs → narration (edge-tts, online) + speech check → `tools/vo_lengths.py` (the Chinese voice must still match `VO_DUR`) → events → `audio.py` (narration, score, foley, ducking, loudness) → picture → master → readcheck → `tools/srt.py` (bilingual .srt) → poster and gallery still.
+- Files: `engine.js`, `kit.js` (style kit, two-line subtitles), `plane.js`, `places.js`, `film.js` (timeline from the narration, queue simulation, 14 shot functions, `texts()`, `events()`), `main.js` / `index.html`, `audio.py`, `lines.json` / `lines_en.json`, `FACTS.md`, `tools/`.
+- Checks: readcheck passes on all world text (the subtitle cues follow the narration and go to the .srt); `tools/motion_check.mjs` reports no jumps, no stop-start stepping and no two standing people closer than 0.35 m. Render ≈ 30–60 ms per 1080p frame.
+- Demo-prop notes: the terminal glass is cut to a parapet in every shot that looks past it; type beside the fuselage stays between the jet bridge and the wing (single line, scaled down where needed); the verdict bars sit far enough ahead of the nose that the nose never covers the cabin icons; the gate's seat numbers and group signs show only in their own shots.
diff --git a/styles/isometric-picture-book/STYLE.md b/styles/isometric-picture-book/STYLE.md
new file mode 100644
index 0000000..fd8caf9
--- /dev/null
+++ b/styles/isometric-picture-book/STYLE.md
@@ -0,0 +1,112 @@
+# Isometric Picture Book — Style Prompt
+
+> A calm explainer of an everyday rule, set in one real place drawn in true isometric with flat colour: small faceless people seen from behind do the thing in order, while serif type lands on the ground, character by character, as if painted there. Whatever hides the action (a roof, a wall) is cut away or lifts off like a paper flap. The order of movement is the explanation.
+> References (grammar only): isometric explainers about public manners (queues, platforms, crossings) and picture-book cutaways where a roof or a wall is lifted away to show the inside. Take the calm pacing, people as the diagram and type on the floor; never copy their characters, layouts, typefaces or music.
+
+## 1. Essence, and what it is not
+
+- **One real place, full bleed.** A platform, a gate, a cabin, a crossing, a counter: the ground runs off every edge of the frame. No floating board, no frame line, no vignette.
+- **People are the diagram.** Slim figures seen from behind, no faces and no hands, move only when the rule says so. Who moves first, who waits, who sits is the information.
+- **Type lies on the ground.** Each idea is one key word or number painted on the floor, big and small sizes, one accent character, landing one character at a time.
+- **The cut-away.** Whatever stands between the camera and the action (a roof, a canopy, the top of a wall, a glass façade) is cut low or lifts off like a paper flap, so the camera always looks into the place from above.
+- **Clean, always.** One place, one action, one phrase per beat. Large calm areas of ground around the type, people in tidy lines and rows, few props, every object instantly recognisable. A frame that needs a second look to find its subject is wrong.
+
+Not **Isometric Infographic**: that style builds a model on a floating board over a dot lattice and labels it with sans-serif pins, icon statistics and inset bubbles to trace a process; here there is no board edge, no pins and no icons: the place is real and full bleed, the labels are serif words lying on its floor, and the explanation is people obeying a rule. Not **Low-poly Isometric Island**: no lighting, no faceted terrain, no shadows or glow; solids are flat three-tone paper colours and the ground is a printed plane. Not a cartoon (no expressions, no gags), not a slide (no headers, no centred titles, no cards).
+
+## 2. Materials & rendering
+
+- True isometric (axes at 30°), Canvas 2D, painter's sort. Every solid and every person is sorted by its **floor footprint** (x + y at floor level), never by the centre of its box: a seat back sorted by its centre height ends up drawn over the passenger sitting behind it.
+- Solids are flat-shaded in **three tones per colour**: top lifted toward warm paper, +y face the base colour, +x face dropped toward a warm umber. Curved bodies (a fuselage, a column) are faceted and quantised to the same tones plus one in-between, so they read as round without gradients. No outlines on solids, no shadows, no textures.
+- Ground surfaces carry only their functional markings (painted lanes, chevrons, lead-in lines, stop bars, seat squares) and a faint tile or slab grid.
+- **Cut-aways** are part of the model: the near wall is cut low and the far wall keeps its windows; a lid is its own solid with a paper-coloured underside, hinged on the far edge so it opens away from the camera; glass is a pale tint with thin mullions and is cut to a parapet whenever it would stand between the camera and type or people.
+- **People** are billboards anchored at their feet, about 1.6–1.8 m tall: a round hair-dark head with a sliver of skin at the ear, a two-tone torso, separate trouser legs, dark shoes, optional long hair or skirt, a rolling case. Seated people show only shoulders and the back of the head above a low seat back. Walking scissors the legs along the screen; arms counter-swing.
+- Bodies obey space: people never pass through seats, walls or each other; a queue keeps about 0.75 m between feet; someone sitting down first steps back into the row's legroom, walks sideways to the seat and sits (never sinking into or floating above it); a lifted case travels up over the open bin and is lowered in, never into a wall or a seat.
+- Everything is a function of time. A crowd that queues is simulated once at load (deterministic) and **sampled with interpolation**, so replaying it slowed down still moves every frame.
+
+## 3. Colour logic
+
+- A warm paper neutral for every ground (outdoor concrete a touch cooler, indoor carpet a touch warmer), one dark ink, **one accent reserved for the rule** (the key character, the "stand here" outline, arrows, a lit sign, the winning number, a stretch of floor that matters), one **subject hue** carried by the place itself (seats, livery bands, chairs in a paler tint, sign trim), one marking colour (lead-in lines, a tug, a baggage tractor). People wear four muted tops, so a filled room reads as an even four-colour weave.
+- The accent never decorates; it appears only where the rule is.
+- Shade toward warm umber and paper, never toward grey or violet: dirty shadows are the fastest way to lose this look.
+- Example palette: paper #F1E8D8, concrete #EAE2D3, carpet #F2E5CE, ink #2A2E29, accent persimmon #D0573A, subject green #3D6B59 / #A7C2B2, marking ginger #E2AE3A; tops ochre, fog blue, grey violet, oat.
+
+## 4. Type & subtitles
+
+- Chinese: a serif (Noto Serif SC, 700 for keywords, 500 for particles); Latin and numerals: a book serif (Newsreader). Open-licence fonts only, subset to the characters used.
+- **Floor type**: big ≈ 1.5 m on the ground, small ≈ 0.8 m; read along the up-right axis. One phrase per beat; one line where the frame is tight. One accent character or number per phrase, never a single thin stroke (一 in the accent reads as a line, not a character). Characters land ≈ 0.14 s apart: fade and scale 1.22 → 1, pale ghost → ink. A painted title or a pair of numbers may scale up to ×1.6.
+- Type sits on clear ground: nothing stands on it, nothing raised stands in front of it (see §9), at least 5 % from every frame edge, and clear of the subtitle bar.
+- Signs in the world (gate signs, group signs, screens) face the camera side of the room at the iso angle, never a flat card facing the lens.
+- Reading time: every piece of world text stays fully in frame ≥ CJK/4.5 + Latin/15 + 1.5 s.
+
+### Narration & subtitles
+
+When the film tells something, a narrator says it and the picture shows it at the same moment: one line per action or shot, each line starting as its action starts. A calm, quick reader in the film's language; the floor carries only that line's key word or number, never the sentence. Subtitles: one cue per narration line on a pale bar in the lower safe area, one Chinese line above (≈ 34 px) and one English line below (≈ 25 px, a translation of the whole sentence), switched hard, never two cues on screen. Numbers the viewer must remember: at most three, each said with what it compares to, and held on screen ≥ 2.5 s.
+
+## 5. Motion quality
+
+- People move only when the rule says so, in order; the order is the point. Walk ≈ 1.5 m/s; nobody moves faster than about 3 m/s on screen, even in a time-lapse: when a process must be compressed, show it as places filling (people settling into their seats) rather than people zipping past.
+- Everything eases; nothing pops. A beat = one floor phrase + one diagram mark (an outline traced, an arrow grown ahead of the walkers, a light run along a path) + one action.
+- A rewind runs the same motion backwards, faster, with a counter running down.
+
+## 6. Camera grammar
+
+| Move | What it expresses | Can serve |
+|---|---|---|
+| slow drift and push (≈ 6–8 % zoom) | calm attention on one rule | a call, a waiting room, a hold to read |
+| follow the head of a line | the order of things | a corridor, a boarding, a procession |
+| rise to wide while a lid opens | revealing a space whole | an interior, a capacity, a grid of places |
+| locked frame | judging, reading | a verdict, a comparison, the last frame |
+| step back to frame one whole incident | cause and effect in one view | one person blocking, one door jamming |
+| tilt down from outside to the people | arrival, cause → people | an opening, a change of place |
+| scale jump (room → building → site) | the result in context | a verdict, an ending |
+
+The angle never changes (iso is fixed); camera moves are translation and zoom. Every move is motivated by the action, and text and subject stay inside the frame at both ends of it. Transitions: a continuous move, a lid opening, a run back along the same path, or a cut on the beat at the same angle. No page turns, wipes, black or blank frames; a pull-out shows its next subject (a mark being drawn) within half a second.
+
+## 7. Sound palette
+
+Soft upright piano and vibraphone; a vibraphone note per landing character (keywords louder, the accent doubled on glockenspiel); pizzicato and shaker when people walk. Repeated actions become rhythm: a stuck queue is broken pizzicato stabs, an orderly one is one chord per group. Quiet place beds (hall air, cabin air, distant engines) and a sustained low string root overlap every cut so no scene change drops out; functional sounds of the place (a home-made chime, wheels on carpet and on metal, bin lids, a tug). A rewind plays the last second of music backwards. With narration, the music ducks about 16 dB under the voice and lifts between lines; mix ≈ −16 LUFS before mux, true peak under −1.5 dBFS.
+
+## 8. Native moves
+
+- **Floor type.** The key word lands on the ground beside the action. *Fits content like:* a hospital triage rule; a polling-station step; a library's quiet zone.
+- **Domino stand-up.** The group called sits together and rises one by one from the near end into a painted lane. *Fits content like:* an exam hall emptying by row; a ferry deck released lane by lane; a classroom drill.
+- **Lid off.** A roof flips open on its far hinge, paper side up, and glides away; the camera rises to see the whole inside. *Fits content like:* a bus at a depot; a lecture hall; a container being packed.
+- **Order lighting.** Places light up one by one in the order they will be used, before anyone moves. *Fits content like:* seat assignments; a parking plan; a vaccination queue by number.
+- **Order arrows.** A flat accent arrow grows ahead of the walkers and branches where each one turns. *Fits content like:* escalator lanes; recycling bins by type; a one-way museum route.
+- **Weave fill.** Places fill in a pattern (every other, window first) so the room becomes a woven grid in four colours. *Fits content like:* a stadium by sections; a cinema with assigned seats; a car park by level.
+- **Bars on the ground.** Two quantities painted as strips on the floor in proportion, the difference marked by a dashed bracket after a still hold. *Fits content like:* two queue times; two routes' lengths; before and after a change.
+- **People as the sample.** The people of a study stand on the ground in the shape of the thing they tested. *Fits content like:* a 72-person boarding test; a class of 30 in their desk plan; a jury in their box.
+- **Stand here.** An accent outline or a lit stretch of floor marks the spot that matters. *Fits content like:* where to wait for a lift; the jammed stretch of an aisle; the right queue at a counter.
+
+## 9. Pitfalls of the medium
+
+- Anything raised by h metres covers the ground h metres up-left of it on screen: a glass wall, a raised walkway, a nose cone or a wing hides type that is metres away. Keep type on the side of the place away from tall objects, or cut those objects down.
+- A crowd folded into a serpentine reads as a solid block; one straight line reads as order. Numbers on the floor beside each person need spacing wide enough for the label (about 1 m).
+- People walking toward the camera show a back view that looks wrong; route walks up-left, up-right or across.
+- Seated people disappear behind high seat backs: keep backs low enough that shoulders show.
+- Sorting boxes by their centre and people by their feet puts furniture over people (see §2).
+- A simulated crowd sampled by rounding to frames steps on and off when replayed slowly; interpolate. Compressing a long process by moving people faster than ~6 m/s (0.2 m per frame) reads as teleporting.
+- A camera move can drag a sign or a word across the frame edge, and background details (a far sign, a row of labels) can appear half-cut at the edge of another shot: anything meant to be read needs both ends of the move checked, and background text belongs only to its own shot.
+- Check a crowd film frame by frame, not by eye: `demo/tools/motion_check.mjs` renders every frame at 30 fps and lists jumps, stop-start stepping and people standing closer than a body width, from positions the film reports through a one-line hook (documented in the tool).
+
+## 10. Engine
+
+- `demo/engine.js` (from iso-infographic): `Iso` with `P()`, queued `box/prism/cyl/bill` (use `bias` to sort solids by their floor footprint) and immediate `boxNow/prismNow/cylNow`.
+- `demo/kit.js`: palette, warm three-tone `tri()`, `facet()` (flat-toned polygon by normal), `onPlane()` (draw in metres on a floor or wall plane), `phraseLayout()` / `floorType()` / `phraseBox()` (floor type and its reading box), `drawPerson()` (walk, case, lift), `drawSeated()`, `subtitles()` (two-line cues, hard switch).
+- `demo/plane.js`: an extruded and lofted fuselage, the cut-away cabin (`cabinBack`, `cabinFront`), the hinged flap (`lid`, `lidMap`), wings, a rear-engined T-tail, a jet bridge and a tug.
+- `demo/places.js`: apron markings, a gate with a glass wall whose height can drop to a parapet (`gateWindow`), painted lanes, group signs, chairs, a line of numbered squares, a baggage train.
+- `demo/film.js`: a timeline built from narration line lengths, a deterministic queue simulation (blocking, stow, sit) sampled with interpolation, `seatIn()` and `stowState()` for sitting and stowing, shot functions, `texts()` for readcheck.
+- `demo/tools/motion_check.mjs`: the crowd check above.
+- Minimal example, not in the demo: a lift lobby with two painted lanes, `floorType()` with 先下后上 on the floor, people billboards stepping out of a box car before the waiting line steps in.
+
+## 11. Variation space
+
+The agent decides the place, its cut-aways, the cast size, the rules and their order, the narration, the camera path, the pacing and the palette within the colour logic.
+
+- Structures: one rule shown right once; the same group doing it two ways and compared (rewind between); a day in one place as five small rules.
+- Openings: the place empty, then people arrive; the title painted on the ground as the first person walks over it; a tilt down from the building to the room.
+- Endings: the place empty again with the rule left on the floor; a scale jump out to the building; the last person stepping onto the outlined spot.
+
+---
+
+How our demo was made (story, shots, narration, score, end card, build): [DEMO.md](DEMO.md). Read it after your treatment exists.
diff --git a/styles/isometric-picture-book/demo/CREDITS b/styles/isometric-picture-book/demo/CREDITS
new file mode 100644
index 0000000..c2e367f
--- /dev/null
+++ b/styles/isometric-picture-book/demo/CREDITS
@@ -0,0 +1,30 @@
+Seventy-Two Seats (七十二个座位) — Isometric Picture Book (Lemo-Opuscar) · LemoLab × Claude Opus 5.5
+
+IMAGES, FOOTAGE, MODELS
+- None. The apron, terminal, jet bridge, aircraft, cabin, people and every mark are drawn in code (engine.js, kit.js,
+ plane.js, places.js, film.js). No photographs, no scans, no AI-generated images, no 3D models.
+- engine.js is the iso engine of the library's Isometric Infographic demo (MIT License, Copyright (c) 2026 LemoLab).
+
+FONTS (SIL Open Font License 1.1, licence texts in fonts/; not in git, build.sh downloads them from github.com/google/fonts)
+- Noto Serif SC (variable, NotoSerifSC[wght].ttf) — Google / Adobe (Chinese type and subtitles), subset by tools/subset.py
+ to the characters the film uses (fonts/NotoSerifSC-sub.ttf)
+ fonts/OFL-NotoSerifSC.txt
+- Newsreader (variable, Newsreader[opsz,wght].ttf) — Production Type (Latin type, numbers, English subtitles)
+ fonts/OFL-Newsreader.txt
+
+NARRATION
+- Text written for this film (lines.json, lines_en.json). Voices synthesised with Microsoft edge-tts
+ (zh-CN-XiaoxiaoNeural; en-US-AvaNeural for the English version), an online service: check Microsoft's terms before
+ commercial use. build.sh generates them; the audio is not in git.
+
+MUSIC & SOUND
+- Original score and sound design written for this film in audio.py: sampled instruments played through the library's
+ core/audio/sampler.py (upright piano, grand piano, vibraphone, glockenspiel, harp, cellos, contrabass pizzicato,
+ violins pizzicato, shaker) and synthesis through core/audio/sfx.py (jet whine, brakes, chime, wheels, bin lids,
+ paper flap, clock ticks, tug, beds of air).
+- Piano: "Salamander Grand Piano V3" by Alexander Holm, licensed under CC BY 3.0 (https://creativecommons.org/licenses/by/3.0/).
+- Samples (CC0): VS Chamber Orchestra: Community Edition (Versilian Studios), Versilian Community Sample Library
+ (Versilian Studios). Downloaded with sh tools/fetch.sh instruments vsco2ce | vcsl | salamander.
+
+FACTS
+- Steffen & Hotchkiss (2012), Journal of Air Transport Management 18(1): 64–67. Every number in the film: FACTS.md.
diff --git a/styles/isometric-picture-book/demo/FACTS.md b/styles/isometric-picture-book/demo/FACTS.md
new file mode 100644
index 0000000..8c5d4a3
--- /dev/null
+++ b/styles/isometric-picture-book/demo/FACTS.md
@@ -0,0 +1,17 @@
+# Facts in Seventy-Two Seats (七十二个座位)
+
+Source: Jason H. Steffen and Jon Hotchkiss (2012), *Experimental test of airplane boarding methods*, Journal of Air Transport Management 18(1): 64–67, doi:10.1016/j.jairtraman.2011.10.003. Preprint: https://arxiv.org/abs/1108.5211 (HTML: https://ar5iv.labs.arxiv.org/html/1108.5211).
+
+| In the film | Claim | Quoted wording |
+|---|---|---|
+| 12 rows of 3 + 3 seats, one aisle; 72 passengers (the cabin, the formation of 72 on the apron) | the test cabin and its cast | "The narrow-body mock airplane was used which had 12 rows of six seats with a single, central aisle." · "We employed 72 passengers—volunteers and hollywood extras." |
+| 只有一条过道 · 可机舱里只有一条过道,窄得只够一个人走 | one aisle, 21 in (53 cm) wide; rows 32 in (0.81 m) apart, the row spacing used in the drawing | "Rows of seats are spaced 32” and the aisle was 21” wide." |
+| 后排先上; the gate signs 9–12 排, 1–4 排, 5–8 排; 叫的都是相邻那几排 | the block method: four rows per group, back block first, then front, then middle | "The block method divided the 12 rows into three groups of four rows." · "The back four rows were the first group, followed by the front four rows, and finishing with the center four rows." |
+| 6:54 · 全部坐满,足足用了六分五十四秒 | the block method's official time | Table 1, Block, Official: 6:54 |
+| 靠窗先上 / 隔开一排 · 让靠窗的人先上,而且前后两个人之间,刚好隔开一排; squares 12A 10A 8A 6A 4A 2A … | the Steffen order: window seats first, and people next to each other in line sit two rows apart in corresponding seats (one row between them) | "Adjacent passengers in line are sitting two rows apart from each other in corresponding seats" (the paper's example runs 12F, 10F, 8F, 6F, 4F, 2F; the film starts on the A side, the same pattern) |
+| 六个人就能同时在六个不同的排数放箱子 | with that order, the people of one group stow their bags in different rows at the same time | "naturally allowing multiple passengers to stow their luggage simultaneously" · "The separation between adjacent passengers provides some space for each passenger to manipulate their luggage into the bins." |
+| 3:36 · 结果全部坐满,只花了三分三十六秒 | the Steffen order's official time | Table 1, Steffen, Official: 3:36 |
+| 足足快了三分多钟,时间缩短了将近一半; the two bars and the dashed bracket | 414 s − 216 s = 198 s (3 min 18 s); 216 / 414 = 52 %, so 48 % shorter: "nearly half" | arithmetic on the two official times |
+| 2012 · 72 名乘客 · 这是2012年,研究人员找来七十二名乘客做过的真实测试 | the year and the cast of the test | published 2012; "We employed 72 passengers" |
+
+Fictional, and not claimed as fact: gate B12 and the 07:10 on its screen, the aircraft, its livery, the terminal, the baggage train. The test was run in a studio mock-up; the film places the same cabin at a made-up gate. No airline name or mark appears. The clock readings during the first boarding before 6:54 illustrate the run and are not measured values; the two compared times are the paper's.
diff --git a/styles/isometric-picture-book/demo/audio.py b/styles/isometric-picture-book/demo/audio.py
new file mode 100644
index 0000000..7cad596
--- /dev/null
+++ b/styles/isometric-picture-book/demo/audio.py
@@ -0,0 +1,169 @@
+# Narration + score + foley for 七十二个座位. Run from the library root (build.sh does):
+# .venv/bin/python <demo>/audio.py <demo> Chinese: out/vo_zh → mix.wav
+# .venv/bin/python <demo>/audio.py <demo> --vo out/vo_en --out mix_en.wav English narration, same score and foley
+# The narration sits on top; the music ducks about 16 dB under it and comes back up in the gaps; foley stays but never covers the voice.
+import sys, os, json, subprocess, re
+import numpy as np, soundfile as sf
+from scipy.signal import resample_poly
+sys.path.insert(0, '.')
+from core.audio import sampler as S
+from core.audio.sfx import SR, add, limit, lp, hp, bp, noise, brown, t_, env_exp, click, clack, thump, whoosh
+
+P = sys.argv[1]
+ARG = lambda k, d: sys.argv[sys.argv.index(k) + 1] if k in sys.argv else d
+VODIR, OUT = ARG('--vo', 'out/vo_zh'), ARG('--out', 'mix.wav')
+EV = json.load(open(os.path.join(P, 'events.json')))['ev']
+TL = next(e for e in EV if e['type'] == 'timeline'); T, SH = TL['T'], TL['S']
+DUR = T['DUR']; N = int(round(DUR * SR))
+S.seed(11)
+ev = lambda kind: [e for e in EV if e['type'] == kind]
+sh = lambda i: SH[i - 1]
+
+# ---------------- narration ----------------
+vo = np.zeros(N, np.float32); VLEN = {}
+for e in ev('vo'):
+ x, sr = sf.read(os.path.join(P, VODIR, e['id'] + '.wav'), dtype='float32')
+ if sr != SR: x = resample_poly(x, SR, sr).astype(np.float32)
+ VLEN[e['id']] = len(x) / SR
+ a = int(e['t'] * SR); b = min(N, a + len(x)); vo[a:b] += x[:b - a]
+# a gentle presence lift and a soft compressor so every line sits at the same level
+vo = vo + .25 * hp(vo, 2500); vo /= np.abs(vo).max() + 1e-9
+# ducking envelope: 1 where the voice speaks (with .12 s attack, .45 s release)
+act = np.zeros(N, np.float32)
+for e in ev('vo'): act[int(max(0, e['t'] - .12) * SR):int(min(DUR, e['t'] + VLEN[e['id']] + .05) * SR)] = 1
+k = int(.45 * SR); ker = np.ones(k) / k; duck = np.convolve(act, ker, 'same').clip(0, 1)
+music_gain = 10 ** (-16 * duck / 20)
+
+# ---------------- score ----------------
+sc = []
+def n(t, inst, p, d, v, pan=0, g=1): sc.append((t, inst, p, d, v, pan, g))
+def chord(t, ps, d, v, inst='upright', pan=.1, strum=.04):
+ for i, p in enumerate(ps): n(t + i * strum, inst, p, d, v, pan)
+CH = {'F': (['F2', 'C3'], ['A3', 'C4', 'F4', 'G4']), 'Bb': (['Bb1', 'F2'], ['A3', 'D4', 'F4']), 'FA': (['A2', 'F3'], ['C4', 'F4', 'A4']),
+ 'Dm': (['D2', 'A2'], ['F3', 'A3', 'C4', 'E4']), 'C': (['C2', 'G2'], ['E3', 'G3', 'C4', 'D4']), 'Gm': (['G2', 'D3'], ['F3', 'Bb3', 'D4'])}
+def bar(t, name, d, v=.36):
+ b, u = CH[name]; chord(t, b, d, v + .06, pan=-.1, strum=0); chord(t + .02, u, d, v)
+B = .6
+bar(0, 'F', 3.4, .36); bar(sh(2)[0], 'Bb', 2.6, .32); bar(sh(2)[0] + 2.6, 'F', 2.6, .3)
+t = T['STAND0'] + .3; i = 0; walk = ['F4', 'A4', 'C5', 'A4', 'G4', 'Bb4', 'D5', 'Bb4']
+while t < sh(4)[0] - .1:
+ n(t, 'violins_pizz', walk[i % 8], .3, .3 if i % 2 else .38, -.25)
+ if i % 2 == 0: n(t, 'contrabass_pizz', ['F2', 'D2', 'Bb1', 'C2'][(i // 4) % 4], .5, .42, -.05)
+ t += B / 2; i += 1
+bar(sh(3)[0], 'C', 1.6, .3)
+for j, p in enumerate(['C4', 'D4', 'F4', 'G4', 'A4', 'C5', 'D5', 'F5']): n(T['LID0'] + .1 + j * .05, 'harp', p, 1.4, .3, .25)
+bar(T['SETTLE'], 'F', 2.4, .32)
+# 4: stuck — a pizzicato stab when the person stops, a held cello D under the wait
+n(sh(4)[0] + .5, 'violins_pizz', 'D3', .3, .5, .15); n(sh(4)[0] + .5, 'violins_pizz', 'A3', .3, .45, .15); n(sh(4)[0] + .5, 'contrabass_pizz', 'D2', .5, .5)
+n(sh(4)[0] + 1.0, 'violins_pizz', 'E3', .3, .4, .15); n(sh(4)[0], 'cellos', 'D2', sh(5)[1] - sh(4)[0], .2)
+bar(sh(5)[0], 'Dm', 2.8, .28); bar(sh(5)[0] + 2.8, 'Bb', 2.6, .28)
+t = T['FAST0']; i = 0; run = ['C4', 'D4', 'E4', 'G4', 'A4', 'C5', 'D5', 'E5']
+while t < T['FAST1'] - .05: n(t, 'piano', run[i % 8], .2, .28 + .1 * (i % 4 == 0), .2); t += B / 4; i += 1
+bar(T['FAST1'], 'Dm', 2.4, .4); n(T['FAST1'], 'cellos', 'D2', 2.6, .3)
+# 7: the new order lights up — a rising glockenspiel run across the seats
+for j in range(12): n(T['LIGHT0'] + j * .12, 'glockenspiel', ['F5', 'A5', 'C6', 'F6'][j % 4], .6, .14 + .01 * j, .3)
+bar(sh(8)[0], 'F', 2.1, .3); bar(sh(8)[0] + 2.1, 'C', 2.1, .28)
+for j, p in enumerate(['F4', 'A4', 'C5', 'F5']): n(sh(8)[0] + .05 + j * .3, 'vibraphone', p, 1.2, .3, .2)
+WV = [['F3', 'A3', 'C4', 'F4', 'A4', 'C5'], ['Bb2', 'F3', 'Bb3', 'D4', 'F4', 'A4'], ['C3', 'G3', 'C4', 'E4', 'G4', 'D5'], ['D3', 'A3', 'D4', 'F4', 'A4', 'C5'],
+ ['F3', 'C4', 'F4', 'A4', 'C5', 'E5'], ['G2', 'D3', 'G3', 'Bb3', 'D4', 'F4'], ['C3', 'G3', 'C4', 'E4', 'G4', 'C5'], ['A2', 'E3', 'A3', 'C4', 'E4', 'G4'],
+ ['Bb2', 'F3', 'Bb3', 'D4', 'F4', 'C5'], ['C3', 'G3', 'E4', 'G4', 'Bb4', 'C5'], ['D3', 'A3', 'F4', 'A4', 'C5', 'E5'], ['F3', 'C4', 'F4', 'A4', 'C5', 'F5']]
+for e in ev('wave'):
+ for j, p in enumerate(WV[e['k']]): n(e['t'], 'vibraphone', p, .8 if e['fast'] else 1.3, (.24 if e['fast'] else .3) + .02 * j, -.3 + .12 * j)
+ n(e['t'], 'contrabass_pizz', S.name(S.midi(WV[e['k']][0]) - 12), .6, .45, -.05)
+t = T['WV0'] + .3; i = 0
+while t < T['WV_END']:
+ n(t, 'violins_pizz', ['C5', 'A4', 'F4', 'A4'][i % 4], .25, .22, -.3)
+ sc.append((t, 'shaker', 'down' if i % 2 == 0 else 'up', None, .14 if i % 2 else .2, .35, 1)); t += B / 2; i += 1
+for e in ev('stop')[1:]: n(e['t'], 'glockenspiel', 'F6', 1.6, .3, .3); bar(e['t'], 'F', 3.0, .34)
+bar(sh(11)[0], 'Bb', 2.0, .28); bar(sh(11)[0] + 2.0, 'Gm', 2.4, .28)
+for e in ev('bracket'): n(e['t'], 'glockenspiel', 'C6', 1.6, .26, .3); bar(e['t'], 'C', 1.6, .3)
+bar(sh(12)[0], 'FA', 5.0, .3)
+bar(sh(13)[0], 'Dm', 5.2, .3)
+bar(sh(14)[0], 'F', DUR - sh(14)[0] + .4, .34); n(sh(14)[0], 'cellos', 'F2', DUR - sh(14)[0], .22)
+for e in ev('char'):
+ if e['p'] == 'end': n(e['t'], 'vibraphone', ['F4', 'A4', 'C5', 'F5', 'A5'][e['i'] % 5], 1.6, .34, .2); continue
+ n(e['t'], 'vibraphone', ['C5', 'A4', 'G4', 'F4', 'D5', 'C5'][e['i'] % 6], .9, .26 if e['big'] else .16, .2)
+ if e['acc']: n(e['t'], 'glockenspiel', 'C6', 1.0, .16, .25)
+# a soft sustained cello root under every shot, overlapping each cut, so no scene change drops out
+ROOT = ['F2', 'F2', 'C2', 'D2', 'D2', 'D2', 'F2', 'C2', 'F2', 'F2', 'G2', 'F2', 'D2', 'F2']
+for j, (a, b) in enumerate(SH): n(max(0, a - .15), 'cellos', ROOT[j], b - a + .6, .16, 0)
+mus = S.render(sc, dur=DUR + 3)
+mus = S.room(mus, size=.45, mix=.2)
+mus = mus[:N] if len(mus) >= N else np.pad(mus, ((0, N - len(mus)), (0, 0)))
+r0 = int(T['REW0'] * SR); rl = int(1.0 * SR) # rewind: the second before, backwards
+mus[r0:r0 + rl] = mus[r0:r0 + rl] * .3 + mus[r0 - rl:r0][::-1] * np.linspace(.4, 1, rl)[:, None]
+
+# ---------------- foley ----------------
+fx = np.zeros((N, 2), np.float32)
+def put(x, t, g=1., pan=0.): add(fx, np.asarray(x, np.float32), t, g, pan)
+def nz(x): m = np.abs(x).max(); return x / m if m > 0 else x
+def bed(t0, t1, x, g, fade=.5):
+ a, b = int(t0 * SR), min(N, int(t1 * SR)); L = b - a
+ if L <= 0: return
+ y = x[:L]; e = np.minimum(1, np.minimum(np.arange(L) / (fade * SR), (L - np.arange(L)) / (fade * SR)))
+ fx[a:b, 0] += (y * e * g).astype(np.float32); fx[a:b, 1] += (np.roll(y, 911)[:L] * e * g).astype(np.float32)
+apronbed = nz(lp(brown(DUR + 1), 300)) + .25 * nz(bp(noise(DUR + 1), 380, 460))
+hall = nz(lp(brown(DUR + 1), 900)) * .7 + .12 * nz(bp(noise(DUR + 1), 300, 2400))
+cabin = nz(bp(noise(DUR + 1), 180, 1600))
+inside = [(3, 7), (9, 11), (13, 14)] # shot ranges inside the cabin
+bed(0, sh(2)[0] + .8, apronbed, .045); bed(sh(2)[0], sh(3)[0] + .5, hall, .045)
+for a, b in inside: bed(sh(a)[0] - .3, sh(b)[1] + .3, cabin, .03)
+bed(sh(8)[0] - .3, sh(8)[1] + .3, hall, .045); bed(sh(11)[0] - .3, sh(13)[0] + .3, apronbed, .045); bed(sh(14)[0] - .3, DUR, apronbed, .045)
+d = 3.2; tt = t_(d); whine = np.sin(2 * np.pi * np.cumsum(np.linspace(3600, 2400, len(tt))) / SR) * np.exp(-tt / 1.4)
+roar = nz(lp(brown(d), 220)) * np.minimum(1, (d - tt) / 1.2)
+for j in range(8): add(fx, ((whine * .25 + roar)[j * len(tt) // 8:(j + 1) * len(tt) // 8] * .1).astype(np.float32), j * d / 8, 1, -.7 + .09 * j)
+for e in ev('brake'): put(nz(hp(noise(.5), 2600)) * env_exp(.5, .12), e['t'], .04, -.1)
+for e in ev('dock'): put(thump(.8, 60), e['t'], .16, .2)
+for e in ev('swish'): put(whoosh(.6, .7), e['t'], .04, 0)
+def chime(f1, f2):
+ d = 1.6; tt = t_(d); a = np.sin(2 * np.pi * f1 * tt) * np.exp(-tt / .5); b = np.sin(2 * np.pi * f2 * tt) * np.exp(-tt / .7)
+ return nz(a + np.pad(b, (int(.32 * SR), 0))[:len(tt)] + .2 * np.sin(2 * np.pi * 2 * f1 * tt) * np.exp(-tt / .2))
+for e in ev('chime'): put(chime(1046.5, 880), e['t'], .06, .35)
+for e in ev('sign'): put(click(1.2, .8), e['t'], .05, -.3)
+for e in ev('stand'): put(thump(.3, 140) * .6, e['t'], .02, -.35 + e['q'] * .02)
+wheels = nz(bp(noise(DUR + 1), 900, 4000)) * (1 + .3 * np.sin(2 * np.pi * 3 * t_(DUR + 1)))
+bed(T['STAND0'] + .6, sh(3)[1], wheels, .015)
+for e in ev('lid_open'): s = nz(bp(noise(.7), 800, 5000)) * np.sin(np.pi * t_(.7) / .7); put(s, e['t'], .04, -.2)
+for e in ev('lid_rest'): put(thump(.5, 90), e['t'], .05, -.3)
+for e in ev('stop_mark'): put(clack(1.0, 1), e['t'] + .1, .1, -.3)
+for e in ev('bin_slap'): put(thump(.6, 120), e['t'], .1, -.2)
+for e in ev('fast'):
+ t = e['t']; dt = .14
+ while t < T['FAST1']: put(click(1.6, .5), t, .025, .3); t += dt; dt = max(.045, dt * .9)
+def beep(f=2400, d=.18): tt = t_(d); return np.sin(2 * np.pi * f * tt) * np.minimum(1, (d - tt) / .02)
+for e in ev('stop'): put(beep(), e['t'], .04, .3)
+for e in ev('rewind'): w = nz(bp(noise(1.0), 300, 6000)) * (t_(1.0) / 1.0) ** 2; put(w, e['t'], .05, 0)
+for e in ev('wave'):
+ for j in range(6): put(click(.9 + .05 * j, .4), e['t'] + .02 * j, .02 if e['fast'] else .035, -.4 + .16 * j)
+for e in ev('bins_shut'): put(clack(1.1, 1), e['t'], .05 if e['k'] > 2 else .08, 0)
+for e in ev('seated'): put(thump(.25, 130), e['t'], .03, 0)
+for e in ev('pull'): put(whoosh(1.0, .8), e['t'], .05, 0)
+for e in ev('bar'): s = nz(bp(noise(.5), 1500, 6000)) * np.sin(np.pi * t_(.5) / .5); put(s, e['t'], .02, -.1)
+for e in ev('crowd'): [put(thump(.2, 160), e['t'] + j * .06, .015, -.3 + j * .05) for j in range(12)]
+for e in ev('band'): s = nz(bp(noise(.5), 800, 3000)) * np.sin(np.pi * t_(.5) / .5); put(s, e['t'], .02, 0)
+
+# ---------------- mix + loudness ----------------
+# set the music bus so that, ducked, it sits 16.5 dB under the voice
+m = act[:N] > 0
+vr = 20 * np.log10(np.sqrt(np.mean((vo[m] * .9) ** 2)) + 1e-9); mr0 = 20 * np.log10(np.sqrt(np.mean((mus[m] * music_gain[m, None]) ** 2)) + 1e-9)
+MG = 10 ** ((vr - 16.5 - mr0) / 20)
+music = mus * music_gain[:, None] * MG + fx * (1 - .45 * duck[:, None])
+mix = np.stack([vo, vo], 1) * .9 + music
+fade = int(.25 * SR); mix[-fade:] *= np.linspace(1, 0, fade)[:, None]
+def measure(x):
+ tmp = os.path.join(P, '.measure.wav'); sf.write(tmp, x.astype(np.float32), SR)
+ out = subprocess.run(['ffmpeg', '-hide_banner', '-nostats', '-i', tmp, '-af', 'ebur128=peak=true', '-f', 'null', '-'], capture_output=True, text=True).stderr
+ os.remove(tmp)
+ return float(re.findall(r'I:\s+(-?[\d.]+) LUFS', out)[-1]), float(re.findall(r'Peak:\s+(-?[\d.]+) dBFS', out)[-1])
+raw = mix.copy(); ceil = -2.4
+for _ in range(6):
+ I, tp = measure(raw); mix = limit(raw * 10 ** ((-16 - I) / 20), 10 ** (ceil / 20)); I, tp = measure(mix)
+ if tp <= -1.6: break
+ ceil -= .5
+mix = mix[:N].astype(np.float32)
+sf.write(os.path.join(P, OUT), mix, SR)
+# how far the music sits under the voice: RMS of music vs voice where the voice speaks
+mr = 20 * np.log10(np.sqrt(np.mean((mus[m] * music_gain[m, None] * MG) ** 2)) + 1e-9)
+w = int(.5 * SR); rms = [20 * np.log10(np.sqrt(np.mean(mix[i:i + w] ** 2)) + 1e-9) for i in range(0, N - w, w)]
+print(f'{OUT} {len(mix) / SR:.2f}s integrated {I:.1f} LUFS true peak {tp:.1f} dBFS music under voice {vr - mr:.1f} dB quietest 0.5 s {min(rms[:-1]):.1f} dBFS at {int(np.argmin(rms[:-1])) * .5:.1f}s (last window is the fade)')
+print('\n'.join(S.credits(sorted({e[1] for e in sc}))))
diff --git a/styles/isometric-picture-book/demo/build.sh b/styles/isometric-picture-book/demo/build.sh
new file mode 100644
index 0000000..e56e6df
--- /dev/null
+++ b/styles/isometric-picture-book/demo/build.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# One command: 《七十二个座位》 Seventy-Two Seats (Isometric Picture Book demo)
+# sh styles/isometric-picture-book/demo/build.sh Chinese narration (the library film): isometric-picture-book.mp4
+# sh styles/isometric-picture-book/demo/build.sh en English narration over the same picture and subtitles: isometric-picture-book-en.mp4
+# Steps: fonts, sample packs, narration (edge-tts, online) + speech check, events, score + mix, picture, master,
+# reading-time check, bilingual subtitles, poster and gallery still. Fonts, voices and mixes are not in git: this rebuilds them.
+set -e
+VO_LANG=${1:-zh}
+HERE=$(cd "$(dirname "$0")" && pwd) # .../<slug>/demo
+FILM=$(cd "$HERE/.." && pwd) # .../<slug>
+LIB=${LIB:-$(cd "$HERE/../../.." && pwd)} # styles/<slug>/demo -> library root
+export LIB
+[ -f "$LIB/core/render/video.mjs" ] || { echo "set LIB to the library folder"; exit 1; }
+PY="$LIB/.venv/bin/python"
+NAME=isometric-picture-book
+FPS=30
+FRAME=10.3 # the cabin with its roof flipped open: poster and gallery still (no subtitle)
+cd "$LIB"
+
+# fonts (OFL, gitignored): Noto Serif SC variable (subset to the characters used) and Newsreader variable
+GF=https://github.com/google/fonts/raw/main/ofl
+mkdir -p "$HERE/fonts" "$HERE/out"
+[ -f "$HERE/tools/NotoSerifSC-VF.ttf" ] || curl -sfL -o "$HERE/tools/NotoSerifSC-VF.ttf" "$GF/notoserifsc/NotoSerifSC%5Bwght%5D.ttf"
+[ -f "$HERE/fonts/Newsreader-VF.ttf" ] || curl -sfL -o "$HERE/fonts/Newsreader-VF.ttf" "$GF/newsreader/Newsreader%5Bopsz,wght%5D.ttf"
+"$PY" "$HERE/tools/subset.py" # fonts/NotoSerifSC-sub.ttf
+# sampled instruments (library packs: VSCO 2 CE and VCSL CC0, Salamander piano CC BY 3.0), fetched once per clone
+for l in vsco2ce vcsl salamander; do [ -d "core/audio/instruments/$l" ] || sh tools/fetch.sh instruments $l; done
+
+# narration: 13 lines. Chinese zh-CN-XiaoxiaoNeural +25 % (film.js VO_DUR holds these line lengths and builds the shots from them);
+# English en-US-AvaNeural +10 % (three lines faster, set per line in lines_en.json), each line starting with its Chinese line.
+if [ "$VO_LANG" = en ]; then
+ "$PY" core/tts/tts_zh.py "$HERE/lines_en.json" "$HERE/out/vo_en" --voice en-US-AvaNeural --rate +10%
+ "$PY" core/tts/asr_check.py "$HERE/lines_en.json" "$HERE/out/vo_en" --lang en --model medium.en
+else
+ "$PY" core/tts/tts_zh.py "$HERE/lines.json" "$HERE/out/vo_zh" --voice zh-CN-XiaoxiaoNeural --rate +25%
+ "$PY" core/tts/asr_check.py "$HERE/lines.json" "$HERE/out/vo_zh" --lang zh --model medium
+ "$PY" "$HERE/tools/vo_lengths.py" # the voice lengths must still match VO_DUR in film.js
+fi
+
+# events from the picture, then narration + score + effects (about -16 LUFS before the master, music 16.5 dB under the voice)
+node core/render/events.mjs "$HERE"
+if [ "$VO_LANG" = en ]; then "$PY" "$HERE/audio.py" "$HERE" --vo out/vo_en --out mix_en.wav; MIX="$HERE/mix_en.wav"; OUTF="$FILM/$NAME-en.mp4"
+else "$PY" "$HERE/audio.py" "$HERE"; MIX="$HERE/mix.wav"; OUTF="$FILM/$NAME.mp4"; fi
+
+# picture and master (mux.sh brings the mix to -14 LUFS)
+if [ "$VO_LANG" != en ] || [ ! -f "$HERE/out/video.mp4" ]; then node core/render/video.mjs "$HERE" --fps $FPS --workers 3 --out "$HERE/out/video.mp4"; fi # the English build reuses the picture
+sh core/render/mux.sh "$HERE/out/video.mp4" "$MIX" "$OUTF" $FPS 0
+
+# reading time of every word on the ground (window.TEXTS); subtitles follow the narration and go to the .srt
+node core/render/readcheck.mjs "$HERE" > "$HERE/out/readcheck.txt" && echo "readcheck ok" || { tail -20 "$HERE/out/readcheck.txt"; exit 1; }
+"$PY" "$HERE/tools/srt.py"
+
+# poster and the gallery style frame: the page itself, without the subtitle bar
+node core/render/still.mjs "$HERE" $FRAME --q nosub=1 --out "$HERE/out" --prefix sf_ >/dev/null
+mkdir -p "$HERE/stills"
+cp "$HERE/out/sf_$FRAME.jpg" "$HERE/stills/styleframe.jpg"; cp "$HERE/out/sf_$FRAME.jpg" "$FILM/poster.jpg"
+echo "done: $OUTF"
diff --git a/styles/isometric-picture-book/demo/engine.js b/styles/isometric-picture-book/demo/engine.js
new file mode 100644
index 0000000..440348f
--- /dev/null
+++ b/styles/isometric-picture-book/demo/engine.js
@@ -0,0 +1,388 @@
+// Isometric Infographic engine — Canvas 2D, true isometric (axes at 30°), flat 3-tone faces, no outlines.
+// World: x → screen down-right, y → screen down-left, z → up. Depth toward viewer = x + y + z.
+// Usage: const iso = new Iso(ctx); iso.cam = {x,y,z,k}; iso.box(...); iso.prism(...); ...; iso.flush();
+export const C30 = Math.cos(Math.PI / 6), S30 = 0.5, TAU = Math.PI * 2;
+export const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
+export const lerp = (a, b, t) => a + (b - a) * t;
+export const seg = (t, a, b) => clamp((t - a) / (b - a));
+export const ss = t => { t = clamp(t); return t * t * (3 - 2 * t); };
+export const eo = t => 1 - Math.pow(1 - clamp(t), 3);
+export const eio = t => { t = clamp(t); return t < .5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; };
+export const back = (t, s = 1.7) => { t = clamp(t) - 1; return 1 + t * t * ((s + 1) * t + s); };
+export const hash = n => { n = Math.sin(n * 127.1 + 311.7) * 43758.5453; return n - Math.floor(n); };
+
+// ---------- colour ----------
+const _rgb = {};
+export function rgb(c) {
+ if (typeof c !== 'string') return c;
+ if (_rgb[c]) return _rgb[c];
+ let h = c.replace('#', ''); if (h.length === 3) h = h.split('').map(x => x + x).join('');
+ return (_rgb[c] = [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)]);
+}
+export const css = (r, a = 1) => a >= 1 ? `rgb(${r[0] | 0},${r[1] | 0},${r[2] | 0})` : `rgba(${r[0] | 0},${r[1] | 0},${r[2] | 0},${a})`;
+export const mix = (a, b, t) => { a = rgb(a); b = rgb(b); return [lerp(a[0], b[0], t), lerp(a[1], b[1], t), lerp(a[2], b[2], t)]; };
+export const hex = r => '#' + r.map(v => Math.round(clamp(v, 0, 255)).toString(16).padStart(2, '0')).join('');
+// A "tri" is [top, left(+y face, mid), right(+x face, dark)].
+export function tri(c, lift = .2, drop = .22) { return [hex(mix(c, '#FFF7E6', lift)), hex(rgb(c)), hex(mix(c, '#231A2C', drop))]; }
+export const PAL = {
+ red: ['#CF5140', '#B3352B', '#8C2620'],
+ green: ['#7BA75F', '#5E8C4A', '#476F37'],
+ blue: ['#5A9BCB', '#3C7FB1', '#2D6390'],
+ cream: ['#FBF4E6', '#F2E6D0', '#D9C8A9'],
+ soil: ['#A77850', '#8A5B3A', '#6A432A'],
+ stone: ['#CFCABF', '#B8B2A6', '#948E83'],
+ mustard: ['#E9BE5C', '#D9A53A', '#B0832A'],
+ ink: '#2E2522', bg: '#F2E6D0', paper: '#FBF4E6',
+};
+
+// ---------- the engine ----------
+export class Iso {
+ constructor(g, W = 1920, H = 1080) {
+ this.g = g; this.W = W; this.H = H;
+ this.cam = { x: 0, y: 0, z: 0, k: 10 };
+ this.items = []; this.T = null; this.stack = [];
+ this.desat = 0; this.keep = false; this.alpha = 1; this.seq = 0;
+ this.light = [0, 0, 1];
+ }
+ // local transform: translate + rotate about z (+ uniform scale). Applies to every primitive.
+ push(ox = 0, oy = 0, oz = 0, rot = 0, s = 1) {
+ this.stack.push(this.T);
+ const p = this.T, c = Math.cos(rot), sn = Math.sin(rot);
+ this.T = { ox, oy, oz, c, s: sn, k: s, parent: p };
+ }
+ pop() { this.T = this.stack.pop(); }
+ w(x, y, z) { // local → world
+ let T = this.T;
+ while (T) { const X = (x * T.c - y * T.s) * T.k + T.ox, Y = (x * T.s + y * T.c) * T.k + T.oy; z = z * T.k + T.oz; x = X; y = Y; T = T.parent; }
+ return [x, y, z];
+ }
+ wn(nx, ny, nz) { let T = this.T; while (T) { const X = nx * T.c - ny * T.s, Y = nx * T.s + ny * T.c; nx = X; ny = Y; T = T.parent; } return [nx, ny, nz]; }
+ // world → screen
+ P(x, y, z) { const c = this.cam, k = c.k, X = x - c.x, Y = y - c.y; return [this.W / 2 + (X - Y) * C30 * k, this.H / 2 + ((X + Y) * S30 - (z - c.z)) * k]; }
+ L(x, y, z) { const [a, b, c] = this.w(x, y, z); return this.P(a, b, c); } // local → screen
+ // inverse of P on plane z
+ unP(sx, sy, z = 0) { const c = this.cam, k = c.k; const u = (sx - this.W / 2) / (C30 * k), v = (sy - this.H / 2) / k + (z - c.z); const X = v + u / 2, Y = v - u / 2; return [X + c.x, Y + c.y]; }
+ vis(x, y, z, r) { const [sx, sy] = this.P(x, y, z), R = r * this.cam.k * 1.2 + 4; return sx > -R && sx < this.W + R && sy > -R && sy < this.H + R; }
+ // ---- colour pipeline (desaturation with one-colour exception) ----
+ col(c, a = 1) {
+ let r = rgb(c);
+ if (this.desat > 0 && !this.keep) { const l = r[0] * .3 + r[1] * .55 + r[2] * .15; const gr = mix([l, l, l], '#E9DFCB', .45); r = mix(r, gr, this.desat); }
+ return css(r, a * this.alpha);
+ }
+ shadeN(t3, n) { // tri + world normal → colour
+ if (typeof t3 === 'string') return t3;
+ const wt = Math.max(n[2], 0), wl = Math.max(n[1], 0), wr = Math.max(n[0], 0), s = wt + wl + wr || 1;
+ const A = rgb(t3[0]), B = rgb(t3[1]), C = rgb(t3[2]);
+ return [(A[0] * wt + B[0] * wl + C[0] * wr) / s, (A[1] * wt + B[1] * wl + C[1] * wr) / s, (A[2] * wt + B[2] * wl + C[2] * wr) / s];
+ }
+ // ---- queue ----
+ add(depth, fn, layer = 1) { const st = { T: this.T, keep: this.keep, alpha: this.alpha }; this.items.push({ d: depth, l: layer, s: this.seq++, fn, st }); }
+ flush() {
+ const it = this.items; this.items = [];
+ it.sort((a, b) => a.l - b.l || a.d - b.d || a.s - b.s);
+ const T0 = this.T, K0 = this.keep, A0 = this.alpha;
+ for (const i of it) { this.T = i.st.T; this.keep = i.st.keep; this.alpha = i.st.alpha; i.fn(); }
+ this.T = T0; this.keep = K0; this.alpha = A0;
+ }
+ // run fn with its own sorted sub-queue (for interiors drawn between back and front walls)
+ sub(fn) { const saved = this.items; this.items = []; fn(); const mine = this.items; this.items = saved; const T0 = this.T; mine.sort((a, b) => a.l - b.l || a.d - b.d || a.s - b.s); for (const i of mine) { this.T = i.st.T; this.keep = i.st.keep; this.alpha = i.st.alpha; i.fn(); } this.T = T0; }
+ // ---- raw drawing ----
+ poly(pts, fill, a = 1) { const g = this.g; g.beginPath(); pts.forEach((p, i) => i ? g.lineTo(p[0], p[1]) : g.moveTo(p[0], p[1])); g.closePath(); g.fillStyle = typeof fill === 'string' && fill.startsWith('rgb') ? fill : this.col(fill, a); g.fill(); }
+ face3(pts3, t3, opt = {}) { // local 3D polygon, shaded by its normal; skips back faces unless opt.both
+ const W = pts3.map(p => this.w(p[0], p[1], p[2]));
+ let n = normal(W);
+ if (opt.out) { const o = this.wn(opt.out[0], opt.out[1], opt.out[2]); if (n[0] * o[0] + n[1] * o[1] + n[2] * o[2] < 0) n = [-n[0], -n[1], -n[2]]; }
+ if (!opt.both && n[0] + n[1] + n[2] <= 1e-6) return false;
+ const c = opt.color ? opt.color : this.shadeN(t3, n[0] + n[1] + n[2] < 0 ? [-n[0], -n[1], -n[2]] : n);
+ this.poly(W.map(p => this.P(p[0], p[1], p[2])), c, opt.a ?? 1); return true;
+ }
+ // ---- primitives (queued, auto depth) ----
+ box(x, y, z, w, d, h, t3, o = {}) {
+ const [cx, cy, cz] = this.w(x + w / 2, y + d / 2, z + h / 2);
+ if (o.cull !== false && !this.vis(cx, cy, cz, Math.hypot(w, d, h) * (this.T ? this.scale() : 1))) return;
+ this.add(cx + cy + cz + (o.bias || 0), () => this.boxNow(x, y, z, w, d, h, t3, o), o.layer ?? 1);
+ }
+ scale() { let k = 1, T = this.T; while (T) { k *= T.k; T = T.parent; } return k; }
+ boxNow(x, y, z, w, d, h, t3, o = {}) {
+ if (typeof t3 === 'string') t3 = tri(t3);
+ const X = x + w, Y = y + d, Z = z + h, F = [];
+ F.push([[x, y, Z], [X, y, Z], [X, Y, Z], [x, Y, Z]]); // top
+ F.push([[x, Y, z], [X, Y, z], [X, Y, Z], [x, Y, Z]]); // +y (left)
+ F.push([[X, y, z], [X, Y, z], [X, Y, Z], [X, y, Z]]); // +x (right)
+ F.push([[x, y, z], [x, y, Z], [X, y, Z], [X, y, z]]); // -y
+ F.push([[x, y, z], [x, Y, z], [x, Y, Z], [x, y, Z]]); // -x
+ // order faces far→near by their centre depth
+ const order = F.map((f, i) => { const c = f.reduce((a, p) => [a[0] + p[0] / 4, a[1] + p[1] / 4, a[2] + p[2] / 4], [0, 0, 0]); const W = this.w(c[0], c[1], c[2]); return [W[0] + W[1] + W[2], i]; }).sort((a, b) => a[0] - b[0]);
+ const OUT = [[0, 0, 1], [0, 1, 0], [1, 0, 0], [0, -1, 0], [-1, 0, 0]];
+ for (const [, i] of order) { if (o.skip && o.skip.includes(i)) continue; this.face3(F[i], t3, { color: o.faceColor?.[i], out: OUT[i] }); }
+ if (o.decal) o.decal(this, { x, y, z, w, d, h });
+ }
+ // extruded footprint polygon (local XY), from z to z+h
+ prism(pts, z, h, t3, o = {}) {
+ let cx = 0, cy = 0; pts.forEach(p => { cx += p[0] / pts.length; cy += p[1] / pts.length; });
+ const W = this.w(cx, cy, z + h / 2), r = Math.max(...pts.map(p => Math.hypot(p[0] - cx, p[1] - cy)), h) * this.scale();
+ if (o.cull !== false && !this.vis(W[0], W[1], W[2], r)) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => this.prismNow(pts, z, h, t3, o), o.layer ?? 1);
+ }
+ prismNow(pts, z, h, t3, o = {}) {
+ if (typeof t3 === 'string') t3 = tri(t3);
+ const n = pts.length, Z = z + h, sides = [];
+ let area = 0; for (let i = 0; i < n; i++) { const a = pts[i], b = pts[(i + 1) % n]; area += a[0] * b[1] - b[0] * a[1]; }
+ const sg = area >= 0 ? 1 : -1;
+ for (let i = 0; i < n; i++) { const a = pts[i], b = pts[(i + 1) % n]; const f = [[a[0], a[1], z], [b[0], b[1], z], [b[0], b[1], Z], [a[0], a[1], Z]]; const m = this.w((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, 0); sides.push([m[0] + m[1], f, [(b[1] - a[1]) * sg, -(b[0] - a[0]) * sg, 0]]); }
+ sides.sort((A, B) => A[0] - B[0]);
+ if (h > 0) for (const [, f, out] of sides) this.face3(f, t3, { color: o.sideColor, out });
+ if (o.top !== false) this.face3(pts.map(p => [p[0], p[1], Z]), t3, { both: true, color: o.topColor });
+ if (o.decal) o.decal(this);
+ }
+ // cylinder: vertical (axis 'z') or lying along 'x' / 'y'
+ cyl(x, y, z, r, h, t3, o = {}) {
+ const n = o.n || 24, axis = o.axis || 'z';
+ if (axis === 'z') { const pts = []; for (let i = 0; i < n; i++) { const a = i / n * TAU; pts.push([x + Math.cos(a) * r, y + Math.sin(a) * r]); } return this.prism(pts, z, h, t3, o); }
+ const [cx, cy, cz] = axis === 'x' ? [x + h / 2, y, z] : [x, y + h / 2, z];
+ const W = this.w(cx, cy, cz); if (o.cull !== false && !this.vis(W[0], W[1], W[2], Math.max(r, h) * this.scale())) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => this.cylNow(x, y, z, r, h, t3, o), o.layer ?? 1);
+ }
+ cylNow(x, y, z, r, h, t3, o = {}) {
+ if (typeof t3 === 'string') t3 = tri(t3);
+ const n = o.n || 24, axis = o.axis, ring = [];
+ for (let i = 0; i < n; i++) { const a = i / n * TAU + (o.spin || 0), u = Math.cos(a) * r, v = Math.sin(a) * r; ring.push(axis === 'x' ? [0, u, v] : [u, 0, v]); }
+ const off = axis === 'x' ? [h, 0, 0] : [0, h, 0], base = [x, y, z];
+ const A = ring.map(p => [p[0] + base[0], p[1] + base[1], p[2] + base[2]]), B = A.map(p => [p[0] + off[0], p[1] + off[1], p[2] + off[2]]);
+ const sides = [];
+ for (let i = 0; i < n; i++) { const j = (i + 1) % n; const f = [A[i], A[j], B[j], B[i]]; const W = this.w((A[i][0] + B[j][0]) / 2, (A[i][1] + B[j][1]) / 2, (A[i][2] + B[j][2]) / 2); sides.push([W[0] + W[1] + W[2], f, i]); }
+ sides.sort((P, Q) => P[0] - Q[0]);
+ const ax = axis === 'x' ? [1, 0, 0] : [0, 1, 0];
+ this.face3(A, t3, { out: [-ax[0], -ax[1], 0] });
+ for (const [, f, i] of sides) this.face3(f, t3, { color: o.stripe && o.stripe(i), out: ring[i].map((v, q) => v + ring[(i + 1) % n][q]) });
+ this.face3(B, t3, { color: o.capColor, out: ax });
+ if (o.decal) o.decal(this);
+ }
+ cone(x, y, z, r, h, t3, o = {}) { // vertical cone / pyramid (n sides)
+ const n = o.n || 20;
+ const W = this.w(x, y, z + h / 3); if (o.cull !== false && !this.vis(W[0], W[1], W[2], Math.max(r, h) * this.scale())) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => this.coneNow(x, y, z, r, h, t3, o), o.layer ?? 1);
+ }
+ coneNow(x, y, z, r, h, t3, o = {}) {
+ const n = o.n || 20; {
+ const tt = typeof t3 === 'string' ? tri(t3) : t3, fs = [];
+ for (let i = 0; i < n; i++) { const a = i / n * TAU + (o.rot || 0), b = (i + 1) / n * TAU + (o.rot || 0); const f = [[x + Math.cos(a) * r, y + Math.sin(a) * r, z], [x + Math.cos(b) * r, y + Math.sin(b) * r, z], [x, y, z + h]]; const m = this.w(x + Math.cos((a + b) / 2) * r, y + Math.sin((a + b) / 2) * r, z); fs.push([m[0] + m[1], f, [Math.cos((a + b) / 2), Math.sin((a + b) / 2), r / h]]); }
+ fs.sort((A, B) => A[0] - B[0]); for (const [, f, out] of fs) this.face3(f, tt, { out });
+ }
+ }
+ // gable roof along x (ridge parallel to x) or y
+ roof(x, y, z, w, d, h, t3, o = {}) {
+ const W = this.w(x + w / 2, y + d / 2, z + h / 2); if (!this.vis(W[0], W[1], W[2], Math.hypot(w, d) * this.scale())) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => {
+ const tt = typeof t3 === 'string' ? tri(t3) : t3, X = x + w, Y = y + d, Z = z + h, ov = o.over || 0;
+ if ((o.ridge || 'x') === 'x') {
+ const m = y + d / 2;
+ this.face3([[x, y, z], [x, m, Z], [x, Y, z]], o.gable || tt, { out: [-1, 0, 0] }); this.face3([[X, Y, z], [X, m, Z], [X, y, z]], o.gable || tt, { out: [1, 0, 0] });
+ this.face3([[x - ov, y - ov, z], [X + ov, y - ov, z], [X + ov, m, Z], [x - ov, m, Z]], tt, { out: [0, -1, 1] }); this.face3([[x - ov, m, Z], [X + ov, m, Z], [X + ov, Y + ov, z], [x - ov, Y + ov, z]], tt, { out: [0, 1, 1] });
+ } else {
+ const m = x + w / 2;
+ this.face3([[x, y, z], [X, y, z], [m, y, Z]], o.gable || tt, { out: [0, -1, 0] }); this.face3([[X, Y, z], [x, Y, z], [m, Y, Z]], o.gable || tt, { out: [0, 1, 0] });
+ this.face3([[x - ov, y - ov, z], [m, y - ov, Z], [m, Y + ov, Z], [x - ov, Y + ov, z]], tt, { out: [-1, 0, 1] }); this.face3([[m, y - ov, Z], [X + ov, y - ov, z], [X + ov, Y + ov, z], [m, Y + ov, Z]], tt, { out: [1, 0, 1] });
+ }
+ }, o.layer ?? 1);
+ }
+ // sphere: flat disc with a lit cap (upper-left) and a dark crescent (right)
+ sphere(x, y, z, r, t3, o = {}) {
+ const W = this.w(x, y, z); if (o.cull !== false && !this.vis(W[0], W[1], W[2], r * this.scale())) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => this.sphereNow(x, y, z, r, t3, o), o.layer ?? 1);
+ }
+ sphereNow(x, y, z, r, t3, o = {}) {
+ if (typeof t3 === 'string') t3 = tri(t3);
+ const g = this.g, [sx, sy] = this.L(x, y, z), R = r * this.cam.k * this.scale();
+ if (R < .4) return;
+ g.save(); g.beginPath(); g.ellipse(sx, sy, R, R * (o.squash || 1), o.rot || 0, 0, TAU); g.fillStyle = this.col(t3[1]); g.fill(); g.clip();
+ g.beginPath(); g.ellipse(sx + R * .62, sy + R * .28, R * 1.02, R * 1.1, 0, 0, TAU); g.fillStyle = this.col(t3[2]); g.fill();
+ g.beginPath(); g.ellipse(sx - R * .28, sy - R * .55, R * .9, R * .72, 0, 0, TAU); g.fillStyle = this.col(t3[0]); g.fill();
+ if (o.hi !== false && R > 6) { g.beginPath(); g.ellipse(sx - R * .38, sy - R * .52, R * .2, R * .12, -.5, 0, TAU); g.fillStyle = this.col('#FFF8EC', .7); g.fill(); }
+ g.restore();
+ }
+ // flat polygon on plane z (ground decal); layer default 0
+ flat(pts, z, c, o = {}) {
+ const W = this.w(pts[0][0], pts[0][1], z);
+ this.add(o.depth ?? (W[0] + W[1] + W[2] - 1e3 + (o.bias || 0)), () => { this.poly(pts.map(p => this.L(p[0], p[1], z)), c, o.a ?? 1); }, o.layer ?? 0);
+ }
+ // 3D polyline (world-local), screen-width px
+ line3(pts, c, lw = 2, o = {}) {
+ const f = () => { const g = this.g; g.save(); g.beginPath(); pts.forEach((p, i) => { const s = this.L(p[0], p[1], p[2]); i ? g.lineTo(s[0], s[1]) : g.moveTo(s[0], s[1]); }); g.strokeStyle = this.col(c, o.a ?? 1); g.lineWidth = o.world ? lw * this.cam.k * this.scale() : lw; g.lineCap = o.cap || 'round'; g.lineJoin = 'round'; if (o.dash) g.setLineDash(o.dash); g.lineDashOffset = o.off || 0; g.stroke(); g.restore(); };
+ if (o.now) return f();
+ const m = this.w(...pts[pts.length >> 1]); this.add(o.depth ?? (m[0] + m[1] + m[2] + (o.bias || 0)), f, o.layer ?? 1);
+ }
+ // billboard: a 2D drawing in screen space anchored at a world point, scaled by zoom (unit = 1 world unit)
+ bill(x, y, z, fn, o = {}) {
+ const W = this.w(x, y, z); if (o.cull !== false && !this.vis(W[0], W[1], W[2], (o.r || 3) * this.scale())) return;
+ this.add(W[0] + W[1] + W[2] + (o.bias || 0), () => { const g = this.g, [sx, sy] = this.L(x, y, z), k = this.cam.k * this.scale(); g.save(); g.translate(sx, sy); g.scale(k, k); fn(g, this, k); g.restore(); }, o.layer ?? 1);
+ }
+ // ---- isometric text: glyphs on a world plane, optionally extruded ----
+ // plane 'xy' (lying, reads up-right), 'xz' (standing, faces +y, reads down-right), 'yz' (standing, faces +x, reads up-right)
+ text3(str, x, y, z, o = {}) {
+ const W = this.w(x, y, z); this.add(o.depth ?? (W[0] + W[1] + W[2] + (o.bias || 0)), () => this.text3Now(str, x, y, z, o), o.layer ?? 1);
+ }
+ text3Now(str, x, y, z, o = {}) {
+ const g = this.g, k = this.cam.k * this.scale(), size = o.size || 2, plane = o.plane || 'xy', ex = o.extrude || 0;
+ const t3 = typeof o.tri === 'string' ? tri(o.tri) : (o.tri || PAL.cream);
+ let u, v, e;
+ if (plane === 'xy') { u = [C30, -S30]; v = [C30, S30]; e = [0, -1]; } // u = −y, v = +x, extrude +z
+ else if (plane === 'xz') { u = [C30, S30]; v = [0, 1]; e = [-C30, S30]; } // u = +x, v = −z, extrude +y
+ else { u = [C30, -S30]; v = [0, 1]; e = [C30, S30]; } // 'yz': u = −y, v = −z, extrude +x
+ const [sx, sy] = this.L(x, y, z);
+ g.save(); g.font = `${o.weight || 700} 100px ${o.font || 'Jost'}`; g.textAlign = o.align || 'left'; g.textBaseline = o.base || 'alphabetic';
+ if (o.track) g.letterSpacing = o.track + 'px';
+ const sc = size * k / 100, steps = Math.max(1, Math.ceil(ex * k / 1.2));
+ for (let i = 0; i <= steps; i++) {
+ const f = i / steps * ex * k;
+ g.setTransform(u[0] * sc, u[1] * sc, v[0] * sc, v[1] * sc, sx + e[0] * f, sy + e[1] * f);
+ g.fillStyle = this.col(i === steps ? (o.face || t3[0]) : (i < steps * .5 ? t3[2] : t3[1]), o.a ?? 1);
+ g.fillText(str, 0, 0);
+ }
+ g.restore();
+ }
+}
+export function normal(W) { // Newell
+ let nx = 0, ny = 0, nz = 0; for (let i = 0; i < W.length; i++) { const a = W[i], b = W[(i + 1) % W.length]; nx += (a[1] - b[1]) * (a[2] + b[2]); ny += (a[2] - b[2]) * (a[0] + b[0]); nz += (a[0] - b[0]) * (a[1] + b[1]); }
+ const l = Math.hypot(nx, ny, nz) || 1; return [nx / l, ny / l, nz / l];
+}
+
+// ---------- infographic layer (screen space) ----------
+export const FONT = 'Jost';
+export function haloText(g, s, x, y, o = {}) {
+ g.save(); g.font = o.font || `600 26px ${FONT}`; g.textAlign = o.align || 'left'; g.textBaseline = o.base || 'alphabetic';
+ if (o.track) g.letterSpacing = o.track + 'px';
+ if (o.halo !== false) { g.lineJoin = 'round'; g.strokeStyle = o.haloColor || 'rgba(251,244,230,.92)'; g.lineWidth = o.hw || 7; g.strokeText(s, x, y); }
+ g.fillStyle = o.color || PAL.ink; g.fillText(s, x, y); const w = g.measureText(s).width; g.restore(); return w;
+}
+// label pin: dot on the object → vertical leader → horizontal rule → title / number / icon row. a ∈ [0,1] reveal
+export function pin(iso, x, y, z, o = {}) {
+ const g = iso.g, a = o.a ?? 1; if (a <= 0) return;
+ const [ax, ay] = iso.P(x, y, z), up = o.up ?? 130, dir = o.dir ?? 1, len = o.len ?? 60;
+ const s1 = eo(seg(a, 0, .18)), s2 = eo(seg(a, .12, .42)), s3 = eo(seg(a, .36, .55)), s4 = seg(a, .45, 1);
+ g.save(); g.globalAlpha = o.fade ?? 1;
+ g.strokeStyle = PAL.ink; g.lineWidth = 2; g.lineCap = 'round';
+ // leader
+ if (s2 > 0) { g.beginPath(); g.moveTo(ax, ay); g.lineTo(ax, ay - up * s2); if (s3 > 0) g.lineTo(ax + dir * len * s3, ay - up); g.stroke(); }
+ // dot
+ const R = 7 * back(s1, 2.2); g.beginPath(); g.arc(ax, ay, Math.max(0, R), 0, TAU); g.fillStyle = PAL.paper; g.fill(); g.stroke();
+ g.beginPath(); g.arc(ax, ay, Math.max(0, R * .42), 0, TAU); g.fillStyle = o.dot || PAL.ink; g.fill();
+ // text
+ if (s4 > 0) {
+ const tx = ax + dir * (len + 12), ty = ay - up;
+ g.save(); g.beginPath(); const wv = 900 * ss(s4); if (dir > 0) g.rect(tx - 4, ty - 80, wv, 220); else g.rect(tx + 4 - wv, ty - 80, wv, 220); g.clip();
+ const al = dir > 0 ? 'left' : 'right', ns = o.ns || 44, uf = `500 ${Math.round(ns * .5)}px ${FONT}`;
+ haloText(g, o.title || '', tx, ty - 10, { font: `600 ${o.ts || 25}px ${FONT}`, track: 3.5, align: al });
+ let uw = 0; if (o.unit) { g.font = uf; g.letterSpacing = '2px'; uw = g.measureText(o.unit).width + 10; g.letterSpacing = '0px'; }
+ let nw = 0; if (o.num) { g.font = `400 ${ns}px ${FONT}`; nw = g.measureText(o.num).width; }
+ if (o.num) haloText(g, o.num, dir > 0 ? tx : tx - uw, ty + ns + 2, { font: `400 ${ns}px ${FONT}`, align: al, track: .5 });
+ if (o.unit) haloText(g, o.unit, dir > 0 ? tx + nw + 10 : tx, ty + ns + 2, { font: uf, align: al, track: 2 });
+ g.restore();
+ if (o.icons) o.icons(g, tx, ty + (o.num ? ns + 18 : 12), dir);
+ }
+ g.restore();
+}
+// circular detail inset (frame within the frame), leader from anchor. drawIn(g, cx, cy, r) draws inside the clipped disc
+export function inset(iso, ax, ay, cx, cy, r, a, drawIn, o = {}) {
+ const g = iso.g; if (a <= 0) return;
+ const l = eo(seg(a, 0, .35)), c = back(seg(a, .25, .8), 1.4), R = r * c;
+ const ang = Math.atan2(cy - ay, cx - ax), ex = cx - Math.cos(ang) * R, ey = cy - Math.sin(ang) * R;
+ g.save(); g.strokeStyle = PAL.ink; g.lineWidth = 2;
+ g.beginPath(); g.moveTo(ax, ay); g.lineTo(lerp(ax, ex, l), lerp(ay, ey, l)); g.stroke();
+ g.beginPath(); g.arc(ax, ay, 6, 0, TAU); g.fillStyle = PAL.paper; g.fill(); g.stroke(); g.beginPath(); g.arc(ax, ay, 2.6, 0, TAU); g.fillStyle = PAL.ink; g.fill();
+ if (R > 1) {
+ g.beginPath(); g.arc(cx + 6, cy + 9, R, 0, TAU); g.fillStyle = 'rgba(46,37,34,.14)'; g.fill();
+ g.save(); g.beginPath(); g.arc(cx, cy, R, 0, TAU); g.clip(); g.fillStyle = o.bg || PAL.paper; g.fillRect(cx - R, cy - R, 2 * R, 2 * R); drawIn(g, cx, cy, R, c); g.restore();
+ g.beginPath(); g.arc(cx, cy, R, 0, TAU); g.lineWidth = 3; g.stroke();
+ g.beginPath(); g.arc(cx, cy, R + 7, 0, TAU); g.lineWidth = 1; g.setLineDash([3, 5]); g.stroke(); g.setLineDash([]);
+ }
+ g.restore();
+}
+// tracking ring ("you are here"): dashed ring that slowly turns + optional tag
+export function ring(g, x, y, r, a = 1, t = 0, tag = null, o = {}) {
+ if (a <= 0) return; g.save(); g.globalAlpha = a; g.strokeStyle = o.color || PAL.ink; g.lineWidth = o.lw || 2.5; g.setLineDash([r * .35, r * .22]); g.lineDashOffset = -t * r * .6;
+ g.beginPath(); g.arc(x, y, r * eo(seg(a, 0, 1)), 0, TAU); g.stroke(); g.setLineDash([]);
+ if (tag) { const ang = o.ang ?? -.8, px = x + Math.cos(ang) * r, py = y + Math.sin(ang) * r, qx = px + 26, qy = py - 26; g.beginPath(); g.moveTo(px, py); g.lineTo(qx, qy); g.lineTo(qx + 18, qy); g.stroke(); haloText(g, tag, qx + 24, qy + 9, { font: `600 ${o.ts || 26}px ${FONT}`, track: 2 }); }
+ g.restore();
+}
+// cut line: dashed ink line with a small scissor-tick at the head, drawn to fraction a
+export function cutLine(g, pts, a, o = {}) {
+ if (a <= 0) return; let L = 0; const d = []; for (let i = 1; i < pts.length; i++) { const l = Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]); d.push(l); L += l; }
+ let rem = L * clamp(a); g.save(); g.strokeStyle = o.color || PAL.ink; g.lineWidth = o.lw || 2.5; g.setLineDash(o.dash || [10, 7]); g.beginPath(); g.moveTo(pts[0][0], pts[0][1]); let hx = pts[0][0], hy = pts[0][1];
+ for (let i = 1; i < pts.length && rem > 0; i++) { const f = Math.min(1, rem / d[i - 1]); hx = lerp(pts[i - 1][0], pts[i][0], f); hy = lerp(pts[i - 1][1], pts[i][1], f); g.lineTo(hx, hy); rem -= d[i - 1]; }
+ g.stroke(); g.setLineDash([]); if (a < 1) { g.beginPath(); g.arc(hx, hy, 5, 0, TAU); g.fillStyle = o.color || PAL.ink; g.fill(); } g.restore();
+}
+// section hatch fill for cut faces (cream + 45° ink hatching), pts in screen space
+export function hatch(g, pts, o = {}) {
+ g.save(); g.beginPath(); pts.forEach((p, i) => i ? g.lineTo(p[0], p[1]) : g.moveTo(p[0], p[1])); g.closePath(); g.fillStyle = o.fill || PAL.paper; g.fill(); g.clip();
+ const xs = pts.map(p => p[0]), ys = pts.map(p => p[1]), x0 = Math.min(...xs), x1 = Math.max(...xs), y0 = Math.min(...ys), y1 = Math.max(...ys), sp = o.sp || 7;
+ g.strokeStyle = o.color || 'rgba(46,37,34,.55)'; g.lineWidth = o.lw || 1.2; g.beginPath();
+ for (let s = x0 - (y1 - y0); s < x1; s += sp) { g.moveTo(s, y1); g.lineTo(s + (y1 - y0), y0); } g.stroke(); g.restore();
+ g.save(); g.beginPath(); pts.forEach((p, i) => i ? g.lineTo(p[0], p[1]) : g.moveTo(p[0], p[1])); g.closePath(); g.strokeStyle = PAL.ink; g.lineWidth = o.edge || 1.5; g.stroke(); g.restore();
+}
+
+// ---------- Isotype icons (screen space, size s px, drawn in the same 3-tone language) ----------
+const mini = (g, s) => ({ P: (x, y, z) => [(x - y) * C30 * s, ((x + y) * S30 - z) * s] });
+function mbox(g, M, x, y, z, w, d, h, t3, lit = 1) {
+ const f = (pts, c) => { g.beginPath(); pts.forEach((p, i) => { const q = M.P(...p); i ? g.lineTo(q[0], q[1]) : g.moveTo(q[0], q[1]); }); g.closePath(); g.fillStyle = c; g.fill(); };
+ const X = x + w, Y = y + d, Z = z + h, T = lit ? t3 : PAL.stone.map(c => hex(mix(c, '#F2E6D0', .45)));
+ f([[x, Y, z], [X, Y, z], [X, Y, Z], [x, Y, Z]], T[1]); f([[X, y, z], [X, Y, z], [X, Y, Z], [X, y, Z]], T[2]); f([[x, y, Z], [X, y, Z], [X, Y, Z], [x, Y, Z]], T[0]);
+}
+export const ICON = {
+ sun(g, x, y, s, lit = 1) { g.save(); g.translate(x, y); const c = lit ? '#E4A93A' : '#D8CCB6'; g.strokeStyle = c; g.lineWidth = s * .09; g.lineCap = 'round'; for (let i = 0; i < 8; i++) { const a = i / 8 * TAU; g.beginPath(); g.moveTo(Math.cos(a) * s * .36, Math.sin(a) * s * .36); g.lineTo(Math.cos(a) * s * .5, Math.sin(a) * s * .5); g.stroke(); } g.beginPath(); g.arc(0, 0, s * .26, 0, TAU); g.fillStyle = c; g.fill(); if (lit) { g.beginPath(); g.arc(-s * .07, -s * .07, s * .12, 0, TAU); g.fillStyle = '#F4CB6A'; g.fill(); } g.restore(); },
+ moon(g, x, y, s, lit = 1) { g.save(); g.translate(x, y); g.beginPath(); g.arc(0, 0, s * .3, 0, TAU); g.fillStyle = lit ? '#3C5A86' : '#D8CCB6'; g.fill(); g.beginPath(); g.arc(s * .12, -s * .08, s * .24, 0, TAU); g.fillStyle = lit ? '#F2E6D0' : '#F2E6D0'; g.fill(); g.restore(); },
+ box(g, x, y, s, t3 = PAL.red, lit = 1) { g.save(); g.translate(x, y); const M = mini(g, s * .42); mbox(g, M, -1.1, -.45, -.45, 2.2, .9, .9, t3, lit); g.restore(); },
+ sack(g, x, y, s, lit = 1) { g.save(); g.translate(x, y); const c = lit ? ['#E0C79A', '#C9A874', '#A5845A'] : ['#E6DCC8', '#DCD0BA', '#CFC2AA']; g.beginPath(); g.moveTo(-s * .32, s * .4); g.quadraticCurveTo(-s * .44, -s * .05, -s * .24, -s * .32); g.lineTo(s * .24, -s * .32); g.quadraticCurveTo(s * .44, -s * .05, s * .32, s * .4); g.closePath(); g.fillStyle = c[1]; g.fill(); g.beginPath(); g.moveTo(s * .02, s * .4); g.lineTo(s * .32, s * .4); g.quadraticCurveTo(s * .44, -s * .05, s * .24, -s * .32); g.lineTo(s * .06, -s * .32); g.closePath(); g.fillStyle = c[2]; g.fill(); g.beginPath(); g.ellipse(0, -s * .34, s * .24, s * .08, 0, 0, TAU); g.fillStyle = c[0]; g.fill(); g.restore(); },
+ bean(g, x, y, s, c = '#6A3B22', lit = 1, rot = -.5) { g.save(); g.translate(x, y); g.rotate(rot); const t3 = tri(lit ? c : '#D8CCB6'); g.beginPath(); g.ellipse(0, 0, s * .42, s * .3, 0, 0, TAU); g.fillStyle = t3[1]; g.fill(); g.save(); g.clip(); g.beginPath(); g.ellipse(-s * .1, -s * .12, s * .36, s * .22, 0, 0, TAU); g.fillStyle = t3[0]; g.fill(); g.restore(); g.beginPath(); g.moveTo(-s * .34, s * .02); g.bezierCurveTo(-s * .1, -s * .1, s * .1, s * .1, s * .34, -s * .02); g.strokeStyle = t3[2]; g.lineWidth = s * .07; g.lineCap = 'round'; g.stroke(); g.restore(); },
+ cherry(g, x, y, s, lit = 1) { g.save(); g.translate(x, y); const t3 = lit ? PAL.red : ['#E6DCC8', '#DCD0BA', '#CFC2AA']; g.beginPath(); g.arc(0, 0, s * .38, 0, TAU); g.fillStyle = t3[1]; g.fill(); g.save(); g.clip(); g.beginPath(); g.arc(s * .24, s * .1, s * .38, 0, TAU); g.fillStyle = t3[2]; g.fill(); g.beginPath(); g.arc(-s * .1, -s * .2, s * .3, 0, TAU); g.fillStyle = t3[0]; g.fill(); g.restore(); g.restore(); },
+};
+// grid of n icons, lit count m (fractional ok): cols, gap in px
+export function iconGrid(g, x, y, n, m, cols, gap, draw, dir = 1) {
+ for (let i = 0; i < n; i++) { const c = i % cols, r = (i / cols) | 0, px = x + dir * (c * gap + gap / 2) - (dir < 0 ? 0 : 0), py = y + r * gap + gap / 2; const on = i < m, pop = on ? back(clamp(m - i), 2.4) : 1; g.save(); g.translate(px, py); g.scale(pop, pop); draw(g, 0, 0, gap * .86, on ? 1 : 0, i); g.restore(); }
+}
+
+// ---------- minimal people (Monument-Valley-like billboards; unit = world units) ----------
+// o: {body, hat, skin, pose, t, face:1|-1, h}
+export function person(g, o = {}) {
+ const h = o.h || 3, B = tri(o.body || PAL.red[1]), sk = o.skin || '#C98B62', f = o.face || 1, bob = o.bob || 0;
+ g.save(); g.scale(f, 1); g.translate(0, -bob);
+ // legs
+ g.fillStyle = o.legs || '#4A3A36'; g.fillRect(-.16 * h, -.26 * h, .12 * h, .26 * h); g.fillRect(.04 * h, -.26 * h, .12 * h, .26 * h);
+ // body (tapered) left mid / right dark
+ g.beginPath(); g.moveTo(-.26 * h, -.22 * h); g.lineTo(-.16 * h, -.66 * h); g.lineTo(.16 * h, -.66 * h); g.lineTo(.26 * h, -.22 * h); g.closePath(); g.fillStyle = B[1]; g.fill();
+ g.beginPath(); g.moveTo(.02 * h, -.22 * h); g.lineTo(.02 * h, -.66 * h); g.lineTo(.16 * h, -.66 * h); g.lineTo(.26 * h, -.22 * h); g.closePath(); g.fillStyle = B[2]; g.fill();
+ if (o.apron) { g.beginPath(); g.moveTo(-.2 * h, -.24 * h); g.lineTo(-.12 * h, -.56 * h); g.lineTo(.12 * h, -.56 * h); g.lineTo(.2 * h, -.24 * h); g.closePath(); g.fillStyle = o.apron; g.fill(); }
+ // arm
+ const arm = o.arm ?? .2; g.strokeStyle = B[2]; g.lineCap = 'round'; g.lineWidth = .09 * h;
+ const ax = .12 * h, ay = -.6 * h, al = .34 * h, ex = ax + Math.sin(arm) * al, ey = ay + Math.cos(arm) * al;
+ g.beginPath(); g.moveTo(ax, ay); g.lineTo(ex, ey); g.stroke(); g.beginPath(); g.arc(ex, ey, .05 * h, 0, TAU); g.fillStyle = sk; g.fill();
+ if (o.tool) o.tool(g, ex, ey, h);
+ // head
+ g.beginPath(); g.arc(0, -.78 * h, .12 * h, 0, TAU); g.fillStyle = sk; g.fill();
+ g.beginPath(); g.arc(.05 * h, -.76 * h, .1 * h, -1.2, 1.9); g.fillStyle = hex(mix(sk, '#231A2C', .2)); g.fill();
+ if (o.hat === 'straw') { g.beginPath(); g.ellipse(0, -.86 * h, .26 * h, .07 * h, 0, 0, TAU); g.fillStyle = '#E9D39A'; g.fill(); g.beginPath(); g.ellipse(0, -.92 * h, .12 * h, .08 * h, 0, Math.PI, TAU); g.fill(); g.fillStyle = '#C9AE6E'; g.fillRect(-.12 * h, -.9 * h, .24 * h, .025 * h); }
+ else if (o.hat === 'cap') { g.beginPath(); g.arc(0, -.8 * h, .125 * h, Math.PI, TAU); g.fillStyle = o.hatColor || PAL.blue[1]; g.fill(); g.fillRect(0, -.81 * h, .2 * h, .03 * h); }
+ else if (o.hair) { g.beginPath(); g.arc(0, -.8 * h, .125 * h, Math.PI * 1.02, TAU * .99); g.fillStyle = o.hair; g.fill(); }
+ if (o.basket) { const t3 = tri('#C9A060'); g.beginPath(); g.moveTo(-.34 * h, -.44 * h); g.lineTo(-.3 * h, -.28 * h); g.lineTo(-.1 * h, -.28 * h); g.lineTo(-.06 * h, -.44 * h); g.closePath(); g.fillStyle = t3[1]; g.fill(); g.fillStyle = t3[0]; g.beginPath(); g.ellipse(-.2 * h, -.44 * h, .14 * h, .035 * h, 0, 0, TAU); g.fill(); if (o.basket > 1) { g.fillStyle = PAL.red[1]; for (let i = 0; i < 5; i++) { g.beginPath(); g.arc(-.29 * h + i * .045 * h, -.455 * h, .022 * h, 0, TAU); g.fill(); } } }
+ g.restore();
+}
+
+// ---------- any shape → isometric solid (the "draw anything in this style" hook) ----------
+// pts: 2D outline in local units (x right, y down, like a sketch); lays it on plane 'xy' (ground) or stands it on 'xz'/'yz'.
+// extrudes by depth and shades with the 3-tone rule. Example: a 4-point spark with a cursor tail in #D97757.
+export function shape(iso, pts, at, o = {}) {
+ const [x, y, z] = at, s = o.scale || 1, d = o.depth ?? .5, t3 = typeof o.color === 'string' ? tri(o.color) : (o.color || PAL.red), plane = o.plane || 'xz';
+ const P3 = (p, off) => plane === 'xy' ? [x + p[1] * s, y - p[0] * s, z + off] : plane === 'xz' ? [x + p[0] * s, y + off, z - p[1] * s] : [x + off, y - p[0] * s, z - p[1] * s];
+ const front = pts.map(p => P3(p, d)), backp = pts.map(p => P3(p, 0));
+ let cx = 0, cy = 0, cz = 0; front.forEach(p => { cx += p[0]; cy += p[1]; cz += p[2]; }); const n = front.length;
+ iso.add(cx / n + cy / n + cz / n + (o.bias || 0), () => {
+ const sides = [];
+ for (let i = 0; i < n; i++) { const j = (i + 1) % n, f = [backp[i], backp[j], front[j], front[i]]; const m = [(f[0][0] + f[2][0]) / 2, (f[0][1] + f[2][1]) / 2, (f[0][2] + f[2][2]) / 2]; sides.push([m[0] + m[1] + m[2], f, [m[0] - cx / n, m[1] - cy / n, m[2] - cz / n]]); }
+ sides.sort((a, b) => a[0] - b[0]); for (const [, f, out] of sides) iso.face3(f, t3, { out }); iso.face3(front, t3, { both: true, color: o.face });
+ }, o.layer ?? 1);
+}
+export function sparkPath(n = 4, r = 1, inner = .28) { // n-point spark (concave star, curved-in sides approximated)
+ const pts = []; for (let i = 0; i < n * 2 * 4; i++) { const a = i / (n * 8) * TAU - Math.PI / 2, k = (i % 8) / 8, tip = Math.pow(Math.abs(Math.cos(k * Math.PI)), 3); pts.push([Math.cos(a) * lerp(r * inner, r, tip), Math.sin(a) * lerp(r * inner, r, tip)]); }
+ return pts;
+}
+export function cursorPath(h = 1.6, w = .32, x = 0, y = 0) { return [[x, y - h / 2], [x + w, y - h / 2], [x + w, y + h / 2], [x, y + h / 2]]; } // the text-cursor "tail" that follows a spark
diff --git a/styles/isometric-picture-book/demo/events.json b/styles/isometric-picture-book/demo/events.json
new file mode 100644
index 0000000..334da49
--- /dev/null
+++ b/styles/isometric-picture-book/demo/events.json
@@ -0,0 +1 @@
+{"dur":59.84,"ev":[{"t":0,"type":"timeline","T":{"WV0":31.770999999999994,"TITLE":0.35,"MOVE0":3.4,"MOVE1":4.6,"CHIME":3.6999999999999997,"SIGN":3.85,"STAND0":3.9,"FT1":4.4,"LID0":8.929999999999998,"LID1":11.479999999999999,"WIDE":9.829999999999998,"SETTLE":10.479999999999999,"RISE1":11.479999999999999,"FT2":8.879999999999999,"FT3":12.507999999999997,"FT5a":16.716999999999995,"FAST0":21.786999999999995,"FAST1":22.886999999999997,"FT4":22.536999999999995,"REW0":25.036999999999995,"LIGHT0":25.786999999999995,"FT7":25.136999999999997,"FT8":27.886999999999997,"FT9":32.971,"FT10":38.58099999999999,"BARS0":41.921,"BRACKET":45.321,"FORM0":46.821,"FT12":47.721,"BAND":51.945,"END0":56.86600000000001,"WV_END":38.33099999999999,"DUR":59.84},"S":[[0,3.4],[3.4,8.579999999999998],[8.579999999999998,12.007999999999997],[12.007999999999997,16.266999999999996],[16.266999999999996,21.786999999999995],[21.786999999999995,25.036999999999995],[25.036999999999995,27.586999999999996],[27.586999999999996,31.770999999999994],[31.770999999999994,38.53099999999999],[38.53099999999999,41.571],[41.571,46.620999999999995],[46.620999999999995,51.645],[51.645,56.71600000000001],[56.71600000000001,59.836000000000006]],"VO":[0.45,3.6999999999999997,8.779999999999998,12.207999999999997,16.466999999999995,21.986999999999995,25.336999999999996,27.786999999999995,31.970999999999993,38.730999999999995,42.321,47.071,51.845000000000006],"VO_DUR":[2.168,4.68,3.028,3.859,5.12,2.527,1.187,3.784,4.719,2.64,2.883,4.374,4.671]},{"t":0,"type":"taxi"},{"t":0.35,"type":"char","p":"title","i":0,"big":true,"acc":false},{"t":0.45,"type":"vo","id":"V01","dur":2.168},{"t":0.48,"type":"char","p":"title","i":1,"big":true,"acc":false},{"t":0.61,"type":"char","p":"title","i":2,"big":true,"acc":false},{"t":0.74,"type":"char","p":"title","i":3,"big":true,"acc":false},{"t":0.87,"type":"char","p":"title","i":4,"big":true,"acc":true},{"t":1,"type":"char","p":"title","i":5,"big":true,"acc":true},{"t":1.33,"type":"char","p":"title","i":6,"big":false,"acc":false},{"t":2.7,"type":"bridge_move"},{"t":2.8,"type":"brake"},{"t":3.4,"type":"dock"},{"t":3.4,"type":"swish"},{"t":3.7,"type":"chime"},{"t":3.7,"type":"vo","id":"V02","dur":4.68},{"t":3.85,"type":"sign"},{"t":3.9,"type":"stand","q":0},{"t":4.2,"type":"stand","q":1},{"t":4.4,"type":"char","p":"ft1","i":0,"big":true,"acc":true},{"t":4.5,"type":"stand","q":2},{"t":4.55,"type":"char","p":"ft1","i":1,"big":true,"acc":false},{"t":4.7,"type":"char","p":"ft1","i":2,"big":true,"acc":false},{"t":4.8,"type":"stand","q":3},{"t":4.85,"type":"char","p":"ft1","i":3,"big":true,"acc":false},{"t":5.1,"type":"stand","q":4},{"t":5.4,"type":"stand","q":5},{"t":5.7,"type":"stand","q":6},{"t":6,"type":"stand","q":7},{"t":6.3,"type":"stand","q":8},{"t":6.6,"type":"stand","q":9},{"t":6.9,"type":"stand","q":10},{"t":7.2,"type":"stand","q":11},{"t":7.5,"type":"stand","q":12},{"t":7.8,"type":"stand","q":13},{"t":8.1,"type":"stand","q":14},{"t":8.4,"type":"stand","q":15},{"t":8.78,"type":"vo","id":"V03","dur":3.028},{"t":8.88,"type":"char","p":"ft2","i":0,"big":false,"acc":false},{"t":8.93,"type":"lid_open"},{"t":9.01,"type":"char","p":"ft2","i":1,"big":false,"acc":false},{"t":9.14,"type":"char","p":"ft2","i":2,"big":true,"acc":false},{"t":9.27,"type":"char","p":"ft2","i":3,"big":true,"acc":false},{"t":9.4,"type":"char","p":"ft2","i":4,"big":true,"acc":false},{"t":9.53,"type":"char","p":"ft2","i":5,"big":true,"acc":false},{"t":10.13,"type":"lid_rest"},{"t":10.38,"type":"aisle_light"},{"t":12.208,"type":"vo","id":"V04","dur":3.859},{"t":12.508,"type":"stop_mark"},{"t":12.508,"type":"char","p":"ft3","i":0,"big":true,"acc":false},{"t":12.648,"type":"char","p":"ft3","i":1,"big":true,"acc":false},{"t":12.788,"type":"char","p":"ft3","i":2,"big":true,"acc":true},{"t":12.928,"type":"char","p":"ft3","i":3,"big":false,"acc":false},{"t":13.008,"type":"bin_slap"},{"t":13.068,"type":"char","p":"ft3","i":4,"big":false,"acc":false},{"t":13.208,"type":"char","p":"ft3","i":5,"big":false,"acc":false},{"t":13.348,"type":"char","p":"ft3","i":6,"big":false,"acc":false},{"t":16.467,"type":"vo","id":"V05","dur":5.12},{"t":16.717,"type":"char","p":"ft5","i":0,"big":false,"acc":false},{"t":16.857,"type":"char","p":"ft5","i":1,"big":false,"acc":false},{"t":16.997,"type":"char","p":"ft5","i":2,"big":true,"acc":false},{"t":17.137,"type":"char","p":"ft5","i":3,"big":true,"acc":false},{"t":17.277,"type":"char","p":"ft5","i":4,"big":true,"acc":false},{"t":21.787,"type":"fast"},{"t":21.987,"type":"vo","id":"V06","dur":2.527},{"t":22.537,"type":"char","p":"ft4","i":0,"big":true,"acc":false},{"t":22.817,"type":"char","p":"ft4","i":1,"big":false,"acc":false},{"t":22.887,"type":"stop","tm":"6:54"},{"t":22.957,"type":"char","p":"ft4","i":2,"big":false,"acc":false},{"t":23.097,"type":"char","p":"ft4","i":3,"big":false,"acc":false},{"t":23.237,"type":"char","p":"ft4","i":4,"big":false,"acc":false},{"t":25.037,"type":"rewind"},{"t":25.137,"type":"char","p":"ft7","i":0,"big":false,"acc":false},{"t":25.257,"type":"char","p":"ft7","i":1,"big":false,"acc":false},{"t":25.337,"type":"vo","id":"V07","dur":1.187},{"t":25.377,"type":"char","p":"ft7","i":2,"big":true,"acc":true},{"t":25.497,"type":"char","p":"ft7","i":3,"big":true,"acc":true},{"t":25.787,"type":"lights"},{"t":27.587,"type":"chime"},{"t":27.787,"type":"vo","id":"V08","dur":3.784},{"t":27.887,"type":"char","p":"ft8","i":0,"big":true,"acc":false},{"t":28.027,"type":"char","p":"ft8","i":1,"big":true,"acc":true},{"t":28.167,"type":"char","p":"ft8","i":2,"big":true,"acc":false},{"t":28.307,"type":"char","p":"ft8","i":3,"big":true,"acc":false},{"t":28.647,"type":"char","p":"ft8","i":4,"big":false,"acc":false},{"t":28.787,"type":"char","p":"ft8","i":5,"big":false,"acc":false},{"t":28.927,"type":"char","p":"ft8","i":6,"big":false,"acc":false},{"t":29.067,"type":"char","p":"ft8","i":7,"big":false,"acc":false},{"t":31.721,"type":"lid_open"},{"t":31.971,"type":"vo","id":"V09","dur":4.719},{"t":32.971,"type":"char","p":"ft9","i":0,"big":false,"acc":true},{"t":33.111,"type":"char","p":"ft9","i":1,"big":false,"acc":false},{"t":33.251,"type":"char","p":"ft9","i":2,"big":false,"acc":false},{"t":33.391,"type":"char","p":"ft9","i":3,"big":false,"acc":false},{"t":33.421,"type":"wave","k":0,"fast":false},{"t":33.531,"type":"char","p":"ft9","i":4,"big":false,"acc":false},{"t":34.221,"type":"bins_shut","k":0},{"t":35.221,"type":"seated","k":0},{"t":35.291,"type":"wave","k":1,"fast":true},{"t":35.331,"type":"bins_shut","k":1},{"t":35.531,"type":"seated","k":1},{"t":35.571,"type":"wave","k":2,"fast":true},{"t":35.611,"type":"bins_shut","k":2},{"t":35.811,"type":"seated","k":2},{"t":35.851,"type":"wave","k":3,"fast":true},{"t":35.891,"type":"bins_shut","k":3},{"t":36.091,"type":"seated","k":3},{"t":36.131,"type":"wave","k":4,"fast":true},{"t":36.171,"type":"bins_shut","k":4},{"t":36.371,"type":"seated","k":4},{"t":36.411,"type":"wave","k":5,"fast":true},{"t":36.451,"type":"bins_shut","k":5},{"t":36.651,"type":"seated","k":5},{"t":36.691,"type":"wave","k":6,"fast":true},{"t":36.731,"type":"bins_shut","k":6},{"t":36.931,"type":"seated","k":6},{"t":36.971,"type":"wave","k":7,"fast":true},{"t":37.011,"type":"bins_shut","k":7},{"t":37.211,"type":"seated","k":7},{"t":37.251,"type":"wave","k":8,"fast":true},{"t":37.291,"type":"bins_shut","k":8},{"t":37.491,"type":"seated","k":8},{"t":37.531,"type":"wave","k":9,"fast":true},{"t":37.571,"type":"bins_shut","k":9},{"t":37.771,"type":"seated","k":9},{"t":37.811,"type":"wave","k":10,"fast":true},{"t":37.851,"type":"bins_shut","k":10},{"t":38.051,"type":"seated","k":10},{"t":38.091,"type":"wave","k":11,"fast":true},{"t":38.131,"type":"bins_shut","k":11},{"t":38.331,"type":"seated","k":11},{"t":38.331,"type":"stop","tm":"3:36"},{"t":38.581,"type":"char","p":"ft10","i":0,"big":true,"acc":true},{"t":38.731,"type":"vo","id":"V10","dur":2.64},{"t":38.861,"type":"char","p":"ft10","i":1,"big":false,"acc":false},{"t":39.001,"type":"char","p":"ft10","i":2,"big":false,"acc":false},{"t":39.141,"type":"char","p":"ft10","i":3,"big":false,"acc":false},{"t":39.281,"type":"char","p":"ft10","i":4,"big":false,"acc":false},{"t":41.571,"type":"pull"},{"t":41.921,"type":"bar"},{"t":42.271,"type":"bar"},{"t":42.321,"type":"vo","id":"V11","dur":2.883},{"t":42.471,"type":"char","p":"b1","i":0,"big":true,"acc":false},{"t":42.821,"type":"char","p":"b2","i":0,"big":true,"acc":true},{"t":45.321,"type":"bracket"},{"t":45.471,"type":"char","p":"b3","i":0,"big":false,"acc":false},{"t":45.571,"type":"char","p":"b3","i":1,"big":false,"acc":false},{"t":45.671,"type":"char","p":"b3","i":2,"big":false,"acc":false},{"t":45.771,"type":"char","p":"b3","i":3,"big":false,"acc":false},{"t":45.871,"type":"char","p":"b3","i":4,"big":false,"acc":false},{"t":45.971,"type":"char","p":"b3","i":5,"big":false,"acc":false},{"t":46.621,"type":"swish"},{"t":46.821,"type":"crowd"},{"t":47.071,"type":"vo","id":"V12","dur":4.374},{"t":47.721,"type":"char","p":"ft12","i":0,"big":true,"acc":false},{"t":47.961,"type":"char","p":"ft12","i":1,"big":false,"acc":false},{"t":48.081,"type":"char","p":"ft12","i":2,"big":false,"acc":false},{"t":48.201,"type":"char","p":"ft12","i":3,"big":false,"acc":false},{"t":48.321,"type":"char","p":"ft12","i":4,"big":false,"acc":false},{"t":48.441,"type":"char","p":"ft12","i":5,"big":false,"acc":false},{"t":48.561,"type":"char","p":"ft12","i":6,"big":false,"acc":false},{"t":51.645,"type":"cut_in"},{"t":51.845,"type":"vo","id":"V13","dur":4.671},{"t":51.945,"type":"band"},{"t":52.145,"type":"char","p":"ft13","i":0,"big":false,"acc":true},{"t":52.285,"type":"char","p":"ft13","i":1,"big":false,"acc":false},{"t":52.425,"type":"char","p":"ft13","i":2,"big":false,"acc":false},{"t":52.565,"type":"char","p":"ft13","i":3,"big":false,"acc":false},{"t":52.705,"type":"char","p":"ft13","i":4,"big":false,"acc":false},{"t":56.866,"type":"char","p":"end","i":0,"big":false,"acc":false},{"t":57.186,"type":"char","p":"end","i":1,"big":false,"acc":false},{"t":57.506,"type":"char","p":"end","i":2,"big":false,"acc":false},{"t":57.826,"type":"char","p":"end","i":3,"big":false,"acc":false},{"t":58.146,"type":"char","p":"end","i":4,"big":false,"acc":false}]}
\ No newline at end of file
diff --git a/styles/isometric-picture-book/demo/film.js b/styles/isometric-picture-book/demo/film.js
new file mode 100644
index 0000000..3df2fe3
--- /dev/null
+++ b/styles/isometric-picture-book/demo/film.js
@@ -0,0 +1,592 @@
+// 七十二个座位 · Seventy-Two Seats — library demo for "Isometric Picture-book Explainer" (narrated cut).
+// One world, built once: the apron and stand B12, a 12-row 3+3 regional jet (its roof a paper flap), a 7.5 m jet bridge,
+// and the gate inside the terminal (floor at 2.3 m, cut away above). Fourteen shots, one per narration line; everything is a function of t.
+import { C, W, H, TOPS, LEGS, iso, tri, mix, hex, css, TAU, clamp, lerp, seg, ss, eo, eio, ei, hash,
+ onPlane, quad, fillPoly, rect, tracePath, font, phraseLayout, phraseWorld, floorType, phraseBox, drawPerson, drawSeated, subtitles, subtitleBox } from './kit.js';
+import { PL, rowY, SEATX, AISLE, DOORY, BR, nose, cabinBack, cabinFront, lid, cabinClosed, aft, wing, bridgeBack, bridgeFront, xAt } from './plane.js';
+import { apron, bagTrain, GZ, WALLX, LANES, LANE_Y, LANE1X, chairPos, gateWindow, gateFloor, lanes, groupSign, counter, gateChair, squares, sqPos,
+ DOOR_SIGN, COUNTER_SCREEN, SIGN } from './places.js';
+
+// ---------- narration (vo2/*.wav, edge-tts Xiaoxiao +25%) and the shot timeline built from it ----------
+export const VO_TEXT = [
+ ['每次登机,为什么总要排那么久?', 'Why does boarding always take so long?'],
+ ['让后排乘客先上,听起来很合理,后排坐好了,就不会挡着前排的路。', 'Back rows first sounds sensible: once they sit down, they are out of everyone’s way.'],
+ ['可机舱里只有一条过道,窄得只够一个人走。', 'But the cabin has one aisle, just wide enough for one person.'],
+ ['只要前面有一个人停下来放箱子,后面所有人都得干等着。', 'When one person stops to stow a bag, everyone behind has to wait.'],
+ ['因为叫的都是相邻那几排,大家全挤在同一个地方,只能一个接一个来。', 'They were called for the same few rows, so they crowd one spot and go one by one.'],
+ ['全部坐满,足足用了六分五十四秒。', 'Filling every seat took a full 6 minutes 54 seconds.'],
+ ['那如果换个顺序呢?', 'What if we change the order?'],
+ ['让靠窗的人先上,而且前后两个人之间,刚好隔开一排。', 'Window seats first, and each person sits one row apart from the next in line.'],
+ ['这样一来,六个人就能同时在六个不同的排数放箱子,谁也不挡谁的路。', 'Now six people stow bags in six different rows at once, and nobody blocks anybody.'],
+ ['结果全部坐满,只花了三分三十六秒。', 'Every seat was filled in just 3 minutes 36 seconds.'],
+ ['足足快了三分多钟,时间缩短了将近一半。', 'More than three minutes faster: nearly half the time.'],
+ ['这是2012年,研究人员找来七十二名乘客做过的真实测试。', 'This was a real test, run in 2012 with 72 passengers.'],
+ ['原来登机慢,根本不是因为人多,而是把所有人都堵在了同一段过道上。', 'Boarding is slow not because of crowds, but because everyone is stuck in the same stretch of aisle.'],
+];
+const VO_DUR = [2.168, 4.68, 3.028, 3.859, 5.12, 2.527, 1.187, 3.784, 4.719, 2.64, 2.883, 4.374, 4.671];
+const G = .2; // breath before and after each line
+
+// the weave (Steffen order): 12 waves of 6, each wave stops at every other row at once
+const WAVES = [];
+{
+ const even = [12, 10, 8, 6, 4, 2], odd = [11, 9, 7, 5, 3, 1], by = (s, rows) => rows.map(r => [r, s]);
+ for (const [a, b] of [['A', 'F'], ['B', 'E'], ['C', 'D']]) WAVES.push(by(a, even), by(b, even), by(a, odd), by(b, odd));
+}
+const ORDER2 = WAVES.flat();
+
+export const S = [], VO = []; // shots [t0, t1]; narration starts
+const T = {};
+{
+ let t = 0;
+ const shot = (len) => { S.push([t, t + len]); t += len; return S[S.length - 1]; };
+ const say = (i, at) => { VO[i] = at; return at + VO_DUR[i]; };
+ // 1 opening: title on the stand
+ say(0, .45); shot(3.4);
+ // 2 gate: back rows first
+ { const t0 = t; const e = say(1, t0 + .3); shot(e + G - t0); }
+ // 3 bridge → flap → cabin
+ { const t0 = t; const e = say(2, t0 + G); shot(e + G - t0); }
+ // 4 one person stops, everyone waits
+ { const t0 = t; const e = say(3, t0 + G); shot(e + G - t0); }
+ // 5 the called rows crowd one stretch
+ { const t0 = t; const e = say(4, t0 + G); shot(e + G - t0); }
+ // 6 time-lapse to 6:54 (the number held ≥ 2.5 s)
+ { const t0 = t; const v = t0 + G; const e = say(5, v); shot(Math.max(e + G, v + .55 + 2.5) - t0); }
+ // 7 rewind, then the new order lights up seat by seat
+ { const t0 = t; say(6, t0 + .3); shot(2.55); }
+ // 8 the line on numbered squares
+ { const t0 = t; const e = say(7, t0 + G); shot(e + G - t0); }
+ // 9 the weave (length set by the choreography below)
+ { const t0 = t; T.WV0 = t0; say(8, t0 + G); }
+}
+const WT = []; {
+ const w0 = T.WV0 + .35, w1 = w0 + 1.3, w2 = w1 + .8, w3 = w2 + 1.0;
+ WT.push({ w0, w1, w2, w3, fast: false });
+ WAVES.slice(1).forEach((w, j) => { const f0 = w3 - .05 + j * .28; WT.push({ w0: f0, w1: f0 + .12, w2: f0 + .16, w3: f0 + .36, fast: true }); });
+}
+export const WV_END = WT[WT.length - 1].w3;
+{
+ let t = Math.max(WV_END + .2, VO[8] + VO_DUR[8] + G); S.push([T.WV0, t]);
+ const shot = (len) => { S.push([t, t + len]); t += len; };
+ const say = (i, at) => { VO[i] = at; return at + VO_DUR[i]; };
+ // 10 3:36
+ { const t0 = t; const v = t0 + G; const e = say(9, v); shot(Math.max(e + G, v + .3 + 2.5) - t0); }
+ // 11 the two time bars
+ { const t0 = t; const e = say(10, t0 + .75); shot(Math.max(e + G, t0 + .35 + .9 + 2.5 + 1.3) - t0); }
+ // 12 the test: 72 passengers in formation
+ { const t0 = t; const e = say(11, t0 + .45); shot(e + G - t0); }
+ // 13 back in the aisle: the same stretch
+ { const t0 = t; const e = say(12, t0 + G); shot(e + G - t0); }
+ // 14 end card
+ shot(3.12);
+}
+export const DUR = +S[S.length - 1][1].toFixed(2);
+const sh = i => S[i - 1]; // shot i (1-based) → [t0, t1]
+const inShot = (t, i) => t >= sh(i)[0] && t < sh(i)[1];
+const CUES = VO_TEXT.map(([cn, en], i) => ({ cn, en, t0: VO[i] - .05, t1: VO[i] + VO_DUR[i] + .12 }));
+CUES.forEach((c, i) => { if (CUES[i + 1]) c.t1 = Math.min(c.t1, CUES[i + 1].t0 - .1); });
+
+// sub-timings
+Object.assign(T, {
+ TITLE: .35,
+ MOVE0: sh(2)[0], MOVE1: sh(2)[0] + 1.2, CHIME: sh(2)[0] + .3, SIGN: sh(2)[0] + .45, STAND0: sh(2)[0] + .5, FT1: sh(2)[0] + 1.0,
+ LID0: sh(3)[0] + .35, LID1: sh(3)[0] + 2.9, WIDE: sh(3)[0] + 1.25, SETTLE: sh(3)[0] + 1.9, RISE1: sh(3)[0] + 2.9, FT2: sh(3)[0] + .3,
+ FT3: sh(4)[0] + .5, FT5a: sh(5)[0] + .45, FAST0: sh(6)[0], FAST1: sh(6)[0] + 1.1, FT4: VO[5] + .55,
+ REW0: sh(7)[0], LIGHT0: sh(7)[0] + .75, FT7: sh(7)[0] + .1, FT8: VO[7] + .1, FT9: sh(9)[0] + 1.2, FT10: sh(10)[0] + .05,
+ BARS0: sh(11)[0] + .35, BRACKET: sh(11)[0] + .35 + .9 + 2.5, FORM0: sh(12)[0] + .2, FT12: sh(12)[0] + 1.1, BAND: sh(13)[0] + .3, END0: sh(14)[0] + .15,
+});
+
+// ---------- the 72 passengers ----------
+export const PAX = [];
+{
+ let i = 0;
+ for (let r = 1; r <= 12; r++) for (const s of 'ABCDEF') {
+ const hsh = hash(i * 3.17 + 1.3), h2 = hash(i * 7.91 + 4.2);
+ PAX.push({ i, row: r, seat: s, h: 1.6 + h2 * .2, top: TOPS[Math.floor(hash(i * 5.3 + .7) * 4)], legs: LEGS[Math.floor(h2 * 4)], hairLong: hsh > .62 ? 1 : 0,
+ bagc: ['#5E6660', '#6E6252', '#4F5A66', '#7A6E62'][Math.floor(hash(i * 2.1) * 4)] });
+ i++;
+ }
+ const front = PAX.filter(p => p.row >= 9).sort((a, b) => hash(a.i * 13.7 + 2) - hash(b.i * 13.7 + 2));
+ const rest = PAX.filter(p => p.row < 9).sort((a, b) => hash(a.i * 9.1 + 5) - hash(b.i * 9.1 + 5));
+ front.forEach((p, k) => p.chair = k); rest.forEach((p, k) => p.chair = 24 + k);
+}
+const paxBySeat = (r, s) => PAX[(r - 1) * 6 + 'ABCDEF'.indexOf(s)];
+const SPEED = 1.5, STRIDE = .72, GAPM = .75;
+
+// ---------- the queue path and the first boarding (rows 9–12 first), simulated once at load ----------
+const QP = [[LANE1X, 18], [LANE1X, -.35], [WALLX, DOORY], [BR.x0, DOORY], [0, DOORY], [0, rowY(12) + .4]];
+const QL = [0]; for (let i = 1; i < QP.length; i++) QL.push(QL[i - 1] + Math.hypot(QP[i][0] - QP[i - 1][0], QP[i][1] - QP[i - 1][1]));
+const S_AISLE = QL[4];
+const sRow = r => S_AISLE + (rowY(r) - DOORY);
+function qAt(s) {
+ s = clamp(s, -50, QL[QL.length - 1]);
+ if (s < 0) return { x: QP[0][0], y: QP[0][1] - s, z: GZ };
+ for (let i = 1; i < QP.length; i++) if (s <= QL[i] || i === QP.length - 1) { const f = (s - QL[i - 1]) / (QL[i] - QL[i - 1] || 1); const x = lerp(QP[i - 1][0], QP[i][0], f), y = lerp(QP[i - 1][1], QP[i][1], f); return { x, y, z: x < BR.x0 - .05 ? PL.FLOOR : GZ }; }
+}
+const RUN1 = PAX.filter(p => p.row >= 9).sort((a, b) => a.chair - b.chair).map((p, q) => {
+ const c = chairPos(p.chair), ts = T.STAND0 + q * .3, walk = (c.x - LANE1X) / SPEED;
+ return { p, c, q, ts, tw: ts + .35, tq: ts + .35 + walk, sJoin: QP[0][1] - c.y };
+});
+const SIM_DT = 1 / 30, SIM_T0 = T.STAND0, SIM_END = 40;
+const SIM = (() => {
+ const st = RUN1.map(() => ({ s: null, mode: 'gate', t0: 0 })), frames = [];
+ for (let t = SIM_T0; t <= SIM_END; t += SIM_DT) {
+ RUN1.forEach((o, k) => {
+ const Sx = st[k];
+ if (Sx.mode === 'gate' && t >= o.tq) { Sx.mode = 'walk'; Sx.s = o.sJoin; }
+ if (Sx.mode === 'walk') {
+ const target = sRow(o.p.row); let lim = target;
+ for (let j = k - 1; j >= 0; j--) if (st[j].mode === 'walk' || st[j].mode === 'stow' || (st[j].mode === 'sit' && t - st[j].t0 < .5)) { lim = Math.min(lim, st[j].s - GAPM); break; } // a sitter blocks until out of the aisle
+ Sx.s = Math.min(Sx.s + SPEED * SIM_DT, Math.max(Sx.s, lim));
+ if (Sx.s >= target - 1e-6) { Sx.mode = 'stow'; Sx.t0 = t; }
+ } else if (Sx.mode === 'stow' && t - Sx.t0 > 1.7) { Sx.mode = 'sit'; Sx.t0 = t; }
+ });
+ frames.push(st.map(x => ({ s: x.s, mode: x.mode, t0: x.t0 })));
+ }
+ return frames;
+})();
+const simAt = ts => {
+ const f = clamp((ts - SIM_T0) / SIM_DT, 0, SIM.length - 1.001), i = Math.floor(f), u = f - i, A = SIM[i], B = SIM[i + 1];
+ return A.map((x, k) => (x.s == null || B[k].s == null ? x : { ...x, s: lerp(x.s, B[k].s, u) }));
+};
+// film time → simulation time, per shot: the gate runs live; the bridge shot jumps to the head of the line at the aircraft door;
+// the jammed shots look a few minutes in, slowed
+const LEAD_DOOR = (() => { for (let ts = SIM_T0; ts < SIM_END; ts += SIM_DT) { const s = simAt(ts)[0].s; if (s != null && s >= QL[3] - 1.4) return ts; } return 13; })();
+function simT(t) {
+ if (t < sh(3)[0]) return t;
+ if (t < sh(4)[0]) return LEAD_DOOR + (t - sh(3)[0]);
+ if (t < sh(7)[0]) return 26.6 + (t - sh(5)[0]) * .5;
+ if (inShot(t, 13)) return 27.2 + (t - sh(13)[0]) * .3;
+ return 30;
+}
+const FILL = (() => {
+ const f = simAt(simT(T.FAST0 - .01)), seatedNow = new Set();
+ RUN1.forEach((o, k) => { if (f[k].mode === 'sit') seatedNow.add(o.p.i); });
+ const grp = p => p.row >= 9 ? 0 : p.row <= 4 ? 1 : 2;
+ const order = PAX.slice().sort((a, b) => (seatedNow.has(b.i) - seatedNow.has(a.i)) || grp(a) - grp(b) || hash(a.i * 4.4) - hash(b.i * 4.4));
+ return { rank: new Map(order.map((p, k) => [p.i, k])), nPre: seatedNow.size, seatedNow };
+})();
+
+// ---------- camera ----------
+const KEY = (a, b, u) => ({ x: lerp(a.x, b.x, u), y: lerp(a.y, b.y, u), z: lerp(a.z, b.z, u), k: Math.exp(lerp(Math.log(a.k), Math.log(b.k), u)) });
+const CAM = {
+ openA: { x: -4.4, y: -14.8, z: .4, k: 58 }, openB: { x: -4.0, y: -14.2, z: .4, k: 62 },
+ gateA: { x: 14.0, y: 2.6, z: 3.7, k: 72 }, gateB: { x: 13.0, y: 1.4, z: 3.6, k: 76 },
+ wide: { x: 1.0, y: 3.4, z: 2.9, k: 76 }, cabin: { x: 1.6, y: 3.5, z: 2.15, k: 86 },
+ stopA: { x: 2.1, y: rowY(6.9), z: 2.3, k: 106 }, stopB: { x: 2.1, y: rowY(7.2), z: 2.3, k: 111 },
+ jamA: { x: 1.6, y: 3.6, z: 2.15, k: 88 }, jamB: { x: 1.4, y: 3.1, z: 2.15, k: 92 },
+ gate2A: { x: 13.6, y: 3.4, z: 3.6, k: 70 }, gate2B: { x: 13.1, y: 2.6, z: 3.5, k: 74 },
+ weaveA: { x: .5, y: 5.4, z: 2.6, k: 94 }, weaveB: { x: .5, y: 4.3, z: 2.6, k: 92 }, fullB: { x: 1.4, y: 3.1, z: 2.15, k: 92 },
+ barsA: { x: -6.8, y: -20.6, z: 0, k: 54 }, barsB: { x: -6.6, y: -20.9, z: 0, k: 58 },
+ formA: { x: -9.8, y: -16.4, z: .8, k: 60 }, formB: { x: -9.6, y: -16.6, z: .8, k: 63 },
+ callA: { x: 1.6, y: 3.6, z: 2.15, k: 88 }, callB: { x: 1.4, y: 3.1, z: 2.15, k: 92 },
+ endA: { x: -6.0, y: -14.6, z: .3, k: 54 }, endB: { x: -5.9, y: -14.8, z: .3, k: 56 },
+};
+const leadPos = ts => { const x = simAt(ts)[0]; return x.s == null ? { x: LANE1X, y: 1 } : qAt(x.s); };
+export function camAt(t) {
+ const u = i => seg(t, sh(i)[0], sh(i)[1]);
+ if (t < sh(2)[0]) return KEY(CAM.openA, CAM.openB, ss(u(1)));
+ if (t < sh(3)[0]) return t < T.MOVE1 ? KEY(CAM.openB, CAM.gateA, eio(seg(t, T.MOVE0, T.MOVE1))) : KEY(CAM.gateA, CAM.gateB, ss(seg(t, T.MOVE1, sh(3)[0] + .3)));
+ if (t < sh(4)[0]) {
+ const L = leadPos(simT(sh(3)[0])), f = { x: L.x + 1.4, y: L.y + 1.2, z: GZ, k: 76 };
+ return t < T.SETTLE ? KEY(f, CAM.wide, eio(seg(t, sh(3)[0] + .15, T.WIDE))) : KEY(CAM.wide, CAM.cabin, eio(seg(t, T.SETTLE, T.RISE1)));
+ }
+ if (t < sh(5)[0]) return KEY(CAM.stopA, CAM.stopB, ss(u(4)));
+ if (t < sh(6)[0]) return KEY(CAM.jamA, CAM.jamB, ss(u(5)));
+ if (t < sh(8)[0]) return CAM.jamB;
+ if (t < sh(9)[0]) return KEY(CAM.gate2A, CAM.gate2B, ss(u(8)));
+ if (t < sh(10)[0]) return KEY(CAM.weaveA, CAM.weaveB, ss(u(9)));
+ if (t < sh(11)[0]) return KEY(CAM.weaveB, CAM.fullB, ss(u(10)));
+ if (t < sh(12)[0]) return t < sh(11)[0] + .55 ? KEY(CAM.fullB, CAM.barsA, eio(seg(t, sh(11)[0], sh(11)[0] + .55))) : KEY(CAM.barsA, CAM.barsB, ss(seg(t, sh(11)[0] + .55, sh(11)[1])));
+ if (t < sh(13)[0]) return t < sh(12)[0] + .8 ? KEY(CAM.barsB, CAM.formA, eio(seg(t, sh(12)[0], sh(12)[0] + .8))) : KEY(CAM.formA, CAM.formB, ss(seg(t, sh(12)[0] + .8, sh(12)[1])));
+ if (t < sh(14)[0]) return KEY(CAM.callA, CAM.callB, ss(u(13)));
+ return KEY(CAM.endA, CAM.endB, ss(u(14)));
+}
+
+// ---------- people ----------
+function seated(p, x, y, u = 1, a = 1) { globalThis.__POS?.push({ i: p.i, k: 's', x, y, a }); iso.bill(x, y + .02, PL.FLOOR, gg => { gg.globalAlpha *= a; drawSeated(gg, p); }, { layer: 1, r: 2 }); }
+// step back into the row's legroom, walk sideways to the seat, then sit (a short cross-fade, never sinking or floating)
+function seatIn(p, r, s, u, a = 1) {
+ const sx = SEATX[s], y = rowY(r), back = ss(seg(u, 0, .2)), go = ss(seg(u, .15, .7)), sit = ss(seg(u, .68, .95));
+ if (sit < 1) { const x = lerp(0, sx * .92, go); standing(p, { x, y: y - .36 * back, z: PL.FLOOR }, { walking: go > 0 && go < 1, phase: x * 8 }, a * (1 - sit)); }
+ if (sit > 0) seated(p, sx, y, 1, a * sit);
+}
+// stowing: lift the case overhead (0–.3), carry it up and over onto the open bin of that side (.3–.7), lower it in (.7–.9)
+let CASES = [];
+function stowState(p, row, seat, u) {
+ const lift = ss(seg(u, 0, .3)) * (1 - ss(seg(u, .8, .95)));
+ if (u > .3 && u < .92) {
+ const side = 'ABC'.includes(seat) ? -1 : 1, xb = side < 0 ? -PL.RX + .03 + .19 : xAt(PL.CUTN) - .135, ztop = (side < 0 ? PL.CUTF : PL.CUTN) + .24;
+ const m = ss(seg(u, .3, .7)), d = ss(seg(u, .7, .92)), arc = Math.sin(Math.PI * m) * .25;
+ CASES.push({ x: lerp(0, xb, m), y: rowY(row) - .05, z: lerp(PL.FLOOR + 2.0, ztop + .12, m) + arc - d * .2, a: 1 - d, c: p.bagc });
+ }
+ return { lift, caseUp: u <= .3 };
+}
+function drawCases(g) { for (const c of CASES) { g.save(); g.globalAlpha *= c.a; iso.boxNow(c.x - .2, c.y - .16, c.z, .4, .32, .22, tri(c.c || '#5E6660', .25, .2)); g.restore(); } CASES = []; }
+function standing(p, pos, pose = {}, a = 1, mark = 0) {
+ globalThis.__POS?.push({ i: p.i, k: 'w', x: pos.x, y: pos.y, a }); // read by tools/motion_check.mjs
+ iso.bill(pos.x, pos.y, pos.z ?? PL.FLOOR, gg => {
+ gg.globalAlpha *= a; drawPerson(gg, p, pose);
+ if (mark > 0) { // a small persimmon marker over the person who stopped
+ gg.globalAlpha *= mark; gg.fillStyle = C.accent; const y = -p.h - .42 - (pose.lift ? .18 : 0);
+ gg.beginPath(); gg.moveTo(-.13, y - .2); gg.lineTo(.13, y - .2); gg.lineTo(0, y); gg.closePath(); gg.fill();
+ }
+ }, { layer: 1, r: 2 });
+}
+function gatePeople1(t) {
+ for (const p of PAX) {
+ const c = chairPos(p.chair), o = RUN1.find(o => o.p === p);
+ if (o && t >= o.ts) {
+ if (t >= o.tq) continue;
+ const up = ss(seg(t, o.ts, o.tw)), d = Math.max(0, (t - o.tw) * SPEED);
+ standing(p, { x: c.x - .25 * up - d, y: c.y, z: GZ }, { walking: d > 0, phase: d / STRIDE * Math.PI, bag: 1 });
+ continue;
+ }
+ iso.bill(c.x - .02, c.y, GZ, gg => drawSeated(gg, p), { layer: 1, r: 2 });
+ }
+}
+function queuePeople(ts, region, a = 1) {
+ const f = simAt(ts);
+ RUN1.forEach((o, k) => {
+ const X = f[k]; if (X.s == null || X.mode === 'gate') return;
+ const p = o.p, pos = qAt(X.s), reg = pos.x >= WALLX ? 'gate' : pos.x >= BR.x0 - .05 ? 'bridge' : 'cabin';
+ if (reg !== region) return;
+ if (X.mode === 'sit') { seatIn(p, p.row, p.seat, seg(ts, X.t0, X.t0 + 1.2), a); return; }
+ const walking = X.mode === 'walk' && (k === 0 || f[k - 1].s == null || X.s < sRow(p.row) - .01) && (k === 0 || f[k - 1].mode !== 'stow' || f[k - 1].s - X.s > GAPM + .05);
+ const st = X.mode === 'stow' ? stowState(p, p.row, p.seat, seg(ts, X.t0, X.t0 + 1.7)) : { lift: 0, caseUp: true };
+ standing(p, pos, { walking, phase: X.s / STRIDE * Math.PI, bag: X.mode === 'walk' ? 1 : 0, lift: st.lift, caseUp: st.caseUp }, a);
+ });
+}
+const binOpenSim = ts => { const f = simAt(ts), m = new Map(); RUN1.forEach((o, k) => { const X = f[k]; if (X.mode === 'stow') { const u = seg(ts, X.t0, X.t0 + 1.7); m.set(o.p.row * 2 + ('DEF'.includes(o.p.seat) ? 1 : 0), ss(seg(u, .15, .3)) * (1 - ss(seg(u, .88, 1)))); } }); return (r, side) => m.get(r * 2 + (side > 0 ? 1 : 0)) || 0; };
+
+// ---------- cabin furniture ----------
+const SEAT_T = tri(C.green, .22, .2);
+function seats(glow) {
+ for (let r = 1; r <= 12; r++) for (const s of 'ABCDEF') {
+ const x = SEATX[s], y = rowY(r), F = PL.FLOOR, gl = glow ? glow(r, s) : 0;
+ const T3 = gl > 0 ? tri(hex(mix(C.green, C.accent, gl * .6)), .22, .2) : SEAT_T;
+ iso.box(x - .21, y - .22, F + .34, .42, .46, .1, T3, { bias: -.39 });
+ iso.box(x - .21, y + .24, F + .36, .42, .1, .44, T3, { bias: -.58, faceColor: { 0: gl > 0 ? hex(mix('#F3ECDF', C.accentLt, gl)) : '#F3ECDF', 3: '#F3ECDF' } });
+ }
+}
+function bins(open, full) {
+ const binBox = (x0, w, y0, y1, z, side, rows, bias) => iso.box(x0, y0, z, w, y1 - y0, .24, tri('#EEE8DC', .3, .18), { bias, decal: I => {
+ const g = I.g, zz = z + .24;
+ g.save(); g.strokeStyle = 'rgba(140,125,100,.35)'; g.lineWidth = 1;
+ for (const r of rows) { if (r === 12) continue; const y = rowY(r) + .405; if (y <= y0 || y >= y1) continue; g.beginPath(); g.moveTo(...I.P(x0, y, zz)); g.lineTo(...I.P(x0 + w, y, zz)); g.lineTo(...I.P(x0 + w, y, z)); g.stroke(); }
+ g.restore();
+ for (const r of rows) {
+ const op = open?.(r, side) || 0; if (op <= 0) continue;
+ const y = rowY(r), hx = side < 0 ? x0 : x0 + w, ang = op * 1.95;
+ fillPoly(g, quad(rect(x0 + .04, x0 + w - .04, y - .36, y + .36), zz + .002), '#5A5F59');
+ if (full?.(r, side)) fillPoly(g, quad(rect(x0 + .06, x0 + w - .06, y - .3, y + .3), zz + .004), '#7A6E62');
+ const ex = -side * Math.cos(ang) * w, ez = Math.sin(ang) * w;
+ fillPoly(g, [I.P(hx, y - .4, zz), I.P(hx, y + .4, zz), I.P(hx - ex, y + .4, zz + ez), I.P(hx - ex, y - .4, zz + ez)], '#F7F2E8');
+ }
+ } });
+ const all = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
+ binBox(-PL.RX + .03, .38, rowY(1) - .45, rowY(12) + .45, PL.CUTF, -1, all, -10);
+ const w = .27, x0 = xAt(PL.CUTN) - w;
+ for (const r of all) binBox(x0, w, rowY(r) - .405, rowY(r) + .405, PL.CUTN, 1, [r], -(PL.CUTN + .12 - PL.FLOOR));
+}
+
+// ---------- floor type: only the narration's key words and numbers ----------
+const PH = {
+ title: { x: -3.6, y: -11.4, z: 0, t0: T.TITLE, t1: sh(2)[0] + 1.0, step: .13, scale: 1.6, lines: [[['七十二个', 'B'], ['座位', 'A']], [['SEVENTY-TWO SEATS', 'en']]], dv: 1.55, indent: .1 },
+ ft1: { x: WALLX + 6.6, y: -1.0, z: GZ, t0: T.FT1, t1: sh(3)[0] + .6, step: .15, lines: [[['后', 'A'], ['排先上', 'B']]] },
+ ft2: { x: 2.75, y: 6.2, z: 0, t0: T.FT2, t1: sh(4)[0], step: .13, lines: [[['只有', 's'], ['一条过道', 'B']]] },
+ ft3: { x: 2.6, y: 6.4, z: 0, t0: T.FT3, t1: sh(5)[0], step: .14, lines: [[['一人', 'B'], ['停', 'A'], [' 后面全等', 's']]] },
+ ft5: { x: 2.6, y: 6.0, z: 0, t0: T.FT5a, t1: sh(6)[0], step: .14, lines: [[['挤在', 's'], ['同一处', 'B']]] },
+ ft4: { x: 2.75, y: 5.2, z: 0, t0: T.FT4, t1: sh(7)[0] + .2, step: .14, lines: [[['6:54', 'n'], [' 全部坐满', 's']]] },
+ ft7: { x: 2.75, y: 5.6, z: 0, t0: T.FT7, t1: sh(8)[0], step: .12, lines: [[['换个', 's'], ['顺序', 'A']]] },
+ ft8: { x: WALLX + 6.6, y: -1.0, z: GZ, t0: T.FT8, t1: sh(9)[0], step: .14, lines: [[['靠', 'B'], ['窗', 'A'], ['先上', 'B']], [['隔开一排', 's']]], dv: 1.7, indent: .25 },
+ ft9: { x: 2.3, y: 5.7, z: 0, t0: T.FT9, t1: sh(10)[0], step: .14, scale: .85, lines: [[['六', 'A'], ['排同时放', 'B']]] },
+ ft10: { x: 2.75, y: 5.2, z: 0, t0: T.FT10, t1: sh(11)[0] + .4, step: .14, lines: [[['3:36', 'na'], [' 全部坐满', 's']]] },
+ b1: { x: -6.33, y: -28.8, z: 0, t0: T.BARS0 + .55, t1: sh(12)[0] + .7, step: .12, scale: 1.3, lines: [[['6:54', 'n']]] },
+ b2: { x: -3.33, y: -22.1, z: 0, t0: T.BARS0 + .9, t1: sh(12)[0] + .7, step: .12, scale: 1.3, lines: [[['3:36', 'na']]] },
+ b3: { x: -1.55, y: -20.0, z: 0, t0: T.BRACKET + .15, t1: sh(12)[0] + .7, step: .1, scale: 1, lines: [[['快了三分多钟', 's']]] },
+ ft12: { x: -6.2, y: -12.6, z: 0, t0: T.FT12, t1: sh(13)[0], step: .12, scale: 1.25, lines: [[['2012', 'n'], [' · 72 名乘客', 's']]] },
+ ft13: { x: 2.3, y: 5.7, z: 0, t0: T.BAND + .2, t1: sh(14)[0], step: .14, scale: .85, lines: [[['同', 'A'], ['一段过道', 'B']]] },
+ end: { x: -3.2, y: -11.0, z: 0, t0: T.END0, t1: 99, step: .16, scale: 1.25, lines: [[['LemoLab', 'e'], [' × ', 'e'], ['Claude', 'e'], [' Opus', 'e'], [' 5.5', 'e']]] },
+};
+const LAY = {}; for (const k in PH) LAY[k] = phraseLayout(PH[k]);
+const typeAt = (g, t, Q, keys) => { if (!Q.has('notype')) for (const k of keys) floorType(g, t, PH[k], LAY[k]); };
+
+// ---------- the world ----------
+const planeDy = t => t < 3.0 ? 14 * (1 - eo(seg(t, 0, 3.0))) : 0;
+const bridgeX0 = t => lerp(4.6, BR.x0, eio(seg(t, 2.7, 3.4)));
+function withDy(dy, fn) { const c = iso.cam; iso.cam = { ...c, y: c.y - dy }; fn(); iso.cam = c; }
+// the gate: first order (lanes, called rows), second order (one line on numbered squares), or empty
+function gateLayer(g, t, Q) {
+ const phase = t < sh(7)[0] ? 1 : t < sh(9)[0] ? 2 : 3;
+ gateFloor(g);
+ lanes(g, { lit: phase === 1 ? 0 : -1, litA: phase === 1 ? ss(seg(t, T.SIGN, T.SIGN + .3)) : 0, a: phase === 2 ? 0 : phase === 3 ? .7 : 1 });
+ if (phase === 2) squares(g, ORDER2.map(([r, s], k) => k < 6 && inShot(t, 8) ? `${r}${s}` : ''));
+ typeAt(g, t, Q, phase === 1 ? ['ft1'] : phase === 2 ? ['ft8'] : []);
+ counter(g);
+ for (let i = 0; i < 72; i++) { const c = chairPos(i); gateChair(c.x, c.y); }
+ if (phase === 1 && t < sh(3)[0]) LANES.forEach((L, i) => groupSign(g, i, i === 0 ? ss(seg(t, T.SIGN, T.SIGN + .3)) : 0));
+ if (phase === 1) { const ts = simT(t); gatePeople1(ts); queuePeople(ts, 'gate'); } // one clock for the whole gate
+ if (phase === 2) ORDER2.forEach(([r, s], k) => { const q = sqPos(k); standing(paxBySeat(r, s), { x: q.x - q.dx * .2, y: q.y - q.dy * .2, z: GZ }, { bag: 1 }); });
+ iso.flush();
+}
+function planeExterior(g, t) { withDy(planeDy(t), () => { wing(g, -1); nose(g, null); cabinClosed(g); aft(g); wing(g, 1); }); }
+function exterior(g, t, Q, o = {}) {
+ iso.g = g; iso.cam = o.cam || camAt(t);
+ apron(g);
+ typeAt(g, t, Q, o.type || []);
+ o.marks?.(g);
+ bagTrain(g, -18.4, -14.6);
+ o.crowd?.();
+ iso.flush();
+ planeExterior(g, t);
+ const x0 = bridgeX0(t); bridgeBack(g, x0); bridgeFront(g, x0);
+ gateWindow(g, { a: 1, h: o.glassH ?? 4.6, sign: o.sign ?? true });
+ gateLayer(g, t, Q);
+}
+function cabinScene(g, t, Q, o = {}) {
+ iso.g = g; iso.cam = o.cam || camAt(t);
+ apron(g, { stand: false });
+ typeAt(g, t, Q, o.type || []);
+ wing(g, -1);
+ nose(g, o.timer);
+ cabinBack(g, { decal: o.floorDecal });
+ seats(o.glow); bins(o.binOpen, o.binFull);
+ o.people?.();
+ iso.flush();
+ drawCases(g);
+ cabinFront(g);
+ aft(g);
+ wing(g, 1);
+ bridgeBack(g);
+ o.bridgePeople?.(); iso.flush();
+ bridgeFront(g);
+ const gl = o.glass ?? { a: 1, h: 1.1 }; if (gl.a > 0) gateWindow(g, gl);
+ gateLayer(g, t, Q);
+ if (o.lid) lid(g, o.lid);
+}
+const fmt = s => { s = Math.max(0, Math.round(s)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`; };
+function lidOpen(t, a, b) {
+ if (t < a) return { a: 1, rot: 0, dx: 0, dy: 0, dz: 0 };
+ if (t >= b) return null;
+ const m = a + (b - a) * .48, h = a + (b - a) * .64, flip = eio(seg(t, a, m)), go = ei(seg(t, h, b));
+ return { a: 1, rot: 2.75 * flip, dx: -4 * go, dy: -2.5 * go, dz: .25 * Math.sin(Math.PI * seg(t, a, m)) + 10 * go };
+}
+const floorTint = (y0, y1, col, a) => g2 => { g2.save(); g2.globalAlpha = a; fillPoly(g2, quad(rect(-xAt(PL.FLOOR) + .05, xAt(PL.FLOOR) - .05, y0, y1), PL.FLOOR + .002), col); g2.restore(); };
+const aisleBand = (y0, y1, a) => g2 => { if (a <= 0) return; g2.save(); g2.globalAlpha = a; fillPoly(g2, quad(rect(-AISLE + .02, AISLE - .02, y0, y1), PL.FLOOR + .003), C.accent); g2.restore(); };
+
+// ---------- the fourteen shots ----------
+function shot1(g, t, Q) { exterior(g, t, Q, { type: ['title'], sign: false }); }
+function shot2(g, t, Q) { exterior(g, t, Q, { type: ['title'], sign: t >= T.MOVE1 - .3 }); }
+function shot3(g, t, Q) {
+ const ts = simT(t);
+ cabinScene(g, t, Q, {
+ type: ['ft2'], timer: { s: '0:00' }, lid: lidOpen(t, T.LID0, T.LID1), glass: t < T.SETTLE ? { a: 1 - ss(seg(t, sh(3)[0], sh(3)[0] + .5)), h: 4.6 } : { a: ss(seg(t, T.SETTLE, T.RISE1)), h: 1.1 },
+ floorDecal: g2 => aisleBand(DOORY + .5, lerp(DOORY + .5, rowY(12) + .3, eo(seg(t, T.SETTLE - .2, T.SETTLE + .8))), .45 * ss(seg(t, T.SETTLE - .2, T.SETTLE + .2)))(g2),
+ people: () => queuePeople(ts, 'cabin'), bridgePeople: () => queuePeople(ts, 'bridge'),
+ });
+}
+function shot4(g, t, Q) { // one person stops to stow a bag (marked), the line behind stops
+ const u = t - sh(4)[0], P9 = RUN1.map(o => o.p), yS = rowY(9);
+ const su = seg(u, .4, 3.8), stop = ss(seg(u, 0, .5)), bside = 'ABC'.includes(P9[0].seat) ? -1 : 1;
+ cabinScene(g, t, Q, {
+ type: ['ft3'], timer: { s: fmt(72 + u * 4), hot: false }, binOpen: (r, s) => r === 9 && s === bside ? ss(seg(su, .15, .3)) * (1 - ss(seg(su, .9, 1))) : 0,
+ people: () => {
+ const st = stowState(P9[0], 9, P9[0].seat, su);
+ standing(P9[0], { x: 0, y: yS, z: PL.FLOOR }, { bag: su > 0 ? 0 : 1, lift: st.lift, caseUp: st.caseUp }, 1, ss(seg(u, .3, .6)));
+ for (let k = 1; k < 9; k++) standing(P9[k], qAt(sRow(9) - .75 * k - (1 - stop) * .5), { bag: 1, walking: stop < 1, phase: (u + k) * 3 });
+ [[10, 'A'], [12, 'F'], [11, 'C'], [12, 'D']].forEach(([r, s]) => seated(paxBySeat(r, s), SEATX[s], rowY(r)));
+ },
+ bridgePeople: () => { for (let k = 9; k < 14; k++) standing(P9[k], qAt(sRow(9) - .75 * k - (1 - stop) * .5), { bag: 1, walking: stop < 1, phase: (u + k) * 3 }); },
+ });
+}
+function shot5(g, t, Q) { // the rows called first all crowd the back stretch of the aisle
+ const ts = simT(t), a = ss(seg(t, sh(5)[0] + .3, sh(5)[0] + .9));
+ cabinScene(g, t, Q, {
+ type: ['ft5'], timer: { s: fmt(221 + (t - sh(5)[0]) * 6) }, binOpen: binOpenSim(ts),
+ floorDecal: floorTint(rowY(9) - .45, rowY(12) + .5, C.accentLt, .55 * a),
+ people: () => queuePeople(ts, 'cabin'), bridgePeople: () => queuePeople(ts, 'bridge'),
+ });
+}
+function shot6(g, t, Q) { // time-lapse: rows 9–12, then 1–4, then 5–8 fill; the timer stops on 6:54
+ const ts = simT(sh(6)[0] - .01), fu = seg(t, T.FAST0, T.FAST1), simA = 1 - ss(seg(t, T.FAST0, T.FAST0 + .3));
+ const tm = fmt(lerp(221 + (sh(6)[0] - sh(5)[0]) * 6, 414, ei(fu) * .3 + eo(fu) * .7));
+ cabinScene(g, t, Q, {
+ type: ['ft4'], timer: { s: tm, hot: t >= T.FAST1 },
+ people: () => {
+ if (simA > 0) queuePeople(ts, 'cabin', simA);
+ for (const p of PAX) {
+ if (FILL.seatedNow.has(p.i)) { seated(p, SEATX[p.seat], rowY(p.row)); continue; }
+ const k = FILL.rank.get(p.i) - FILL.nPre, n = 72 - FILL.nPre, tf = T.FAST0 + .1 + k / n * .9, v = ss(seg(t, tf, tf + .12));
+ if (v > 0) seated(p, SEATX[p.seat], rowY(p.row), v, v);
+ }
+ },
+ bridgePeople: () => { if (simA > 0) queuePeople(ts, 'bridge', simA); },
+ });
+}
+function shot7(g, t, Q) { // rewind to an empty cabin, then the new order lights up seat by seat
+ const ru = seg(t, T.REW0, T.REW0 + .6);
+ const lit = (r, s) => { const k = ORDER2.findIndex(([rr, ss2]) => rr === r && ss2 === s), tl = T.LIGHT0 + k * (1.45 / 72); return ss(seg(t, tl, tl + .12)); };
+ cabinScene(g, t, Q, {
+ type: ['ft7'], timer: { s: fmt(414 * (1 - ru)) }, glow: lit,
+ people: () => { for (const p of PAX) { const tr = T.REW0 + (1 - FILL.rank.get(p.i) / 72) * .5, v = 1 - ss(seg(t, tr, tr + .1)); if (v > 0) seated(p, SEATX[p.seat], rowY(p.row), v, v); } },
+ });
+}
+function shot8(g, t, Q) { exterior(g, t, Q, { type: [] }); }
+function shot9(g, t, Q) {
+ const people = [], arrows = [], open = new Map();
+ WAVES.forEach((w, k) => {
+ const X = WT[k];
+ w.forEach(([r, s]) => {
+ const p = paxBySeat(r, s), side = 'ABC'.includes(s) ? -1 : 1, key = r * 2 + (side > 0 ? 1 : 0);
+ if (t >= X.w3) { people.push(() => seated(p, SEATX[s], rowY(r))); return; }
+ if (X.fast) { // time-lapse: the arrow branches into the six rows and the six passengers settle into their seats
+ if (t < X.w0 - .12) return;
+ const a = ss(seg(t, X.w1, X.w3)); if (a > 0) people.push(() => seated(p, SEATX[s], rowY(r), 1, a));
+ arrows.push({ r, side, s, grow: ss(seg(t, X.w0 - .12, X.w1)), branch: ss(seg(t, X.w0, X.w1 + .06)), fade: 1 - ss(seg(t, X.w2, X.w3 + .15)) });
+ return;
+ }
+ // wave 1 walks in for real (≈ 2.2 m/s at most), stops at every other row at once, stows, sits
+ const D = rowY(12) - rowY(8.5), e = ss(seg(t, X.w0, X.w1)), y = rowY(r) - D * (1 - e);
+ if (t < X.w2) {
+ const u = seg(t, X.w1, X.w2), st = t >= X.w1 ? stowState(p, r, s, u) : { lift: 0, caseUp: true };
+ const pos = y >= DOORY ? { x: 0, y, z: PL.FLOOR } : qAt(sRow(r) - D * (1 - e));
+ people.push(() => standing(p, pos, { walking: t < X.w1, phase: (y + 20) / STRIDE * Math.PI, bag: t < X.w1 ? 1 : 0, lift: st.lift, caseUp: st.caseUp }));
+ if (t >= X.w1) open.set(key, ss(seg(u, .15, .3)) * (1 - ss(seg(u, .88, 1))));
+ } else { const u = seg(t, X.w2, X.w3); people.push(() => seatIn(p, r, s, u)); }
+ arrows.push({ r, side, s, grow: ss(seg(t, X.w0 - .15, X.w1)), branch: ss(seg(t, X.w1 - .1, X.w1 + .25)), fade: 1 - ss(seg(t, X.w2, X.w3 + .1)) });
+ });
+ });
+ cabinScene(g, t, Q, {
+ type: ['ft9'], timer: { s: fmt(216 * seg(t, T.WV0 + .3, WV_END)), hot: t >= WV_END }, binOpen: (r, side) => open.get(r * 2 + (side > 0 ? 1 : 0)) || 0,
+ floorDecal: g2 => weaveArrows(g2, arrows), people: () => people.forEach(f => f()), lid: lidOpen(t, T.WV0 - .05, T.WV0 + 1.0),
+ });
+}
+function weaveArrows(g, arrows) {
+ const z = PL.FLOOR + .004;
+ let far = -1, a = 0; for (const A of arrows) if (A.fade > 0 && A.grow > 0) { far = Math.max(far, lerp(DOORY + .4, rowY(A.r), A.grow)); a = Math.max(a, A.fade); }
+ if (far < 0) return;
+ g.save(); g.globalAlpha = a * .92; const hw = .09;
+ fillPoly(g, quad(rect(-hw, hw, DOORY + .4, far), z), C.accent);
+ for (const A of arrows) {
+ if (A.branch <= 0 || A.fade <= 0) continue;
+ g.globalAlpha = A.fade * .92;
+ const y = rowY(A.r) - .02, x1 = A.side * lerp(.05, Math.abs(SEATX[A.s]) - .1, A.branch), hl = .18 * A.side;
+ fillPoly(g, quad([[0, y - hw], [x1 - hl, y - hw], [x1 - hl, y - .2], [x1, y], [x1 - hl, y + .2], [x1 - hl, y + hw], [0, y + hw]], z), C.accent);
+ }
+ g.restore();
+}
+function shot10(g, t, Q) {
+ cabinScene(g, t, Q, { type: ['ft10'], timer: { s: '3:36', hot: true }, people: () => PAX.forEach(p => seated(p, SEATX[p.seat], rowY(p.row))) });
+}
+// 11: two bars painted on the concrete, lengths in proportion to 414 s and 216 s; the missing stretch of the short bar is marked
+const BAR = { y0: -14.4, k: 13.8 / 414, x1: -6.9, x2: -3.9, w: .8 };
+function bars(g, t) {
+ const L1 = 414 * BAR.k, L2 = 216 * BAR.k, g1 = eo(seg(t, T.BARS0, T.BARS0 + .55)), g2 = eo(seg(t, T.BARS0 + .35, T.BARS0 + .9));
+ const strip = (x, L, col, a = 1) => fillPoly(g, quad(rect(x - BAR.w, x, BAR.y0 - L, BAR.y0), .002), col, a);
+ if (g1 > 0) strip(BAR.x1, L1 * g1, C.ink, .9);
+ if (g2 > 0) strip(BAR.x2, L2 * g2, C.accent);
+ miniCabin(g, BAR.x1 - 1.95, BAR.y0 + 3.9, true, ss(seg(t, T.BARS0 - .1, T.BARS0 + .3)));
+ miniCabin(g, BAR.x2 - 1.95, BAR.y0 + 3.9, false, ss(seg(t, T.BARS0 + .2, T.BARS0 + .6)));
+ const p = eo(seg(t, T.BRACKET, T.BRACKET + .6)); if (p <= 0) return;
+ // the time saved: a dashed persimmon bracket alongside the short bar, from its end to where the long bar ends
+ const ya = BAR.y0 - L2, yb = ya - (L1 - L2) * p, x = BAR.x2 + .95;
+ g.save(); g.strokeStyle = C.accent; g.lineWidth = 3.5; g.lineCap = 'round';
+ g.setLineDash([10, 8]); g.beginPath(); g.moveTo(...iso.P(x, ya, .003)); g.lineTo(...iso.P(x, yb, .003)); g.stroke(); g.setLineDash([]);
+ g.beginPath(); g.moveTo(...iso.P(x - .35, ya, .003)); g.lineTo(...iso.P(x + .35, ya, .003));
+ if (p > .98) { g.moveTo(...iso.P(x - .35, yb, .003)); g.lineTo(...iso.P(x + .35, yb, .003)); }
+ g.stroke(); g.restore();
+}
+function miniCabin(g, x, y, queued, a) {
+ if (a <= 0) return;
+ g.save(); g.globalAlpha = a;
+ onPlane(g, x, y, .002, 'xy', g2 => {
+ g2.strokeStyle = C.ink; g2.lineWidth = .1; g2.beginPath(); g2.roundRect(0, 0, 3.4, 1.8, .8); g2.stroke();
+ g2.fillStyle = C.ink;
+ for (let i = 0; i < 6; i++) for (const v of [.28, .5, 1.3, 1.52]) g2.fillRect(.55 + i * .4, v - .08, .24, .15);
+ if (queued) for (let i = 0; i < 6; i++) { g2.beginPath(); g2.arc(.67 + i * .4, .9, .13, 0, TAU); g2.fill(); }
+ });
+ g.restore();
+}
+function shot11(g, t, Q) { exterior(g, t, Q, { type: ['b1', 'b2'], marks: g2 => bars(g2, t), glassH: 1.1 }); }
+// 12: the test itself — 72 passengers standing on the concrete in the cabin's own layout, 12 rows of 3 + 3
+const FORM = { x0: -14.6, y0: -12.2, dx: .62, dy: .95, gap: .7 };
+function formation(t) {
+ const u0 = T.FORM0;
+ for (let r = 1; r <= 12; r++) for (const s of 'ABCDEF') {
+ const c = 'ABCDEF'.indexOf(s), x = FORM.x0 + c * FORM.dx + (c >= 3 ? FORM.gap : 0), y = FORM.y0 - (12 - r) * FORM.dy;
+ const ta = u0 + (12 - r) * .06 + c * .015, a = ss(seg(t, ta, ta + .25));
+ if (a > 0) standing(paxBySeat(r, s), { x, y, z: 0 }, { bag: 0 }, a);
+ }
+}
+function shot12(g, t, Q) { // the bars fade as the camera pans to the formation
+ const fade = 1 - ss(seg(t, sh(12)[0], sh(12)[0] + .7));
+ exterior(g, t, Q, { type: ['ft12'], crowd: () => formation(t), glassH: 1.1, marks: g2 => { if (fade > 0) { g2.save(); g2.globalAlpha = fade; bars(g2, t); for (const k of ['b1', 'b2']) floorType(g2, t, PH[k], LAY[k], fade); g2.restore(); } } });
+}
+function shot13(g, t, Q) { // back in the aisle: the jammed stretch lit in persimmon
+ const ts = simT(t), a = ss(seg(t, T.BAND, T.BAND + .5));
+ cabinScene(g, t, Q, {
+ type: ['ft13'], timer: { s: '4:12' }, binOpen: binOpenSim(ts),
+ floorDecal: aisleBand(DOORY + .4, rowY(9) + .3, .8 * a), people: () => queuePeople(ts, 'cabin'), bridgePeople: () => queuePeople(ts, 'bridge'),
+ });
+}
+function shot14(g, t, Q) { exterior(g, t, Q, { type: ['end'], glassH: 1.1 }); }
+const SHOTS = [shot1, shot2, shot3, shot4, shot5, shot6, shot7, shot8, shot9, shot10, shot11, shot12, shot13, shot14];
+
+// ======================================================================
+export function render(g, t, Q) {
+ g.setTransform(1, 0, 0, 1, 0, 0); CASES = [];
+ let i = S.findIndex(([a, b]) => t >= a && t < b); if (i < 0) i = S.length - 1;
+ SHOTS[i](g, t, Q);
+ if (!Q.has('nosub')) subtitles(g, t, CUES);
+}
+
+// ---------- readcheck: the world text meant to be read (the subtitle cues follow the narration and go to the .srt) ----------
+function planeBox(x, y, z, plane, u0, u1, v0, v1) {
+ const P = (u, v) => plane === 'yz' ? iso.P(x, y - u, z - v) : iso.P(x + v, y - u, z);
+ const pts = [P(u0, v0), P(u1, v0), P(u0, v1), P(u1, v1)];
+ return { x0: Math.min(...pts.map(p => p[0])), x1: Math.max(...pts.map(p => p[0])), y0: Math.min(...pts.map(p => p[1])), y1: Math.max(...pts.map(p => p[1])) };
+}
+const KEYS = [['title'], ['title', 'ft1'], ['ft2'], ['ft3'], ['ft5'], ['ft4'], ['ft4', 'ft7'], ['ft8'], ['ft9'], ['ft10'], ['b1', 'b2'], ['ft12'], ['ft13'], ['end']];
+export function texts(t) {
+ const out = []; iso.cam = camAt(t);
+ let i = S.findIndex(([a, b]) => t >= a && t < b); if (i < 0) i = S.length - 1;
+ for (const k of KEYS[i]) {
+ const P = PH[k], L = LAY[k]; if (t < L[0].tc || t >= P.t1) continue;
+ for (const li of [...new Set(L.map(c => c.li))]) out.push({ id: `${k}.${li}`, text: L.filter(c => c.li === li).map(c => c.ch).join(''), ...phraseBox(P, L, li) });
+ }
+ if (i === 1 && t >= T.MOVE1) {
+ const D = DOOR_SIGN; out.push({ id: 'doorSign', text: 'B12 登机口 GATE', ...planeBox(D.x, D.y, D.z, 'yz', 0, D.w, -D.h, 0) });
+ if (t >= T.SIGN) { const s = SIGN(0); out.push({ id: 'sign0', text: '9–12 排 ROWS 9–12', ...planeBox(s.x + .035, s.y + .64, GZ + 1.75, 'yz', 0, 1.3, 0, .62) }); }
+ }
+ if (i === 7) {
+ let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9;
+ for (let k = 0; k < 6; k++) { const q = sqPos(k), b = planeBox(q.x + .62, q.y + .2, GZ, 'xy', 0, .75, -.34, 0); x0 = Math.min(x0, b.x0); y0 = Math.min(y0, b.y0); x1 = Math.max(x1, b.x1); y1 = Math.max(y1, b.y1); }
+ out.push({ id: 'squares', text: ORDER2.slice(0, 6).map(([r, s]) => `${r}${s}`).join(' '), x0, y0, x1, y1 });
+ }
+ return out;
+}
+export const CUE_LIST = CUES;
+export const subtitleBoxes = g => CUES.map(c => subtitleBox(g, c));
+
+// ---------- sound cues (events.json) ----------
+export function events() {
+ const ev = [], E = (t, type, o = {}) => ev.push({ t: +t.toFixed(3), type, ...o });
+ E(0, 'timeline', { T: { ...T, WV_END, DUR }, S, VO, VO_DUR });
+ E(0, 'taxi'); E(2.8, 'brake'); E(2.7, 'bridge_move'); E(3.4, 'dock');
+ E(T.MOVE0, 'swish'); E(T.CHIME, 'chime'); E(T.SIGN, 'sign');
+ for (const o of RUN1) if (o.ts < sh(3)[0]) E(o.ts, 'stand', { q: o.q });
+ E(T.LID0, 'lid_open'); E(T.LID0 + 1.2, 'lid_rest'); E(T.SETTLE - .1, 'aisle_light');
+ E(sh(4)[0] + .5, 'stop_mark'); E(sh(4)[0] + 1.0, 'bin_slap');
+ E(T.FAST0, 'fast'); E(T.FAST1, 'stop', { tm: '6:54' });
+ E(T.REW0, 'rewind'); E(T.LIGHT0, 'lights');
+ E(sh(8)[0], 'chime'); E(T.WV0 - .05, 'lid_open');
+ WT.forEach((X, k) => { E(X.w1, 'wave', { k, fast: X.fast }); E(X.w2, 'bins_shut', { k }); E(X.w3, 'seated', { k }); });
+ E(WV_END, 'stop', { tm: '3:36' });
+ E(sh(11)[0], 'pull'); E(T.BARS0, 'bar'); E(T.BARS0 + .35, 'bar'); E(T.BRACKET, 'bracket');
+ E(sh(12)[0], 'swish'); E(T.FORM0, 'crowd'); E(sh(13)[0], 'cut_in'); E(T.BAND, 'band');
+ for (const k of Object.keys(PH)) LAY[k].forEach((c, i) => E(c.tc, 'char', { p: k, i, big: c.size >= 1.4, acc: c.col === C.accent }));
+ CUES.forEach((c, i) => E(VO[i], 'vo', { id: `V${String(i + 1).padStart(2, '0')}`, dur: VO_DUR[i] }));
+ return ev.sort((a, b) => a.t - b.t);
+}
+export const TIMES = T, SHOT_LIST = S;
diff --git a/styles/isometric-picture-book/demo/fonts/OFL-Newsreader.txt b/styles/isometric-picture-book/demo/fonts/OFL-Newsreader.txt
new file mode 100644
index 0000000..d2d4f40
--- /dev/null
+++ b/styles/isometric-picture-book/demo/fonts/OFL-Newsreader.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
\ No newline at end of file
diff --git a/styles/isometric-picture-book/demo/fonts/OFL-NotoSerifSC.txt b/styles/isometric-picture-book/demo/fonts/OFL-NotoSerifSC.txt
new file mode 100644
index 0000000..d952d62
--- /dev/null
+++ b/styles/isometric-picture-book/demo/fonts/OFL-NotoSerifSC.txt
@@ -0,0 +1,92 @@
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/styles/isometric-picture-book/demo/index.html b/styles/isometric-picture-book/demo/index.html
new file mode 100644
index 0000000..b734451
--- /dev/null
+++ b/styles/isometric-picture-book/demo/index.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<html><head><meta charset="utf-8"><title>七十二个座位</title>
+<style>
+@font-face{font-family:'NotoSerifSC';src:url('fonts/NotoSerifSC-sub.ttf') format('truetype');font-weight:200 900;}
+@font-face{font-family:'Newsreader';src:url('fonts/Newsreader-VF.ttf') format('truetype');font-weight:200 800;}
+html,body{margin:0;background:#F1E8D8;overflow:hidden}canvas{position:absolute;left:0;top:0;display:block;width:100vw;height:100vh}
+</style>
+</head><body><canvas id="c" width="1920" height="1080"></canvas>
+<script type="module" src="main.js"></script></body></html>
diff --git a/styles/isometric-picture-book/demo/kit.js b/styles/isometric-picture-book/demo/kit.js
new file mode 100644
index 0000000..a2e3232
--- /dev/null
+++ b/styles/isometric-picture-book/demo/kit.js
@@ -0,0 +1,174 @@
+// Style kit for "Isometric Picture-book Explainer": palette, plane drawing, floor type, people, subtitles.
+// engine.js is the iso-infographic engine.
+import { Iso, mix, hex, css, rgb, C30, S30, TAU, clamp, lerp, seg, ss, eo, eio, hash } from './engine.js';
+export { Iso, mix, hex, css, rgb, C30, S30, TAU, clamp, lerp, seg, ss, eo, eio, hash };
+// three tones per solid: top lifted toward warm paper, the +x face dropped toward a warm umber (never toward grey or violet)
+export function tri(c, lift = .22, drop = .2) { return [hex(mix(c, '#FFF8EA', lift)), hex(rgb(c)), hex(mix(c, '#5B4434', drop))]; }
+export const W = 1920, H = 1080;
+export const ei = t => { t = clamp(t); return t * t * t; };
+
+// ---------- palette (apricot warm: one ink, one accent for the rule, one subject green, one marking ginger) ----------
+export const C = {
+ bg: '#F1E8D8', paper: '#FAF4E8', ink: '#2A2E29', soft: '#7A7468', ghost: '#D6CCBA',
+ accent: '#D0573A', accentLt: '#EDBFA9', green: '#3D6B59', greenMid: '#6E9886', greenLt: '#A7C2B2', ginger: '#E2AE3A',
+ hair: '#2A2624', skin: '#D9A882', dark: '#3A3E3B',
+ apron: '#EAE2D3', apronJoint: '#DDD3C1', carpet: '#F2E5CE', carpetLane: '#EADAC0', carpetEdge: '#DCCAAC',
+ body: '#F6F2EA', belly: '#E4DDD1', cabinFloor: '#E3D3B8', aisle: '#F5ECDC', wallIn: '#F7F1E6',
+ glass: '#C3D8D1', metal: '#CEC7BA', screen: '#2F3532',
+};
+// people: four muted tops (the weave reads in these four colours)
+export const TOPS = ['#B9824F', '#7F98AE', '#8C8199', '#D3C29E'];
+export const LEGS = ['#3E4450', '#59534A', '#3A3D42', '#4B4F5A'];
+
+export const font = (w, px, fam = 'NotoSerifSC') => `${w} ${px}px ${fam}`;
+export function track(g, s, x, y, sp) { let cx = x; for (const ch of s) { g.fillText(ch, cx, y); cx += g.measureText(ch).width + sp; } return cx - x - sp; }
+export function trackW(g, s, sp) { let w = 0; for (const ch of s) w += g.measureText(ch).width + sp; return w - sp; }
+
+export const iso = new Iso(null, W, H);
+
+// ---------- plane drawing ----------
+// world plane: 'xy' floor (u = −y, v = +x), 'yz' wall facing +x (u = −y, v = −z), 'xz' wall facing +y (u = +x, v = −z)
+export function onPlane(g, x, y, z, plane, fn) {
+ const k = iso.cam.k, [sx, sy] = iso.P(x, y, z);
+ const u = plane === 'xz' ? [C30, S30] : [C30, -S30], v = plane === 'xy' ? [C30, S30] : [0, 1];
+ g.save(); g.setTransform(u[0] * k, u[1] * k, v[0] * k, v[1] * k, sx, sy); fn(g); g.restore();
+}
+export const quad = (pts, z) => pts.map(p => iso.P(p[0], p[1], z));
+export function fillPoly(g, pts, col, a = 1) { g.beginPath(); pts.forEach((p, i) => i ? g.lineTo(p[0], p[1]) : g.moveTo(p[0], p[1])); g.closePath(); g.fillStyle = typeof col === 'string' ? col : css(col); const a0 = g.globalAlpha; g.globalAlpha = a0 * a; g.fill(); g.globalAlpha = a0; }
+export const rect = (x0, x1, y0, y1) => [[x0, y0], [x1, y0], [x1, y1], [x0, y1]];
+export function tracePath(g, pts, p) { // stroke a screen polyline up to fraction p
+ let L = 0; const d = []; for (let i = 1; i < pts.length; i++) { const l = Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]); d.push(l); L += l; }
+ let rem = L * p; g.beginPath(); g.moveTo(...pts[0]);
+ for (let i = 1; i < pts.length && rem > 0; i++) { const f = Math.min(1, rem / d[i - 1]); g.lineTo(lerp(pts[i - 1][0], pts[i][0], f), lerp(pts[i - 1][1], pts[i][1], f)); rem -= d[i - 1]; }
+ g.stroke();
+}
+// a 3D facet in world metres, flat-toned by its normal (top / +y / +x), culled when it faces away
+export function facet(g, pts, t3, o = {}) {
+ const a = pts[0], b = pts[1], c = pts[2];
+ let n = [(b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]), (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]), (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])];
+ if (o.out && n[0] * o.out[0] + n[1] * o.out[1] + n[2] * o.out[2] < 0) n = n.map(v => -v);
+ if (!o.both && n[0] + n[1] + n[2] <= 1e-9) return false;
+ const L = Math.hypot(...n) || 1; n = n.map(v => v / L);
+ let col = o.color;
+ if (!col) { const T = typeof t3 === 'string' ? tri(t3) : t3; col = n[2] > .8 ? T[0] : n[2] > .42 ? hex(mix(T[0], n[0] > n[1] ? T[2] : T[1], .5)) : (n[0] > n[1] ? T[2] : T[1]); }
+ fillPoly(g, pts.map(p => iso.P(p[0], p[1], p[2])), col, o.a ?? 1);
+ return true;
+}
+
+// ---------- floor type: phrases of segments [text, kind]; B big ink, A big accent, s small, n/na numerals (Latin serif) ----------
+const SZ = { B: [700, 1.5, C.ink], A: [700, 1.5, C.accent], s: [500, .82, C.ink], n: [600, 1.5, C.ink, 'Newsreader'], na: [600, 1.5, C.accent, 'Newsreader'], ns: [500, .82, C.ink, 'Newsreader'], nsa: [600, .95, C.accent, 'Newsreader'], en: [500, .62, C.soft, 'Newsreader'], e: [600, 1.0, C.ink, 'Newsreader'] };
+let _mg = null;
+export function measure(w, s, fam) { if (!_mg) _mg = new OffscreenCanvas(8, 8).getContext('2d'); _mg.font = font(w, 100, fam); return _mg.measureText(s).width; }
+// P = {id, x, y, z, t0, t1 (fade start), step, lineGap, dv, scale, lines, indent}
+export function phraseLayout(P) {
+ const out = []; let tc = P.t0; const sc = P.scale || 1;
+ P.lines.forEach((line, li) => {
+ let u = (li ? (P.indent ?? .55) : 0) * sc; const v = li * (P.dv || 1.85) * sc;
+ for (const [s, k] of line) {
+ const [w, size0, col, fam] = SZ[k], size = size0 * sc;
+ const units = fam ? [s] : [...s]; // numbers/latin set as one run
+ for (const ch of units) { if (ch === ' ') { u += .3 * sc; continue; } const cw = measure(w, ch, fam) * size / 100; out.push({ ch, u, v, w, size, col, cw, tc, fam, li }); u += cw + .05 * sc; tc += (P.step || .14) * (fam ? 2 : 1); }
+ }
+ tc += P.lineGap ?? .2;
+ });
+ return out;
+}
+export function floorType(g, t, P, L, alpha = 1) {
+ const fade = (1 - ss(seg(t, P.t1, P.t1 + .3))) * alpha; if (fade <= 0) return;
+ for (const c of L) {
+ const a = eo(seg(t, c.tc, c.tc + .3)); if (a <= 0) continue;
+ const dk = ss(seg(t, c.tc + .1, c.tc + .48)), sc = lerp(1.22, 1, eo(seg(t, c.tc, c.tc + .34)));
+ onPlane(g, P.x + c.v, P.y - c.u, P.z ?? 0, 'xy', g2 => {
+ g2.globalAlpha = a * fade; g2.font = font(c.w, 100, c.fam); g2.textBaseline = 'alphabetic';
+ g2.fillStyle = css(mix(c.col === C.accent ? C.accentLt : C.ghost, c.col, dk));
+ const s = c.size / 100, mw = measure(c.w, c.ch, c.fam);
+ g2.translate(c.cw / 2, -c.size * .38); g2.scale(s * sc, s * sc); g2.translate(-mw / 2, c.size * .38 / s);
+ g2.fillText(c.ch, 0, 0);
+ });
+ }
+}
+export function phraseBox(P, L, li) {
+ let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9;
+ for (const c of L) if (li == null || c.li === li) for (const [du, dv] of [[0, 0], [c.cw, 0], [0, -c.size], [c.cw, -c.size]]) { const [sx, sy] = iso.P(P.x + c.v + dv, P.y - c.u - du, P.z ?? 0); x0 = Math.min(x0, sx); y0 = Math.min(y0, sy); x1 = Math.max(x1, sx); y1 = Math.max(y1, sy); }
+ return { x0, y0, x1, y1 };
+}
+// world-space extent of a phrase on the floor: [xmin, xmax, ymin, ymax]
+export function phraseWorld(P, L) {
+ let x0 = 1e9, x1 = -1e9, y0 = 1e9, y1 = -1e9;
+ for (const c of L) { x0 = Math.min(x0, P.x + c.v - c.size); x1 = Math.max(x1, P.x + c.v); y0 = Math.min(y0, P.y - c.u - c.cw); y1 = Math.max(y1, P.y - c.u); }
+ return [x0, x1, y0, y1];
+}
+
+// ---------- people: billboards in metres, seen from behind; no faces, no hands ----------
+// pose s: {phase, walking, bag (0 none, 1 rolling case), lift 0..1 (case raised overhead), sit}
+export function drawPerson(g, p, s = {}) {
+ const h = p.h, sw = s.walking ? Math.sin(s.phase) : 0, bob = s.walking ? Math.abs(Math.cos(s.phase)) * .012 * h : 0;
+ const B = tri(p.top, .18, .26), Lg = p.legs, Ld = hex(mix(Lg, '#15171A', .25));
+ g.save(); g.translate(0, -bob);
+ if (s.bag && !s.lift) caseRoll(g, h, p);
+ const leg = (hx, fx, col) => { g.beginPath(); g.moveTo(hx - .034 * h, -.49 * h); g.lineTo(hx + .034 * h, -.49 * h); g.lineTo(fx + .028 * h, -.02 * h); g.lineTo(fx - .028 * h, -.02 * h); g.closePath(); g.fillStyle = col; g.fill(); g.beginPath(); g.ellipse(fx - .008 * h, -.012 * h, .04 * h, .016 * h, 0, 0, TAU); g.fillStyle = '#232524'; g.fill(); };
+ leg(.04 * h, .045 * h - sw * .1 * h, Ld); leg(-.04 * h, -.045 * h + sw * .1 * h, Lg);
+ if (p.skirt) { const S = tri(p.skirt, .15, .25); g.beginPath(); g.moveTo(-.1 * h, -.62 * h); g.lineTo(.1 * h, -.62 * h); g.lineTo(.15 * h, -.38 * h); g.lineTo(-.15 * h, -.38 * h); g.closePath(); g.fillStyle = S[1]; g.fill(); }
+ const lift = s.lift || 0;
+ const arm = (sx, swing, col) => { g.save(); g.translate(sx, -.79 * h); g.rotate(swing); g.fillStyle = col; g.beginPath(); g.roundRect(-.026 * h, 0, .052 * h, .3 * h, .026 * h); g.fill(); g.restore(); };
+ arm(.125 * h, lerp(-sw * .22 + .04, -2.9, lift), B[2]);
+ g.beginPath(); g.moveTo(-.105 * h, -.5 * h); g.lineTo(-.12 * h, -.78 * h); g.quadraticCurveTo(-.12 * h, -.81 * h, -.09 * h, -.815 * h); g.lineTo(.09 * h, -.815 * h); g.quadraticCurveTo(.12 * h, -.81 * h, .12 * h, -.78 * h); g.lineTo(.105 * h, -.5 * h); g.closePath(); g.fillStyle = B[1]; g.fill();
+ g.beginPath(); g.moveTo(.03 * h, -.5 * h); g.lineTo(.03 * h, -.815 * h); g.lineTo(.09 * h, -.815 * h); g.quadraticCurveTo(.12 * h, -.81 * h, .12 * h, -.78 * h); g.lineTo(.105 * h, -.5 * h); g.closePath(); g.fillStyle = B[2]; g.fill();
+ arm(-.125 * h, lerp(sw * .22 - .04, 2.9, lift), B[1]);
+ head(g, h, p);
+ if (lift && s.caseUp !== false) { const y = lerp(-.62, -1.22, lift) * h; caseBox(g, 0, y, h, p); }
+ g.restore();
+}
+function head(g, h, p) {
+ g.fillStyle = hex(mix(C.skin, '#5A3A2A', .15)); g.fillRect(-.022 * h, -.85 * h, .044 * h, .05 * h);
+ if (p.hairLong) { g.beginPath(); g.roundRect(-.07 * h, -.9 * h, .14 * h, .17 * h, .05 * h); g.fillStyle = C.hair; g.fill(); }
+ g.beginPath(); g.arc(0, -.885 * h, .066 * h, 0, TAU); g.fillStyle = C.hair; g.fill();
+ g.beginPath(); g.ellipse(-.058 * h, -.872 * h, .012 * h, .02 * h, 0, 0, TAU); g.fillStyle = C.skin; g.fill();
+}
+function caseRoll(g, h, p) { // small rolling case at the person's right, handle up
+ const c = tri(p.bagc || '#5E6660', .2, .25);
+ g.fillStyle = '#4A4E4B'; g.fillRect(.205 * h, -.62 * h, .012 * h, .3 * h);
+ g.beginPath(); g.roundRect(.15 * h, -.34 * h, .14 * h, .32 * h, .02 * h); g.fillStyle = c[1]; g.fill();
+ g.fillStyle = c[2]; g.fillRect(.25 * h, -.34 * h, .04 * h, .32 * h);
+}
+export function caseBox(g, x, y, h, p) { const c = tri(p.bagc || '#5E6660', .2, .25); g.beginPath(); g.roundRect(x - .16 * h, y - .1 * h, .32 * h, .2 * h, .02 * h); g.fillStyle = c[1]; g.fill(); g.fillStyle = c[0]; g.fillRect(x - .16 * h, y - .1 * h, .32 * h, .045 * h); }
+// seated, seen from behind and above: shoulders and the back of the head (the seat back hides the rest)
+export function drawSeated(g, p, s = {}) {
+ const B = tri(p.top, .18, .26), sink = s.sink ?? 0;
+ g.save(); g.translate(0, sink);
+ g.beginPath(); g.moveTo(-.22, -.5); g.lineTo(-.23, -.93); g.quadraticCurveTo(-.22, -1.0, -.15, -1.01); g.lineTo(.15, -1.01); g.quadraticCurveTo(.22, -1.0, .23, -.93); g.lineTo(.22, -.5); g.closePath(); g.fillStyle = B[1]; g.fill();
+ g.beginPath(); g.moveTo(.05, -.5); g.lineTo(.05, -1.01); g.lineTo(.15, -1.01); g.quadraticCurveTo(.22, -1.0, .23, -.93); g.lineTo(.22, -.5); g.closePath(); g.fillStyle = B[2]; g.fill();
+ g.fillStyle = hex(mix(C.skin, '#5A3A2A', .15)); g.fillRect(-.04, -1.07, .08, .08);
+ if (p.hairLong) { g.beginPath(); g.roundRect(-.12, -1.2, .24, .25, .08); g.fillStyle = C.hair; g.fill(); }
+ g.beginPath(); g.arc(0, -1.15, .11, 0, TAU); g.fillStyle = C.hair; g.fill();
+ g.restore();
+}
+
+// ---------- subtitles: one cue per narration line, Chinese above, English below, on a pale bar in the lower safe area ----------
+export const SUB = { cn: 34, en: 25, y: 1022, pad: 18 }; // y = baseline of the English line (≥ 54 px from the bottom edge)
+export function subtitles(g, t, cues) {
+ for (const s of cues) {
+ if (t < s.t0 || t >= s.t1) continue; // hard switch: one cue at a time, no cross-fade
+ g.save();
+ g.font = font(500, SUB.cn); const wc = g.measureText(s.cn).width; g.font = font(420, SUB.en, 'Newsreader'); const we = g.measureText(s.en).width;
+ const w = Math.max(wc, we) + 2 * SUB.pad, top = SUB.y - SUB.en - SUB.cn - 22;
+ g.fillStyle = 'rgba(250,245,236,.86)'; g.beginPath(); g.roundRect(W / 2 - w / 2, top, w, SUB.y + 14 - top, 6); g.fill();
+ g.textAlign = 'center'; g.textBaseline = 'alphabetic';
+ g.fillStyle = C.ink; g.font = font(500, SUB.cn); g.fillText(s.cn, W / 2, SUB.y - SUB.en - 12);
+ g.fillStyle = '#4A4A42'; g.font = font(420, SUB.en, 'Newsreader'); g.fillText(s.en, W / 2, SUB.y);
+ g.restore();
+ }
+}
+export function subtitleBox(g, s) { // screen box of a cue (for the margin check)
+ g.save(); g.font = font(500, SUB.cn); const wc = g.measureText(s.cn).width; g.font = font(420, SUB.en, 'Newsreader'); const we = g.measureText(s.en).width; g.restore();
+ const w = Math.max(wc, we) + 2 * SUB.pad; return { x0: W / 2 - w / 2, x1: W / 2 + w / 2, y0: SUB.y - SUB.en - SUB.cn - 22, y1: SUB.y + 14 };
+}
+// ---------- English subtitle bar (single line) ----------
+export function subtitle(g, t, subs) {
+ for (const s of subs) {
+ const a = ss(seg(t, s.t0, s.t0 + .22)) * (1 - ss(seg(t, s.t1 - .18, s.t1))); if (a <= 0) continue;
+ g.save(); g.globalAlpha = a; g.font = font(420, 32, 'Newsreader'); const w = g.measureText(s.text).width;
+ g.fillStyle = 'rgba(247,241,230,.9)'; g.beginPath(); g.roundRect(W / 2 - w / 2 - 20, 1008 - 30, w + 40, 52, 4); g.fill();
+ g.fillStyle = C.ink; g.textAlign = 'center'; g.textBaseline = 'middle'; g.fillText(s.text, W / 2, 1008 - 3); g.restore();
+ }
+}
diff --git a/styles/isometric-picture-book/demo/lines.json b/styles/isometric-picture-book/demo/lines.json
new file mode 100644
index 0000000..8cf601d
--- /dev/null
+++ b/styles/isometric-picture-book/demo/lines.json
@@ -0,0 +1,60 @@
+[
+ {
+ "id": "V01",
+ "text": "每次登机,为什么总要排那么久?"
+ },
+ {
+ "id": "V02",
+ "text": "让后排乘客先上,听起来很合理,后排坐好了,就不会挡着前排的路。"
+ },
+ {
+ "id": "V03",
+ "text": "可机舱里只有一条过道,窄得只够一个人走。"
+ },
+ {
+ "id": "V04",
+ "text": "只要前面有一个人停下来放箱子,后面所有人都得干等着。"
+ },
+ {
+ "id": "V05",
+ "text": "因为叫的都是相邻那几排,大家全挤在同一个地方,只能一个接一个来。",
+ "say": "因为叫的,都是相邻那几排,大家全挤在,同一个地方,只能一个接一个来。",
+ "asr": "因为叫的都是相邻那几排,大家拳击在同一个地方,只能一个接一个来。"
+ },
+ {
+ "id": "V06",
+ "text": "全部坐满,足足用了六分五十四秒。",
+ "asr": "全部坐满,足足用了6分54秒。"
+ },
+ {
+ "id": "V07",
+ "text": "那如果换个顺序呢?"
+ },
+ {
+ "id": "V08",
+ "text": "让靠窗的人先上,而且前后两个人之间,刚好隔开一排。"
+ },
+ {
+ "id": "V09",
+ "text": "这样一来,六个人就能同时在六个不同的排数放箱子,谁也不挡谁的路。"
+ },
+ {
+ "id": "V10",
+ "text": "结果全部坐满,只花了三分三十六秒。",
+ "asr": "结果全部坐满,只花了3分36秒。"
+ },
+ {
+ "id": "V11",
+ "text": "足足快了三分多钟,时间缩短了将近一半。"
+ },
+ {
+ "id": "V12",
+ "text": "这是2012年,研究人员找来七十二名乘客做过的真实测试。",
+ "say": "这是二零一二年,研究人员找来七十二名乘客做过的真实测试。",
+ "asr": "这是2012年,研究人员找来72名乘客做过的真实测试。"
+ },
+ {
+ "id": "V13",
+ "text": "原来登机慢,根本不是因为人多,而是把所有人都堵在了同一段过道上。"
+ }
+]
\ No newline at end of file
diff --git a/styles/isometric-picture-book/demo/lines_en.json b/styles/isometric-picture-book/demo/lines_en.json
new file mode 100644
index 0000000..cb63c2a
--- /dev/null
+++ b/styles/isometric-picture-book/demo/lines_en.json
@@ -0,0 +1,60 @@
+[
+ {
+ "id": "V01",
+ "text": "Why does boarding always take so long?"
+ },
+ {
+ "id": "V02",
+ "text": "Back rows first sounds sensible: once they sit down, they are out of everyone’s way.",
+ "say": "Back rows first... sounds sensible: once they sit down, they are, out of everyone's way.",
+ "rate": "+25%"
+ },
+ {
+ "id": "V03",
+ "text": "But the cabin has one aisle, just wide enough for one person."
+ },
+ {
+ "id": "V04",
+ "text": "When one person stops to stow a bag, everyone behind has to wait."
+ },
+ {
+ "id": "V05",
+ "text": "They were called for the same few rows, so they crowd one spot and go one by one."
+ },
+ {
+ "id": "V06",
+ "text": "Filling every seat took a full 6 minutes 54 seconds.",
+ "rate": "+20%"
+ },
+ {
+ "id": "V07",
+ "text": "What if we change the order?"
+ },
+ {
+ "id": "V08",
+ "text": "Window seats first, and each person sits one row apart from the next in line.",
+ "rate": "+25%"
+ },
+ {
+ "id": "V09",
+ "text": "Now six people stow bags in six different rows at once, and nobody blocks anybody."
+ },
+ {
+ "id": "V10",
+ "text": "Every seat was filled in just 3 minutes 36 seconds."
+ },
+ {
+ "id": "V11",
+ "text": "More than three minutes faster: nearly half the time."
+ },
+ {
+ "id": "V12",
+ "text": "This was a real test, run in 2012 with 72 passengers.",
+ "say": "This was a real test, run in twenty twelve with 72 passengers.",
+ "asr": "This was a real test, run in 2012 with 72 passengers."
+ },
+ {
+ "id": "V13",
+ "text": "Boarding is slow not because of crowds, but because everyone is stuck in the same stretch of aisle."
+ }
+]
\ No newline at end of file
diff --git a/styles/isometric-picture-book/demo/main.js b/styles/isometric-picture-book/demo/main.js
new file mode 100644
index 0000000..21fb354
--- /dev/null
+++ b/styles/isometric-picture-book/demo/main.js
@@ -0,0 +1,12 @@
+const Q = new URLSearchParams(location.search);
+const cv = document.getElementById('c'), g = cv.getContext('2d');
+const CJK = '七十二个座位后排先上只有一条过道够人走停面全等挤在同处坐满换顺序靠窗隔开六时放快了三分多钟名乘客登机口';
+await Promise.all([
+ document.fonts.load('500 40px NotoSerifSC', CJK), document.fonts.load('700 40px NotoSerifSC', CJK),
+ document.fonts.load('400 40px Newsreader'), document.fonts.load('500 40px Newsreader'), document.fonts.load('600 40px Newsreader'), document.fonts.load('700 40px Newsreader'),
+]);
+const film = await import('./film.js');
+window.DUR = film.DUR; window.T = film.TIMES; window.SHOTS = film.SHOT_LIST; window.EV = film.events(); window.TEXTS = film.texts;
+window.render = t => { g.setTransform(1, 0, 0, 1, 0, 0); g.globalAlpha = 1; film.render(g, t, Q); };
+window.SUBBOX = () => film.subtitleBoxes(g).map((b, i) => ({ ...b, t0: film.CUE_LIST[i].t0, t1: film.CUE_LIST[i].t1 }));
+window.READY = true;
diff --git a/styles/isometric-picture-book/demo/places.js b/styles/isometric-picture-book/demo/places.js
new file mode 100644
index 0000000..7d73e77
--- /dev/null
+++ b/styles/isometric-picture-book/demo/places.js
@@ -0,0 +1,160 @@
+// Places: the apron (concrete, guide line, stop bar) and the gate inside the terminal (floor at z 2.3, cut away above).
+import { C, W, H, iso, tri, mix, hex, css, TAU, clamp, lerp, seg, ss, eo, fillPoly, onPlane, rect, quad } from './kit.js';
+import { BR } from './plane.js';
+
+// ---------- apron ----------
+export function apron(g, o = {}) {
+ g.fillStyle = C.apron; g.fillRect(0, 0, W, H);
+ g.save(); g.strokeStyle = C.apronJoint; g.lineWidth = 1; g.globalAlpha = .7; g.beginPath(); // concrete slab joints, 5 m
+ for (let x = -60; x <= 60; x += 5) { const a = iso.P(x, -80, 0), b = iso.P(x, 80, 0); g.moveTo(...a); g.lineTo(...b); }
+ for (let y = -80; y <= 80; y += 5) { const a = iso.P(-60, y, 0), b = iso.P(60, y, 0); g.moveTo(...a); g.lineTo(...b); }
+ g.stroke(); g.restore();
+ fillPoly(g, quad(rect(-.12, .12, -8.1, 60), .001), C.ginger); // lead-in line on the stand centreline
+ if (o.stand !== false) fillPoly(g, quad(rect(-1.6, 1.6, -8.25, -7.95), .001), C.ginger); // stop bar ahead of the nose
+ // the neighbouring stand B11 (empty) and the service road: background detail, all in the marking colour, kept thin
+ fillPoly(g, quad(rect(-24.12, -23.88, -8.1, 60), .001), C.ginger, .8);
+ fillPoly(g, quad(rect(-25.6, -22.4, -8.25, -7.95), .001), C.ginger, .8);
+ g.save(); g.strokeStyle = 'rgba(250,246,238,.95)'; g.lineWidth = 2; g.setLineDash([12, 10]);
+ for (const x of [-20.2, -18.9]) { g.beginPath(); g.moveTo(...iso.P(x, -60, .001)); g.lineTo(...iso.P(x, 60, .001)); g.stroke(); }
+ g.restore();
+}
+// a parked baggage tractor with three carts on the service road (background)
+export function bagTrain(g, x, y) {
+ iso.boxNow(x - .6, y - 1.6, .2, 1.2, 1.6, .7, tri(C.ginger, .25, .2));
+ iso.boxNow(x - .5, y - 1.5, .9, 1.0, .7, .55, tri('#E9E2D4', .3, .18), { faceColor: { 2: '#A9BDB5', 1: '#B9CBC4' } });
+ for (let k = 0; k < 3; k++) {
+ const yy = y + .4 + k * 2.4;
+ iso.boxNow(x - .7, yy, .35, 1.4, 2.0, .12, tri('#B9B2A5', .25, .2));
+ iso.boxNow(x - .62, yy + .1, .47, 1.24, 1.8, .55, tri(['#7F98AE', '#B9824F', '#8C8199'][k], .25, .2));
+ }
+}
+
+// ---------- gate ----------
+export const GZ = 2.3, WALLX = 9.5;
+// three painted lanes parallel to the glass, entrances at +y, all leading up to the door
+export const LANES = [{ x0: WALLX + .45, x1: WALLX + 1.4, label: '9–12', en: 'ROWS 9–12' }, { x0: WALLX + 1.6, x1: WALLX + 2.55, label: '1–4', en: 'ROWS 1–4' }, { x0: WALLX + 2.75, x1: WALLX + 3.7, label: '5–8', en: 'ROWS 5–8' }];
+export const LANE_Y = [-.35, 9.6];
+export const laneX = i => (LANES[i].x0 + LANES[i].x1) / 2;
+export const LANE1X = laneX(0);
+export const CHAIR_X = [WALLX + 4.6, WALLX + 6.4, WALLX + 8.2], CHAIR_Y0 = .9, CHAIR_DY = .62;
+export const chairPos = i => ({ x: CHAIR_X[Math.floor(i / 24)], y: CHAIR_Y0 + (i % 24) * CHAIR_DY });
+export const DOOR_SIGN = { x: WALLX + .02, y: BR.y1 + .35, z: GZ + 2.55, w: 2.3, h: .6 };
+
+export function gateWindow(g, o = {}) { // glass wall at x = WALLX facing +x, the door opening at the bridge, a sign over the door
+ // o.h: glass height above the floor. Full (4.6 m) in the gate shots; cut away to a parapet (1.1 m) when the camera looks past it
+ const a = o.a ?? 1; if (a <= 0) return;
+ const hh = o.h ?? 4.6, Z0 = GZ, Z1 = GZ + hh, y0 = -10, y1 = 26, d0 = BR.y0 - .15, d1 = BR.y1 + .15, DZ = Math.min(2.45, hh);
+ g.save(); g.globalAlpha *= a;
+ for (const [ya, yb] of [[y0, d0], [d1, y1]]) fillPoly(g, [iso.P(WALLX, ya, Z0), iso.P(WALLX, yb, Z0), iso.P(WALLX, yb, Z1), iso.P(WALLX, ya, Z1)], C.glass, .2);
+ if (hh > 2.45) fillPoly(g, [iso.P(WALLX, d0, Z0 + 2.45), iso.P(WALLX, d1, Z0 + 2.45), iso.P(WALLX, d1, Z1), iso.P(WALLX, d0, Z1)], C.glass, .2);
+ g.strokeStyle = '#B9B1A2'; g.lineWidth = 2.2; g.beginPath();
+ for (let y = y0; y <= y1; y += 3.2) { if (y > d0 - .05 && y < d1 + .05) continue; g.moveTo(...iso.P(WALLX, y, Z0)); g.lineTo(...iso.P(WALLX, y, Z1)); }
+ g.moveTo(...iso.P(WALLX, y0, Z0 + .35)); g.lineTo(...iso.P(WALLX, y1, Z0 + .35));
+ g.stroke();
+ g.lineWidth = 4; g.beginPath(); g.moveTo(...iso.P(WALLX, y0, Z1)); g.lineTo(...iso.P(WALLX, y1, Z1)); g.stroke();
+ g.strokeStyle = C.dark; g.lineWidth = 3.5; g.beginPath();
+ for (const [y, z] of hh > 2.45 ? [[d0, Z0], [d0, Z0 + 2.45], [d1, Z0 + 2.45], [d1, Z0]] : [[d0, Z0 + hh], [d0, Z0]]) g.lineTo(...iso.P(WALLX + .01, y, z));
+ if (hh <= 2.45) { g.moveTo(...iso.P(WALLX + .01, d1, Z0 + hh)); g.lineTo(...iso.P(WALLX + .01, d1, Z0)); }
+ g.stroke();
+ // the gate sign hanging on the glass over the door (reads up-right, at 3/4 like everything on this wall)
+ const S = DOOR_SIGN;
+ if (o.sign !== false && hh >= S.z - GZ + .2) onPlane(g, S.x, S.y, S.z, 'yz', g2 => {
+ g2.fillStyle = C.screen; g2.beginPath(); g2.roundRect(0, -S.h, S.w, S.h, .06); g2.fill();
+ g2.fillStyle = '#E9C46A'; g2.font = '700 .42px Newsreader'; g2.textBaseline = 'alphabetic'; g2.fillText('B12', .14, -.15);
+ g2.fillStyle = '#EFE8DA'; g2.font = '500 .26px NotoSerifSC'; g2.fillText('登机口', 1.18, -.22);
+ g2.font = '500 .13px Newsreader'; g2.fillStyle = '#B9B2A4'; g2.fillText('GATE', 1.2, -.05);
+ });
+ g.restore();
+}
+export function gateFloor(g) {
+ fillPoly(g, quad(rect(WALLX, 60, -10, 60), GZ), C.carpet);
+ g.save(); g.strokeStyle = 'rgba(190,165,125,.16)'; g.lineWidth = 1; g.beginPath(); // carpet tiles, 2 m
+ for (let x = WALLX + 2; x < 40; x += 2) { g.moveTo(...iso.P(x, -10, GZ)); g.lineTo(...iso.P(x, 60, GZ)); }
+ for (let y = -10; y < 60; y += 2) { g.moveTo(...iso.P(WALLX, y, GZ)); g.lineTo(...iso.P(40, y, GZ)); }
+ g.stroke(); g.restore();
+ fillPoly(g, quad(rect(WALLX, WALLX + .45, -10, 60), GZ + .001), C.carpetEdge);
+ // the terminal's end: its slab edge toward the camera side is hidden, so mark the end with a low parapet
+ iso.boxNow(WALLX, -10.25, GZ, 40, .25, .5, tri('#E6DDCC', .3, .18));
+}
+// painted queue lanes: outline + chevrons pointing to the door; only the lit lane carries colour
+export function lanes(g, o = {}) {
+ const a = o.a ?? 1; if (a <= 0) return;
+ g.save(); g.globalAlpha *= a;
+ const [ya, yb] = LANE_Y;
+ LANES.forEach((L, i) => {
+ const on = o.lit === i, lit = on ? (o.litA ?? 1) : 0;
+ const col = css(mix(hex(mix(C.green, C.carpet, on ? .3 : .55)), C.accent, lit));
+ const pts = quad(rect(L.x0, L.x1, ya, yb), GZ + .002);
+ fillPoly(g, pts, hex(mix(C.carpetLane, C.accentLt, lit * .35)), on ? 1 : .6);
+ g.strokeStyle = col; g.lineWidth = on ? 2.4 : 1.6; g.lineJoin = 'round';
+ g.beginPath(); pts.forEach((p, j) => j ? g.lineTo(...p) : g.moveTo(...p)); g.closePath(); g.stroke();
+ const xc = (L.x0 + L.x1) / 2;
+ g.lineWidth = on ? 2 : 1.4;
+ for (let y = ya + 1.2; y < yb - .4; y += 1.5) { g.beginPath(); g.moveTo(...iso.P(xc - .26, y + .26, GZ + .003)); g.lineTo(...iso.P(xc, y, GZ + .003)); g.lineTo(...iso.P(xc + .26, y + .26, GZ + .003)); g.stroke(); }
+ });
+ g.restore();
+}
+// group sign on a post at a lane entrance; the plate faces +x (camera) and reads up-right
+export const SIGN = i => ({ x: laneX(i), y: LANE_Y[1] + .55, z: GZ + 1.08 });
+export function groupSign(g, i, lit, a = 1) {
+ const L = LANES[i], { x, y: yc } = SIGN(i);
+ iso.add(x + yc + GZ + .5, () => {
+ const gg = iso.g; gg.save(); gg.globalAlpha *= a;
+ iso.boxNow(x - .14, yc - .14, GZ, .28, .28, .04, tri('#B7B0A3'));
+ iso.boxNow(x - .035, yc - .035, GZ, .07, .07, 1.1, tri(C.dark, .25, .2));
+ iso.boxNow(x - .03, yc - .7, GZ + 1.08, .06, 1.4, .7, tri(lit > .5 ? C.accent : '#EFE9DD', .25, .2), { faceColor: { 2: css(mix('#FAF5EC', C.accent, lit)) } });
+ onPlane(gg, x + .035, yc + .64, GZ + 1.75, 'yz', g2 => {
+ g2.fillStyle = css(mix(C.ink, '#FFF8EE', lit)); g2.font = '600 .4px Newsreader'; g2.textBaseline = 'alphabetic';
+ g2.fillText(L.label, .1, .38); const w = g2.measureText(L.label).width;
+ g2.font = '700 .34px NotoSerifSC'; g2.fillText('排', .16 + w, .38);
+ g2.font = '500 .15px Newsreader'; g2.fillStyle = css(mix(C.soft, '#FFF0E6', lit)); g2.fillText(L.en, .1, .58);
+ });
+ gg.restore();
+ }, 1);
+}
+export const COUNTER_SCREEN = { x: WALLX + 1.46, y: -2.95, z: GZ + 1.0, w: 1.3, h: .42 };
+export function counter(g) { // boarding podium by the door, its screen faces +x
+ iso.box(WALLX + .7, -4.4, GZ, .75, 1.6, 1.05, tri('#ECE5D8', .3, .18), { cull: false, decal: I => {
+ const S = COUNTER_SCREEN;
+ onPlane(I.g, S.x, S.y, S.z, 'yz', g2 => {
+ g2.fillStyle = C.screen; g2.fillRect(0, 0, S.w, S.h);
+ g2.fillStyle = '#E9C46A'; g2.font = '600 .2px Newsreader'; g2.textBaseline = 'middle'; g2.fillText('B12 07:10', .1, .22);
+ });
+ I.poly([I.P(WALLX + 1.451, -4.4, GZ + .55), I.P(WALLX + 1.451, -2.8, GZ + .55), I.P(WALLX + 1.451, -2.8, GZ + .6), I.P(WALLX + 1.451, -4.4, GZ + .6)], C.green);
+ } });
+}
+// a gate chair in the pale subject green: seat, back toward +x (people face the window, −x)
+const CHAIR_T = tri(C.greenLt, .25, .18);
+export function gateChair(x, y) {
+ iso.box(x - .22, y - .24, GZ + .36, .44, .48, .08, CHAIR_T);
+ iso.box(x + .2, y - .24, GZ + .4, .08, .48, .42, CHAIR_T, { faceColor: { 0: '#F1EADD' } });
+}
+
+// ---------- the second order: one line of seat-number squares snaking through the three lanes ----------
+const SQ_Y0 = -.05, SQ_Y1 = 13.0, SQ_STEP = .95;
+const SNAKE = [[laneX(0), SQ_Y0], [laneX(0), SQ_Y0 + 80]]; // one straight line in lane 1, running out of frame
+const SNL = [0]; for (let i = 1; i < SNAKE.length; i++) SNL.push(SNL[i - 1] + Math.hypot(SNAKE[i][0] - SNAKE[i - 1][0], SNAKE[i][1] - SNAKE[i - 1][1]));
+// k-th square: position and the direction the line faces there (toward the door)
+export function sqPos(k) {
+ const d = k * SQ_STEP;
+ for (let i = 1; i < SNAKE.length; i++) if (d <= SNL[i] || i === SNAKE.length - 1) {
+ const f = (d - SNL[i - 1]) / (SNL[i] - SNL[i - 1]), [ax, ay] = SNAKE[i - 1], [bx, by] = SNAKE[i];
+ const L = Math.hypot(bx - ax, by - ay); return { x: lerp(ax, bx, f), y: lerp(ay, by, f), dx: (ax - bx) / L, dy: (ay - by) / L };
+ }
+}
+export function squares(g, labels, a = 1) {
+ if (a <= 0) return;
+ g.save(); g.globalAlpha *= a;
+ labels.forEach((lab, k) => {
+ const q = sqPos(k), h = .2, z = GZ + .003;
+ g.strokeStyle = hex(mix(C.green, C.carpet, .2)); g.lineWidth = 1.5;
+ g.beginPath(); quad(rect(q.x - h, q.x + h, q.y - h, q.y + h), z).forEach((p, j) => j ? g.lineTo(...p) : g.moveTo(...p)); g.closePath(); g.stroke();
+ // the label sits on the front half of the square (toward the door), clear of the feet
+ // the seat number is painted beside its square, on the +x side, where no body covers it
+ if (lab) onPlane(g, q.x + .78, q.y + .35, z, 'xy', g2 => {
+ g2.fillStyle = C.ink; g2.font = '600 .4px Newsreader'; g2.textBaseline = 'alphabetic'; g2.fillText(lab, 0, 0);
+ });
+ });
+ g.restore();
+}
+export const SQ_LABEL_BOX = k => { const q = sqPos(k); return [[q.x - .25, q.y - .25], [q.x + .25, q.y + .25]]; };
diff --git a/styles/isometric-picture-book/demo/plane.js b/styles/isometric-picture-book/demo/plane.js
new file mode 100644
index 0000000..7947756
--- /dev/null
+++ b/styles/isometric-picture-book/demo/plane.js
@@ -0,0 +1,198 @@
+// The aircraft (a 12-row, 3+3, one-aisle cabin), its lid that lifts like a picture-book flap, and the jet bridge.
+// World metres. Fuselage axis along y: nose at −y (screen up-right), tail at +y. Doors on the +x side (toward camera).
+import { C, iso, tri, mix, hex, css, TAU, clamp, lerp, seg, ss, eo, facet, fillPoly, onPlane, rect, quad, tracePath } from './kit.js';
+
+export const PL = { ZC: 2.85, RX: 1.95, RZ: 2.0, FLOOR: 2.1, CUTN: 2.55, CUTF: 3.6, YF: -2.2, YA: 11.4, DOOR: [-1.65, -.55], BRIDGE_Z: 2.3 };
+export const rowY = r => .75 + (r - 1) * .81; // seat-cushion centre of row r (1..12), pitch 32 in
+export const SEATX = { A: -1.415, B: -.955, C: -.495, D: .495, E: .955, F: 1.415 };
+export const AISLE = .265; // half-width (aisle 53 cm)
+export const DOORY = -1.1;
+
+// ---------- hull sections ----------
+const N = 32;
+function ell(a, s = 1, dz = 0) { return [PL.RX * s * Math.cos(a), PL.ZC + dz + PL.RZ * s * Math.sin(a)]; }
+function arc(a0, a1, s = 1, dz = 0, n = N) { const out = [], m = Math.max(2, Math.ceil(Math.abs(a1 - a0) / TAU * n)); for (let i = 0; i <= m; i++) out.push(ell(lerp(a0, a1, i / m), s, dz)); return out; }
+const A_N = Math.asin((PL.CUTN - PL.ZC) / PL.RZ); // near cut angle (x > 0)
+const A_F = Math.PI - Math.asin((PL.CUTF - PL.ZC) / PL.RZ); // far cut angle (x < 0)
+export const xAt = z => PL.RX * Math.sqrt(Math.max(0, 1 - ((z - PL.ZC) / PL.RZ) ** 2));
+
+const BODY = tri(C.body, .35, .2);
+// extrude a section polyline (x,z) along y from y0 to y1, outward normals away from the section centre
+function extrude(g, sec, y0, y1, t3, o = {}) {
+ for (let i = 0; i < sec.length - 1; i++) {
+ const [xa, za] = sec[i], [xb, zb] = sec[i + 1];
+ const mx = (xa + xb) / 2, mz = (za + zb) / 2, out = o.inside ? [-mx, 0, -(mz - PL.ZC)] : [mx, 0, mz - PL.ZC];
+ facet(g, [[xa, y0, za], [xb, y0, zb], [xb, y1, zb], [xa, y1, za]], t3, { out, color: o.color });
+ }
+}
+// loft between stations [{y, s, dz}] on full ellipses (convex), optional end caps
+function loft(g, st, t3, o = {}) {
+ for (let k = 0; k < st.length - 1; k++) {
+ const A = st[k], B = st[k + 1];
+ for (let i = 0; i < N; i++) {
+ const a0 = i / N * TAU, a1 = (i + 1) / N * TAU;
+ const p = ell(a0, A.s, A.dz), q = ell(a1, A.s, A.dz), r = ell(a1, B.s, B.dz), u = ell(a0, B.s, B.dz);
+ const am = (a0 + a1) / 2;
+ facet(g, [[p[0], A.y, p[1]], [q[0], A.y, q[1]], [r[0], B.y, r[1]], [u[0], B.y, u[1]]], t3, { out: [Math.cos(am), (B.y - A.y) > 0 ? (A.s - B.s) : (B.s - A.s), Math.sin(am)] });
+ }
+ }
+}
+const capPts = (y, s = 1, dz = 0) => { const o = []; for (let i = 0; i < N; i++) { const [x, z] = ell(i / N * TAU, s, dz); o.push([x, y, z]); } return o; };
+
+// ---------- nose (closed), with the front bulkhead and its timer ----------
+const NOSE = [{ y: PL.YF, s: 1, dz: 0 }, { y: -3.6, s: .985, dz: -.02 }, { y: -4.9, s: .9, dz: -.08 }, { y: -6.0, s: .72, dz: -.18 }, { y: -6.8, s: .46, dz: -.3 }, { y: -7.25, s: .16, dz: -.38 }];
+export function nose(g, timer) {
+ // bulkhead (faces +y, into the cabin): drawn first, the nose shell occludes nothing behind it
+ facet(g, capPts(PL.YF), null, { color: C.wallIn, out: [0, 1, 0] });
+ loft(g, [...NOSE].reverse(), BODY);
+ // cockpit windows on the near cheek
+ for (let i = 0; i < 3; i++) {
+ const y0 = -5.2 - i * .34, y1 = y0 - .26, z0 = 3.72 - i * .05, z1 = z0 + .3;
+ const xs = z => PL.RX * .8 * Math.sqrt(Math.max(0, 1 - ((z - PL.ZC + .14) / (PL.RZ * .8)) ** 2));
+ fillPoly(g, [iso.P(xs(z0) + .02, y0, z0), iso.P(xs(z0) - .02, y1, z0), iso.P(xs(z1) - .05, y1, z1), iso.P(xs(z1) + .02, y0, z1)], '#3C4744');
+ }
+ if (timer) timerScreen(g, timer);
+}
+export function timerScreen(g, tm) { // small dark screen on the front bulkhead, read along +x
+ const z = 3.08, y = PL.YF + .01;
+ onPlane(g, -.62, y, z, 'xz', g2 => {
+ g2.fillStyle = C.screen; g2.beginPath(); g2.roundRect(0, 0, 1.24, .5, .05); g2.fill();
+ g2.fillStyle = tm.hot ? '#F08A6A' : '#E9C46A'; g2.font = '600 0.38px Newsreader'; g2.textAlign = 'center'; g2.textBaseline = 'middle';
+ g2.fillText(tm.s, .62, .27);
+ });
+}
+
+// ---------- the cabin: interior (floor, far wall, seats) and the lower hull ----------
+export function cabinBack(g, o = {}) {
+ const yA = PL.YF, yB = PL.YA;
+ // far inner wall (faces +x), from the floor up to the far cut, with a row of windows
+ const far = arc(A_F, Math.PI - Math.asin((PL.FLOOR - PL.ZC) / PL.RZ), 1);
+ extrude(g, far, yA, yB, null, { inside: true, color: C.wallIn });
+ for (let r = 1; r <= 12; r++) {
+ const y = rowY(r) - .05, z0 = 3.0, z1 = 3.42, x0 = -xAt(z0) + .02, x1 = -xAt(z1) + .02;
+ fillPoly(g, [iso.P(x0, y - .15, z0), iso.P(x0, y + .15, z0), iso.P(x1, y + .15, z1), iso.P(x1, y - .15, z1)], '#C9D6D1');
+ }
+ // floor and the aisle
+ const xf = xAt(PL.FLOOR);
+ fillPoly(g, quad(rect(-xf, xf, yA, yB), PL.FLOOR), C.cabinFloor);
+ fillPoly(g, quad(rect(-AISLE, AISLE, yA + .4, yB - .3), PL.FLOOR + .001), C.aisle);
+ // far rim (cut top), a narrow strip
+ fillPoly(g, quad(rect(-PL.RX, -xAt(PL.CUTF) + .16, yA, yB), PL.CUTF), hex(mix(C.body, '#FFF7E6', .3)));
+ if (o.decal) o.decal(g);
+}
+export function cabinFront(g, o = {}) { // near lower hull: exterior up to the low cut, with a gap at the door
+ const yA = PL.YF, yB = PL.YA, [d0, d1] = PL.DOOR;
+ extrude(g, arc(-Math.PI, A_N, 1), yA, yB, BODY);
+ const zt = PL.CUTN;
+ fillPoly(g, quad(rect(xAt(zt) - .2, xAt(zt), yA, yB), zt), hex(mix(C.body, '#FFF7E6', .45)));
+ // belly line
+ const zb = 1.05; fillPoly(g, [iso.P(xAt(zb), yA, zb), iso.P(xAt(zb), yB, zb), iso.P(xAt(zb - .12), yB, zb - .12), iso.P(xAt(zb - .12), yA, zb - .12)], C.belly);
+ if (o.door) { const z0 = PL.FLOOR + .02; fillPoly(g, [iso.P(xAt(z0) + .01, d0, z0), iso.P(xAt(z0) + .01, d1, z0), iso.P(xAt(zt) + .01, d1, zt), iso.P(xAt(zt) + .01, d0, zt)], '#3C4441', .9); }
+}
+// the lid: everything above the cut, closed by its chord. It flips open on a hinge along the far cut edge,
+// like a paper flap (its underside is paper-coloured), then glides away. L = {a, rot (rad), dx, dy, dz}
+export const HINGE = [-xAt(PL.CUTF), PL.CUTF];
+export function lidMap(L) {
+ const c = Math.cos(L.rot || 0), s = Math.sin(L.rot || 0), [hx, hz] = HINGE;
+ return (x, y, z) => [hx + (x - hx) * c - (z - hz) * s + (L.dx || 0), y + (L.dy || 0), hz + (x - hx) * s + (z - hz) * c + (L.dz || 0)];
+}
+export function lid(g, L) {
+ if (L.a <= 0) return;
+ const M = lidMap(L);
+ const sec = arc(A_N, A_F, 1); // near cut → over the top → far cut; the chord closes it
+ const R = sec.map(([x, z]) => M(x, 0, z)); // rotated section (y = 0)
+ const cx = R.reduce((a, p) => a + p[0], 0) / R.length, cz = R.reduce((a, p) => a + p[2], 0) / R.length;
+ const y0 = PL.YF + (L.dy || 0), y1 = PL.YA + (L.dy || 0);
+ g.save(); g.globalAlpha *= L.a;
+ const n = R.length;
+ for (let i = 0; i < n; i++) {
+ const A = R[i], B = R[(i + 1) % n], chord = i === n - 1;
+ const out = [(A[0] + B[0]) / 2 - cx, 0, (A[2] + B[2]) / 2 - cz];
+ facet(g, [[A[0], y0, A[2]], [B[0], y0, B[2]], [B[0], y1, B[2]], [A[0], y1, A[2]]], BODY, { out, color: chord ? C.wallIn : undefined });
+ }
+ facet(g, R.map(p => [p[0], y1, p[2]]), null, { out: [0, 1, 0], color: hex(mix(C.wallIn, C.belly, .35)) });
+ // livery follows the flap
+ const P = (x, y, z) => { const q = M(x, y, z); return iso.P(q[0], q[1], q[2]); };
+ const nearFacing = Math.cos(L.rot || 0) > -.2;
+ if (nearFacing) livery(g, 0, L.dy || 0, 0, PL.YF, PL.YA, true, (x, y, z) => P(x, y - (L.dy || 0), z));
+ g.restore();
+}
+// windows + two green bands on the near side (on the lid when the cabin is cut); P maps world → screen
+export function livery(g, dx, dy, dz, y0, y1, onLid, Pm) {
+ const P = Pm ? ((x, y, z) => Pm(x, y + dy, z)) : ((x, y, z) => iso.P(x + dx, y + dy, z + dz));
+ const band = (za, zb, col) => fillPoly(g, [P(xAt(za) + .005, y0, za), P(xAt(za) + .005, y1, za), P(xAt(zb) + .005, y1, zb), P(xAt(zb) + .005, y0, zb)], col);
+ band(2.62, 2.74, C.greenLt); band(2.8, 2.95, C.green);
+ for (let r = 1; r <= 12; r++) {
+ const y = rowY(r) - .05, z0 = 3.08, z1 = 3.38;
+ fillPoly(g, [P(xAt(z0) + .006, y - .14, z0), P(xAt(z0) + .006, y + .14, z0), P(xAt(z1) + .006, y + .14, z1), P(xAt(z1) + .006, y - .14, z1)], '#8FA79C');
+ }
+ const [d0, d1] = PL.DOOR; g.save(); g.strokeStyle = hex(mix(C.body, '#6F6A60', .35)); g.lineWidth = 1.4;
+ g.beginPath(); for (const [y, z] of [[d0, 2.56], [d0, 4.05], [d1, 4.05], [d1, 2.56]]) { const p = P(xAt(z) + .006, y, z); g.lineTo(p[0], p[1]); } g.stroke(); g.restore();
+}
+// a closed cabin section (used when the lid is down and nothing inside is shown)
+export function cabinClosed(g) {
+ extrude(g, arc(-Math.PI / 2 - 1.2, Math.PI / 2 + .2, 1), PL.YF, PL.YA, BODY);
+ const zb = 1.05; fillPoly(g, [iso.P(xAt(zb), PL.YF, zb), iso.P(xAt(zb), PL.YA, zb), iso.P(xAt(zb - .12), PL.YA, zb - .12), iso.P(xAt(zb - .12), PL.YF, zb - .12)], C.belly);
+ livery(g, 0, 0, 0, PL.YF, PL.YA, false);
+}
+
+// ---------- aft body, tail, wings, engines ----------
+const AFT = [{ y: PL.YA, s: 1, dz: 0 }, { y: 14.2, s: 1, dz: 0 }, { y: 16.4, s: .86, dz: .2 }, { y: 18.4, s: .58, dz: .55 }, { y: 19.9, s: .27, dz: .85 }, { y: 20.5, s: .1, dz: .95 }];
+export function aft(g) {
+ aftEngine(g, -1);
+ loft(g, AFT, BODY);
+ const zb = 1.05; fillPoly(g, [iso.P(xAt(zb), PL.YA, zb), iso.P(xAt(zb), 14.2, zb), iso.P(xAt(zb - .12), 14.2, zb - .12), iso.P(xAt(zb - .12), PL.YA, zb - .12)], C.belly);
+ livery(g, 0, 0, 0, PL.YA, 13.2, false);
+ // T-tail: far tailplane, fin, near tailplane
+ tailplane(g, -1);
+ const fin = [[15.4, 4.5], [19.7, 4.0], [20.3, 8.8], [18.7, 8.8]], th = .12;
+ const F = tri(C.green, .25, .2);
+ for (let i = 0; i < 4; i++) { const [ya, za] = fin[i], [yb, zb2] = fin[(i + 1) % 4]; facet(g, [[th, ya, za], [th, yb, zb2], [-th, yb, zb2], [-th, ya, za]], F, { out: [0, zb2 - za, ya - yb] }); }
+ facet(g, fin.map(([y, z]) => [th, y, z]), F, { out: [1, 0, 0] });
+ fillPoly(g, [iso.P(th + .003, 16.75, 5.7), iso.P(th + .003, 19.85, 5.7), iso.P(th + .003, 19.95, 6.45), iso.P(th + .003, 17.3, 6.45)], C.greenLt);
+ tailplane(g, 1);
+ aftEngine(g, 1);
+}
+function tailplane(g, s) {
+ const pts = [[s * .1, 18.6], [s * 4.3, 20.0], [s * 4.3, 20.6], [s * .1, 20.4]];
+ iso.prismNow(s > 0 ? pts : pts.slice().reverse(), 8.75, .12, tri(C.body, .3, .22));
+}
+function aftEngine(g, s) { // rear-mounted engine on a short pylon
+ const ex = s * 2.75, zc = 3.55;
+ iso.boxNow(s > 0 ? 1.5 : -2.4, 14.4, zc - .12, .9, 1.4, .24, tri('#DCD6CB', .3, .2));
+ iso.cylNow(ex, 13.4, zc, .64, .28, tri(C.green, .25, .2), { axis: 'y', n: 22 });
+ iso.cylNow(ex, 13.6, zc, .62, 2.8, tri('#E7E1D6', .35, .22), { axis: 'y', n: 22 });
+ iso.cylNow(ex, 16.35, zc, .36, .3, tri('#6B6E68', .2, .2), { axis: 'y', n: 16 });
+}
+export function stabilizers() {}
+export function wing(g, side) {
+ const s = side, pts = [[s * 1.6, 7.0], [s * 8.8, 10.3], [s * 8.8, 11.05], [s * 1.6, 11.0]];
+ iso.prismNow(s > 0 ? pts : pts.slice().reverse(), 1.15, .24, tri('#E9E3D7', .35, .22));
+ const tip = [[s * 8.62, 10.22], [s * 8.82, 10.3], [s * 8.82, 11.05], [s * 8.62, 11.05]];
+ iso.prismNow(s > 0 ? tip : tip.slice().reverse(), 1.39, .9, tri(C.green, .25, .2));
+}
+
+// ---------- jet bridge: floor, a tall far wall, a low near wall (cut away), on a leg ----------
+export const BR = { x0: 1.98, x1: 9.5, y0: -2.05, y1: -.15, z: PL.BRIDGE_Z };
+const BRT = tri('#E3DDD1', .3, .18), BRG = tri(C.green, .25, .2);
+// x0: where the bridge ends (1.98 = docked at the door; larger = retracted toward the terminal)
+export function bridgeBack(g, x0 = BR.x0) {
+ const { x1, y0, y1, z } = BR;
+ iso.boxNow(7.25, -1.25, 0, .3, .3, z - .2, tri('#B3AC9F', .25, .2));
+ iso.boxNow(7.05, -1.55, .12, .7, .9, .3, tri('#9C968A', .2, .2));
+ iso.boxNow(x0, y0 - .1, z, x1 - x0, .1, 2.35, BRT);
+ for (let x = x0 + .35; x < x1 - .3; x += .9) fillPoly(g, [iso.P(x, y0 + .001, z + .95), iso.P(x + .65, y0 + .001, z + .95), iso.P(x + .65, y0 + .001, z + 1.9), iso.P(x, y0 + .001, z + 1.9)], '#CADBD4');
+ iso.boxNow(x0, y0, z - .22, x1 - x0, y1 - y0, .22, BRT, { faceColor: { 1: BRG[1] } });
+ fillPoly(g, quad(rect(x0, x1, y0, y1), z + .002), '#E6DAC5');
+}
+export function bridgeFront(g, x0 = BR.x0) {
+ const { x1, y0, y1, z } = BR;
+ iso.boxNow(x0, y1, z, x1 - x0, .1, .85, BRT, { faceColor: { 1: BRG[1] } });
+ iso.boxNow(x0 - .02, y0 - .12, z - .2, .22, y1 - y0 + .24, .2, tri('#C9C1B2', .25, .2));
+}
+// push-back tug: a low box with a small cab, nose toward the aircraft
+export function tug(g, y) {
+ iso.boxNow(-.75, y - 2.9, .25, 1.5, 2.3, .55, tri(C.ginger, .25, .2));
+ iso.boxNow(-.6, y - 2.75, .8, 1.2, .9, .6, tri('#E9E2D4', .3, .18), { faceColor: { 2: '#9FB2AB', 1: '#B7C7C0' } });
+ iso.boxNow(-.08, y - .6, .45, .16, .9, .1, tri(C.dark, .2, .2));
+}
diff --git a/styles/isometric-picture-book/demo/stills/styleframe.jpg b/styles/isometric-picture-book/demo/stills/styleframe.jpg
new file mode 100644
index 0000000..d191460
Binary files /dev/null and b/styles/isometric-picture-book/demo/stills/styleframe.jpg differ
diff --git a/styles/isometric-picture-book/demo/tools/motion_check.mjs b/styles/isometric-picture-book/demo/tools/motion_check.mjs
new file mode 100644
index 0000000..dac0ac6
--- /dev/null
+++ b/styles/isometric-picture-book/demo/tools/motion_check.mjs
@@ -0,0 +1,38 @@
+// Crowd motion check for this style: every frame at 30 fps, every person's floor position.
+// node styles/isometric-picture-book/demo/tools/motion_check.mjs styles/isometric-picture-book/demo [--fps 30] [--gap .35]
+// The film reports people through a hook: inside the code that draws a person, push
+// globalThis.__POS?.push({ i: <person id>, k: 'w' (standing) | 's' (seated), x, y, a: <alpha> })
+// Reports: jumps (a person moves more than 0.2 m between two frames, i.e. faster than 6 m/s: reads as a teleport),
+// stepping (move, freeze one frame, move: the motion is sampled coarser than the frame rate), and overlaps
+// (two standing people whose feet are closer than --gap metres). Shot cuts (window.SHOTS starts) are skipped.
+import { openDemo, closeServer } from '../../../../core/render/page.mjs';
+const args = process.argv.slice(2), opt = (k, d) => { const i = args.indexOf(k); return i >= 0 ? +args[i + 1] : d; };
+const FPS = opt('--fps', 30), GAP = opt('--gap', .35);
+const { browser, page } = await openDemo(args[0], { w: 960, h: 540, q: 'nosub=1' });
+const r = await page.evaluate(({ FPS, GAP }) => {
+ const cuts = (window.SHOTS || []).map(s => s[0]), isCut = t => cuts.some(a => Math.abs(t - a) < 1.5 / FPS);
+ let prev = null; const jumps = [], over = [], step = {};
+ for (let f = 0; f <= window.DUR * FPS; f++) {
+ const t = f / FPS; globalThis.__POS = []; window.render(t);
+ const cur = new Map(); for (const d of globalThis.__POS) cur.set(d.i + d.k, d);
+ if (prev && !isCut(t)) for (const [k, d] of cur) {
+ const q = prev.get(k); if (!q) continue;
+ const m = Math.hypot(d.x - q.x, d.y - q.y);
+ if (m > .2 && d.a > .3) jumps.push(`${t.toFixed(2)}s person ${d.i}: ${m.toFixed(2)} m in one frame`);
+ const s = step[k] ??= { last: [], n: 0, at: [] }; s.last.push(m); if (s.last.length > 3) s.last.shift();
+ if (s.last.length === 3 && s.last[0] > .003 && s.last[1] < .0005 && s.last[2] > .003) { s.n++; s.at.push(t.toFixed(2)); }
+ }
+ const W = globalThis.__POS.filter(d => d.k === 'w' && d.a > .5);
+ for (let a = 0; a < W.length; a++) for (let b = a + 1; b < W.length; b++) {
+ const m = Math.hypot(W[a].x - W[b].x, W[a].y - W[b].y);
+ if (m < GAP) over.push(`${t.toFixed(2)}s persons ${W[a].i}/${W[b].i}: ${m.toFixed(2)} m apart`);
+ }
+ prev = cur;
+ }
+ globalThis.__POS = undefined;
+ const stepping = Object.entries(step).filter(([, s]) => s.n > 2).map(([k, s]) => `${k}: move-freeze-move ${s.n}x (${s.at.slice(0, 5).join(' ')})`);
+ return { jumps, over, stepping };
+}, { FPS, GAP });
+for (const [name, list] of [['jumps', r.jumps], ['overlaps', r.over], ['stepping', r.stepping]]) { console.log(`${name}: ${list.length}`); list.slice(0, 20).forEach(l => console.log(' ' + l)); }
+await browser.close(); closeServer();
+process.exit(r.jumps.length + r.over.length + r.stepping.length ? 1 : 0);
diff --git a/styles/isometric-picture-book/demo/tools/srt.py b/styles/isometric-picture-book/demo/tools/srt.py
new file mode 100644
index 0000000..cfb4e4b
--- /dev/null
+++ b/styles/isometric-picture-book/demo/tools/srt.py
@@ -0,0 +1,13 @@
+"""Bilingual subtitles (one Chinese line, one English line per narration line), timed exactly as the page shows them.
+ .venv/bin/python styles/isometric-picture-book/demo/tools/srt.py → styles/isometric-picture-book/isometric-picture-book.srt"""
+import json, os, subprocess, sys
+HERE = os.path.dirname(os.path.abspath(__file__)); D = os.path.dirname(HERE); FILM = os.path.dirname(D)
+tl = next(e for e in json.load(open(os.path.join(D, 'events.json')))['ev'] if e['type'] == 'timeline')
+cn = [l['text'] for l in json.load(open(os.path.join(D, 'lines.json'), encoding='utf-8'))]
+en = [l['text'] for l in json.load(open(os.path.join(D, 'lines_en.json'), encoding='utf-8'))]
+VO, VD = tl['VO'], tl['VO_DUR']
+cues = [{'t0': VO[i] - .05, 't1': VO[i] + VD[i] + .12, 'text': cn[i] + '\n' + en[i]} for i in range(len(VO))]
+for i in range(len(cues) - 1): cues[i]['t1'] = min(cues[i]['t1'], cues[i + 1]['t0'] - .1) # one cue at a time (as kit.js shows them)
+tmp = os.path.join(D, 'out', 'cues.json'); os.makedirs(os.path.dirname(tmp), exist_ok=True)
+json.dump(cues, open(tmp, 'w', encoding='utf-8'), ensure_ascii=False)
+subprocess.run([sys.executable, 'core/render/srt.py', tmp, os.path.join(FILM, os.path.basename(FILM) + '.srt')], check=True)
diff --git a/styles/isometric-picture-book/demo/tools/subset.py b/styles/isometric-picture-book/demo/tools/subset.py
new file mode 100644
index 0000000..c0a4f4d
--- /dev/null
+++ b/styles/isometric-picture-book/demo/tools/subset.py
@@ -0,0 +1,11 @@
+"""Subset Noto Serif SC (OFL) to the characters the film prints and the subtitles say. Run from the library root:
+ .venv/bin/python styles/isometric-picture-book/demo/tools/subset.py"""
+import os
+HERE = os.path.dirname(os.path.abspath(__file__)); D = os.path.dirname(HERE)
+txt = ''.join(open(os.path.join(D, f), encoding='utf-8').read() for f in ['film.js', 'places.js', 'plane.js', 'kit.js', 'lines.json'])
+chars = sorted(set(ch for ch in txt if ord(ch) > 0x2E7F) | set('0123456789:·×–,。?:、'))
+open(os.path.join(HERE, 'chars.txt'), 'w', encoding='utf-8').write(''.join(chars) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .,-')
+from fontTools import subset
+subset.main([os.path.join(HERE, 'NotoSerifSC-VF.ttf'), '--text-file=' + os.path.join(HERE, 'chars.txt'),
+ '--output-file=' + os.path.join(D, 'fonts', 'NotoSerifSC-sub.ttf'), '--layout-features=*', '--no-hinting'])
+print(len(chars), 'chars')
diff --git a/styles/isometric-picture-book/demo/tools/vo_lengths.py b/styles/isometric-picture-book/demo/tools/vo_lengths.py
new file mode 100644
index 0000000..a810af7
--- /dev/null
+++ b/styles/isometric-picture-book/demo/tools/vo_lengths.py
@@ -0,0 +1,9 @@
+"""The shot timeline in film.js is built from the Chinese line lengths (VO_DUR). After a fresh narration run, check that
+ out/vo_zh/dur.json still matches (edge-tts can drift by a few milliseconds; more than 0.08 s means: update VO_DUR)."""
+import json, os, re, sys
+D = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+got = json.load(open(os.path.join(D, 'out', 'vo_zh', 'dur.json')))
+want = [float(x) for x in re.search(r'const VO_DUR = \[([^\]]*)\]', open(os.path.join(D, 'film.js'), encoding='utf-8').read()).group(1).split(',')]
+bad = [(f'V{i + 1:02d}', w, got[f'V{i + 1:02d}']) for i, w in enumerate(want) if abs(got[f'V{i + 1:02d}'] - w) > .08]
+for b in bad: print('line %s: film.js %.3f s, voice %.3f s' % b)
+print('voice lengths match VO_DUR' if not bad else 'update VO_DUR in film.js to the voice lengths above'); sys.exit(1 if bad else 0)
diff --git a/styles/isometric-picture-book/isometric-picture-book.srt b/styles/isometric-picture-book/isometric-picture-book.srt
new file mode 100644
index 0000000..b62b7e5
--- /dev/null
+++ b/styles/isometric-picture-book/isometric-picture-book.srt
@@ -0,0 +1,64 @@
+1
+00:00:00,400 --> 00:00:02,738
+每次登机,为什么总要排那么久?
+Why does boarding always take so long?
+
+2
+00:00:03,650 --> 00:00:08,500
+让后排乘客先上,听起来很合理,后排坐好了,就不会挡着前排的路。
+Back rows first sounds sensible: once they sit down, they are out of everyone’s way.
+
+3
+00:00:08,730 --> 00:00:11,928
+可机舱里只有一条过道,窄得只够一个人走。
+But the cabin has one aisle, just wide enough for one person.
+
+4
+00:00:12,158 --> 00:00:16,187
+只要前面有一个人停下来放箱子,后面所有人都得干等着。
+When one person stops to stow a bag, everyone behind has to wait.
+
+5
+00:00:16,417 --> 00:00:21,707
+因为叫的都是相邻那几排,大家全挤在同一个地方,只能一个接一个来。
+They were called for the same few rows, so they crowd one spot and go one by one.
+
+6
+00:00:21,937 --> 00:00:24,634
+全部坐满,足足用了六分五十四秒。
+Filling every seat took a full 6 minutes 54 seconds.
+
+7
+00:00:25,287 --> 00:00:26,644
+那如果换个顺序呢?
+What if we change the order?
+
+8
+00:00:27,737 --> 00:00:31,691
+让靠窗的人先上,而且前后两个人之间,刚好隔开一排。
+Window seats first, and each person sits one row apart from the next in line.
+
+9
+00:00:31,921 --> 00:00:36,810
+这样一来,六个人就能同时在六个不同的排数放箱子,谁也不挡谁的路。
+Now six people stow bags in six different rows at once, and nobody blocks anybody.
+
+10
+00:00:38,681 --> 00:00:41,491
+结果全部坐满,只花了三分三十六秒。
+Every seat was filled in just 3 minutes 36 seconds.
+
+11
+00:00:42,271 --> 00:00:45,324
+足足快了三分多钟,时间缩短了将近一半。
+More than three minutes faster: nearly half the time.
+
+12
+00:00:47,021 --> 00:00:51,565
+这是2012年,研究人员找来七十二名乘客做过的真实测试。
+This was a real test, run in 2012 with 72 passengers.
+
+13
+00:00:51,795 --> 00:00:56,636
+原来登机慢,根本不是因为人多,而是把所有人都堵在了同一段过道上。
+Boarding is slow not because of crowds, but because everyone is stuck in the same stretch of aisle.
diff --git a/styles/isometric-picture-book/poster.jpg b/styles/isometric-picture-book/poster.jpg
new file mode 100644
index 0000000..d191460
Binary files /dev/null and b/styles/isometric-picture-book/poster.jpg differ
diff --git a/styles/isometric-picture-book/style.json b/styles/isometric-picture-book/style.json
new file mode 100644
index 0000000..0cdfd13
--- /dev/null
+++ b/styles/isometric-picture-book/style.json
@@ -0,0 +1,19 @@
+{
+ "slug": "isometric-picture-book",
+ "num": "74",
+ "en": "Isometric Picture Book",
+ "cn": "等距绘本",
+ "category_en": "Information & Keynote",
+ "category_cn": "信息与发布",
+ "film": "Seventy-Two Seats",
+ "line": "A clean isometric gate, jet bridge and cabin where faceless travellers board in order, serif words land on the floor and a paper roof flips open, so the order of movement explains why one way fills 72 seats in nearly half the time.",
+ "line_cn": "干净的等距登机口、廊桥和机舱,背影小人按顺序登机,衬线大字落在地上,机舱顶盖像纸盖一样翻开;动的顺序本身就讲清了为什么换一种叫法能快将近一半。",
+ "uses": [
+ "Everyday rules and etiquette",
+ "Queues, flows and boarding",
+ "Comparing two ways of doing it",
+ "Public-space explainers"
+ ],
+ "frame_sec": 37.5,
+ "dur": 59.84
+}