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 种现成风格,也能做出你自己的
JavaScript agent-skillsai-agentsai-short-filmai-videoanimationcanvasclaudeclaude-codeclaude-code-pluginclaude-code-skillcreative-codingffmpegfilmmakingmotion-graphicsopus-5-5prompt-librarytext-to-speechthreejsvideo-productionwebgl
Paper-cut Lightbox: a new demo, "The Last Night Train", with no figures
lemomo-ai47158784fe11
diff --git a/styles/paper-lantern/DEMO.md b/styles/paper-lantern/DEMO.mdindex ec92a8a..51c370c 100644--- a/styles/paper-lantern/DEMO.md+++ b/styles/paper-lantern/DEMO.md@@ -2,217 +2,114 @@One example among many. Don't reuse its story, arc, shots, props or timings.-Demo: *一个月饼的相思 · A Mooncake's Longing* (121.8 s) · `paper-lantern.mp4` · source in [`demo/`](demo/) · engine: three.js 0.170 (WebGL, SSAA 2×, VSM soft shadows, custom DoF + bloom compositor), Canvas2D-drawn paper layers, headless Chrome frame capture.+Demo: *The Last Night Train* 《末班夜车》 (51.0 s, 1920×1080, 30 fps) · `paper-lantern.mp4` · source in [`demo/`](demo/) · engine: three.js 0.170 (WebGL, SSAA 2×, VSM soft shadows, custom DoF + bloom compositor), Canvas2D-drawn paper layers, headless Chrome frame capture.--**The demo narration is Mandarin Chinese** (edge-tts `zh-CN-XiaoxiaoNeural`) with Chinese subtitles. The library default is English with Kokoro (`core/tts/`); "Score structure" and "Engine reference" show how to switch. The demo runs 2 minutes; 45–120 s all work in this style.--**Voice licence exception.** The demo's narration was generated with Microsoft's Edge neural TTS (via the open-source `edge-tts` client), whose terms for redistributing the audio are unclear, so the voice track of `paper-lantern.mp4` is **not covered by the library's CC BY 4.0 licence** for demo films. We plan to re-voice it with Kokoro. In your own film, use Kokoro (`core/tts/`) or a voice you have the right to use; keep `tts.py` only as a timing sketch.+An old night train makes its last run. At a snowy mountain halt its windows light up car by car and it pulls away over a curved viaduct; it runs alongside a pine forest past three small halts; it goes into a long tunnel and the picture blinks to black; it comes out in a river valley where the town lights its windows as it passes; it slows along the sea cliffs; at the seaside terminus its windows go out one by one, the last one last, and the station lamp stays on. No figures: the story is told by the train, its lit windows, the stations and the light. English narration (Kokoro `bm_george`) with Chinese and English subtitles. The line and its stations are fiction ([`demo/FACTS.md`](demo/FACTS.md)).## Story & structure-The film opens on the real lightbox on a table and pushes into it. The box cavity is **0.56 × 0.33 m, 0.16 m deep**. The film is bookended by the **real world**: a walnut table in a dark room, the lit lightbox in a wooden frame, a tea set and a plate of real mooncakes lit by the box's spill light. The first shot pushes from the room into the box; the last pulls back out.+Hook: a dark train at a lit halt; its windows come on one car at a time, engine first, each with a rising glockenspiel note. Turn: the tunnel, a 0.27 s blink of true dark and silence, and on the other side the snow is gone. Landing: the same windows go out one by one at the terminus, the falling notes mirror the rising ones, and the station lamp is the last light in the frame.-How the demo used the medium's powers:+Every section has its own colour ladder (changing ladder = another place) and its own camera move:-| Native power | Story use |-|---|---|-| **Light turns on** | The opening is literally switching the lamp on: moon, then far layers, then windows light up one by one. "Lights coming on" = a story beginning, a home, someone waiting. |-| **Depth = distance** | Stacked layers of mountains, rivers, cities make *distance* visible. Journeys, longing, "far away" stories are native. |-| **Silhouettes** | People are black cut-outs with a few jointed parts (an arm, a sleeve). Faceless figures read as everyone — good for folk tales, family, festivals. |-| **Windows** | A lit window with a silhouette inside is the strongest image this style has. Two lit windows sharing one moon is the demo's thesis shot. |-| **Paper text** | Titles, letters and poems are paper too: vertical brush calligraphy on a cut strip, revealed column by column, with a red seal. |-| **The box itself** | Pulling out to the real table at the end says "this was a keepsake / a story told at home". |--**Story shape (proven in the demo):** room → lamp on → push into the box, title → origin (grandma's kitchen, the mooncake is pressed) → a bit of culture (a Ming-dynasty scroll quote) → the absence (an empty seat) → the journey (train across layered mountains, a myth told on the way, a box passing the other way) → arrival in the far city → the letter → **the twist: the other box was going the other way** (mutual longing — two windows, one moon) → a classical poem → pull out of the box, "中秋快乐".+| Section | Ladder | Camera |+|---|---|---|+| The halt and the viaduct | snow blue `#060b22` sky → `#7385b6` peaks → `#1b2650` viaduct → `#080d24` front | slow push, then a fast pull-out with the departing engine, then a lateral move along the valley |+| The forest | deeper blue, a pale snow slope `#44588e` behind the line | travelling alongside at the train's speed, rising; foreground pines rush past |+| The tunnel | cold slate `#26335f` cliff | push toward the portal, fade, a 0.27 s black |+| The river | teal `#04131c` sky → `#5f8c94` hills → `#2c5260` town | hard cut out of black on a small flare, lateral move with the train |+| The sea cliffs | indigo `#070a26` → `#7272b0` far waves | crane down past thin clouds to the train on the cliff curve |+| The terminus | pre-dawn violet, sea `#6a6aaa`, platform `#151a40` | wide on the arrival, close along the carriages as the windows go out, a beat on the last window, pull back to the lamp |-Adapting any topic: find the **two places** and the **one light** they share (a moon, a lighthouse, a window). Build each place as a layer stack; build one travel sequence between them; end with both lit at once.+Native moves spent: *the lamp turns on* (car by car), *depth as distance* (the viaduct, the forest strip, the river), *travelling alongside*, *locked frame with only light changing* (the terminus), *silence* (the tunnel blink), and a paper ticket that drops on a thread for the end card.## Shots-| Beat | Camera |-|---|---|-| Opening | Room wide (z 1.45) on the dark box → lamp on → 7 s ease-in-out push through the frame to z ≈ 0.56, then keep creeping in. Focus pulls from the front layer to the village. |-| In-box shots | Nearly frontal, slow dolly in/out (`aim(cam, [px,py,pz, tx,ty,tz], t)`), hand-held micro-drift `hand ≈ .0006 m`. Aperture 12–26 (in `post()`), focus on the story layer so foreground reeds and back mountains soften. |-| Top-down inserts | The mooncake press and the open gift box are shot as flat top-down layer stacks (same engine, different set). |-| Train | Lateral travel: layers scroll at speeds proportional to depth (parallax). |-| Ending | Push inside the box, then a pull back out to the table (z 0.5 → 1.08), tea set enters frame, title 「中秋快乐」 fades in inside the box, credits under it, 1.2 s fade to black. |+Film time; dissolves are 0.6 s.-Motion as built in the demo:--- **Everything moves like paper on a stick**: layers slide (x/y), rotate about a pivot (`ax/ay` anchor = joint), scale in from 0 along one axis ("written out"), or light up. No squash and stretch, no morphing.-- **Jointed figures**: a body sheet + a separate arm sheet anchored at the shoulder (`GRAN_SHOULDER`, `GIRL_SHOULDER`, `SUSHI_SHOULDER` in `people.js`); animate `rotation.z` only.-- **Light cues are the big motion**: lamp-on sequence in S01 — moon (0.5–3.2 s) → sky → each layer's translucency staggered by 0.42 s → key light → windows → lanterns flicker (`1 + .06·sin(7.3t)·sin(3.1t)`).-- **Text reveal**: paper strips grow from their anchor edge (`reveal()` in `s13_note.js` scales the mesh *and* the texture repeat so glyphs are not squashed), timed to the spoken word.-- **Hard action beats land on whisper word times**: the wooden mould slams on 「啪」(`E.word('L04', 13)`), the 「圆」 character flashes on its word, the light arcs grow from 「互」.-- **Transitions**: 0.5–1.2 s dissolves between shots (`in: { type: 'dissolve', dur }`), an `iris` mode exists (circular wipe from `center`). The signature transition is a **near-plane auspicious-cloud curtain** (`cloudCurtain()` in `s17_sushi.js`) closing over the last 1.2 s of a shot and opening on the next — the two halves must meet exactly at their front edges.+| # | Time | Shot | Camera / transition |+|---|---|---|---|+| S1 | 0.0–13.8 | PINE HALT: a house on a snowy rise with two lit windows, the platform lamp clicks on (0.4 s); windows light car by car from 1.5 s, one every 0.34 s; headlight 5.25 s, horn 5.5 s, departure 5.9 s; at 10 s the train is on the curved arched viaduct over the snowy valley | push → pull-out following the engine → lateral |+| S2 | 13.8–22.0 | the forest: the line rises and falls; a pale snow slope with a lit house at each of three halts (ELM, STONE, MILL HALT), lamp posts, name boards below the line | dissolve; travelling alongside, rising |+| S3 | 22.0–25.75 | a stone arch portal in a snowy cliff; the carriages go in one by one, the headlight goes out; black 25.5–25.77 s | dissolve; push in; fade to black |+| S4 | 25.75–35.4 | the river valley: a low arched bridge, the town on the hill behind it lights its windows after the train passes; warm paper flakes on the water; the moon | hard cut, small flare; lateral |+| S5 | 35.4–40.2 | the sea cliffs: thin clouds, a far headland with one light, three seas (far waves small, near waves big), the train on the cliff curve, a dark rock in front | dissolve; crane down |+| S6 | 40.2–51.0 | SEA END: canopy with a scalloped valance, posts, railing, name board; a sea wall takes the train's shadow; the train stops at 41.0 s; windows go out from 42.0 s, the last one at 45.75 s; the lamp lays a warm pool on the platform; the ticket drops at 47.5 s and swings to rest | dissolve; wide → close lateral → pull back |## Score structure-**Voice (demo, Mandarin):** `edge-tts`, voice `zh-CN-XiaoxiaoNeural`, rate `+10%`, pitch `-2Hz` (`demo/tts.py`); per-line `rate` overrides in `script.json` (L01 `+5%`, quoted letters `+2%`, the poem L23 **`-12%`**, closing line `-6%`). Output is trimmed at 2 % of peak (20 ms pre-roll, 120 ms tail) → 48 kHz mono `vo/<id>.wav` + `vo/dur.json`.-- **Polyphonic characters**: feed TTS a homophone via a `say` field and keep the real text for subtitles: 「相思的"相"」→ `say: 原来,相思的香,是互相的香。` (TTS otherwise reads xiàng).-- **Proof**: `demo/asr.py` (faster-whisper **medium**, zh) prints OK/DIFF per line; DIFFs that are homophones or numerals (八月十五 → 8月15, 她 → 他) are fine — listen to the rest.-- **Word timings**: `demo/words.py <ids…>` → `vo/words.json` (whisper word timestamps). Shots read them via `E.word(id, k)`; **k is a whisper token index, not a character index** (whisper groups 「我们」 as one token) — print the list and count.--**Voice (English, library default):** write `lines.json` with `{id, text, voice, speed}`, run `core/tts/tts.py` (Kokoro, e.g. `bf_emma` / `af_heart`, speed ≈ .9) into `demo/vo/`, then `core/tts/asr_check.py` which writes `vo/dur.json` and a compatible `vo/words.json` (English word indices). Put the same ids/text into `script.json`. See "Switching to English" under Engine reference for the subtitle-split change.--**Music:** Kevin MacLeod — **"Ripples"** (guzheng, 0 → ~37 s) handing over to **"Nu Flute"** (dizi + strings) with a 4.5 s crossfade; both CC BY 4.0 (incompetech.com). The handover is solved backwards so Nu Flute's own 70 s swell lands on the poem: `T_FLU = C.L23.at − 70 + .3`. Nu Flute −3.3 dB relative. 2 s fade in, 3 s fade out. Why these: pentatonic, no drums (percussive energy < 0.02) — the librosa numbers are in `demo/music/analysis.json`.--**Mix (`demo/mix.py`):** voice → downsampled-envelope compressor (−22 dB, 3:1) → HP 70 Hz → RMS −18 dB; music RMS −27.5 dB with **5.5 dB ducking** under speech (0.25 s smoothed envelope); procedural foley at −24…−34 dB: switch click + rising shimmer (lamp on), wooden-mould thud + puff, chimes on reveals, paper rustles, lid thud, train bed (rumble + 0.62 s "clack-clack"), whoosh for the passing train and cloud curtain, city hum, a bite crunch. Everything is placed from `out/timeline.json` (line starts) and `vo/words.json`. Peak-limited to −1 dBFS; the final mux normalises to **−14 LUFS** (two-pass loudnorm in `core/render/mux.sh`).+- 96 bpm; the harp ostinato is locked to the wheel clacks (two per beat at cruising speed). The clacks come from the train's speed curve (`mix.py` `speed()`), so they slow to a stop at the terminus.+- Glockenspiel: one note per window, rising D5–F♯6 at the halt, the same notes falling at the terminus. A bowed-vibraphone note under the lamp.+- Flute tune over the harp on the viaduct and again by the river; strings tremolo in D minor into the tunnel, cut to silence for the blink; an open D major chord with a harp sweep on the way out; solo violin and strings at the sea; harp and strings under the end card.+- Foley: snow wind, river, sea, room tone; lamp clicks, horn (two detuned saws, band-passed), brake hiss, wheel clacks and rumble, whooshes in and out of the tunnel, paper for the ticket. Everything stops during the blink.+- Mix (`demo/mix.py`): voice compressed, RMS −18 dB; music ducked 5 dB under speech with a 300 Hz–4 kHz dip; peak-limited; `core/render/mux.sh` to −14 LUFS, true peak −1.2 dB.+- Instruments from VSCO 2 CE, VCSL (CC0) and Salamander Grand Piano (CC BY 3.0) through `core/audio/sampler.py`.## Palette & props-**Units and layout.** Everything is in metres, y up. Box cavity `BOX = { w: .56, h: .33, d: .16 }` (`src/room.js`). Layers sit at z from about **−0.14 (sky) to 0 (front)**; in-box camera at z ≈ 0.3–0.56 with fov 26°. Full-bleed layers inside the box are `.558 × .328` — **never larger than the cavity**, or they poke through the wooden frame in the room shots.--**Layer stack for a night exterior (S01):**-| z | Layer | Colour | backlight `trans` |-|---|---|---|---|-| −.135 | sky gradient (unlit, `skyPanel`) + stars | `#0a1330 → #172a58 → #2e4478 → #43598a` | — |-| −.125 | moon disc + additive halo | `#fffaf0 / #fff0cf / #f7dca4` | — |-| −.112 | auspicious clouds (祥云) | `#c3cbe8` | .9 |-| −.098 | far karst mountains, carved contour slits | `#6a86c2` | .7 |-| −.080 | mid mountains | `#3f5a92` | .45 |-| −.062 | village (江南 houses) + emissive windows | `#5a70a6` walls / `#1b284f` roofs, glow `#ffb862` | .25 |-| −.046 | river + moon trail (emissive) | `#22325e`, trail `#e9cf96` | .3 |-| −.030 | osmanthus tree + bridge, emissive blossoms | `#17224a`, flowers `#d9a24a` | .12 |-| −.014 | foreground bank + reeds | `#0e1532` | .05 |-| +.004 | hanging lanterns (emissive) | `#0d1328`, glow `#ff8a48` | .05 |--Rule: **back layers bright + translucent, front layers dark + opaque**. Interiors use the same ladder in warm browns (kitchen wall `#b08058`, props `#6e3b1f`, figure `#2e170d`, lamp glow `#ffc878`); the far city uses violets (`#2a2456`, windows `#e8cc90`).--**Accents:** seal red `#b3302a`, gold title paper `#f1dbac` / `#f3d998`, box red `#9e2a20`, a single blue box `#2a4f7a` for the granddaughter's reply.--**Paper finish** (`finish()` in `src/paper.js`): tiled fibre grain (`GRAIN`, 512², α .9, `source-atop`), top rim band `rgba(255,236,200,.35)` shifted 3 px, bottom shade `rgba(0,0,0,.28)` shifted 3 px. Canvas resolution `PPM = 5200` px/m.--**Backlight shader** (`paperMat()`): `emissive += albedo × lightCol × trans × uLit × fall × (.35 + 1.3·cloud)`, `fall = mix(.22, 1, exp(−d²/R²))` around the per-shot light point `uLight` (usually the moon). `cloud` is a tiled pulp-mottle texture (`CLOUD()`). Emissive windows come from a second Canvas (`glowDraw`, white = light) scaled by `glow` and gated by `uGlowLit` (0→1 to "switch on").--**Fonts** (`demo/fonts/`, OFL): Ma Shan Zheng `FONT.brush` for titles/poems, Zhi Mang Xing `FONT.xing` for running script, Long Cang `FONT.hand` for the child's handwriting, Noto Serif SC `FONT.song` for subtitles and credits.--**Real-world set** (`lightbox()` in `src/room.js`): extruded walnut frame (Poly Haven `american_walnut_veneer`, tint `#8a6a52`), black paper lining inside, walnut table, dark radial wall `#2a2018 → #0a0806`, a `RectAreaLight` spill `#ffc98a` (intensity 6–7) at the box mouth, hemisphere fill `.25`, Poly Haven `tea_set_01` (teapot, cup, saucer, plate) and two procedural 3D mooncakes (cylinder + bump-mapped face from `cakeFace`).+- Units in metres, y up. Layers from the sky at z −0.142 to the foreground at about −0.03; the train at −0.0785, its viaduct or embankment at −0.08, platforms and lamp posts in front at about −0.073.+- The train: an engine and seven carriages (`world.js` `car()`), each its own sheet, placed along the track by arc length and turned to its slope; windows are glow-mapped panes. `shots.js` `train()` places the same train on any track function `y(x)` and drives the headlight flare and its light wedge (`uBeam`), which lights the paper it crosses.+- Warm light only in points: windows `#ffc46a`, lamps `#ffc070`, headlight `#ffd590`. Bloom strength 0.3, threshold 1.15.+- Paper text: name boards (PINE HALT, ELM HALT, STONE HALT, MILL HALT, SEA END) and the ticket, all placed clear of every light.## Titles, subtitles & end card-- Burned-in DOM subtitle (`#sub` in `index.html`): Noto Serif SC 500, 40 px, `#fbf3e4`, letter-spacing .06em, 74 px from the bottom, soft black shadow; fades in 0.15 s before the line, out 0.3 s after. Lines longer than 21 characters split at the comma nearest the middle; trailing punctuation is dropped and inner `,。:` become full-width spaces.-- **Lines that appear as paper in the picture are not subtitled** (`"sub": false` in `script.json`): grandma's letter (L17) and the poem (L23). Don't show the same words twice.-- Title: vertical Ma Shan Zheng on a paper strip inside the box (「一个月饼 / 的相思」) with a red seal 「中秋」, fading in after the second line.-- End card: 「中秋快乐」 paper title inside the box + red seal 「团圆」; the credit block (`#credit`, 19 px, two lines: music / assets / fonts) fades in 0.6 s after the last line.-- **Sign-off (this library's demo only):** our demo's end card carries **"LemoLab × Claude Opus 5.5"** as a **paper-cut strip inside the lightbox**, not as overlay text: `sign` sheet in `src/shots/s18_finale.js` — `w .26, h .02`, centred at `y −.1515` on the dark foreground bank, `z −.024` (in front of the bank layer, near the final focus plane), `text(…, .0115, FONT.song, { fill: '#f3d998', weight: 600 })`, `trans .3`, `shadow/recv: false`. It fades in over `tT + 1.0 → tT + 2.0` (1 s after 「中秋快乐」 starts, ≈116.6–117.6 s) and stays to the end, so it reads as part of the lamp while the credit block sits on the table below. It belongs to the library's own demos: a user's film carries no LemoLab credit, no strip like this and no copy of this end card.-- `paper-lantern.srt` holds all 25 lines (including the two in-picture ones) at their spoken times.--## Pitfalls we hit (demo record)--- **`destination-out` cut-outs need an opaque fillStyle**: set `x.fillStyle = '#000'` (or any opaque colour) before punching holes; a transparent or glow-white fill leaves the hole half-cut. `props.js` `cut(x, fn)` does it for you.-- **VSM shadows leak light bleeding / self-shadow halos**: layers that must not take part (titles, lanterns in front, light arcs, curtains) need **both** `shadow: false` **and** `recv: false`.-- **Additive glows**: a transparent radial-gradient `CanvasTexture` shows a visible square edge. Use the analytic `ShaderMaterial` falloff (`burst()` in `paper.js`) for light spilling out of an opened box.-- **Near-plane cloud curtain**: compute the closing position so the two curtains' **front edges** touch (`±.035` offset in `s16_mutual.js`), otherwise a slit of the old shot shows through.-- **Layers bigger than the cavity** poke through the wooden frame in room shots — keep full-bleed sheets ≤ `.558 × .328`.-- **Grade uniforms must not be sticky**: if `Pipe.final()` writes `lift`/`gain` only when a shot's `grade()` returns them, a shot without them inherits the previous shot's values and the result depends on which frame a render worker started on (visible grade pops at worker boundaries, e.g. 60.9 s / S09 and 101.5 s / S16). So every missing grade key falls back to `GRADE0` (`post.js`: lift `[0, .005, .018]` cool night default, gain `[1.03, 1, .95]`), and renders are identical for any worker count. Night exteriors rely on the defaults; interiors must return their warm `lift` explicitly (as S08 does).-- Whisper medium mishears Chinese homophones (八月 → 8月, 她 → 他, 婵娟 → 禅绢); judge DIFFs by ear, not by string match.-- Headless Chrome must run with GPU flags (`--use-angle=gl --enable-gpu --ignore-gpu-blocklist`, `render/browser.mjs`); SwiftShader is ~6× slower.+- Subtitles: one Chinese line (Noto Serif SC 500, 40 px) over one English line (Cormorant Garamond 600, 42 px), warm off-white, 64 px from the bottom, on the dark front band, with a faint dark band (`#sub .band`). `demo/tools/subcheck.py` measures the ground under every cue: 98 % or more of the non-text pixels are dark in this film. The last line stays to the end.+- End card: a paper ticket on a thread drops from above at 47.5 s, overshoots and swings to rest. Main panel: a route line `FROM PINE HALT → TO SEA END`, the title (English largest, then 末班夜车), a rule, the style name 纸雕灯影 / Paper-cut Lightbox, and `LemoLab × Claude Opus 5.5` on its own line; notched corners, a punched hole top left, a perforated stub with a red 车 stamp. The sign-off belongs to the library's own demos: a user's film carries no LemoLab credit and no copy of this card.-## Build notes+## Pitfalls we hit-```-styles/paper-lantern/demo/- index.html page: canvas + #sub + #credit, importmap → /node_modules/three (repo root is the static server root)- script.json lines: {id, text, rate?, say?, sub?}- tts.py asr.py words.py edge-tts → vo/*.wav + dur.json; whisper proof; word timings → vo/words.json- src/main.js timeline (GAP table), shot scheduler (lazy build / dispose), dissolves, subtitles, credits, window.render(t)- src/shots/index.js shot list, each start anchored to a line: start: L('L06') - .5- src/shots/sNN_*.js one module per shot: build(E) → { S, update(t), post(t), grade(t) }- src/paper.js stage.js post.js room.js art.js people.js props.js lib.js engine (see Engine reference)- render/still.mjs video.mjs cues.mjs stills, parallel video render, export out/timeline.json- mix.py voice + music + foley → out/mix.wav- music/ analysis.json (librosa numbers); km_Ripples.mp3 + km_Nu_Flute.mp3 (incompetech, git-ignored)-```+- A sky panel of fixed width shows its edge in a travelling shot: move it with the camera.+- Light over text: a lamp flare covered the PINE HALT board at first; every board now sits clear of lamps and the headlight.+- Subtitles over a lit window wash out: keep the bottom band dark, or use the faint band.+- A long black reads as a broken film: the tunnel blink is 0.27 s, sound included.+- Wide frames with the train as a thin dotted line in the middle and empty dark below look thin: fill the frame with layers (a foreground silhouette, a slope or a town behind, a curve in the line) and get close at the moments that matter.-All commands from the repo root (`lemo-opuscar/`). Python = `.venv/bin/python`; `edge-tts` must be on `PATH` (user-level `pip install edge-tts`; it is not in `.venv`).+## Build```sh-D=styles/paper-lantern/demo-# 1. voice (Mandarin demo) — delete vo/<id>.mp3 or set "redo": true to regenerate a line-python3 $D/tts.py # → $D/vo/<id>.wav, $D/vo/dur.json-.venv/bin/python $D/asr.py # OK / DIFF per line (≈1.5 min, whisper medium, CPU)-.venv/bin/python $D/words.py L01 L02 … L25 # → $D/vo/words.json (pass ALL ids: it rewrites the file)-# English instead: .venv/bin/python core/tts/tts.py $D/lines_en.json $D/vo && .venv/bin/python core/tts/asr_check.py $D/lines_en.json $D/vo--# 2. timeline + review stills (any number of times, seconds)-node $D/render/cues.mjs # → $D/out/timeline.json (DUR, line cues C, shot plan P)-node $D/render/still.mjs 5 12.5 62.5 116 --out $D/out/review # add --q '?ssaa=1' for fast previews-# core renderer works too: node core/render/still.mjs $D 12.5 --out $D/out/review-# debug: ?sheet (character sheet), ?nolit=1 (backlight off), ?hide=clouds,far (S01 layers)--# 3. mix-.venv/bin/python $D/mix.py # → $D/out/mix.wav (optional arg: other output path)--# 4. render video (≈90 s for 3653 frames with 6 workers on an M-series Mac; ≈3 min with 2)-node $D/render/video.mjs --workers 6 # → $D/out/video.mp4 (segments written next to the output; any worker count gives the same frames)--# 5. mux: two-pass loudnorm −14 LUFS, 30 fps, no grain-sh core/render/mux.sh $D/out/video.mp4 $D/out/mix.wav styles/paper-lantern/paper-lantern.mp4 30 0+LIB=<library root> sh styles/paper-lantern/demo/build.sh # fonts, voice, timeline, picture, mix, master, poster, style frame+LIB=<library root> sh styles/paper-lantern/demo/build.sh 40 51 # only a span of the film → demo/out/cut_40-51.mp4```-Review loop: stills of every shot at its key word time → sheet (`ffmpeg … tile=6x5`) → fix → only then the full render. Check the room shots (first 10 s, last 8 s) at full SSAA; they carry the "it's a real object" illusion.+On a fresh clone, first: `sh plugin/skills/lemo-opuscar/scripts/setup.sh deps voice`, `sh tools/fetch.sh instruments vsco2ce`, `sh tools/fetch.sh instruments vcsl`, `sh tools/fetch.sh instruments salamander`. `demo/tools/fonts.py` downloads the two OFL fonts and subsets Noto Serif SC to the film's characters. The narration WAVs are regenerated from `demo/voices/lines.json` when missing, then checked with `asr_check.py`.-## Engine reference+`demo/tools/timeline.py` is the one timeline: narration starts, subtitle cues, every action's time (`HIT`: the lamp, each window, the departure, the tunnel, the stop, each window going out, the card) and the shot list. The page (`timeline.json`) and `mix.py` read it; it writes `paper-lantern.srt`. Query options: `?from=a&to=b` renders a span, `?nosub=1` hides the subtitles (for stills). About 40 s for 1 530 frames with 2 workers on an M-series Mac.-**Page contract** (`src/main.js`): exposes `window.READY`, `window.DUR`, `window.render(t)` (deterministic per frame), `window.CUES` (line cues), `window.PLAN` (shot table). Query `?ssaa=N` (default 2).+Reading-time check (`core/render/readcheck.mjs`): the page exposes no `window.TEXTS`, so the tool reports that it cannot check. The paper text on screen (the name boards, the ticket) stays in frame for at least 4 s each; subtitles are timed by the `.srt` (each ≥ 1.8 s and ≥ its line + 0.6 s).-**Timeline**: lines start at 2.6 s; each line lasts its `dur.json` length followed by `GAP[id]` seconds (`GAP` table in `main.js`, e.g. `L02: 4.2` for the title beat, `L25: 5.0` for the ending). Shots are anchored to lines in `src/shots/index.js`; changing a voice line re-times everything automatically.+## Engine reference-**Shot context `E`** (passed to `build`): `dur`, `T0`, `C` (all cues), `env` (PMREM room env map), `W` (words), `cue(id)` / `cueEnd(id)` (line start/end in shot-local seconds), `word(id, k)` (shot-local start of whisper token k).+**Page contract** (`src/main.js`): `window.READY`, `window.DUR`, `window.render(t)` (deterministic). Query `?ssaa=N` (default 2).| Module | Key API | Notes ||---|---|---|-| `paper.js` | `sheet({ U, w, h, draw, glowDraw?, glow, glowCol, trans, z, x, y, ax, ay, shadow, recv, finish, ppm, bumpDraw? })` | One paper layer. `draw(x, k)` paints in metres (origin centre, y up). `glowDraw` paints the emissive map (white = light, black = mask). `trans` = backlight translucency. `ax/ay` = pivot. Returns a Mesh; `m.material.userData.u` has `uTrans`, `uGlowLit`, `uClip` (circle clip `[cx, cy, r, inside?]`). |-| | `skyPanel({ w, h, z, stops, stars, starMinY, gain })` | Unlit gradient back panel. |-| | `moon({ x, y, z, r, gain, halo, haloGain, art? })`, `setMoon(m, k)` | Disc + additive halo; `k` = brightness 0…1+. |-| | `text(x, s, px, py, size, font, o)`, `vtext(…)` | Text in metre space (vertical for `vtext`). |-| | `burst(w, h, col)` → `m.userData.set(k)` | Analytic additive glow. |-| | `paint(w, h, draw, ppm)`, `finish(c, o)`, `tex(c)`, `PPM`, `GRAIN`, `CLOUD()` | Low-level canvas helpers. |-| `stage.js` | `stage({ light, lightR, lightCol, key, keyCol, keyPos, keyTarget, keyAngle, amb, ambCol, shadowR, fov, bg })` → `{ scene, U, cam, key, amb, add(...) }` | Scene + top LED spot (VSM, 2048², radius 10) + ambient + backlight uniforms `U`. |-| | `aim(cam, [px,py,pz, tx,ty,tz], t, { hand, handF, roll, fov })` | Camera with hand-held drift. |-| | `dispose(scene)` | Called by the scheduler when a shot leaves. |-| `post.js` | `Pipe.shot(scene, cam, { focus, aper, maxCoc, bloom: { strength, radius, threshold } }, target)` | MSAA4 half-float → CoC → 96-tap gather DoF → UnrealBloom. `focus` = distance in metres. |-| | `Pipe.final({ mixB, mode, center, expo, fade, vig, sat, contrast, lift, gain })` | Dissolve / iris, grade, vignette, neutral tone map, sRGB. Keys a shot omits fall back to `GRADE0` every frame. |-| `room.js` | `await lightbox(S, E, { spill, spillCol })` → `{ g, frame, spill, table, props }`, `BOX` | Real-world box, table, tea set, mooncakes. Textures load from `/core/assets/polyhaven/`. |-| `art.js` | `karst`, `ridge`, `xiangyun`, `waves`, `waterTop`, `osmanthus`, `pine`, `willow`, `reeds`, `jiangnanHouse(x, o, g)`, `pavilion`, `lantern(x, o, g)`, `mooncake`, `FONT` | Paper-cut motifs; functions with `g` draw their windows into the glow canvas. |-| `people.js` | `grannyStand/Sit`, `girlStand/Sit`, `childStand`, `sushi`, `change` (Chang'e), `rabbit`, `arm(x, s, a, b)`, `spline`, `ribbon`, `*_SHOULDER` | Silhouette figures, scale `s` = height in m. |-| `props.js` | `cut(x, fn)`, `roundWindow`, `steamers`, `stove`, `jar`, `bowl`, `teapot`, `pendant`, `calendar`, `table`, `chair`, `boxFront`, `label`, `cake3q` | Interior props. |-| `lib.js` | `ss`, `seg`, `eio`, `eo`, `ei`, `back`, `spring`, `lerp`, `clamp`, `mulberry`, `vnoise`, `track`, `env` | Deterministic helpers. |--**Minimal shot** (a moonlit hill with one lit window; add it to `SHOTS()` as `{ id: 'S99', start: L('L05') - .3, in: { type: 'dissolve', dur: .8 }, build: s99.build }`):+| `paper.js` | `sheet({ U, w, h, draw, glowDraw?, glow, glowCol, trans, z, x, y, ax, ay, shadow, recv, finish, ppm })` | One paper layer; `ax/ay` = pivot. Per sheet: `uGlowLit` (switch the glow), `uGR` (glow only inside a radius; it lights the river town behind the train), `uGY`, `uClip`. Shared: `uLight`, `uFloor`, `uBeamO/uBeamD` (the headlight wedge). |+| | `skyPanel`, `moon`, `text`, `burst`, `finish`, `paint`, `PPM` | |+| `stage.js` | `stage({ light, lightR, lightCol, key, keyCol, keyPos, keyTarget, amb, floor })`, `aim(cam, [px,py,pz, tx,ty,tz], t, { hand })`, `dispose()` | Scene, top spot (VSM), backlight uniforms, hand-held drift. |+| `post.js` | `Pipe.shot(scene, cam, { focus, aper, maxCoc, bloom }, target)`, `Pipe.final({ mixB, expo, vig, sat, contrast, lift, gain, fade })` | Grade keys fall back to defaults every frame. |+| `world.js` | `peaks(x, o)`, `firs(x, o)`, `car(x, g, L, H, loco)`, `tint`, `cut`; `world(E)` = shot S1 | Motifs in metre space; sheets are cut in neutral grey and coloured by `tint()`. |+| `shots.js` | `s2`…`s6(E)`; helpers `train(S, U, z)`, `lampPost`, `haltSign`, `glowDisc`, `band`, `fir` | Each shot: `{ S, update(t), post(), grade() }`, `t` in film seconds. |++**Minimal shot** (a train crossing a lit valley):```js-import { sheet, skyPanel, moon, setMoon } from '../paper.js';-import { karst, jiangnanHouse } from '../art.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp } from '../lib.js';--export function build(E) {- const MN = [.08, .07, -.13];- const S = stage({ light: MN, lightR: .15, lightCol: '#ffe2ae', key: 1.0, amb: .3, ambCol: '#7d90c8', keyCol: '#d6dcff' });+import { sheet, skyPanel } from './paper.js';+import { stage, aim } from './stage.js';+import { tint, PAPER, peaks } from './world.js';+import { train } from './shots.js';+export function crossing(E) {+ const S = stage({ light: [0, .03, -.1], lightR: .12, lightCol: '#b8c8f0', key: 1, amb: .2, floor: .3 });const { U } = S;- S.add(skyPanel({ w: .56, h: .33, z: -.14, stops: [[0, '#0a1330'], [1, '#43598a']], stars: 200 }));- const mn = S.add(moon({ x: MN[0], y: MN[1], z: MN[2], r: .035 }));- S.add(sheet({ U, w: .558, h: .328, z: -.1, trans: .7, draw: x => { x.fillStyle = '#6a86c2';- karst(x, { x0: -.28, x1: .28, base: -.03, peaks: [[-.15, .06, .03], [.1, .05, .025]], carve: .0005 }); } }));- const house = { cx: -.05, by: -.09, w: .06, h: .03, windows: [[.012, .01, .01, .01]], wall: '#5a70a6', tile: '#1b284f' };- const town = S.add(sheet({ U, w: .558, h: .328, z: -.06, trans: .25, glow: 2.2, glowCol: '#ffb862',- draw: x => jiangnanHouse(x, house), glowDraw: g => jiangnanHouse(null, house, g) }));- S.add(sheet({ U, w: .558, h: .328, z: -.02, trans: .05, draw: x => { x.fillStyle = '#0e1532'; x.fillRect(-.28, -.165, .56, .075); } }));- const tOn = E.word('L05', 2); // light the window on the 3rd spoken token+ S.add(skyPanel({ w: 1, h: .5, z: -.142, stops: [[0, '#060b22'], [1, '#283a6a']], stars: 200 }));+ const far = S.add(sheet({ U, w: .74, h: .36, z: -.126, trans: .85, draw: x => { x.fillStyle = PAPER; peaks(x, { x0: -.37, x1: .37, base: 0, list: [[-.1, .1, .07], [.12, .08, .06]] }); } }));+ tint(far, '#7385b6');+ const tr = train(S, U, -.0785);return {S,- update(t) {- setMoon(mn, ss(seg(t, 0, 1.5)));- town.material.userData.u.uGlowLit.value = ss(seg(t, tOn, tOn + .6));- aim(S.cam, [0, 0, lerp(.56, .48, eio(t / E.dur)), 0, 0, -.07], t);- },- post() { return { focus: S.cam.position.z + .06, aper: 14, maxCoc: 14, bloom: { strength: .35, radius: .6, threshold: 1.15 } }; },- grade() { return { expo: 1.05, vig: .42, sat: 1.05, contrast: .1 }; }, // missing lift/gain → GRADE0 (cool night); interiors add lift: [.012, .006, 0]+ update(t) { tr.set(-.2 + .12 * t, () => -.006, 1); aim(S.cam, [0, 0, .43, 0, -.01, -.08], t); },+ post() { return { focus: .51, aper: 10, maxCoc: 10, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { return {}; },};}```--**Switching to English**: in `main.js` the subtitle splitter assumes Chinese (`st.length > 21`, split on `[,。:]`, punctuation → full-width space). For English change it to split at the `, ` nearest the middle when longer than ~42 characters and keep punctuation; set `#sub` to a Latin serif (e.g. add an OFL font such as Cormorant to `fonts/`) at ~38 px. `E.word(id, k)` then counts English words. Everything else (timeline, mix, render) is language-agnostic.diff --git a/styles/paper-lantern/STYLE.md b/styles/paper-lantern/STYLE.mdindex 8c6ddf8..b7c5d72 100644--- a/styles/paper-lantern/STYLE.md+++ b/styles/paper-lantern/STYLE.md@@ -1,11 +1,11 @@# Paper-cut Lightbox — Style Prompt-> A layered paper-cut shadow box (纸雕灯) lit from behind: 6–9 sheets of cut card stacked in a shallow box, a warm light glowing through the paper, windows and moons burning through holes, soft shadows falling from each layer onto the next. The frame is the box; the camera is a macro lens inside a lamp.-> References (grammar only): commercial paper-cut shadow-box lamps (纸雕灯 / "shadow box lightbox") for the layer stack and backlight; Lotte Reiniger's silhouette films for the cut-out, jointed figure language; Chinese 剪纸 motifs (auspicious clouds, eaves, mountains) as one possible vocabulary. Do not copy any specific lamp design, film frame or character.+> A layered paper-cut shadow box (纸雕灯) lit from behind: 6–9 sheets of cut card stacked in a shallow box, a warm light glowing through the paper, windows and moons burning through holes, soft shadows falling from each layer onto the next. The camera is a macro lens inside a lamp: it can show the box, or let the paper scenery fill the whole screen.+> References (grammar only): commercial paper-cut shadow-box lamps (纸雕灯 / "shadow box lightbox") for the layer stack and backlight; Lotte Reiniger's silhouette films for the cut-out, jointed figure language (when a film has figures); Chinese 剪纸 motifs (auspicious clouds, eaves, mountains) as one possible vocabulary. Do not copy any specific lamp design, film frame or character.## 1. Essence, and what it is not-Every shot is **one physical object**: a shallow box (a cavity about 0.56 × 0.33 m, 0.16 m deep) holding parallel sheets of cut paper. Everything on screen is one of three things:+Every shot is made of **one physical object**: a shallow box (a cavity about 0.56 × 0.33 m, 0.16 m deep) holding parallel sheets of cut paper. Two framings are both valid, and a film may use either or both: **box framing** (the lamp's edge or frame is in the picture) and **full-bleed** (the lens is inside the box and the paper scenery fills the screen). The stack, the backlight and the shadows are the same in both. Everything on screen is one of three things:1. **A paper layer**: a flat cut sheet, one flat colour, fibre grain, a thin warm **rim of light on its top edge** and a **dark band on its bottom edge**. Back layers lighter and cooler, the front almost black: that value ladder *is* the depth.2. **Light through paper**: a warm, cloudy translucency (pulp mottling), strongest near the light source. Windows, lanterns, trails of light are **holes / emissive windows** that burn and bloom.@@ -17,7 +17,7 @@ Not flat paper-cut animation (here: depth, backlight, cast shadows), not shadow## 2. Materials & rendering-- **Units in metres, y up.** Layers from z ≈ −0.14 (sky) to 0 (front); camera at z ≈ 0.3–0.56, fov ~26°. Full-bleed sheets are **never larger than the cavity**.+- **Units in metres, y up.** Layers from z ≈ −0.14 (sky) to 0 (front); camera at z ≈ 0.2–0.56, fov ~26°. In box framing, sheets are **never larger than the cavity**. In full-bleed shots that travel, a layer may be a long strip that scrolls past, and the sky panel moves with the camera so its edge never shows.- **A layer** is a Canvas2D drawing in metre space mapped to a plane; cut-outs are `destination-out` holes. Finish on every sheet: fibre grain (`source-atop`), a warm top rim and a dark bottom shade, each shifted a few px.- **Backlight shader**: `emissive += albedo × lightCol × trans × lit × falloff × (base + cloud)`, with a Gaussian falloff around a per-shot light point and a tiled pulp-mottle texture. `trans` per layer goes from ~.9 (far) to ~.05 (front).- **Emissive windows**: a second canvas (white = light) gated by a 0→1 "switch on" uniform; bloom makes them burn. Titles, lights and curtains in front neither cast nor receive shadows.@@ -36,14 +36,17 @@ Not flat paper-cut animation (here: depth, backlight, cast shadows), not shadow- **Text in the picture is paper**: titles, letters, poems and captions are cut strips inside the box, revealed by growing from an anchor edge (scale the texture repeat with the mesh so glyphs aren't squashed), with an optional small seal.- Chinese: an OFL brush font (e.g. Ma Shan Zheng) for titles, a running script for handwriting, Noto Serif SC for subtitles. Latin: an OFL serif (e.g. Cormorant) at similar weight.-- **Subtitles** are a quiet burned-in line under the box (serif 500, ~40 px CJK / ~38 px Latin, warm off-white, soft shadow, ~74 px from the bottom), fading in just before the line. Split long lines at the comma nearest the middle (~21 CJK / ~42 Latin characters).+- **Subtitles** are quiet and burned in: warm off-white serif, soft shadow, fading in just before the line. Where they sit depends on the framing:+ - **box framing**: under the box, on the dark of the room (serif 500, ~40 px CJK / ~38 px Latin, ~74 px from the bottom);+ - **full-bleed**: on the darkest band at the bottom of the scene (the front layer), ~64 px from the bottom, never over a figure, a lit window or a light. A faint dark band behind the text is allowed when something lit has to sit there.+ - A bilingual cue is one CJK line (~40 px) over one Latin line (~42 px). No wrapping: a line longer than ~21 CJK / ~42 Latin characters becomes two cues, split at the comma nearest the middle.- **Words that appear as paper are not subtitled**: never show the same words twice.- Hold ≥ max(1.8 s, speech + 0.6 s).## 5. Motion quality- **Everything moves like paper on a stick**: layers slide (x/y), rotate about a pivot, scale in from 0 along one axis ("written out"), or light up. No squash and stretch, no morphing, no bending.-- **Jointed figures**: a body sheet + separate limb sheets anchored at the joint; animate rotation only.+- **Figures are optional.** A film can tell its story with lit windows, vehicles, lamps and objects, and have no figure at all. When it has figures, they are jointed silhouettes: a body sheet + separate limb sheets anchored at the joint; animate rotation only.- **Light cues are the big motion**: the source, then each layer's translucency in a ~0.4 s stagger, then windows, then flicker (`1 + .06·sin(7.3t)·sin(3.1t)`).- **Hard action lands on spoken words** (use whisper word timings): an object slams, a character flashes, a light arc grows on its word.- Hand-held micro-drift on the camera (~0.6 mm) keeps a locked frame alive. Render on ones at 30 fps; never step.@@ -63,6 +66,7 @@ A vocabulary, not a route. The lens is small and the box is shallow: moves are s| Locked frame with only light changing | waiting; the passage of a day or a night | a vigil; seasons; a city going to sleep || Tilt up/down the stack | climbing; falling; sky vs ground | a mountain; a well; hope and weight || Near-plane occluder wipe | a curtain between scenes | chapter changes; dreams; a secret revealed |+| Travelling alongside | speed; being carried along (near layers rush past, far layers drift) | a journey by train or boat; a delivery; a migration |Framing: the story layer in focus, foreground and far layers soft; box edges fully out of frame inside, clearly in frame outside, never half. Transitions: dissolves (0.5–1.2 s), an iris, light off/on, a near-plane curtain whose halves meet exactly. No whip pans, no digital zooms.@@ -85,29 +89,31 @@ A menu: use the ones your story needs.- **Paper that writes itself.** A strip grows from its edge on the spoken word. *Fits content like:* a recipe; the terms of a treaty; a child's first word.- **The box as keepsake.** The camera finds the real lamp in a room, real objects lit by its spill. *Fits content like:* a wedding anniversary; a product unboxing; a museum object's story.- **Light burst from an opened thing.** A lid lifts and analytic glow spills out. *Fits content like:* a gift; a discovery; a new idea.-- **Silhouette in a window.** One jointed figure inside a lit frame. *Fits content like:* someone working late; a portrait of a craftsperson; a patient waiting.+- **Silhouette in a window.** One figure inside a lit frame, or none: a lit window alone is enough. *Fits content like:* someone working late; a portrait of a craftsperson; a patient waiting.## 9. Pitfalls of the medium-- `destination-out` cut-outs need an **opaque fillStyle** before punching, or the hole is half-cut (`props.js` `cut(x, fn)` does it).+- `destination-out` cut-outs need an **opaque fillStyle** before punching, or the hole is half-cut (`world.js` `cut(x, fn)` does it).- Soft shadows bleed and halo: layers that must not take part need **both** `shadow: false` and `recv: false`.- A transparent radial-gradient texture shows a square edge as an additive glow → use an analytic shader falloff (`burst()`).- A near-plane curtain whose halves don't meet at their **front edges** leaves a slit of the old shot.- Sheets larger than the cavity poke through the frame in outside shots.- **Grade state must not carry over** between shots: every grade key a shot omits must fall back to a default each frame, or renders depend on which frame a worker started on (visible pops at worker boundaries).+- **Light over paper text**: a lamp's glow or a headlight flare over a name board or a card washes the letters out. Keep every lit point clear of text.+- **Subtitles over a lit window** lose their contrast: frame so the bottom band is dark, or put the faint band behind them.- Headless Chrome must run with GPU flags; SwiftShader is ~6× slower.## 10. Engine-In `demo/src/`: `paper.js` (`sheet()` = one lit paper layer; `skyPanel`, `moon`, `text`, `burst`), `stage.js` (scene, top spot, `aim()` camera), `post.js` (DoF, bloom, transitions, grade), `room.js` (the real box and table), `art.js` / `people.js` / `props.js` (motifs, jointed figures, props), `lib.js`. `src/main.js` schedules shots, each `build(E) → { S, update(t), post(t), grade(t) }`. API table and a minimal shot: [DEMO.md](DEMO.md) "Engine reference".+In `demo/src/`: `paper.js` (`sheet()` = one lit paper layer with an optional glow map and reveal uniforms; `skyPanel`, `moon`, `text`, `burst`), `stage.js` (scene, top spot, backlight uniforms, `aim()` camera), `post.js` (DoF, bloom, transitions, grade), `world.js` (paper motifs: peaks, firs, the train's carriages; the first shot), `shots.js` (the other shots), `lib.js`. `src/main.js` reads one timeline and draws each shot, two during a dissolve; each shot is `build(E) → { S, update(t), post(), grade() }`. API table and a minimal shot: [DEMO.md](DEMO.md) "Engine reference".## 11. Variation space-You decide the places, the figures (or none), the ladders, the light source, whether the real world appears, the opening, the ending and the camera path. All far from our demo:+You decide the places, the figures (or none), the ladders, the light source, the framing, whether the real world appears, the opening, the ending and the camera path. Stay away from our demo's story (an old night train's last run from a snowy halt to the sea), its shots (windows lighting up car by car, a curved viaduct over a snowy valley, a tunnel that blinks to black, windows going out one by one at a terminus) and its props (a paper train, halts with name boards, a ticket end card). Some directions:- Structures: **one window, one year** (a locked lamp; the scene inside changes season by season, light the only transition); **a vertical stack** (the film tilts down through sky, city, street, underground, each a chapter); **a relay of objects** (a single object passes hand to hand across five small boxes, each a different ladder).- Openings: **already lit, mid-scene** (a figure walking through a lit street; we learn it is paper only when the camera racks focus); **darkness and one hole** (a single pinprick of light widens into a moon, a door, an eye); **top-down** (hands' view of a sheet being cut; the cut sheet slides into the stack).-- Endings: **the lights go out one by one**, the last window last; **rack focus to the front layer** until the story blurs into warm light; **a new sheet slides in** at the front, starting the next story.+- Endings: **rack focus to the front layer** until the story blurs into warm light; **a new sheet slides in** at the front, starting the next story; **pull out to the lamp on a table**, its spill on the objects around it.---diff --git a/styles/paper-lantern/demo/CREDITS b/styles/paper-lantern/demo/CREDITSindex a6c2bb2..33ca15b 100644--- a/styles/paper-lantern/demo/CREDITS+++ b/styles/paper-lantern/demo/CREDITS@@ -1,36 +1,27 @@-一个月饼的相思 · A Mooncake's Longing — Paper-cut Lightbox (Lemo-Opuscar demo)+The Last Night Train · 末班夜车 — Paper-cut Lightbox 纸雕灯影 (Lemo-Opuscar demo)LemoLab × Claude Opus 5.5-All paper layers, figures, props, calligraphy layouts and the lightbox are drawn by code in this folder-(Canvas2D paper layers + three.js renderer). No photos or AI-generated images inside the box.-Story, script and shot design are original.+Story, picture, score and sound are made in code in this folder. Every paper layer, the train, the stations and the end card+are drawn by src/ (Canvas2D paper layers + three.js renderer). No photos, footage or generated images are used.+The line and its stations are fiction (see FACTS.md).-Music (both used in the film, crossfaded at ~37 s):-- "Ripples" — Kevin MacLeod (incompetech.com). Licensed under Creative Commons: By Attribution 4.0 License- http://creativecommons.org/licenses/by/4.0/ · file: music/km_Ripples.mp3-- "Nu Flute" — Kevin MacLeod (incompetech.com). Licensed under Creative Commons: By Attribution 4.0 License- http://creativecommons.org/licenses/by/4.0/ · file: music/km_Nu_Flute.mp3+Narration+- Kokoro TTS (kokoro-onnx, model Kokoro-82M v1.0, voice bm_george), Apache License 2.0+ https://github.com/thewh1teagle/kokoro-onnx · https://huggingface.co/hexgrad/Kokoro-82M+ Generated offline with core/tts/tts.py and checked with core/tts/asr_check.py (faster-whisper base.en, MIT).-3D assets and textures (Poly Haven, CC0), loaded from core/assets/polyhaven/:-- tea_set_01 — https://polyhaven.com/a/tea_set_01-- american_walnut_veneer (walnut_diff / walnut_nor / walnut_rough) — https://polyhaven.com/a/american_walnut_veneer-Environment lighting: three.js RoomEnvironment (procedural, MIT). No HDRI is used (the HDRIs and the desk lamp in-core/assets/polyhaven/ belong to the shared folder, not to this film).+Music (written for this film, played on sampled instruments by core/audio/sampler.py)+- 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)+ Instruments: glockenspiel, bowed vibraphone, harp, flute, solo violin, violins, violins tremolo, violas, cellos, contrabass, piano.-Fonts (SIL Open Font License 1.1, Google Fonts; files in fonts/src/, licence texts not bundled — see fonts.google.com):-- Ma Shan Zheng — titles, poem, seals-- Zhi Mang Xing — running-script notes-- Long Cang — the granddaughter's handwriting-- Noto Serif SC — subtitles and credits+Sound effects+- Procedural (core/audio/sfx.py and mix.py): snow wind, river, sea, room tone, wheel clacks, rumble, horn, brake hiss,+ lamp clicks, shimmer, tunnel whooshes, paper.-Voice: Microsoft Edge neural TTS voice zh-CN-XiaoxiaoNeural, generated with the open-source edge-tts client-(github.com/rany2/edge-tts).-LICENCE EXCEPTION: this voice track (the narration in paper-lantern.mp4) is NOT covered by the library's CC BY 4.0-licence for demo films; Microsoft's terms for redistributing Edge TTS audio are unclear. We plan to re-voice it with-Kokoro (core/tts/). In your own film, use Kokoro or a voice you have the right to use, never this track.-Speech check / word timings: faster-whisper (MIT) with the Systran faster-whisper-medium model (MIT).-Sound effects: synthesized in mix.py (no samples).+Fonts (SIL Open Font License 1.1; fetched into fonts/ by tools/fonts.py, licence texts alongside)+- Cormorant Garamond — Christian Thalmann (Catharsis Fonts), https://github.com/CatharsisFonts/Cormorant+- Noto Serif SC (subset to the characters the film uses) — Adobe / Google, https://github.com/notofonts/noto-cjk-Texts quoted: 苏轼《水调歌头·明月几时有》(Song dynasty); 田汝成《西湖游览志余》(Ming dynasty) — public domain.--Software: three.js (MIT), playwright-core (Apache-2.0), FFmpeg (LGPL/GPL).+Picture engine+- three.js r170 (MIT), loaded from the library's node_modules.diff --git a/styles/paper-lantern/demo/FACTS.md b/styles/paper-lantern/demo/FACTS.mdnew file mode 100644index 0000000..02fa1df--- /dev/null+++ b/styles/paper-lantern/demo/FACTS.md@@ -0,0 +1,7 @@+# Facts in The Last Night Train++The film is fiction. Nothing on screen stands for a real railway, place or event.++- **Stations**: PINE HALT (the departure), ELM HALT, STONE HALT and MILL HALT (passed on the way) and SEA END (the terminus) are invented names. They are not real stations.+- **"For forty years"**: the age of the line is part of the story, not a fact about any railway.+- **The train**: a generic old night train drawn in code (an engine and seven carriages). It is not modelled on a real locomotive.diff --git a/styles/paper-lantern/demo/asr.py b/styles/paper-lantern/demo/asr.pydeleted file mode 100644index 0432d6b..0000000--- a/styles/paper-lantern/demo/asr.py+++ /dev/null@@ -1,9 +0,0 @@-import json, re-import os as _os; _os.chdir(_os.path.dirname(_os.path.abspath(__file__))) # paths relative to demo/-from faster_whisper import WhisperModel-m = WhisperModel('medium', device='cpu', compute_type='int8')-norm = lambda s: re.sub(r'[^一-鿿0-9]', '', s)-for L in json.load(open('script.json')):- segs, _ = m.transcribe(f"vo/{L['id']}.wav", language='zh', beam_size=5, initial_prompt='以下是普通话的句子。')- got = ''.join(s.text for s in segs)- print('OK ' if norm(got)==norm(L['text']) else 'DIFF', L['id'], norm(L['text']), '→', norm(got))diff --git a/styles/paper-lantern/demo/assets/SOURCES.md b/styles/paper-lantern/demo/assets/SOURCES.mddeleted file mode 100644index d412891..0000000--- a/styles/paper-lantern/demo/assets/SOURCES.md+++ /dev/null@@ -1,8 +0,0 @@-# Poly Haven assets used by this demo (CC0)--Loaded at render time from the shared folder `core/assets/polyhaven/` (see `src/room.js`); nothing is copied here.--- tea_set_01 — https://polyhaven.com/a/tea_set_01-- walnut_diff/nor/rough.jpg — american_walnut_veneer, https://polyhaven.com/a/american_walnut_veneer--Lighting is three.js `RoomEnvironment` (procedural). The HDRIs (lythwood_lounge, photo_studio_loft_hall) and desk_lamp_arm_01 in `core/assets/polyhaven/` are not used by this demo.diff --git a/styles/paper-lantern/demo/build.sh b/styles/paper-lantern/demo/build.shnew file mode 100755index 0000000..d2869dd--- /dev/null+++ b/styles/paper-lantern/demo/build.sh@@ -0,0 +1,38 @@+#!/bin/sh+# One command: The Last Night Train 末班夜车 (Paper-cut Lightbox demo), 51 s, 1920×1080, 30 fps+# sh demo/build.sh fonts if missing, voice if missing + speech check, timeline + subtitles, picture, mix, master,+# poster and the gallery style frame+# sh demo/build.sh 25 30 only a span of the film (film seconds) → demo/out/cut_25-30.mp4+# Needs the voice tier (Kokoro model, faster-whisper) and the VSCO 2 CE, VCSL and Salamander sample libraries:+# sh plugin/skills/lemo-opuscar/scripts/setup.sh deps voice+# sh tools/fetch.sh instruments vsco2ce; sh tools/fetch.sh instruments vcsl; sh tools/fetch.sh instruments salamander+set -e+HERE=$(cd "$(dirname "$0")" && pwd) # .../styles/paper-lantern/demo+FILM=$(cd "$HERE/.." && pwd) # .../styles/paper-lantern+LIB=${LIB:-$(cd "$HERE/../../.." && pwd)} # library root+export LIB+[ -f "$LIB/core/render/video.mjs" ] || { echo "set LIB to the library folder"; exit 1; }+PY="$LIB/.venv/bin/python"; FPS=30; WORKERS=${WORKERS:-2}+cd "$LIB"+"$PY" "$HERE/tools/fonts.py"+if [ ! -f "$HERE/voices/L8.wav" ]; then+ "$PY" core/tts/tts.py "$HERE/voices/lines.json" "$HERE/voices"+ "$PY" core/tts/asr_check.py "$HERE/voices/lines.json" "$HERE/voices" --lang en+fi+python3 "$HERE/tools/timeline.py" "$FILM/paper-lantern.srt" # → demo/timeline.json and the film's subtitles+if [ -n "$1" ]; then+ A=$1; B=$2; OUT="$HERE/out/cut_${A}-${B}.mp4"+ node core/render/video.mjs "$HERE" --fps $FPS --workers $WORKERS --q "from=$A&to=$B" --out "$HERE/out/cut.mp4"+ "$PY" "$HERE/mix.py" "$A" "$B"+ sh core/render/mux.sh "$HERE/out/cut.mp4" "$HERE/out/mix.wav" "$OUT" $FPS 0+ echo "→ $OUT"; exit 0+fi+node core/render/video.mjs "$HERE" --fps $FPS --workers $WORKERS --out "$HERE/out/video.mp4"+"$PY" "$HERE/mix.py"+sh core/render/mux.sh "$HERE/out/video.mp4" "$HERE/out/mix.wav" "$FILM/paper-lantern.mp4" $FPS 0+# poster and style frame: the train on the curved viaduct over the snowy valley, no subtitles+node core/render/still.mjs "$HERE" 9.6 --q "nosub=1" --out "$HERE/out/stills"+ffmpeg -loglevel error -y -i "$HERE/out/stills/t_9.6.jpg" -q:v 3 "$FILM/poster.jpg"+ffmpeg -loglevel error -y -i "$HERE/out/stills/t_9.6.jpg" -vf scale=1280:-2 -q:v 4 "$HERE/stills/styleframe.jpg"+"$PY" "$HERE/tools/subcheck.py" "$FILM/paper-lantern.mp4" | tail -1+echo "→ $FILM/paper-lantern.mp4 $FILM/paper-lantern.srt $FILM/poster.jpg"diff --git a/styles/paper-lantern/demo/fonts/OFL-CormorantGaramond.txt b/styles/paper-lantern/demo/fonts/OFL-CormorantGaramond.txtnew file mode 100644index 0000000..507d70f--- /dev/null+++ b/styles/paper-lantern/demo/fonts/OFL-CormorantGaramond.txt@@ -0,0 +1,93 @@+Copyright 2015 the Cormorant Project Authors (github.com/CatharsisFonts/Cormorant)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+https://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/styles/paper-lantern/demo/fonts/OFL-NotoSerifSC.txt b/styles/paper-lantern/demo/fonts/OFL-NotoSerifSC.txtnew file mode 100644index 0000000..1c9f432--- /dev/null+++ b/styles/paper-lantern/demo/fonts/OFL-NotoSerifSC.txt@@ -0,0 +1,93 @@+Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+https://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/styles/paper-lantern/demo/index.html b/styles/paper-lantern/demo/index.htmlindex b56620d..3656de7 100644--- a/styles/paper-lantern/demo/index.html+++ b/styles/paper-lantern/demo/index.html@@ -1,17 +1,18 @@<!doctype html>-<html><head><meta charset="utf-8"><title>一个月饼的相思</title>+<html><head><meta charset="utf-8"><title>The Last Night Train</title><style>-@font-face { font-family: MaShanZheng; src: url(fonts/MaShanZheng.ttf); }-@font-face { font-family: ZhiMangXing; src: url(fonts/ZhiMangXing.ttf); }-@font-face { font-family: LongCang; src: url(fonts/LongCang.ttf); }-@font-face { font-family: NotoSerifSC; src: url(fonts/NotoSerifSC.ttf); font-weight: 200 900; }+@font-face { font-family: NotoSerifSC; src: url(fonts/NotoSerifSC-sub.ttf); font-weight: 200 900; }+@font-face { font-family: Cormorant; src: url(fonts/CormorantGaramond-VF.ttf); font-weight: 300 700; }html, body { margin: 0; background: #000; overflow: hidden; }#c { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }-#sub { position: absolute; left: 0; right: 0; bottom: 74px; text-align: center; white-space: pre-line; line-height: 1.45; font-family: NotoSerifSC; font-weight: 500; font-size: 40px; letter-spacing: .06em;- color: #fbf3e4; text-shadow: 0 0 2px rgba(0,0,0,.9), 0 2px 10px rgba(0,0,0,.75), 0 0 28px rgba(0,0,0,.45); opacity: 0; }-#credit { position: absolute; left: 0; right: 0; bottom: 40px; text-align: center; font-family: NotoSerifSC; font-weight: 400; font-size: 19px; line-height: 1.7; color: rgba(245,232,210,.85); text-shadow: 0 1px 6px rgba(0,0,0,.8); opacity: 0; white-space: pre-line; }+#sub { position: absolute; left: 0; right: 0; bottom: 64px; text-align: center; opacity: 0; color: #fbf3e4; text-shadow: 0 0 2px rgba(0,0,0,.85), 0 2px 10px rgba(0,0,0,.7), 0 0 26px rgba(0,0,0,.45); }+#sub .band { display: inline-block; padding: 8px 34px 10px; border-radius: 14px; background: rgba(6, 9, 30, .5); box-shadow: 0 0 26px 16px rgba(6, 9, 30, .4); }+#sub .zh { font-family: NotoSerifSC; font-weight: 500; font-size: 40px; letter-spacing: .06em; line-height: 1.35; white-space: nowrap; }+#sub .en { font-family: Cormorant; font-weight: 600; font-size: 42px; letter-spacing: .01em; line-height: 1.25; white-space: nowrap; color: #f3e6cf; }+#card { position: absolute; inset: 0; display: none; background: #3a3a3a; color: #ddd; font: 600 64px Cormorant; align-items: center; justify-content: center; flex-direction: column; }+#card small { font: 400 28px Cormorant; color: #aaa; margin-top: 18px; }</style><script type="importmap">{ "imports": { "three": "/node_modules/three/build/three.module.js", "three/addons/": "/node_modules/three/examples/jsm/" } }</script>-</head><body><canvas id="c"></canvas><div id="sub"></div><div id="credit"></div>+</head><body><canvas id="c"></canvas><div id="card"></div><div id="sub"><div class="band"><div class="zh"></div><div class="en"></div></div></div><script type="module" src="src/main.js"></script></body></html>diff --git a/styles/paper-lantern/demo/mix.py b/styles/paper-lantern/demo/mix.pyindex 56af0b8..a2b5b3e 100644--- a/styles/paper-lantern/demo/mix.py+++ b/styles/paper-lantern/demo/mix.py@@ -1,129 +1,152 @@-"""Mix: narration (compression + balancing) + score (Ripples → Nu Flute relay, ducking automatically under narration) + procedural sound effects → out/mix.wav-Usage: python mix.py [out.wav] (run node render/cues.mjs first to produce out/timeline.json; default output out/mix.wav; any cwd works)"""-import json, sys, os, numpy as np, soundfile as sf, librosa-from scipy.signal import butter, sosfilt, fftconvolve-OUT = os.path.abspath(sys.argv[1]) if len(sys.argv) > 1 else None-os.chdir(os.path.dirname(os.path.abspath(__file__))) # all paths below are relative to demo/-OUT = OUT or 'out/mix.wav'-SR = 48000-rng = np.random.default_rng(3)-T = json.load(open('out/timeline.json')); C, DUR = T['C'], T['DUR']-W = json.load(open('vo/words.json'))-N = int((DUR + .5) * SR)+"""The Last Night Train — score + train foley + narration for the whole timeline → out/mix.wav.+python mix.py whole film+python mix.py 0 10 a cut of the timeline (same mix, sliced, 0.35 s fade-out at the end)+Run with the library's .venv python."""+import sys, os, json+import numpy as np, soundfile as sf, soxr+HERE = os.path.dirname(os.path.abspath(__file__))+LIB = os.environ.get('LIB') or os.path.abspath(os.path.join(HERE, '../../..'))+sys.path.insert(0, LIB)+from core.audio import sampler as S+from core.audio.sfx import SR, add, bp, lp, hp, noise, brown, norm, t_, env_exp, whoosh, thump, limit+from scipy.ndimage import uniform_filter1d, maximum_filter1d-def t_(d): return np.arange(int(d * SR)) / SR-def bp(x, lo, hi, o=2): return sosfilt(butter(o, [lo, hi], 'band', fs=SR, output='sos'), x)-def lp(x, f, o=2): return sosfilt(butter(o, f, 'low', fs=SR, output='sos'), x)-def hp(x, f, o=2): return sosfilt(butter(o, f, 'high', fs=SR, output='sos'), x)-def noise(d): return rng.standard_normal(int(d * SR))-def env(d, a, r): tt = t_(d); return np.minimum(1, tt / max(a, 1e-4)) * np.exp(-np.maximum(0, tt - a) / r)-def norm(x, p=1.): m = np.abs(x).max(); return x / m * p if m > 0 else x+TL = json.load(open(os.path.join(HERE, 'timeline.json')))+H, L, DUR = TL['HIT'], TL['L'], TL['DUR']+N = int(DUR * SR) + SR+tt = np.arange(N) / SR+S.seed(5); rng = np.random.default_rng(4)def db(x): return 10 ** (x / 20)-def put(buf, x, t, g=1.):- i = int(t * SR); j = min(len(buf), i + len(x));- if i < len(buf): buf[i:j] += x[:j - i] * g-def word(lid, k): return C[lid]['at'] + W[lid][k][1]+def rms(x): return np.sqrt(np.mean(x ** 2) + 1e-12)+def env_lin(pts): xs, ys = zip(*pts); return np.interp(tt, xs, ys)-# —— Narration: light compression against sibilance (peak limiting + RMS balancing) ——-vo = np.zeros(N)-for lid, c in C.items():- a, sr = librosa.load(f'vo/{lid}.wav', sr=SR, mono=True)- put(vo, a, c['at'])-def compress(x, thr=-20, ratio=3, att=.003, rel=.12):- e = np.abs(x); out = np.zeros_like(e); ga, gr = np.exp(-1 / (att * SR)), np.exp(-1 / (rel * SR)); s = 0- # downsample the envelope for speed- hop = 48; ee = e[:len(e) // hop * hop].reshape(-1, hop).max(1); o = np.zeros_like(ee); ga, gr = np.exp(-hop / (att * SR)), np.exp(-hop / (rel * SR))- for i, v in enumerate(ee): s = ga * s + (1 - ga) * v if v > s else gr * s + (1 - gr) * v; o[i] = s- lvl = 20 * np.log10(np.maximum(o, 1e-6)); gdb = np.minimum(0, (thr - lvl) * (1 - 1 / ratio))- g = np.repeat(db(gdb), hop); g = np.concatenate([g, np.full(len(x) - len(g), g[-1])])- return x * g-vo = compress(vo, -22, 3)-vo = hp(vo, 70)-speech = np.abs(vo) > 1e-4+# ———————— the train's speed (metres of track per second, for the wheel rhythm) and where the clacks fall ————————+B = 60 / 96 # one beat at 96 bpm; at cruising speed the wheels clack twice per beat (da-dum)+def speed(t): # 0..1 of cruising speed+ if t < H['depart']: return 0+ if t < H['stop'] - 1.6: return min(1, ((t - H['depart']) / 4.6) ** 1.4)+ return max(0, (H['stop'] - t) / 1.6)+clacks, ph, t = [], 0., H['depart']+while t < H['stop']:+ v = speed(t)+ if v > .02:+ ph += v * (1 / 240) / (B / 2)+ if ph >= 1: ph -= 1; clacks.append((t, v))+ t += 1 / 240-# —— Score ——-def load(p): a, _ = librosa.load(p, sr=SR, mono=False); return a if a.ndim == 2 else np.stack([a, a])-rip, flu = load('music/km_Ripples.mp3'), load('music/km_Nu_Flute.mp3')-music = np.zeros((2, N))-T_FLU = C['L23']['at'] - 70 + .3 # make Nu Flute's swell at 70 s land on “但愿人长久” ("may we all live long")-XF0, XF1 = T_FLU, T_FLU + 4.5-tt = np.arange(N) / SR-r = rip[:, :min(rip.shape[1], int(XF1 * SR))]; gr_ = np.clip((XF1 - tt[:r.shape[1]]) / (XF1 - XF0), 0, 1) ** .7-music[:, :r.shape[1]] += r * gr_ * db(0)-i0 = int(T_FLU * SR); f = flu[:, :N - i0]; gf = np.clip((tt[i0:i0 + f.shape[1]] - XF0) / (XF1 - XF0), 0, 1) ** .7-music[:, i0:i0 + f.shape[1]] += f * gf * db(-3.3)-# Opening: guzheng fades in over the first 2 s; ending: fades out over the last 3 s-music *= np.clip(tt / 2.0, 0, 1) * np.clip((DUR - tt) / 3.0, 0, 1)-# Ducking under narration: pull down 7 dB while speaking (smoothed envelope)-e = np.convolve(speech.astype(float), np.ones(int(.25 * SR)) / int(.25 * SR), 'same')-e = np.clip(e * 3, 0, 1); duck = db(-5.5 * e)-music *= duck+# ———————————————— score ————————————————+ev = []+def n(t, inst, p, d, v, pan=0., **k): ev.append(dict(t=t, inst=inst, pitch=p, dur=d, vel=v, pan=pan, **k))+# windows light car by car: one glockenspiel note each, rising (and at the terminus, the same notes falling as they go out)+UP = ['D5', 'E5', 'F#5', 'A5', 'B5', 'D6', 'E6', 'F#6']+for k, t in enumerate(H['cars']): n(t, 'glockenspiel', UP[k], 1.6, .32 + .02 * k, .3 - .08 * k)+for k, t in enumerate(H['off']): n(t, 'glockenspiel', UP[::-1][k], 1.8, .3 - .015 * k, -.3 + .08 * k)+n(H['lamp'] + .05, 'vibraphone_bowed', 'A4', 4.0, .22, -.2)+# a quiet string bed under the departure, D major+for p, v, pan in [('D3', .22, -.3), ('A3', .2, .1), ('F#4', .18, .3)]: n(1.4, 'violas' if p != 'D3' else 'cellos', p, 8.6, v, pan, attack=1.6, release=1.2)+# the journey: a harp ostinato locked to the wheels from the departure; a flute tune over it+CH = [('D', ['D3', 'A3', 'D4', 'F#4']), ('A', ['A2', 'E3', 'A3', 'C#4']), ('Bm', ['B2', 'F#3', 'B3', 'D4']), ('G', ['G2', 'D3', 'G3', 'B3'])]+t0 = H['depart'] + .5; bar = 4 * B+def ostinato(a, b, vel=.3):+ k = 0; t = a+ while t < b - .05:+ name, ch = CH[int((t - t0) // bar) % 4]; n(t, 'harp', ch[[0, 2, 1, 3, 2, 1, 3, 2][k % 8]], 1.2, vel * (1.1 if k % 8 == 0 else 1), -.25); t += B / 2; k += 1+ostinato(t0, 22.0)+TUNE = [('F#5', 1.5), ('E5', .5), ('D5', 1), ('A4', 1), ('B4', 1.5), ('A4', .5), ('F#4', 2), ('G4', 1), ('A4', 1), ('B4', 1), ('D5', 1), ('C#5', 1.5), ('B4', .5), ('A4', 2)]+def tune(a, inst='flute', vel=.34, oct=0):+ t = a+ for p, d in TUNE:+ if oct: p = p[:-1] + str(int(p[-1]) + oct)+ n(t, inst, p, d * B * .95, vel, .2, attack=.05); t += d * B+tune(t0 + 2 * bar) # enters on the viaduct+for k in range(int((22 - t0) / bar)): # piano roots on the bar+ n(t0 + k * bar, 'piano', CH[k % 4][1][0], bar * .9, .26, -.1)+# into the tunnel: minor, rising tremolo, then nothing+for p, v in [('D4', .22), ('F4', .2), ('A4', .2), ('D3', .26)]: n(22.0, 'violins_trem' if p != 'D3' else 'cellos', p, H['portal'] - 22.0 + .1, v, 0, attack=2.0, release=.15)+# out of the tunnel: the river (warm, open), then the sea (broad)+X = H['dark'][1]+for p, v, pan in [('D2', .3, 0), ('D3', .3, -.3), ('A3', .28, -.1), ('F#4', .28, .2), ('A4', .26, .3), ('D5', .24, .25)]:+ n(X, 'contrabass' if p == 'D2' else 'cellos' if p in ('D3', 'A3') else 'violas' if p == 'F#4' else 'violins', p, 4.0, v, pan, attack=.08, release=1.4)+for k, p in enumerate(['D4', 'F#4', 'A4', 'D5', 'F#5', 'A5', 'D6']): n(X - .3 + k * .04, 'harp', p, 1.6, .3, .2)+t0 = X + .2; ostinato(X + .2, 40.2, .28); tune(X + .2 + bar, 'flute', .32)+tune(35.4, 'violin', .3)+for p, v in [('D3', .22), ('A3', .2), ('F#4', .2), ('D5', .18)]: n(35.4, 'violas' if p != 'D3' else 'cellos', p, 5.0, v, 0, attack=1.0, release=1.2)+# the terminus: the harp alone, then the falling window notes, a last chord into the end card+for k, p in enumerate(['D3', 'A3', 'D4', 'F#4', 'A4', 'D5']): n(46.0 + k * .07, 'harp', p, 4.5, .3, -.2 + k * .06)+for p, v in [('D3', .2), ('A3', .18), ('F#4', .18)]: n(46.0, 'violas' if p != 'D3' else 'cellos', p, 4.6, v, 0, attack=.8, release=1.6)+n(48.3, 'glockenspiel', 'A5', 2.4, .26, .3)-# —— Sound effects ——-fx = np.zeros(N)-def click(v=1.): # switch- d = .05; x = hp(noise(d), 2000) * env(d, .0005, .004) + np.sin(2 * np.pi * 1800 * t_(d)) * env(d, .0005, .01) * .4; return norm(x) * v-def shimmer(d=3., v=1.): # lamp lights up: high overtones slowly rising- tt2 = t_(d); x = sum(np.sin(2 * np.pi * f * tt2 + rng.random() * 6) * (.5 + .5 * np.sin(2 * np.pi * (.3 + k * .07) * tt2)) for k, f in enumerate([1320, 1760, 1980, 2640, 3520]))- return norm(x * np.minimum(1, tt2 / (d * .6)) * np.exp(-np.maximum(0, tt2 - d * .6) / (d * .3))) * v-def thud(v=1., f0=90): # wooden mould pressing down / lid closing- d = .35; tt2 = t_(d); x = np.sin(2 * np.pi * f0 * tt2 * (1 - .3 * tt2)) * env(d, .002, .07) + lp(noise(d), 900) * env(d, .001, .03) * .8 + bp(noise(d), 1500, 4000) * env(d, .0005, .008) * .5- return norm(x) * v-def puff(v=1.):- d = .6; return norm(bp(noise(d), 300, 3000) * env(d, .01, .15)) * v-def rustle(d=1.5, v=1.): # paper rustling- x = bp(noise(d), 1500, 7000); am = np.clip(sosfilt(butter(1, 12, 'low', fs=SR, output='sos'), np.abs(noise(d))) * 3, 0, 1)- return norm(x * am * np.sin(np.pi * t_(d) / d) ** .5) * v-def crunch(v=1.):- d = .25; x = sum(bp(noise(d), 2000, 6000) * env(d, .001, .01 + k * .004) * (rng.random() > .3) for k in range(1)); x = np.roll(x, 0)- for k in range(6): put_ = int(rng.random() * .15 * SR); x[put_:put_ + 400] += bp(noise(400 / SR), 1500, 5000)[:len(x[put_:put_ + 400])] * .6- return norm(x * env(d, .002, .08)) * v-def chime(v=1., f=1568):- d = 2.2; tt2 = t_(d); x = sum(a * np.sin(2 * np.pi * f * m * tt2) * np.exp(-tt2 / (.9 / m ** .5)) for m, a in [(1, 1), (2.76, .4), (5.4, .2)]); return norm(x) * v-def train_bed(d): # train: low-frequency rumble + "clack-clack" of the rails- tt2 = t_(d); rum = lp(noise(d), 180) * .5 + lp(noise(d), 60) * .8- x = rum * (.8 + .2 * np.sin(2 * np.pi * .7 * tt2))- per = .62- for k in range(int(d / per)):- for off in (0, .12):- s = int((k * per + off) * SR); c = hp(noise(.08), 400) * env(.08, .001, .02) * .9 + np.sin(2 * np.pi * 140 * t_(.08)) * env(.08, .001, .03)- x[s:s + len(c)] += c[:len(x[s:s + len(c)])]- return norm(x) * np.minimum(1, np.minimum(tt2, d - tt2) / .8)-def whoosh(d=1.6, v=1.):- n = noise(d); tt2 = t_(d); out = np.zeros_like(n); hop = 960- for i in range(0, len(n), hop):- fc = 300 + 2200 * np.sin(np.pi * i / len(n)); seg = bp(n[max(0, i - 4000):i + hop], fc * .7, fc * 1.4)[-hop:]; out[i:i + len(seg)] = seg- return norm(out * np.sin(np.pi * tt2 / d) ** 2) * v-def hum(d, v=1.): # distant city traffic- return norm(lp(noise(d), 400) + bp(noise(d), 500, 1500) * .2) * v * np.minimum(1, np.minimum(t_(d), d - t_(d)) / 1.0)+music = S.render(ev, dur=DUR + 1); music = np.pad(music, ((0, max(0, N - len(music))), (0, 0)))[:N]+music = S.room(music, size=.5, mix=.2)+music = np.pad(music, ((0, max(0, N - len(music))), (0, 0)))[:N]+d0, d1 = H['dark']+music *= np.where((tt > H['portal'] + .1) & (tt < d1), 0, 1)[:, None] * np.clip(1 - (tt - H['portal']) / .2, 0, 1)[:, None] ** (tt < d1)[:, None]-P = {p[0]: p for p in T['P']}-put(fx, click(), .55, db(-24))-put(fx, shimmer(4.0), 1.0, db(-30))-put(fx, thud(1, 85), word('L04', 13) + .02, db(-14))-put(fx, puff(), word('L04', 13) + .05, db(-26))-put(fx, chime(1, 1318), C['L05']['at'] + W['L05'][8][1] + .1, db(-30)) # flash on the character “圆” (round / reunion)-put(fx, rustle(2.2), C['L06']['at'] + .6, db(-28)) # scroll unrolling-put(fx, rustle(.6), word('L09', 8) - .5, db(-30)) # note slip-put(fx, thud(1, 110), C['L10']['at'] - .45, db(-18)) # lid closing-tb0, tb1 = P['S07'][1], P['S09'][1] + .6-put(fx, train_bed(tb1 - tb0), tb0, db(-28))-put(fx, train_bed(P['S10'][2] - P['S10'][1]), P['S10'][1], db(-27))-put(fx, whoosh(1.8), C['L14']['at'] + .1, db(-22)) # oncoming train-put(fx, chime(1, 1760), C['L14']['at'] + 1.0, db(-30)) # the instant they pass each other-put(fx, hum(P['S11'][2] - P['S11'][1]), P['S11'][1], db(-34))-put(fx, rustle(.8), word('L16', 6) - .1, db(-28)); put(fx, chime(1, 1175), word('L16', 6) + .3, db(-31))-put(fx, crunch(), word('L18', 1) + .05, db(-24))-put(fx, rustle(.8), word('L19', 6) - .2, db(-28)); put(fx, chime(1, 1318), word('L19', 6) + .2, db(-31))-put(fx, chime(1, 1568), word('L21', 7) + 1.2, db(-29)); put(fx, chime(1, 2093), word('L21', 7) + 1.5, db(-33))-put(fx, whoosh(1.4), P['S17'][1] - 1.0, db(-26)) # auspicious-cloud curtain-fx = np.stack([fx, fx])+# ———————————————— foley ————————————————+fx = np.zeros((N, 2))+def tick(v=1.):+ d = .03; x = t_(d); return norm(hp(noise(d), 3000) * env_exp(d, .002) + np.sin(2 * np.pi * 2600 * x) * env_exp(d, .004) * .4) * v+def clack(v=1.):+ d = .12; x = t_(d); return norm(lp(noise(d), 1800) * env_exp(d, .012) + np.sin(2 * np.pi * 95 * x) * env_exp(d, .03) * .9 + np.sin(2 * np.pi * 410 * x) * env_exp(d, .01) * .3) * v+def horn(d=1.3):+ x = t_(d); f = [293.7, 370]; s = sum(2 * ((x * fr * (1 + .002 * np.sin(2 * np.pi * 5 * x))) % 1) - 1 for fr in f)+ e = np.minimum(1, x / .08) * np.minimum(1, (d - x) / .35); return norm(lp(bp(s, 200, 2600), 1800) * e)+def hiss(d=1.2, v=1.):+ return norm(bp(noise(d), 2500, 8000) * np.exp(-t_(d) / (d * .4))) * v+def shimmer(d=1.2, f0=1800):+ x = t_(d); s = sum(np.sin(2 * np.pi * f0 * m * (1 + .2 * x / d) * x + m) / m for m in (1, 1.5, 2, 3)) * np.sin(np.pi * x / d) ** 2 * np.exp(-x / d); return norm(s)+# beds: a snowy wind (S1–S3), the river (S4), the sea (S5–S6); everything off in the tunnel+wind = bp(noise(DUR + 1), 250, 1600)[:N] * (.6 + .4 * np.sin(2 * np.pi * tt / 4.3))+add(fx, wind * env_lin([(0, .7), (5, .7), (10, .9), (22, .6), (H['portal'], .4), (H['portal'] + .15, 0), (DUR + 1, 0)]) * db(-31), 0, 1, .2)+river = bp(brown(DUR + 1), 300, 3000)[:N]+add(fx, river * env_lin([(0, 0), (d1, 0), (d1 + .6, .7), (34, .7), (36, 0), (DUR + 1, 0)]) * db(-38), 0, 1, -.2)+sea = bp(brown(DUR + 1), 80, 900)[:N] * (.55 + .45 * np.sin(2 * np.pi * tt / 6.1) ** 2)+add(fx, sea * env_lin([(0, 0), (34.5, 0), (36.5, 1), (DUR + 1, 1)]) * db(-30), 0, 1, 0)+room = lp(brown(DUR + 1), 160)[:N]; add(fx, room * np.where((tt > d0) & (tt < d1), 0, 1) * db(-46), 0, 1, 0)+# the halt: the lamp clicks on, each window a small click; the headlight; the horn; brakes off+add(fx, tick(), H['lamp'], db(-30), -.3); add(fx, shimmer(1.0), H['lamp'] + .05, db(-38), -.3)+for k, t in enumerate(H['cars']): add(fx, tick(.8), t, db(-34), .3 - .08 * k)+add(fx, tick(), H['head'], db(-30), .3)+add(fx, horn(1.3), H['horn'], db(-17), .35)+add(fx, hiss(1.4), H['depart'] - .2, db(-32), .3)+# the wheels: a soft da-dum on the joints, louder with speed; muffled in the tunnel, silent in the dark+for t, v in clacks:+ if d0 <= t < d1: continue+ g = db(-27 + 6 * v) * (.6 if H['portal'] - .3 < t < d0 else 1)+ add(fx, clack(), t, g, .1)+rumble = lp(brown(DUR + 1), 140)[:N] * np.array([speed(x) for x in tt[::480]]).repeat(480)[:N]+add(fx, rumble * np.where((tt > d0) & (tt < d1), 0, 1) * db(-28), 0, 1, 0)+add(fx, whoosh(.9), H['portal'] - .3, db(-24), .2) # into the tunnel+add(fx, whoosh(1.2), d1 - .05, db(-24), -.2) # out the other side+add(fx, hiss(2.0), H['stop'] - .8, db(-28), .3) # brakes at the terminus+for t in H['off']: add(fx, tick(.7), t, db(-34), 0)+add(fx, bp(noise(1.0), 1500, 7000) * np.sin(np.pi * t_(1.0) / 1.0) ** 1.5, H['card'], db(-40), .2)+if os.environ.get('SIGN10') == '1': add(fx, bp(noise(.8), 1500, 7000) * np.sin(np.pi * t_(.8) / .8) ** 1.5, H['sign'], db(-40), .3)-# —— Bus: narration centred, about 10 dB above the music ——-def rms(x): return np.sqrt(np.mean(x[np.abs(x) > 1e-4] ** 2))-vo_s = np.stack([vo, vo]) * (db(-18) / rms(vo))-mu = music * (db(-27.5) / rms(music.mean(0)))-mix = vo_s + mu + fx * db(-4)-mix = mix / max(1, np.abs(mix).max() / db(-1))-sf.write(OUT, mix.T.astype(np.float32), SR)-print('mix ok', mix.shape[1] / SR, 'peak', 20 * np.log10(np.abs(mix).max()), 'T_FLU', round(T_FLU, 2))+fx *= np.clip(np.minimum(np.abs(tt - d0 - .01), np.abs(tt - d1 + .02)) / .03, 0, 1)[:, None] ** ((tt > d0 - .02) & (tt < d1))[:, None] # the blink of dark is silent+fx *= np.where((tt > d0 + .02) & (tt < d1 - .02), 0, 1)[:, None]+# ———————————————— voice ————————————————+vo = np.zeros(N)+for i, l in L.items():+ w, sr = sf.read(os.path.join(HERE, 'voices', i + '.wav'), dtype='float32')+ if w.ndim > 1: w = w.mean(1)+ w = soxr.resample(w, sr, SR); s = int(l['at'] * SR); vo[s:s + len(w)] += w[:N - s]+vo = hp(vo, 80)+def comp(x, thr_db=-24, ratio=3.):+ e = np.sqrt(uniform_filter1d(x ** 2, int(.02 * SR)) + 1e-12); ed = 20 * np.log10(e)+ gdb = np.where(ed > thr_db, (thr_db - ed) * (1 - 1 / ratio), 0); gdb = uniform_filter1d(gdb, int(.01 * SR)); return x * db(gdb)+vo = comp(vo); act = np.abs(vo) > 1e-4; vo *= db(-18) / rms(vo[act])+music *= db(-27) / rms(music)+speak = uniform_filter1d(maximum_filter1d(act.astype(float), int(.25 * SR)), int(.25 * SR))+mid = np.stack([bp(music[:, c], 300, 4000) for c in (0, 1)], 1)+music = music * db(-5 * speak)[:, None] - mid * (1 - db(-3)) * speak[:, None]+mix = music + fx + vo[:, None]+mix = np.stack([limit(mix[:, c], .89) for c in (0, 1)], 1)+os.makedirs(os.path.join(HERE, 'out'), exist_ok=True)+if len(sys.argv) >= 3:+ a, b = float(sys.argv[1]), float(sys.argv[2]); seg = mix[int(a * SR):int(b * SR)].copy()+ f = int(.35 * SR); seg[-f:] *= np.linspace(1, 0, f)[:, None]+ sf.write(os.path.join(HERE, 'out', 'mix.wav'), seg.astype(np.float32), SR); print('cut', a, b)+else:+ sf.write(os.path.join(HERE, 'out', 'mix.wav'), mix[:int(DUR * SR)].astype(np.float32), SR); print('full', DUR)+print('instruments', sorted({e['inst'] for e in ev}), 'clacks', len(clacks))diff --git a/styles/paper-lantern/demo/music/analysis.json b/styles/paper-lantern/demo/music/analysis.jsondeleted file mode 100644index d46593d..0000000--- a/styles/paper-lantern/demo/music/analysis.json+++ /dev/null@@ -1,458 +0,0 @@-{- "km_Ripples.mp3": {- "dur": 205.5,- "tempo": 117.5,- "rms_dbfs": -22.2,- "centroid_hz": 893,- "perc_ratio": 0.017,- "low_lt250": 0.169,- "mid_250_2k": 0.82,- "high_gt2k": 0.011,- "arc5s": [- -17.6,- -16.6,- -13.0,- -15.0,- -11.4,- -11.7,- -16.2,- -11.4,- -14.3,- -13.9,- -15.6,- -15.2,- -13.9,- -15.8,- -11.1,- -12.7,- -15.7,- -11.5,- -10.4,- -13.0,- -14.1,- -13.9,- -12.6,- -11.9,- -13.4,- -13.8,- -21.4,- -12.8,- -8.7,- -11.6,- -10.0,- -10.7,- -13.2,- -11.2,- -15.6,- -13.9,- -13.0,- -9.1,- -12.1,- -21.4,- -49.7,- -130.8- ],- "swells": [- [- 10,- 4.1- ],- [- 70,- 3.8- ],- [- 135,- 4.8- ],- [- 140,- 8.4- ],- [- 185,- 4.3- ]- ],- "drops": [- [- 130,- -7.8- ],- [- 195,- -10.8- ],- [- 200,- -33.0- ],- [- 205,- -95.3- ]- ],- "loudest15s_start": 140- },- "km_Nu_Flute.mp3": {- "dur": 82.8,- "tempo": 129.2,- "rms_dbfs": -18.7,- "centroid_hz": 967,- "perc_ratio": 0.006,- "low_lt250": 0.307,- "mid_250_2k": 0.681,- "high_gt2k": 0.012,- "arc5s": [- -9.2,- -7.8,- -4.6,- -8.6,- -6.5,- -8.4,- -9.3,- -5.1,- -5.5,- -8.1,- -7.5,- -8.1,- -8.1,- -14.4,- -6.9,- -9.5,- -45.8- ],- "swells": [- [- 10,- 3.9- ],- [- 35,- 3.8- ],- [- 70,- 4.3- ]- ],- "drops": [- [- 65,- -6.3- ],- [- 80,- -37.6- ]- ],- "loudest15s_start": 35- },- "pb_NastelBom_Asian_China_Chinese_Music.mp3": {- "dur": 178.5,- "tempo": 89.1,- "rms_dbfs": -13.5,- "centroid_hz": 1465,- "perc_ratio": 0.01,- "low_lt250": 0.031,- "mid_250_2k": 0.952,- "high_gt2k": 0.018,- "arc5s": [- -18.2,- -17.8,- -15.9,- -14.3,- -8.2,- -6.1,- -6.5,- -5.9,- -4.9,- -6.2,- -6.5,- -6.3,- -6.8,- -6.7,- -6.9,- -6.2,- -7.4,- -5.9,- -7.0,- -5.9,- -8.3,- -5.9,- -12.1,- -12.8,- -12.6,- -11.9,- -5.9,- -6.8,- -6.2,- -5.1,- -4.5,- -6.2,- -5.2,- -6.8,- -5.8,- -32.0- ],- "swells": [- [- 20,- 6.9- ],- [- 25,- 5.2- ],- [- 130,- 6.3- ]- ],- "drops": [- [- 175,- -25.7- ]- ],- "loudest15s_start": 140- },- "sb_EchoesOfHome.mp3": {- "dur": 291.7,- "tempo": 136.0,- "rms_dbfs": -17.2,- "centroid_hz": 857,- "perc_ratio": 0.028,- "low_lt250": 0.72,- "mid_250_2k": 0.274,- "high_gt2k": 0.006,- "arc5s": [- -22.4,- -24.4,- -22.1,- -20.2,- -22.5,- -21.8,- -21.4,- -19.8,- -20.4,- -18.9,- -18.7,- -13.6,- -16.0,- -13.6,- -16.2,- -12.0,- -12.0,- -13.6,- -12.0,- -11.4,- -11.7,- -11.5,- -11.9,- -12.2,- -12.5,- -11.2,- -8.6,- -9.6,- -9.6,- -6.9,- -6.7,- -7.7,- -9.5,- -8.6,- -9.7,- -11.2,- -8.8,- -9.8,- -9.9,- -11.5,- -14.4,- -13.1,- -13.9,- -14.4,- -14.2,- -13.4,- -12.5,- -13.1,- -12.4,- -11.5,- -8.9,- -8.0,- -6.6,- -10.0,- -9.2,- -16.2,- -20.4,- -29.2,- -54.8- ],- "swells": [- [- 55,- 5.2- ]- ],- "drops": [- [- 275,- -6.6- ],- [- 280,- -7.7- ],- [- 285,- -10.9- ],- [- 290,- -30.0- ]- ],- "loudest15s_start": 145- },- "pb_MoLiHua_JasmineFlower.mp3": {- "dur": 206.1,- "tempo": 99.4,- "rms_dbfs": -27.8,- "centroid_hz": 1759,- "perc_ratio": 0.009,- "low_lt250": 0.004,- "mid_250_2k": 0.899,- "high_gt2k": 0.097,- "arc5s": [- -5.8,- -5.1,- -4.9,- -7.0,- -6.2,- -8.1,- -9.5,- -5.5,- -5.3,- -6.1,- -6.9,- -6.3,- -8.1,- -8.3,- -5.2,- -5.8,- -5.8,- -7.8,- -5.9,- -8.8,- -14.7,- -13.0,- -12.3,- -12.6,- -12.3,- -13.1,- -15.4,- -5.5,- -5.1,- -5.3,- -6.4,- -5.6,- -7.5,- -9.3,- -17.2,- -15.7,- -20.2,- -21.3,- -17.2,- -16.4,- -17.6,- -22.1- ],- "swells": [- [- 135,- 8.8- ],- [- 140,- 5.3- ],- [- 190,- 3.6- ]- ],- "drops": [- [- 100,- -7.3- ],- [- 170,- -8.8- ],- [- 205,- -5.1- ]- ],- "loudest15s_start": 0- },- "sb_TheLongWayHome.mp3": {- "dur": 172.7,- "tempo": 184.6,- "rms_dbfs": -18.6,- "centroid_hz": 482,- "perc_ratio": 0.049,- "low_lt250": 0.582,- "mid_250_2k": 0.418,- "high_gt2k": 0.001,- "arc5s": [- -8.1,- -10.5,- -7.7,- -7.8,- -8.6,- -6.0,- -7.0,- -7.4,- -6.7,- -9.0,- -9.0,- -8.4,- -6.8,- -7.5,- -8.7,- -6.6,- -7.4,- -6.1,- -6.5,- -4.7,- -5.5,- -5.4,- -6.5,- -5.1,- -6.5,- -10.4,- -12.8,- -13.4,- -13.6,- -13.8,- -15.5,- -15.2,- -17.3,- -34.3,- -39.8- ],- "swells": [],- "drops": [- [- 165,- -18.0- ],- [- 170,- -14.0- ]- ],- "loudest15s_start": 95- }-}\ No newline at end of filediff --git a/styles/paper-lantern/demo/render/browser.mjs b/styles/paper-lantern/demo/render/browser.mjsdeleted file mode 100644index 69c39d8..0000000--- a/styles/paper-lantern/demo/render/browser.mjs+++ /dev/null@@ -1,15 +0,0 @@-// Headless Chrome: prefer the PLAYWRIGHT_CHROME environment variable, otherwise find the headless shell in the local playwright cache-// GPU flags route WebGL through ANGLE/GL (~6× faster than the default SwiftShader on M-series Macs)-import fs from 'fs'; import path from 'path';-function findExe() {- if (process.env.PLAYWRIGHT_CHROME) return process.env.PLAYWRIGHT_CHROME;- const base = path.join(process.env.HOME, 'Library/Caches/ms-playwright');- const dirs = fs.existsSync(base) ? fs.readdirSync(base).filter(d => d.startsWith('chromium_headless_shell')).sort().reverse() : [];- for (const d of dirs) {- const p = path.join(base, d, 'chrome-headless-shell-mac-arm64/chrome-headless-shell');- if (fs.existsSync(p)) return p;- }- return undefined; // leave it to playwright to find one-}-export const EXE = findExe();-export const ARGS = ['--use-angle=gl', '--enable-gpu', '--ignore-gpu-blocklist', '--font-render-hinting=none', '--force-color-profile=srgb'];diff --git a/styles/paper-lantern/demo/render/cues.mjs b/styles/paper-lantern/demo/render/cues.mjsdeleted file mode 100644index b05336d..0000000--- a/styles/paper-lantern/demo/render/cues.mjs+++ /dev/null@@ -1,8 +0,0 @@-import fs from 'fs';-import path from 'path';-import { openPage, closeServer, ROOT } from './page.mjs';-const { browser, page } = await openPage();-const d = await page.evaluate(() => ({ C: window.CUES, P: window.PLAN, DUR: window.DUR }));-fs.mkdirSync(path.join(ROOT, 'out'), { recursive: true });-fs.writeFileSync(path.join(ROOT, 'out/timeline.json'), JSON.stringify(d, null, 1)); console.log('DUR', d.DUR);-await browser.close(); closeServer();diff --git a/styles/paper-lantern/demo/render/page.mjs b/styles/paper-lantern/demo/render/page.mjsdeleted file mode 100644index e14d032..0000000--- a/styles/paper-lantern/demo/render/page.mjs+++ /dev/null@@ -1,21 +0,0 @@-// Open demo/index.html (static server root = repo root, so the page can reference /node_modules/three, /core/assets/...), wait for window.READY-import { chromium } from 'playwright-core';-import path from 'path'; import { fileURLToPath } from 'url';-import { serve } from './serve.mjs';-import { EXE, ARGS } from './browser.mjs';-export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); // demo directory-export const REPO = path.resolve(ROOT, '../../..'); // repo root (static server root)-export const PAGE = '/' + path.relative(REPO, ROOT).split(path.sep).map(encodeURIComponent).join('/') + '/index.html';-let srv = null;-export async function server() { if (!srv) srv = await serve(REPO); return srv; }-export async function openPage(q = '') {- const { port } = await server();- const browser = await chromium.launch({ executablePath: EXE, args: ARGS });- const page = await browser.newPage({ viewport: { width: 1920, height: 1080 }, deviceScaleFactor: 1 });- page.on('console', m => { if (m.type() === 'error' || m.type() === 'warning') console.error('[page]', m.text().slice(0, 400)); else if (process.env.LOG) console.log('[log]', m.text().slice(0, 400)); });- page.on('pageerror', e => console.error('[pageerror]', e.message));- await page.goto(`http://127.0.0.1:${port}${PAGE}${q}`);- await page.waitForFunction(() => window.READY === true, null, { timeout: 180000 });- return { browser, page };-}-export function closeServer() { if (srv) srv.server.close(); }diff --git a/styles/paper-lantern/demo/render/serve.mjs b/styles/paper-lantern/demo/render/serve.mjsdeleted file mode 100644index 59acc1e..0000000--- a/styles/paper-lantern/demo/render/serve.mjs+++ /dev/null@@ -1,12 +0,0 @@-// Minimal static server (ES modules can't load over file://)-import http from 'http'; import fs from 'fs'; import path from 'path';-const T = { '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', '.json': 'application/json', '.css': 'text/css', '.jpg': 'image/jpeg', '.png': 'image/png', '.hdr': 'application/octet-stream', '.bin': 'application/octet-stream', '.gltf': 'model/gltf+json', '.woff2': 'font/woff2', '.ttf': 'font/ttf', '.svg': 'image/svg+xml', '.wav': 'audio/wav' };-export function serve(root, port = 0) {- return new Promise(res => {- const s = http.createServer((q, r) => {- const p = path.join(root, decodeURIComponent(q.url.split('?')[0]));- fs.readFile(p, (e, d) => { if (e) { r.writeHead(404); r.end(); return; } r.writeHead(200, { 'Content-Type': T[path.extname(p)] || 'application/octet-stream' }); r.end(d); });- });- s.listen(port, '127.0.0.1', () => res({ server: s, port: s.address().port }));- });-}diff --git a/styles/paper-lantern/demo/render/still.mjs b/styles/paper-lantern/demo/render/still.mjsdeleted file mode 100644index 3854621..0000000--- a/styles/paper-lantern/demo/render/still.mjs+++ /dev/null@@ -1,14 +0,0 @@-// Render stills: node render/still.mjs <t> [<t> ...] [--out dir] [--q ?ssaa=1]-import fs from 'fs'; import path from 'path';-import { openPage, closeServer, ROOT } from './page.mjs';-const args = process.argv.slice(2), take = k => { const i = args.indexOf(k); return i >= 0 ? args.splice(i, 2)[1] : null; };-const out = take('--out') || path.join(ROOT, 'stills'), q = take('--q') || '';-fs.mkdirSync(out, { recursive: true });-const { browser, page } = await openPage(q);-for (const ts of args) {- const t0 = Date.now();- await page.evaluate(t => window.render(t), parseFloat(ts));- const f = path.join(out, `t_${ts}.jpg`);- await page.screenshot({ path: f, type: 'jpeg', quality: 90 }); console.log(f, Date.now() - t0 + 'ms');-}-await browser.close(); closeServer();diff --git a/styles/paper-lantern/demo/render/video.mjs b/styles/paper-lantern/demo/render/video.mjsdeleted file mode 100644index 5c27e7b..0000000--- a/styles/paper-lantern/demo/render/video.mjs+++ /dev/null@@ -1,29 +0,0 @@-// Render video: node render/video.mjs [--fps 30] [--workers 6] [--from s] [--to s] [--out out/video.mp4]-import fs from 'fs'; import path from 'path'; import { spawn, execFileSync } from 'child_process';-import { openPage, closeServer, ROOT } from './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), WK = +opt('--workers', 6), q = opt('--q', '');-const outDir = path.join(ROOT, 'out'); fs.mkdirSync(outDir, { recursive: true });-const out = path.resolve(opt('--out', path.join(outDir, 'video.mp4')));-const segDir = path.dirname(out); fs.mkdirSync(segDir, { recursive: true }); // segment files are written next to the output file-const probe = await openPage(q); const DUR = await probe.page.evaluate(() => window.DUR); await probe.browser.close();-const F0 = Math.round(+opt('--from', 0) * FPS), F1 = Math.round(+opt('--to', DUR) * FPS);-const TOTAL = F1 - F0, per = Math.ceil(TOTAL / WK), t0 = Date.now();-await Promise.all([...Array(WK)].map(async (_, w) => {- const a = F0 + w * per, b = Math.min(F1, a + per); if (a >= b) return;- const { browser, page } = await openPage(q);- const ff = spawn('ffmpeg', ['-y', '-loglevel', 'error', '-f', 'image2pipe', '-framerate', String(FPS), '-c:v', 'mjpeg', '-i', '-',- '-c:v', 'libx264', '-preset', 'medium', '-crf', '12', '-pix_fmt', 'yuv420p', path.join(segDir, `seg_${w}.mp4`)]);- for (let f = a; f < b; f++) {- await page.evaluate(t => window.render(t), f / FPS);- const buf = await page.screenshot({ type: 'jpeg', quality: 95 });- if (!ff.stdin.write(buf)) await new Promise(r => ff.stdin.once('drain', r));- if ((f - a) % 90 === 0) console.log(`w${w} ${f - a}/${b - a} ${((Date.now() - t0) / 1000).toFixed(0)}s`);- }- ff.stdin.end(); await new Promise(r => ff.on('close', r)); await browser.close();-}));-const list = path.join(segDir, 'segs.txt');-fs.writeFileSync(list, [...Array(WK)].map((_, w) => `file 'seg_${w}.mp4'`).filter((_, w) => w * per < TOTAL).join('\n'));-execFileSync('ffmpeg', ['-y', '-loglevel', 'error', '-f', 'concat', '-safe', '0', '-i', list, '-c', 'copy', out]);-console.log('done', out, TOTAL, 'frames', ((Date.now() - t0) / 1000).toFixed(0) + 's');-closeServer();diff --git a/styles/paper-lantern/demo/script.json b/styles/paper-lantern/demo/script.jsondeleted file mode 100644index e7dd7b9..0000000--- a/styles/paper-lantern/demo/script.json+++ /dev/null@@ -1,110 +0,0 @@-[- {- "id": "L01",- "text": "农历八月十五,秋天刚好走到一半,所以叫中秋。",- "rate": "+5%"- },- {- "id": "L02",- "text": "这一夜,月亮最圆,想念也最重。"- },- {- "id": "L03",- "text": "我是一块月饼,出生在外婆的厨房。"- },- {- "id": "L04",- "text": "揉面,包馅,再用外公刻的木模子,啪地一压——"- },- {- "id": "L05",- "text": "我的脸上,就印上了一个“圆”字。"- },- {- "id": "L06",- "text": "早在明朝,中秋送月饼就成了习俗,图的就是团圆。"- },- {- "id": "L07",- "text": "可今年,外婆的饭桌上,又空着一个位子。"- },- {- "id": "L08",- "text": "小满在很远的城市上班,已经三年没回家过中秋了。"- },- {- "id": "L09",- "text": "外婆把我装进盒子,压上一张字条,写好了地址。"- },- {- "id": "L10",- "text": "于是,我出发了。"- },- {- "id": "L11",- "text": "翻过山,跨过江,在夜车里摇摇晃晃。"- },- {- "id": "L12",- "text": "第一次离开外婆,我才知道,原来这就是想家。"- },- {- "id": "L13",- "text": "外婆讲过,月亮上住着嫦娥,她回不了家,就把月亮点得格外亮,好让地上想家的人,都看得见。"- },- {- "id": "L14",- "text": "半路上,一个盒子和我擦肩而过。它往南走,走得很急。"- },- {- "id": "L15",- "text": "终于,我到了小满的城市。楼很高,灯很亮,月亮却很远。"- },- {- "id": "L16",- "text": "她加完班回来,拆开盒子,看见了外婆的字:"- },- {- "id": "L17",- "text": "“月亮圆了,就算你回过家了。”",- "rate": "+2%",- "sub": false- },- {- "id": "L18",- "text": "她咬了一口,是小时候的味道。眼睛,一下就红了。"- },- {- "id": "L19",- "text": "同一个晚上,外婆也收到了一个盒子。"- },- {- "id": "L20",- "text": "里面是一块歪歪扭扭的月饼,还有一张字条:“外婆,今年换我给你做。”"- },- {- "id": "L21",- "text": "原来,相思的“相”,是互相的相。",- "rate": "+2%",- "say": "原来,相思的香,是互相的香。"- },- {- "id": "L22",- "text": "九百多年前的中秋,苏轼想念弟弟,写下了一句:"- },- {- "id": "L23",- "text": "但愿人长久,千里共婵娟。",- "rate": "-12%",- "sub": false- },- {- "id": "L24",- "text": "隔着千里,我们看的,是同一个月亮。"- },- {- "id": "L25",- "text": "中秋快乐。",- "rate": "-6%"- }-]\ No newline at end of filediff --git a/styles/paper-lantern/demo/src/art.js b/styles/paper-lantern/demo/src/art.jsdeleted file mode 100644index cb5416b..0000000--- a/styles/paper-lantern/demo/src/art.js+++ /dev/null@@ -1,329 +0,0 @@-// Paper-cut motifs: everything is drawn on the metric canvas (y up). Colours are supplied by the caller.-import { mulberry, TAU, lerp, clamp } from './lib.js';--export const FONT = { brush: '"MaShanZheng"', xing: '"ZhiMangXing"', hand: '"LongCang"', song: '"NotoSerifSC"' };--// —— Mountains ——-// Rounded karst peaks: peaks=[[cx, h, w], ...], smoothly combined by taking the maximum-export function karst(x, o) {- const { x0, x1, base, bottom = base - 1, peaks, step = .002, rough = 0, seed = 1 } = o;- const R = mulberry(seed), ph = R() * 100;- x.beginPath(); x.moveTo(x0, bottom);- for (let u = x0; u <= x1 + step; u += step) {- let y = 0;- for (const [cx, h, w] of peaks) { const d = (u - cx) / w; y += Math.pow(Math.max(0, h * Math.exp(-d * d * 2.2)), 4); }- y = Math.pow(y, .25);- y += rough * (Math.sin(u * 91 + ph) * .5 + Math.sin(u * 237 + ph * 2) * .3 + Math.sin(u * 511) * .2);- x.lineTo(u, base + y);- }- x.lineTo(x1, bottom); x.closePath(); x.fill();- if (o.carve) { // contour carving lines inside the mountain (cut-through slits that let the light of the layer behind show)- x.save(); x.globalCompositeOperation = 'destination-out'; x.strokeStyle = '#000'; x.lineCap = 'round'; x.lineWidth = o.carve;- for (const [cx, h, w] of peaks) for (const [f, d] of [[.78, .14], [.55, .3], [.34, .46]]) {- if (h * f < .012) continue;- x.beginPath(); let started = false;- for (let u = cx - w * 1.1; u <= cx + w * 1.1; u += step) {- const dd = (u - cx) / (w * f), yy = base + h * f * Math.exp(-dd * dd * 2.2) - h * d * .35;- const inside = Math.exp(-dd * dd * 2.2) > .22;- if (inside) { started ? x.lineTo(u, yy) : x.moveTo(u, yy); started = true; } else started = false;- }- x.stroke();- }- x.restore();- }-}-// Noise ridge line-export function ridge(x, o) {- const { x0, x1, base, amp, bottom = base - 1, seed = 1, freq = 12, step = .002 } = o;- const R = mulberry(seed), ph = [R() * 9, R() * 9, R() * 9];- x.beginPath(); x.moveTo(x0, bottom);- for (let u = x0; u <= x1 + step; u += step) {- const y = amp * (.55 * Math.sin(u * freq + ph[0]) + .3 * Math.sin(u * freq * 2.3 + ph[1]) + .15 * Math.sin(u * freq * 5.1 + ph[2]));- x.lineTo(u, base + y);- }- x.lineTo(x1, bottom); x.closePath(); x.fill();-}--// —— Auspicious clouds (祥云 xiangyun) —— (one swirling cloud head + trailing tail), s = scale, dir = ±1 tail direction-export function xiangyun(x, cx, cy, s, dir = 1, o = {}) {- const heads = o.heads || [[0, 0, 1], [1.05 * dir, -.12, .72], [-.9 * dir, -.18, .62], [.35 * dir, .72, .58]];- x.save(); x.translate(cx, cy);- x.beginPath();- for (const [hx, hy, r] of heads) { x.moveTo(hx * s + r * s, hy * s); x.arc(hx * s, hy * s, r * s, 0, TAU); }- // Tail: tapering outward from the lower edge of the main cloud head- const L = (o.tail ?? 2.6) * s, d = dir;- x.moveTo(-.2 * s * d, -.55 * s);- x.bezierCurveTo((.8 * d) * s, -1.05 * s, (1.8 * d) * s, -.55 * s, (1.6 * d) * s + L * .3 * d, -.75 * s);- x.bezierCurveTo((1.8 * d) * s + L * .5 * d, -.9 * s, (1.6 * d) * s + L * .9 * d, -.62 * s, (1.4 * d) * s + L * d, -.78 * s);- x.bezierCurveTo((1.4 * d) * s + L * .7 * d, -.98 * s, (1.2 * d) * s + L * .2 * d, -1.02 * s, .3 * d * s, -.98 * s);- x.closePath();- x.fill();- // Swirl carving lines (cut through)- x.globalCompositeOperation = 'destination-out'; x.strokeStyle = '#000'; x.lineCap = 'round';- for (const [hx, hy, r] of heads) {- x.lineWidth = r * s * .16; x.beginPath();- for (let i = 0; i <= 40; i++) {- const u = i / 40, th = (o.spin ?? 1) * d * (u * 1.75 * TAU) + 1.2, rr = r * s * (.12 + .62 * u);- const px = hx * s + Math.cos(th) * rr, py = hy * s + Math.sin(th) * rr;- i ? x.lineTo(px, py) : x.moveTo(px, py);- }- x.stroke();- }- x.globalCompositeOperation = 'source-over';- x.restore();-}--// —— Water waves (fish-scale pattern) ——-export function waves(x, o) {- const { x0, x1, y0, y1, r, fill, line, lw } = o;- x.fillStyle = fill; x.fillRect(x0, y1, x1 - x0, y0 - y1);- x.strokeStyle = line; x.lineWidth = lw;- let row = 0;- for (let y = y0; y > y1; y -= r * .55, row++) {- for (let u = x0 + (row % 2) * r; u < x1 + r; u += r * 2) {- x.beginPath(); x.arc(u, y, r, Math.PI * 1.08, Math.PI * 1.92); x.stroke();- x.beginPath(); x.arc(u, y, r * .62, Math.PI * 1.12, Math.PI * 1.88); x.stroke();- }- }-}-// Wave top edge (water surface)-export function waterTop(x, o) {- const { x0, x1, base, amp, len, bottom = base - 1, ph = 0 } = o;- x.beginPath(); x.moveTo(x0, bottom);- for (let u = x0; u <= x1; u += .001) x.lineTo(u, base + amp * Math.sin((u / len) * TAU + ph) + amp * .4 * Math.sin((u / len) * TAU * 2.3 + ph * 1.7));- x.lineTo(x1, bottom); x.closePath(); x.fill();-}--// —— Trees ——-// Trunk: starting from (bx,by), list of forking branches [[x1,y1,w]...]-function limb(x, ax, ay, bx, by, w0, w1, bend = .15) {- const dx = bx - ax, dy = by - ay, L = Math.hypot(dx, dy), nx = -dy / L, ny = dx / L;- const mx = (ax + bx) / 2 + nx * L * bend, my = (ay + by) / 2 + ny * L * bend;- x.beginPath();- x.moveTo(ax + nx * w0 / 2, ay + ny * w0 / 2);- x.quadraticCurveTo(mx + nx * (w0 + w1) / 4, my + ny * (w0 + w1) / 4, bx + nx * w1 / 2, by + ny * w1 / 2);- x.lineTo(bx - nx * w1 / 2, by - ny * w1 / 2);- x.quadraticCurveTo(mx - nx * (w0 + w1) / 4, my - ny * (w0 + w1) / 4, ax - nx * w0 / 2, ay - ny * w0 / 2);- x.closePath(); x.fill();-}-export { limb };-// Osmanthus tree: round crown (several cloud clumps) + leaf-shaped cut-outs + blossom dots (blossom dots drawn on glow or in another colour)-export function osmanthus(x, o) {- const { cx, by, h, seed = 3, flowers } = o, R = mulberry(seed), s = h;- const trunkTop = by + h * .45;- limb(x, cx, by, cx - .02 * s, trunkTop, .09 * s, .05 * s, .12);- limb(x, cx - .01 * s, by + h * .3, cx - .22 * s, by + h * .62, .04 * s, .018 * s, -.1);- limb(x, cx - .015 * s, by + h * .38, cx + .2 * s, by + h * .66, .035 * s, .016 * s, .12);- const blobs = o.blobs || [[0, .72, .3], [-.24, .64, .22], [.24, .66, .22], [-.12, .88, .2], [.14, .9, .19], [-.36, .52, .14], [.36, .55, .14], [0, 1.0, .14]];- x.beginPath();- for (const [bx, byy, r] of blobs) {- const n = 14;- for (let i = 0; i <= n; i++) {- const a = i / n * TAU, k = 1 + .08 * Math.sin(a * 5 + bx * 20);- const px = cx + bx * s + Math.cos(a) * r * s * k, py = by + byy * s + Math.sin(a) * r * s * k;- i ? x.lineTo(px, py) : x.moveTo(px, py);- }- x.closePath();- }- x.fill();- if (o.cut !== false) { // leaf-shaped cut-outs- x.globalCompositeOperation = 'destination-out';- for (let i = 0; i < (o.leaves ?? 60); i++) {- const [bx, byy, r] = blobs[Math.floor(R() * blobs.length)];- const a = R() * TAU, rr = Math.sqrt(R()) * r * .78;- leaf(x, cx + (bx + Math.cos(a) * rr) * s, by + (byy + Math.sin(a) * rr) * s, .035 * s * (.6 + R() * .5), R() * TAU);- }- x.globalCompositeOperation = 'source-over';- }- if (flowers) {- x.fillStyle = flowers;- for (let i = 0; i < (o.nFlowers ?? 70); i++) {- const [bx, byy, r] = blobs[Math.floor(R() * blobs.length)];- const a = R() * TAU, rr = Math.sqrt(R()) * r * .9;- const px = cx + (bx + Math.cos(a) * rr) * s, py = by + (byy + Math.sin(a) * rr) * s, fr = .008 * s * (.7 + R() * .6);- for (let k = 0; k < 4; k++) { x.beginPath(); x.arc(px + Math.cos(k * TAU / 4) * fr, py + Math.sin(k * TAU / 4) * fr, fr * .8, 0, TAU); x.fill(); }- }- }-}-export function leaf(x, px, py, L, a) {- x.save(); x.translate(px, py); x.rotate(a);- x.beginPath(); x.moveTo(-L / 2, 0); x.quadraticCurveTo(0, L * .38, L / 2, 0); x.quadraticCurveTo(0, -L * .38, -L / 2, 0); x.fill();- x.restore();-}-// Pine: trunk + stacked horizontal needle clumps-export function pine(x, o) {- const { cx, by, h, seed = 2 } = o, R = mulberry(seed), s = h;- limb(x, cx, by, cx + .06 * s, by + h * .9, .07 * s, .03 * s, .1);- const tiers = o.tiers || [[.95, .16], [.78, .26], [.6, .32], [.42, .26]];- for (const [ty, w] of tiers) {- const px = cx + .05 * s * ty, py = by + ty * s;- x.beginPath(); x.moveTo(px - w * s, py - .02 * s);- const n = 9;- for (let i = 0; i <= n; i++) {- const u = i / n, qx = px - w * s + u * 2 * w * s;- x.quadraticCurveTo(qx - w * s / n, py + (.05 + .03 * R()) * s * Math.sin(u * Math.PI) + .02 * s, qx, py + .03 * s * Math.sin(u * Math.PI));- }- x.quadraticCurveTo(px, py - .07 * s, px - w * s, py - .02 * s); x.fill();- }-}-// Willow: main trunk + drooping willow strands-export function willow(x, o) {- const { cx, by, h, seed = 4, strands = 26, phase = 0 } = o, R = mulberry(seed), s = h;- limb(x, cx, by, cx + .08 * s, by + h * .78, .08 * s, .04 * s, -.12);- limb(x, cx + .06 * s, by + h * .6, cx - .18 * s, by + h * .86, .035 * s, .015 * s, .15);- limb(x, cx + .07 * s, by + h * .68, cx + .3 * s, by + h * .9, .03 * s, .012 * s, -.15);- x.lineCap = 'round';- for (let i = 0; i < strands; i++) {- const sx = cx + (-.3 + R() * .66) * s, sy = by + (.8 + R() * .16) * s, L = (.35 + R() * .45) * s, sway = (o.sway ?? .03) * s * Math.sin(phase + i);- x.lineWidth = .006 * s; x.beginPath(); x.moveTo(sx, sy);- x.bezierCurveTo(sx + .05 * s, sy + .02 * s, sx + .02 * s + sway * .5, sy - L * .5, sx + sway, sy - L); x.stroke();- for (let k = 1; k < 7; k++) { const u = k / 7; leaf(x, sx + sway * u + .02 * s * (1 - u), sy - L * u, .03 * s, -Math.PI / 2 + (k % 2 ? .5 : -.5)); }- }-}-// Reeds / grass clump-export function reeds(x, o) {- const { x0, x1, by, h, n = 40, seed = 6, sway = 0 } = o, R = mulberry(seed);- x.lineCap = 'round';- for (let i = 0; i < n; i++) {- const px = lerp(x0, x1, R()), hh = h * (.4 + R() * .6), lean = (R() - .5) * .3 + sway * (.6 + R() * .4);- x.lineWidth = h * .018; x.beginPath(); x.moveTo(px, by);- x.quadraticCurveTo(px + lean * hh * .3, by + hh * .6, px + lean * hh, by + hh); x.stroke();- if (R() < .45) leaf(x, px + lean * hh, by + hh + h * .04, h * .12, Math.PI / 2 + lean);- else if (R() < .5) { x.save(); x.translate(px + lean * hh * .5, by + hh * .5); x.rotate(R() < .5 ? .6 : -.6); x.beginPath(); x.ellipse(h * .06, 0, h * .08, h * .012, 0, 0, TAU); x.fill(); x.restore(); }- }-}--// —— Architecture ——-// Jiangnan houses: white walls, dark-grey tiles, matouqiang (马头墙, stepped "horse-head" gable walls); windows=[[dx,dy,w,h]] relative to the wall's bottom-left; win window colour, glow drawn into glowCtx-export function jiangnanHouse(x, o, g) {- const { cx, by, w, h, roof = .3 * h, windows = [], win = '#f4c46e', wall = '#3a4a74', tile = '#1e2848', gables = true } = o;- const L = cx - w / 2, top = by + h;- if (g) { g.fillStyle = '#fff'; for (const [dx, dy, ww, hh] of windows) g.fillRect(L + dx, by + dy, ww, hh); return; }- x.fillStyle = wall; x.fillRect(L, by, w, h);- // Dark-grey tile roof: both ends slightly upturned- x.fillStyle = tile; x.beginPath();- x.moveTo(L - .06 * w, top); x.quadraticCurveTo(L + .05 * w, top + roof * .15, L + .08 * w, top + roof);- x.lineTo(L + w - .08 * w, top + roof); x.quadraticCurveTo(L + w - .05 * w, top + roof * .15, L + w + .06 * w, top);- x.lineTo(L + w + .07 * w, top + roof * .18); x.lineTo(L - .07 * w, top + roof * .18); x.closePath(); x.fill();- x.fillRect(L - .06 * w, top - roof * .12, w * 1.12, roof * .14);- if (gables) for (const side of [0, 1]) { // horse-head walls: two steps, white wall with black eaves- const sw = .13 * w;- [[0, 1.55], [sw * .95, 1.15]].forEach(([off, k]) => {- const x0 = side ? L + w - off - sw : L + off, hh = h + roof * k;- x.fillStyle = wall; x.fillRect(x0, by, sw, hh);- x.fillStyle = tile; x.beginPath(); x.moveTo(x0 - sw * .25, by + hh); x.lineTo(x0 + sw * 1.25, by + hh); x.lineTo(x0 + sw * 1.1, by + hh + roof * .22); x.lineTo(x0 - sw * .1, by + hh + roof * .22); x.closePath(); x.fill();- });- }- for (const [dx, dy, ww, hh] of windows) {- x.fillStyle = win; x.fillRect(L + dx, by + dy, ww, hh);- x.fillStyle = tile; for (let i = 1; i < 3; i++) { x.fillRect(L + dx + ww * i / 3 - ww * .04, by + dy, ww * .08, hh); x.fillRect(L + dx, by + dy + hh * i / 3 - hh * .04, ww, hh * .08); }- }- x.fillStyle = tile; x.fillRect(L + w * .44, by, w * .12, h * .55); // door-}-// Pavilion-export function pavilion(x, o) {- const { cx, by, w, h } = o, s = w;- x.fillRect(cx - s * .55, by, s * 1.1, s * .06); // plinth- for (const u of [-.42, -.14, .14, .42]) x.fillRect(cx + u * s - s * .025, by + s * .06, s * .05, h * .55); // pillars- x.fillRect(cx - s * .5, by + s * .06 + h * .18, s, s * .025); // railing- for (let i = 0; i < 9; i++) x.fillRect(cx - s * .48 + i * s * .12, by + s * .06, s * .012, h * .18);- const ry = by + s * .06 + h * .55;- x.fillRect(cx - s * .5, ry, s, s * .05);- x.beginPath(); // flying eaves- x.moveTo(cx - s * .82, ry + s * .2);- x.quadraticCurveTo(cx - s * .6, ry + s * .04, cx - s * .3, ry + s * .1);- x.lineTo(cx + s * .3, ry + s * .1);- x.quadraticCurveTo(cx + s * .6, ry + s * .04, cx + s * .82, ry + s * .2);- x.quadraticCurveTo(cx + s * .5, ry + s * .2, cx + s * .1, ry + h * .38);- x.lineTo(cx - s * .1, ry + h * .38);- x.quadraticCurveTo(cx - s * .5, ry + s * .2, cx - s * .82, ry + s * .2);- x.closePath(); x.fill();- x.beginPath(); x.moveTo(cx, ry + h * .5); x.lineTo(cx + s * .04, ry + h * .37); x.lineTo(cx - s * .04, ry + h * .37); x.fill();- x.beginPath(); x.arc(cx, ry + h * .5, s * .03, 0, TAU); x.fill();-}-// Lantern (red, glow draws the light)-export function lantern(x, o, g) {- const { cx, cy, r, col = '#c8352a', rib = '#7a1a14', cap = '#2b1a14', string = true, tassel = true } = o;- if (string) { x.fillStyle = cap; x.fillRect(cx - r * .03, cy + r * .9, r * .06, o.stringLen ?? r * 3); }- x.fillStyle = cap; x.fillRect(cx - r * .45, cy + r * .72, r * .9, r * .2); x.fillRect(cx - r * .45, cy - r * .92, r * .9, r * .2);- x.fillStyle = col; x.beginPath(); x.ellipse(cx, cy, r * 1.05, r * .85, 0, 0, TAU); x.fill();- x.strokeStyle = rib; x.lineWidth = r * .06;- for (const k of [-.6, -.25, .25, .6]) { x.beginPath(); x.ellipse(cx, cy, r * 1.05 * Math.abs(k), r * .85, 0, -Math.PI / 2, Math.PI / 2, k < 0); x.stroke(); }- x.beginPath(); x.moveTo(cx, cy + r * .85); x.lineTo(cx, cy - r * .85); x.stroke();- if (tassel) {- x.fillStyle = cap; x.fillRect(cx - r * .04, cy - r * 1.3, r * .08, r * .4);- x.fillStyle = col; x.beginPath(); x.moveTo(cx - r * .15, cy - r * 1.3); x.lineTo(cx + r * .15, cy - r * 1.3); x.lineTo(cx + r * .22, cy - r * 2.1); x.lineTo(cx - r * .22, cy - r * 2.1); x.closePath(); x.fill();- }- if (g) { const gr = g.createRadialGradient(cx, cy, 0, cx, cy, r * 1.05); gr.addColorStop(0, '#fff'); gr.addColorStop(.7, 'rgba(255,255,255,.75)'); gr.addColorStop(1, 'rgba(255,255,255,.2)'); g.fillStyle = gr; g.beginPath(); g.ellipse(cx, cy, r * 1.05, r * .85, 0, 0, TAU); g.fill(); }-}--// —— Mooncake —— (patterned disc, golden tones). o: {r, char, font, petals}-export function mooncake(x, o) {- const { r, petals = 14, body = '#c98a3a', light = '#e8b35c', dark = '#8a5520', char = '圆' } = o;- const cx = o.cx || 0, cy = o.cy || 0;- x.save(); x.translate(cx, cy);- // Scalloped outer rim- x.fillStyle = body; x.beginPath();- for (let i = 0; i <= 200; i++) {- const a = i / 200 * TAU, k = 1 - .06 * Math.pow(Math.abs(Math.cos(a * petals / 2)), .6);- const px = Math.cos(a) * r * k, py = Math.sin(a) * r * k; i ? x.lineTo(px, py) : x.moveTo(px, py);- }- x.closePath(); x.fill();- // Grooves (carved lines between the petals)- x.strokeStyle = dark; x.lineWidth = r * .025; x.lineCap = 'round';- for (let i = 0; i < petals; i++) { const a = (i + .5) / petals * TAU; x.beginPath(); x.moveTo(Math.cos(a) * r * .72, Math.sin(a) * r * .72); x.lineTo(Math.cos(a) * r * .9, Math.sin(a) * r * .9); x.stroke(); }- // Inner ring- x.lineWidth = r * .03; x.beginPath(); x.arc(0, 0, r * .7, 0, TAU); x.stroke();- x.fillStyle = light; x.beginPath(); x.arc(0, 0, r * .66, 0, TAU); x.fill();- // Pearl-bead border- x.fillStyle = dark; for (let i = 0; i < 36; i++) { const a = i / 36 * TAU; x.beginPath(); x.arc(Math.cos(a) * r * .6, Math.sin(a) * r * .6, r * .018, 0, TAU); x.fill(); }- // Central character- if (char) {- x.fillStyle = dark; x.beginPath(); x.arc(0, 0, r * .47, 0, TAU); x.lineWidth = r * .02; x.strokeStyle = dark; x.stroke();- x.save(); x.scale(1, -1); x.font = `${r * .62}px ${o.font || FONT.brush}`; x.textAlign = 'center'; x.textBaseline = 'middle'; x.fillStyle = dark; x.fillText(char, 0, r * .04); x.restore();- }- x.restore();-}--// —— Figure silhouettes —— (facing right); returns joint positions for animation-// Grandma seated: head, hair bun, slightly hunched back, cardigan. Origin = seat point at the hips-export function grannySeated(x, s, o = {}) {- x.beginPath();- // Body (back → shoulder → chest → belly → legs)- x.moveTo(-.16 * s, 0);- x.bezierCurveTo(-.2 * s, .18 * s, -.2 * s, .38 * s, -.12 * s, .52 * s); // back- x.bezierCurveTo(-.08 * s, .6 * s, .02 * s, .62 * s, .08 * s, .57 * s); // shoulder- x.bezierCurveTo(.14 * s, .5 * s, .16 * s, .36 * s, .14 * s, .22 * s); // chest- x.bezierCurveTo(.16 * s, .1 * s, .2 * s, .06 * s, .36 * s, .06 * s); // upper thigh- x.lineTo(.4 * s, .02 * s); x.lineTo(.4 * s, -.34 * s); // knee → shin- x.lineTo(.46 * s, -.4 * s); x.lineTo(.3 * s, -.4 * s); x.lineTo(.3 * s, -.06 * s);- x.lineTo(-.14 * s, -.06 * s); x.closePath(); x.fill();- // Neck + head- x.beginPath(); x.moveTo(-.02 * s, .56 * s); x.lineTo(.04 * s, .56 * s); x.lineTo(.05 * s, .66 * s); x.lineTo(-.02 * s, .66 * s); x.fill();- granHead(x, .02 * s, .74 * s, s, o);-}-export function granHead(x, hx, hy, s, o = {}) {- x.beginPath();- x.moveTo(hx - .08 * s, hy + .02 * s);- x.bezierCurveTo(hx - .08 * s, hy + .12 * s, hx + .06 * s, hy + .14 * s, hx + .08 * s, hy + .05 * s); // top of head- x.lineTo(hx + .1 * s, hy + .01 * s); // forehead- x.lineTo(hx + .115 * s, hy - .015 * s); // nose- x.lineTo(hx + .095 * s, hy - .03 * s);- x.lineTo(hx + .1 * s, hy - .045 * s); // mouth- x.bezierCurveTo(hx + .09 * s, hy - .08 * s, hx + .04 * s, hy - .09 * s, hx + .0 * s, hy - .07 * s); // chin- x.lineTo(hx - .06 * s, hy - .05 * s);- x.closePath(); x.fill();- // Hair bun- x.beginPath(); x.arc(hx - .09 * s, hy + .06 * s, .045 * s, 0, TAU); x.fill();- if (o.glasses) { x.save(); x.strokeStyle = x.fillStyle; x.lineWidth = .006 * s; x.restore(); }-}-// Arm: from the shoulder (0,0) reaching to the hand, a = upper-arm angle, b = forearm relative angle (radians), lengths L1/L2, thickness w-export function arm(x, s, a, b, o = {}) {- const L1 = (o.L1 ?? .2) * s, L2 = (o.L2 ?? .19) * s, w = (o.w ?? .055) * s;- const ex = Math.cos(a) * L1, ey = Math.sin(a) * L1, hx = ex + Math.cos(a + b) * L2, hy = ey + Math.sin(a + b) * L2;- limb(x, 0, 0, ex, ey, w * 1.1, w * .9, 0);- limb(x, ex, ey, hx, hy, w * .9, w * .7, 0);- x.beginPath(); x.arc(ex, ey, w * .45, 0, TAU); x.fill();- x.beginPath(); x.ellipse(hx + Math.cos(a + b) * w * .3, hy + Math.sin(a + b) * w * .3, w * .55, w * .42, a + b, 0, TAU); x.fill();- return [hx, hy];-}diff --git a/styles/paper-lantern/demo/src/main.js b/styles/paper-lantern/demo/src/main.jsindex c757567..225e20d 100644--- a/styles/paper-lantern/demo/src/main.js+++ b/styles/paper-lantern/demo/src/main.js@@ -1,81 +1,46 @@-// Master control: timeline (laid out from the voice-over durations), shot scheduling (lazy load/release), transitions, subtitles+// The Last Night Train: one timeline (timeline.json from tools/timeline.py) drives the picture, the subtitles and the mix.+// ?from=a&to=b renders a cut (window.DUR = b − a); ?sign10=1 grows the credit strip in the 10 s cut's last 2.5 s.import * as THREE from 'three';import { Pipe } from './post.js';-import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';import { dispose } from './stage.js';import { ss, seg, clamp } from './lib.js';-import { SHOTS } from './shots/index.js';+import { world } from './world.js';+import * as SH from './shots.js';const Q = new URLSearchParams(location.search), SSAA = +(Q.get('ssaa') || 2);-const script = await (await fetch('script.json')).json();-const dur = await (await fetch('vo/dur.json')).json();-const WORDS = await (await fetch('vo/words.json')).json();+const TL = await (await fetch('timeline.json')).json();+const FROM = Q.has('from') ? +Q.get('from') : 0, TO = Q.has('to') ? +Q.get('to') : TL.DUR;+window.DUR = +(TO - FROM).toFixed(3);+const BUILD = { S1: world, S2: SH.s2, S3: SH.s3, S4: SH.s4, S5: SH.s5, S6: SH.s6 };+const TR = { cut: { type: 'cut', dur: 0 }, dissolve: { type: 'dissolve', dur: .6 } };+const plan = TL.SHOTS.map(([id, start, tr]) => ({ id, start, in: TR[tr] || TR.cut }));+plan.forEach((s, i) => { s.end = i + 1 < plan.length ? plan[i + 1].start : TL.DUR; });-// —— Timeline: each line = start time at; GAP = pause after that line ends ——-const GAP = { L01: .6, L02: 4.2, L03: .35, L04: .15, L05: 1.0, L06: 1.4, L07: .5, L08: 1.0, L09: .35, L10: 1.6, L11: .5, L12: .9, L13: .8, L14: 1.3,- L15: .8, L16: .25, L17: 1.2, L18: 1.6, L19: .45, L20: 1.4, L21: 1.6, L22: .35, L23: 2.0, L24: 1.0, L25: 5.0 };-const C = {}; let cur = 2.6;-for (const L of script) { C[L.id] = { at: cur, dur: dur[L.id], end: cur + dur[L.id], text: L.text, sub: L.sub ?? true }; cur += dur[L.id] + GAP[L.id]; }-const DUR = cur;-window.CUES = C; window.DUR = DUR;--// —— Shot list —— (start times are anchored to narration lines)-const plan = SHOTS(C, DUR);-plan.forEach((s, i) => { s.end = i + 1 < plan.length ? plan[i + 1].start : DUR; s.dur = s.end - s.start; });-window.PLAN = plan.map(s => [s.id, +s.start.toFixed(2), +s.end.toFixed(2)]);-window.EV = plan.flatMap(s => (s.sfx || []).map(e => ({ ...e, t: e.t })));--// —— Renderer ——const canvas = document.getElementById('c');const renderer = new THREE.WebGLRenderer({ canvas, antialias: false, powerPreference: 'high-performance', preserveDrawingBuffer: true });renderer.setPixelRatio(SSAA); renderer.setSize(1920, 1080, false);renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.VSMShadowMap;renderer.toneMapping = THREE.NoToneMapping; renderer.outputColorSpace = THREE.LinearSRGBColorSpace;const pipe = new Pipe(renderer, 1920, 1080, SSAA);-const pmrem = new THREE.PMREMGenerator(renderer); const ENV = pmrem.fromScene(new RoomEnvironment(), .04).texture;-await Promise.all(['MaShanZheng', 'ZhiMangXing', 'LongCang', 'NotoSerifSC'].map(f => document.fonts.load(`40px ${f}`, '一个月饼的相思中秋外婆圆')));+await Promise.all([document.fonts.load('40px NotoSerifSC', '车夜'), document.fonts.load('700 40px NotoSerifSC', '车'), document.fonts.load('600 40px Cormorant', 'Lemo'), document.fonts.load('700 40px Cormorant', 'PINE')]);const live = new Map();-async function get(i) {- const p = plan[i];- if (!live.has(i)) { const t0 = performance.now(); live.set(i, await p.build({ dur: p.dur, T0: p.start, C, env: ENV, W: WORDS, cue: id => C[id].at - p.start, cueEnd: id => C[id].end - p.start, word: (id, k) => C[id].at - p.start + (WORDS[id]?.[k] ? WORDS[id][k][1] : C[id].dur * k / [...C[id].text].length) })); console.log('built', p.id, Math.round(performance.now() - t0) + 'ms'); }- return live.get(i);-}+function get(i) { if (!live.has(i)) live.set(i, BUILD[plan[i].id]({ H: TL.HIT, sign: Q.get('sign10') === '1', T0: plan[i].start, dur: plan[i].end - plan[i].start })); return live.get(i); }function gc(keep) { for (const [i, s] of live) if (!keep.includes(i)) { dispose(s.S.scene); live.delete(i); } }+function draw(i, t, target) { const s = get(i); s.update(t); pipe.shot(s.S.scene, s.S.cam, s.post(), target); return s.grade(); }-async function drawShot(i, t, target) {- const s = await get(i), tl = t - plan[i].start;- s.update(tl);- if (Q.get('nolit')) { s.S.U.uLit.value = 0; s.S.amb.intensity = .02; s.S.key.intensity *= 2; }- pipe.shot(s.S.scene, s.S.cam, s.post(tl), target);- return s.grade(tl);-}--const sub = document.getElementById('sub'), credit = document.getElementById('credit');-credit.textContent = '配乐 Kevin MacLeod《Ripples》《Nu Flute》incompetech.com · CC BY 4.0\n茶具与木纹 Poly Haven · CC0 字体 马善政楷书 · 志莽行书 · 龙藏体 · 思源宋体 · OFL';-window.render = async (t) => {+const sub = document.getElementById('sub'), zh = sub.querySelector('.zh'), en = sub.querySelector('.en');+function R(t) {let i = plan.findIndex(p => t >= p.start && t < p.end); if (i < 0) i = plan.length - 1;- const p = plan[i], tl = t - p.start, tr = p.in || { type: 'cut', dur: 0 };- let mixB = 0, g;- if (i > 0 && tr.type !== 'cut' && tl < tr.dur) {- await drawShot(i - 1, t, pipe.rtA);- g = await drawShot(i, t, pipe.rtB);- mixB = (tr.ease || ss)(tl / tr.dur);- gc([i - 1, i]);- } else {- g = await drawShot(i, t, pipe.rtA); gc([i]);- }- pipe.final({ ...g, mixB, mode: tr.type === 'iris' ? 1 : 0, center: tr.center, time: t, fade: (g.fade ?? 1) * ss(clamp((DUR - t) / 1.2)) });- // Subtitles- let txt = '', a = 0;- for (const L of Object.values(C)) if (L.sub && t > L.at - .15 && t < L.end + .3) { txt = L.text.replace(/[“”]/g, m => m); a = Math.min(ss(seg(t, L.at - .15, L.at + .05)), 1 - ss(seg(t, L.end + .1, L.end + .3))); }- let st = txt.replace(/[,。:—]+$/, '');- if (st.length > 21) { // long lines are broken into two at the comma closest to the middle- const cs = [...st.matchAll(/[,。:]/g)].map(m => m.index); const mid = st.length / 2;- const k = cs.sort((a, b) => Math.abs(a - mid) - Math.abs(b - mid))[0];- if (k !== undefined) st = st.slice(0, k) + '\n' + st.slice(k + 1);- }- credit.style.opacity = Math.min(ss(seg(t, C.L25.end + .6, C.L25.end + 1.4)), 1 - ss(seg(t, DUR - 1.0, DUR - .1)));- sub.textContent = st.replace(/[,。:]/g, '\u3000'); sub.style.opacity = a;-};+ const p = plan[i], tl = t - p.start;+ let g, mixB = 0;+ if (i > 0 && p.in.type !== 'cut' && tl < p.in.dur) { draw(i - 1, t, pipe.rtA); g = draw(i, t, pipe.rtB); mixB = ss(tl / p.in.dur); gc([i - 1, i]); }+ else { g = draw(i, t, pipe.rtA); gc([i]); }+ const fin = 1;+ pipe.final({ ...g, mixB, fade: (g.fade ?? 1) * (FROM === 0 ? ss(clamp(t / .5)) : 1) * fin });+ let c = null, a = 0;+ for (const q of TL.cues) if (t > q.t0 && t < q.t1) { c = q; a = Math.min(ss(seg(t, q.t0, q.t0 + .2)), 1 - ss(seg(t, q.t1 - .22, q.t1))); }+ zh.textContent = c ? c.zh.replace(/[,。]$/, '') : ''; en.textContent = c ? c.en : ''; sub.style.opacity = Q.has('nosub') ? 0 : a;+}+window.render = t => R(FROM + t);window.READY = true;diff --git a/styles/paper-lantern/demo/src/paper.js b/styles/paper-lantern/demo/src/paper.jsindex 3e75a09..a07f365 100644--- a/styles/paper-lantern/demo/src/paper.js+++ b/styles/paper-lantern/demo/src/paper.js@@ -97,18 +97,25 @@ export function paperMat(map, U, o = {}) {if (o.envMap) { m.envMap = o.envMap; m.envMapIntensity = o.envI ?? 1; }if (o.bumpMap) { m.bumpMap = o.bumpMap; m.bumpScale = o.bump ?? 4; }if (o.color) m.color.set(o.color);- const own = { uTrans: { value: o.trans ?? .25 }, uGlowLit: { value: 1 }, tCloud: { value: CLOUD() }, uCloudS: { value: o.cloudS ?? 9 }, uClip: { value: new THREE.Vector4(0, 0, 100, 0) } };+ const own = { uTrans: { value: o.trans ?? .25 }, uGlowLit: { value: 1 }, tCloud: { value: CLOUD() }, uCloudS: { value: o.cloudS ?? 9 }, uClip: { value: new THREE.Vector4(0, 0, 100, 0) }, uGY: { value: new THREE.Vector4(0, .01, 1, 0) }, uGR: { value: new THREE.Vector4(0, 0, 0, 0) }, uBeamK: { value: o.beamK ?? 1 } };m.userData.u = own;m.onBeforeCompile = s => {Object.assign(s.uniforms, U, own);s.vertexShader = 'varying vec3 vWP;\n' + s.vertexShader.replace('#include <fog_vertex>', '#include <fog_vertex>\n vWP = (modelMatrix * vec4(transformed, 1.)).xyz;');- s.fragmentShader = 'varying vec3 vWP; uniform vec3 uLight, uLightCol; uniform float uLightR, uLit, uTrans, uGlowLit, uCloudS; uniform sampler2D tCloud; uniform vec4 uClip;\n' ++ s.fragmentShader = 'varying vec3 vWP; uniform vec3 uLight, uLightCol, uBeamO, uBeamD, uBeamCol; uniform float uLightR, uLit, uTrans, uGlowLit, uCloudS, uFloor, uBeamK; uniform sampler2D tCloud; uniform vec4 uClip, uGY, uGR;\n' +s.fragmentShader.replace('#include <alphatest_fragment>', `#include <alphatest_fragment>{ float cd = length(vWP.xy - uClip.xy) - uClip.z; if (uClip.w < .5 ? cd > 0. : cd < 0.) discard; }`).replace('#include <emissivemap_fragment>', `#include <emissivemap_fragment>totalEmissiveRadiance *= uGlowLit;- { float d = length(vWP.xy - uLight.xy); float fall = mix(.22, 1., exp(-d*d/(uLightR*uLightR)));+ if (uGR.w > .5) { float rr = length(vWP.xy - uGR.xy); totalEmissiveRadiance *= smoothstep(uGR.z, uGR.z - .006, rr); }+ if (uGY.w > .5) { float dy = vWP.y - uGY.x; float band = exp(-dy*dy/(uGY.y*uGY.y)); totalEmissiveRadiance *= max(band, dy < 0. ? uGY.z : 0.); }+ { float d = length(vWP.xy - uLight.xy); float fall = mix(uFloor, 1., exp(-d*d/(uLightR*uLightR)));float g = texture2D(tCloud, vMapUv * uCloudS).r;- totalEmissiveRadiance += diffuseColor.rgb * uLightCol * (uTrans * uLit * fall * (.35 + 1.3 * g)); }`);+ totalEmissiveRadiance += diffuseColor.rgb * uLightCol * (uTrans * uLit * fall * (.35 + 1.3 * g));+ if (uBeamO.z > 0.) { // optional beam: a soft wedge of light lighting the paper it passes through (unused when uBeamO.z = 0)+ vec2 bd = vWP.xy - uBeamO.xy; float r = length(bd); float a = atan(bd.y, bd.x) - uBeamD.x; a = mod(a + 3.14159265, 6.2831853) - 3.14159265;+ float w = uBeamD.y * (1. + r * 3.);+ float m = exp(-a*a/(w*w)) * smoothstep(.0, .015, r) * exp(-r / uBeamD.z);+ totalEmissiveRadiance += diffuseColor.rgb * uBeamCol * (m * uBeamO.z * uBeamK * (.25 + uTrans) * (.5 + .9 * g)); } }`);};m.customProgramCacheKey = () => 'paperT' + (o.emissiveMap ? 'g' : '') + (o.envMap ? 'e' : '') + (o.bumpMap ? 'b' : '');return m;diff --git a/styles/paper-lantern/demo/src/people.js b/styles/paper-lantern/demo/src/people.jsdeleted file mode 100644index c0f41e5..0000000--- a/styles/paper-lantern/demo/src/people.js+++ /dev/null@@ -1,106 +0,0 @@-// Figure silhouettes: key points + Catmull-Rom smoothed outline (a point with a third value 1 = sharp corner). Facing right, coordinates for height H=1, s = actual height (metres)-import { TAU } from './lib.js';-import { limb } from './art.js';--// Smooth closed curve through the points (central-difference Catmull-Rom → cubic Bézier); tangent is 0 at sharp-corner points-export function spline(x, s, pts, closed = true, k = 1 / 6) {- const n = pts.length, P = i => pts[closed ? (i + n) % n : Math.max(0, Math.min(n - 1, i))];- x.beginPath(); x.moveTo(pts[0][0] * s, pts[0][1] * s);- for (let i = 0; i < (closed ? n : n - 1); i++) {- const p0 = P(i - 1), p1 = P(i), p2 = P(i + 1), p3 = P(i + 2);- const c1 = p1[2] ? p1 : [p1[0] + (p2[0] - p0[0]) * k, p1[1] + (p2[1] - p0[1]) * k];- const c2 = p2[2] ? p2 : [p2[0] - (p3[0] - p1[0]) * k, p2[1] - (p3[1] - p1[1]) * k];- x.bezierCurveTo(c1[0] * s, c1[1] * s, c2[0] * s, c2[1] * s, p2[0] * s, p2[1] * s);- }- if (closed) x.closePath();-}-const fill = (x, s, pts) => { spline(x, s, pts); x.fill(); };-const shift = (pts, dx, dy) => pts.map(p => [p[0] + dx, p[1] + dy, p[2]]);--// —— Xiaoman (young woman, low ponytail) ——-const GIRL_HEAD = [[0, 1], [.04, .99], [.062, .965], [.066, .945], [.08, .922, 1], [.067, .912], [.07, .9], [.064, .893], [.066, .885], [.058, .872], [.035, .862], [.03, .845]];-const GIRL_BACKHEAD = [[-.055, .845], [-.058, .862], [-.075, .85], [-.1, .8], [-.105, .74, 1], [-.085, .8], [-.07, .87], [-.072, .925], [-.055, .975], [-.03, .995]];-const GIRL_TORSO_F = [[.035, .82], [.058, .8], [.078, .752], [.074, .712], [.055, .668], [.046, .612], [.054, .552], [.06, .5]];-const GIRL_TORSO_B = [[-.075, .5], [-.062, .58], [-.046, .64], [-.056, .72], [-.058, .79]];-export function girlStand(x, s) {- fill(x, s, [...GIRL_HEAD, ...GIRL_TORSO_F, [.056, .42], [.05, .3], [.046, .18], [.04, .06], [.1, .022], [.106, 0, 1], [-.035, 0, 1], [-.042, .04], [-.03, .1], [-.046, .2], [-.036, .3], [-.05, .42], ...GIRL_TORSO_B, ...GIRL_BACKHEAD]);-}-export function girlSit(x, s) { // origin = sitting point- fill(x, s, [...shift([...GIRL_HEAD, ...GIRL_TORSO_F], 0, -.5), [.15, .03], [.25, .032], [.275, .005], [.265, -.12], [.258, -.22], [.322, -.248], [.326, -.262, 1], [.212, -.262, 1], [.21, -.22], [.21, -.1], [.215, -.03], [.1, -.036], [-.05, -.03],- ...shift([...GIRL_TORSO_B, ...GIRL_BACKHEAD], 0, -.5)]);-}-export const GIRL_SHOULDER = [.0, .775];--// —— Grandma (hunched back, hair bun, cardigan, wide-leg trousers) ——-const GRAN_HEAD = [[.0, .955], [.05, .953], [.083, .926], [.094, .9, 1], [.08, .889], [.084, .877], [.075, .862], [.05, .85], [.045, .83]];-const GRAN_TORSO_F = [[.06, .8], [.085, .74], [.092, .66], [.086, .56], [.093, .5, 1], [.07, .49]];-const GRAN_TORSO_B = [[-.066, .48], [-.088, .5, 1], [-.094, .6], [-.098, .7], [-.075, .81], [-.035, .855]];-const GRAN_BACKHEAD = [[-.03, .88], [-.035, .92], [-.015, .952]];-export function grannyStand(x, s, o = {}) {- fill(x, s, [...GRAN_HEAD, ...GRAN_TORSO_F, [.074, .35], [.07, .06], [.12, .03], [.126, 0, 1], [-.042, 0, 1], [-.047, .05], [-.052, .3], ...GRAN_TORSO_B, ...GRAN_BACKHEAD]);- bun(x, s, 0, o);-}-export function grannySit(x, s, o = {}) { // origin = sitting point- fill(x, s, [...shift([...GRAN_HEAD, ...GRAN_TORSO_F], 0, -.48), [.16, .04], [.26, .04], [.285, .01], [.275, -.12], [.27, -.22], [.33, -.25], [.335, -.262, 1], [.215, -.262, 1], [.213, -.22], [.215, -.03], [.1, -.04], [-.07, -.03],- ...shift([...GRAN_TORSO_B, ...GRAN_BACKHEAD], 0, -.48)]);- bun(x, s, -.48, o);-}-function bun(x, s, dy, o) {- x.beginPath(); x.ellipse(-.035 * s, (.925 + dy) * s, .034 * s, .03 * s, -.4, 0, TAU); x.fill();- if (o.pin) { x.save(); x.fillStyle = o.pin; x.translate(-.035 * s, (.93 + dy) * s); x.rotate(-.35); x.fillRect(-.05 * s, -.003 * s, .085 * s, .006 * s); x.beginPath(); x.arc(-.05 * s, 0, .008 * s, 0, TAU); x.fill(); x.restore(); }-}-export const GRAN_SHOULDER = [.0, .77];--// —— Arm: shoulder at (0,0); a upper-arm angle, b forearm relative angle; returns palm position ——-export function arm(x, s, a, b, o = {}) {- const L1 = (o.L1 ?? .175) * s, L2 = (o.L2 ?? .155) * s, w = (o.w ?? .046) * s, sl = o.sleeve ?? 1;- const ex = Math.cos(a) * L1, ey = Math.sin(a) * L1, hx = ex + Math.cos(a + b) * L2, hy = ey + Math.sin(a + b) * L2;- limb(x, 0, 0, ex, ey, w * 1.25 * sl, w * .95 * sl, 0);- limb(x, ex, ey, hx, hy, w * .92 * sl, w * .62 * (o.cuff ?? 1), 0);- x.beginPath(); x.arc(ex, ey, w * .47 * sl, 0, TAU); x.fill();- x.beginPath(); x.arc(0, 0, w * .62 * sl, 0, TAU); x.fill();- const ha = a + b + (o.wrist || 0), hl = w * 1.35; // hand: mitten shape- x.save(); x.translate(hx, hy); x.rotate(ha);- x.beginPath(); x.moveTo(0, w * .3); x.quadraticCurveTo(hl * .7, w * .42, hl, w * .08); x.quadraticCurveTo(hl * 1.02, -w * .2, hl * .7, -w * .3); x.lineTo(hl * .35, -w * .52); x.quadraticCurveTo(hl * .2, -w * .45, hl * .25, -w * .28); x.lineTo(0, -w * .3); x.closePath(); x.fill();- x.restore();- return [hx + Math.cos(ha) * hl * .6, hy + Math.sin(ha) * hl * .6];-}--// —— Child (two hair buns) ——-export function childStand(x, s) {- fill(x, s, [[0, .98], [.07, .96], [.1, .9], [.115, .86, 1], [.1, .845], [.09, .8], [.05, .77], [.05, .74], [.09, .7], [.1, .58], [.13, .4, 1], [.05, .4], [.05, .02], [.09, .0, 1], [.0, 0, 1], [.0, .38], [-.03, .38], [-.03, 0, 1], [-.1, 0, 1], [-.08, .02], [-.08, .4], [-.13, .4, 1], [-.1, .58], [-.08, .7], [-.04, .75], [-.08, .8], [-.1, .9], [-.07, .96]]);- x.beginPath(); x.arc(-.07 * s, .96 * s, .045 * s, 0, TAU); x.arc(.06 * s, .985 * s, .042 * s, 0, TAU); x.fill();-}--// —— Su Shi (Dongpo scarf hat, wide robe, long beard) ——-export function sushi(x, s) {- fill(x, s, [[-.02, 1.1, 1], [.07, 1.1, 1], [.065, .99], [.07, .975], [.078, .955], [.086, .935, 1], [.074, .928], [.076, .915], [.07, .9], [.075, .87], [.06, .8], [.04, .76], [.03, .8], [.036, .86],- [.05, .82], [.095, .76], [.11, .6], [.13, .3], [.19, .02], [.2, 0, 1], [-.2, 0, 1], [-.17, .1], [-.13, .4], [-.1, .65], [-.09, .78], [-.05, .86], [-.055, .92], [-.045, .97], [-.035, 1.0]]);- // ribbons hanging from the back of the hat- x.beginPath(); x.moveTo(-.03 * s, 1.05 * s); x.quadraticCurveTo(-.09 * s, 1.0 * s, -.11 * s, .9 * s); x.lineTo(-.095 * s, .9 * s); x.quadraticCurveTo(-.075 * s, .99 * s, -.03 * s, 1.02 * s); x.fill();-}-export const SUSHI_SHOULDER = [.02, .8];--// —— Chang'e (flying apsara pose, origin = waist; long skirt streaming behind) ——-export function change(x, s, ph = 0) {- const w = k => .02 * Math.sin(ph + k);- fill(x, s, [[.0, .34], [.03, .345], [.05, .33], [.058, .315, 1], [.05, .31], [.052, .3], [.045, .29], [.03, .285], [.03, .26], [.05, .24], [.06, .18], [.05, .1], [.035, .03],- [-.05, -.06], [-.18, -.12 + w(1)], [-.34, -.15 + w(2)], [-.5, -.13 + w(3)], [-.62, -.07 + w(4), 1], [-.5, -.1 + w(3)], [-.36, -.1 + w(2)], [-.2, -.06 + w(1)], [-.08, .0], [-.04, .1], [-.045, .2], [-.03, .26], [-.035, .3]]);- x.beginPath(); x.arc(-.01 * s, .37 * s, .028 * s, 0, TAU); x.arc(.028 * s, .375 * s, .024 * s, 0, TAU); x.fill(); // double hair buns-}-// Streamer: a band of varying width along a path (pts are absolute metric coordinates)-export function ribbon(x, pts, w0, w1) {- const n = pts.length, L = [], R = [];- for (let i = 0; i < n; i++) {- const p = pts[i], q = pts[Math.min(n - 1, i + 1)], r = pts[Math.max(0, i - 1)];- const dx = q[0] - r[0], dy = q[1] - r[1], d = Math.hypot(dx, dy) || 1, w = (w0 + (w1 - w0) * i / (n - 1)) / 2;- L.push([p[0] - dy / d * w, p[1] + dx / d * w]); R.push([p[0] + dy / d * w, p[1] - dx / d * w]);- }- x.beginPath(); L.forEach((p, i) => i ? x.lineTo(...p) : x.moveTo(...p)); R.reverse().forEach(p => x.lineTo(...p)); x.closePath(); x.fill();-}-// Jade Rabbit (sitting on its haunches, facing right)-export function rabbit(x, s) {- fill(x, s, [[.3, .66], [.36, .6], [.42, .5, 1], [.36, .44], [.3, .38], [.3, .3], [.26, .12], [.3, .04], [.34, 0, 1], [-.18, 0, 1], [-.28, .08], [-.34, .12], [-.3, .2], [-.26, .3], [-.12, .44], [.1, .5], [.16, .6]]);- x.beginPath(); x.ellipse(.2 * s, .82 * s, .05 * s, .2 * s, -.35, 0, TAU); x.fill();- x.beginPath(); x.ellipse(.28 * s, .8 * s, .045 * s, .18 * s, .05, 0, TAU); x.fill();-}diff --git a/styles/paper-lantern/demo/src/props.js b/styles/paper-lantern/demo/src/props.jsdeleted file mode 100644index b9336a2..0000000--- a/styles/paper-lantern/demo/src/props.js+++ /dev/null@@ -1,115 +0,0 @@-// Interior prop paper-cuts: round-window lattice, steamers, jars, wall calendar, pendant lamp, table and chairs, bowls and plates, gift box, note slip-import { TAU, mulberry } from './lib.js';-import { text, vtext } from './paper.js';-import { FONT } from './art.js';--export const cut = (x, fn) => { x.save(); x.globalCompositeOperation = 'destination-out'; x.fillStyle = '#000'; fn(); x.restore(); };--// Round window: a round hole in the wall + ice-crack / huiwen (回纹, Greek-key fret) lattice (drawn in the wall layer: whole wall first, then cut the hole, then draw the lattice)-export function roundWindow(x, cx, cy, r, bar, style = 'ice') {- cut(x, () => { x.beginPath(); x.arc(cx, cy, r, 0, TAU); x.fill(); });- x.save(); x.beginPath(); x.arc(cx, cy, r, 0, TAU); x.clip();- x.strokeStyle = x.fillStyle; x.lineWidth = bar; x.lineCap = 'square';- if (style === 'ice') { // ice-crack pattern: random polyline mesh- const R = mulberry(9), pts = [];- for (let i = 0; i < 14; i++) { const a = R() * TAU, rr = Math.sqrt(R()) * r * .9; pts.push([cx + Math.cos(a) * rr, cy + Math.sin(a) * rr]); }- for (const p of pts) { const q = pts.map(o => [o, Math.hypot(o[0] - p[0], o[1] - p[1])]).sort((a, b) => a[1] - b[1]).slice(1, 4); for (const [o] of q) { x.beginPath(); x.moveTo(...p); x.lineTo(...o); x.stroke(); } }- for (let i = 0; i < 10; i++) { const a = i / 10 * TAU + .2; const p = pts.map(o => [o, Math.hypot(o[0] - cx - Math.cos(a) * r, o[1] - cy - Math.sin(a) * r)]).sort((a, b) => a[1] - b[1])[0][0]; x.beginPath(); x.moveTo(...p); x.lineTo(cx + Math.cos(a) * r * 1.1, cy + Math.sin(a) * r * 1.1); x.stroke(); }- } else { // square-grid fret pattern- const n = 6;- for (let i = -n; i <= n; i++) { x.beginPath(); x.moveTo(cx + i * r / n * 1.1, cy - r); x.lineTo(cx + i * r / n * 1.1, cy + r); x.stroke(); x.beginPath(); x.moveTo(cx - r, cy + i * r / n * 1.1); x.lineTo(cx + r, cy + i * r / n * 1.1); x.stroke(); }- }- x.restore();- x.lineWidth = bar * 2.2; x.strokeStyle = x.fillStyle; x.beginPath(); x.arc(cx, cy, r, 0, TAU); x.stroke();-}--// Stack of steamers (front view)-export function steamers(x, cx, by, w, n, col, band) {- const h = w * .28;- for (let i = 0; i < n; i++) {- const y = by + i * h * .92;- x.fillStyle = col; x.beginPath(); x.roundRect(cx - w / 2, y, w, h, h * .2); x.fill();- x.fillStyle = band; x.fillRect(cx - w / 2, y + h * .38, w, h * .1);- for (let k = 1; k < 8; k++) x.fillRect(cx - w / 2 + k * w / 8, y + h * .12, w * .006, h * .7);- }- const y = by + n * h * .92; // lid- x.fillStyle = col; x.beginPath(); x.moveTo(cx - w / 2, y); x.quadraticCurveTo(cx, y + h * 1.1, cx + w / 2, y); x.closePath(); x.fill();- x.beginPath(); x.arc(cx, y + h * .58, w * .05, 0, TAU); x.fill();-}-// Stove-export function stove(x, cx, by, w, h, col, mouth) {- x.fillStyle = col; x.fillRect(cx - w / 2, by, w, h); x.fillRect(cx - w * .55, by + h, w * 1.1, h * .08);- x.fillStyle = mouth; x.beginPath(); x.moveTo(cx - w * .14, by); x.lineTo(cx - w * .14, by + h * .3); x.arc(cx, by + h * .3, w * .14, Math.PI, 0, true); x.lineTo(cx + w * .14, by); x.closePath(); x.fill();-}-// Jar / bowl-export function jar(x, cx, by, w, h) {- x.beginPath(); x.moveTo(cx - w * .3, by); x.bezierCurveTo(cx - w * .6, by + h * .3, cx - w * .55, by + h * .8, cx - w * .25, by + h * .88); x.lineTo(cx - w * .22, by + h); x.lineTo(cx + w * .22, by + h); x.lineTo(cx + w * .25, by + h * .88);- x.bezierCurveTo(cx + w * .55, by + h * .8, cx + w * .6, by + h * .3, cx + w * .3, by); x.closePath(); x.fill();-}-export function bowl(x, cx, by, w, h) {- x.beginPath(); x.moveTo(cx - w / 2, by + h); x.quadraticCurveTo(cx - w * .45, by + h * .1, cx - w * .15, by + h * .08); x.lineTo(cx - w * .15, by); x.lineTo(cx + w * .15, by); x.lineTo(cx + w * .15, by + h * .08); x.quadraticCurveTo(cx + w * .45, by + h * .1, cx + w / 2, by + h); x.closePath(); x.fill();-}-export function teapot(x, cx, by, s) {- x.beginPath(); x.ellipse(cx, by + s * .4, s * .5, s * .4, 0, 0, TAU); x.fill();- x.fillRect(cx - s * .15, by + s * .75, s * .3, s * .12); x.beginPath(); x.arc(cx, by + s * .92, s * .07, 0, TAU); x.fill();- x.beginPath(); x.moveTo(cx + s * .4, by + s * .45); x.quadraticCurveTo(cx + s * .75, by + s * .5, cx + s * .8, by + s * .8); x.lineTo(cx + s * .72, by + s * .8); x.quadraticCurveTo(cx + s * .65, by + s * .6, cx + s * .4, by + s * .3); x.fill();- x.lineWidth = s * .08; x.strokeStyle = x.fillStyle; x.beginPath(); x.arc(cx - s * .55, by + s * .45, s * .2, Math.PI * .4, Math.PI * 1.6); x.stroke();-}-// Pendant lamp (shade + bulb glow)-export function pendant(x, cx, cy, s, col, g) {- x.fillStyle = col; x.fillRect(cx - s * .02, cy + s * .4, s * .04, 1);- x.beginPath(); x.moveTo(cx - s * .08, cy + s * .4); x.lineTo(cx + s * .08, cy + s * .4); x.lineTo(cx + s * .5, cy); x.lineTo(cx - s * .5, cy); x.closePath(); x.fill();- if (g) { g.fillStyle = '#fff'; g.beginPath(); g.ellipse(cx, cy - s * .02, s * .25, s * .1, 0, 0, TAU); g.fill(); }- else { x.save(); x.fillStyle = '#ffe2a8'; x.beginPath(); x.ellipse(cx, cy - s * .02, s * .25, s * .1, 0, 0, TAU); x.fill(); x.restore(); }-}-// Wall calendar-export function calendar(x, cx, cy, w, col, ink, red) {- x.fillStyle = col; x.fillRect(cx - w / 2, cy - w * .7, w, w * 1.3);- x.fillStyle = red; x.fillRect(cx - w / 2, cy + w * .42, w, w * .18);- text(x, '八月', cx, cy + w * .3, w * .2, FONT.song, { fill: ink, weight: 700 });- text(x, '十五', cx, cy - w * .1, w * .42, FONT.song, { fill: red, weight: 900 });- text(x, '中秋', cx, cy - w * .5, w * .16, FONT.song, { fill: ink, weight: 700 });-}-// Table (front view: tabletop + legs), chair (side view, facing left/right)-export function table(x, cx, ty, w, h, top = .012) {- x.fillRect(cx - w / 2, ty - top, w, top); x.fillRect(cx - w / 2 + w * .02, ty - top * 2, w * .96, top);- x.fillRect(cx - w / 2 + w * .05, ty - h, w * .03, h); x.fillRect(cx + w / 2 - w * .08, ty - h, w * .03, h);- x.fillRect(cx - w / 2 + w * .05, ty - h * .7, w * .9, top * .5);-}-export function chair(x, cx, by, s, dir = 1) { // dir=1 chair back on the left (person faces right)- const bx = cx - dir * s * .22;- x.fillRect(bx - s * .025, by, s * .05, s * 1.0); // back leg + chair back- x.fillRect(cx + dir * s * .2 - s * .025, by, s * .05, s * .45); // front leg- x.fillRect(cx - s * .26, by + s * .43, s * .52, s * .05); // seat- x.fillRect(Math.min(bx, bx + dir * s * .02) - s * .02, by + s * .98, s * .09, s * .04);- for (const k of [.62, .8]) x.fillRect(bx - s * .025, by + s * k, dir * s * .05 + (dir < 0 ? 0 : 0), s * .03);-}-// Gift box (front view): box body + gold fret-pattern border-export function boxFront(x, cx, by, w, h, col, gold) {- x.fillStyle = col; x.fillRect(cx - w / 2, by, w, h);- x.strokeStyle = gold; x.lineWidth = h * .035; x.strokeRect(cx - w / 2 + h * .08, by + h * .08, w - h * .16, h * .84);- x.lineWidth = h * .015; x.strokeRect(cx - w / 2 + h * .14, by + h * .14, w - h * .28, h * .72);- for (const sx of [-1, 1]) for (const sy of [0, 1]) { // fret pattern at the corners- const px = cx + sx * (w / 2 - h * .14), py = by + (sy ? h - h * .14 : h * .14);- x.beginPath(); x.moveTo(px, py); x.lineTo(px - sx * h * .12, py); x.lineTo(px - sx * h * .12, py + (sy ? -1 : 1) * h * .12); x.lineTo(px - sx * h * .05, py + (sy ? -1 : 1) * h * .12); x.lineTo(px - sx * h * .05, py + (sy ? -1 : 1) * h * .05); x.stroke();- }-}-// Delivery label / note slip-export function label(x, cx, cy, w, h, lines, o = {}) {- x.save(); x.translate(cx, cy); x.rotate(o.rot || 0);- x.fillStyle = o.paper || '#f4ecd8'; x.fillRect(-w / 2, -h / 2, w, h);- x.fillStyle = o.line || '#c0392b'; x.fillRect(-w / 2, h / 2 - h * .16, w, h * .05);- lines.forEach(([s, dy, size], i) => text(x, s, o.align === 'left' ? -w / 2 + w * .08 : 0, dy, size, o.font || FONT.xing, { fill: o.ink || '#2a1a12', align: o.align || 'center' }));- x.restore();-}--// Mooncake in 3/4 top view (side wall + squashed top pattern): faceFn(x) draws the top face (radius r, metric, not squashed)-export function cake3q(x, cx, cy, r, faceFn, o = {}) {- const k = o.k ?? .42, side = r * (o.side ?? .36);- x.save(); x.translate(cx, cy);- x.fillStyle = o.sideCol || '#8a5220';- x.beginPath(); x.ellipse(0, -side, r * .97, r * k * .97, 0, 0, TAU); x.fill(); x.fillRect(-r * .97, -side, r * 1.94, side);- x.fillStyle = o.sideHi || 'rgba(255,220,160,.25)'; x.fillRect(-r * .97, -side * .55, r * 1.94, side * .12);- x.scale(1, k); faceFn(x);- x.restore();-}diff --git a/styles/paper-lantern/demo/src/room.js b/styles/paper-lantern/demo/src/room.jsdeleted file mode 100644index a5413d3..0000000--- a/styles/paper-lantern/demo/src/room.js+++ /dev/null@@ -1,67 +0,0 @@-// Real world: the paper-cut lightbox (wooden frame, inner walls) on a walnut table, a dim room, a tea set and a plate of real mooncakes-import * as THREE from 'three';-import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';-import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js';-import { paint, tex } from './paper.js';-import { cakeFace } from './shots/s03_press.js';-RectAreaLightUniformsLib.init();--export const BOX = { w: .56, h: .33, d: .16, front: .014, border: .035 };-const tl = new THREE.TextureLoader();-const woodCache = {};-function wood(rep = 1, rot = 0) {- const k = rep + ':' + rot; if (woodCache[k]) return woodCache[k];- const ld = (f, srgb) => { const t = tl.load('/core/assets/polyhaven/' + f); t.wrapS = t.wrapT = THREE.RepeatWrapping; t.repeat.set(rep, rep); t.rotation = rot; t.anisotropy = 8; if (srgb) t.colorSpace = THREE.SRGBColorSpace; return t; };- return woodCache[k] = { map: ld('walnut_diff.jpg', true), normalMap: ld('walnut_nor.jpg'), roughnessMap: ld('walnut_rough.jpg') };-}--export async function lightbox(S, E, o = {}) {- const g = new THREE.Group(); S.scene.add(g);- const { w, h, d, front, border } = BOX;- const W = w + border * 2, H = h + border * 2;- // Front frame: extruded shape with a hole- const sh = new THREE.Shape(); sh.moveTo(-W / 2, -H / 2); sh.lineTo(W / 2, -H / 2); sh.lineTo(W / 2, H / 2); sh.lineTo(-W / 2, H / 2); sh.closePath();- const hole = new THREE.Path(); const r = .006; hole.moveTo(-w / 2 + r, -h / 2); hole.lineTo(w / 2 - r, -h / 2); hole.quadraticCurveTo(w / 2, -h / 2, w / 2, -h / 2 + r); hole.lineTo(w / 2, h / 2 - r); hole.quadraticCurveTo(w / 2, h / 2, w / 2 - r, h / 2); hole.lineTo(-w / 2 + r, h / 2); hole.quadraticCurveTo(-w / 2, h / 2, -w / 2, h / 2 - r); hole.lineTo(-w / 2, -h / 2 + r); hole.quadraticCurveTo(-w / 2, -h / 2, -w / 2 + r, -h / 2); sh.holes.push(hole);- const fgeo = new THREE.ExtrudeGeometry(sh, { depth: .018, bevelEnabled: true, bevelThickness: .003, bevelSize: .003, bevelSegments: 3, curveSegments: 6 });- const wm = new THREE.MeshStandardMaterial({ ...wood(3), color: '#8a6a52', roughness: .55, normalScale: new THREE.Vector2(.6, .6) });- const frame = new THREE.Mesh(fgeo, wm); frame.position.z = front - .004; frame.castShadow = frame.receiveShadow = true; g.add(frame);- // Four walls of the box + back panel (wood grain outside, dark paper inside)- const side = (sw, shh, sd, x, y, z) => { const m = new THREE.Mesh(new THREE.BoxGeometry(sw, shh, sd), wm); m.position.set(x, y, z); m.castShadow = m.receiveShadow = true; g.add(m); };- const bt = border * .5;- side(W, bt, d, 0, -h / 2 - bt / 2, front - d / 2); side(W, bt, d, 0, h / 2 + bt / 2, front - d / 2);- side(bt, H, d, -w / 2 - bt / 2, 0, front - d / 2); side(bt, H, d, w / 2 + bt / 2, 0, front - d / 2);- side(W, H, .01, 0, 0, front - d - .005);- // Black paper lining inside (stops reflections off the wooden inner walls showing)- const inner = new THREE.MeshStandardMaterial({ color: '#0a0806', roughness: 1 });- for (const [ww, hh, x, y, rx, ry] of [[w, d, 0, -h / 2 + .0005, -Math.PI / 2, 0], [w, d, 0, h / 2 - .0005, Math.PI / 2, 0], [d, h, -w / 2 + .0005, 0, 0, Math.PI / 2], [d, h, w / 2 - .0005, 0, 0, -Math.PI / 2]]) {- const m = new THREE.Mesh(new THREE.PlaneGeometry(ww, hh), inner); m.position.set(x, y, front - d / 2); m.rotation.set(rx, ry, 0); m.receiveShadow = true; g.add(m);- }- // Tabletop + wall- const tw = wood(4, Math.PI / 2);- const table = new THREE.Mesh(new THREE.PlaneGeometry(3, 2), new THREE.MeshStandardMaterial({ ...tw, color: '#6a4a36', roughness: .45 }));- table.rotation.x = -Math.PI / 2; table.position.set(0, -H / 2, .4); table.receiveShadow = true; g.add(table);- const wallC = paint(4, 2.4, x => { const gr = x.createRadialGradient(0, .1, .1, 0, 0, 2); gr.addColorStop(0, '#2a2018'); gr.addColorStop(1, '#0a0806'); x.fillStyle = gr; x.fillRect(-2, -1.2, 4, 2.4); }, 200);- const wall = new THREE.Mesh(new THREE.PlaneGeometry(4, 2.4), new THREE.MeshStandardMaterial({ map: tex(wallC), roughness: 1 }));- wall.position.set(0, .6, -.9); wall.receiveShadow = true; g.add(wall);- // Light spilling out of the lightbox (area light, lighting the tabletop and tea set)- const spill = new THREE.RectAreaLight(o.spillCol || '#ffc98a', o.spill ?? 6, w * .9, h * .9); spill.position.set(0, 0, front + .002); spill.lookAt(0, -.05, 1); g.add(spill);- const fill = new THREE.HemisphereLight('#3a3040', '#140c06', .25); g.add(fill);- // Tea set (Poly Haven CC0) + a plate of real mooncakes- const gl = await new GLTFLoader().loadAsync('/core/assets/polyhaven/tea_set_01/tea_set_01.gltf');- const pick = n => gl.scene.getObjectByName(n);- const props = new THREE.Group(); g.add(props);- const place = (n, x, z, ry = 0) => { const m = pick(n); if (!m) return; m.position.set(x, -H / 2, z); m.rotation.set(0, ry, 0); m.traverse(c => { if (c.isMesh) { c.castShadow = c.receiveShadow = true; } }); props.add(m); return m; };- place('tea_set_01_teapot_01', .5, .02, -.6); place('tea_set_01_cup_small_01', .38, .17, .3); place('tea_set_01_saucer_circular_03', .38, .17);- const plate = place('tea_set_01_plate_large_circular_03', -.42, .14);- const face = (kind) => paint(.08, .08, x => cakeFace(x, .036, kind, kind === 'bump' ? {} : { base: '#b8742c', hi: '#e9b25c', lo: '#6a3812' }), 3000);- const topMat = new THREE.MeshStandardMaterial({ map: tex(face('color')), bumpMap: tex(face('bump'), { linear: true }), bumpScale: 6, roughness: .45, metalness: .1, transparent: false, alphaTest: .5 });- const sideMat = new THREE.MeshStandardMaterial({ color: '#8a5220', roughness: .6 });- for (const [dx, dz, ry] of [[-.02, -.01, .3], [.035, .03, 1.2]]) {- const c = new THREE.Group();- const top = new THREE.Mesh(new THREE.PlaneGeometry(.08, .08), topMat); top.rotation.x = -Math.PI / 2; top.position.y = .026; c.add(top);- const cyl = new THREE.Mesh(new THREE.CylinderGeometry(.0345, .036, .025, 48), sideMat); cyl.position.y = .0128; c.add(cyl);- c.traverse(m => { if (m.isMesh) m.castShadow = m.receiveShadow = true; });- c.position.set(-.42 + dx, -H / 2 + .012, .14 + dz); c.rotation.y = ry; props.add(c);- }- return { g, frame, spill, table, props };-}diff --git a/styles/paper-lantern/demo/src/shots.js b/styles/paper-lantern/demo/src/shots.jsnew file mode 100644index 0000000..efea3ed--- /dev/null+++ b/styles/paper-lantern/demo/src/shots.js@@ -0,0 +1,321 @@+// The Last Night Train — shots 2–6. Each build(E) → { S, update(t), post(), grade() }, t = film seconds.+// Every shot has its own colour ladder, its own camera move; the train is the same paper train in all of them.+import * as THREE from 'three';+import { sheet, skyPanel, moon, setMoon, text } from './paper.js';+import { stage, aim } from './stage.js';+import { mulberry, lerp, clamp, TAU, ss, seg, eio, eo, ei, back } from './lib.js';+import { PAPER, BASE, tint, cut, peaks, firs, car } from './world.js';++const L = .043, HC = .015, NCAR = 8;+const SERIF = '"Cormorant"';++export function glowDisc(r, col = '#ffd590') {+ const m = new THREE.Mesh(new THREE.PlaneGeometry(r * 2, r * 2), new THREE.ShaderMaterial({ uniforms: { col: { value: new THREE.Color(col) }, k: { value: 0 } }, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,+ vertexShader: 'varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.); }',+ fragmentShader: 'varying vec2 vUv; uniform vec3 col; uniform float k; void main(){ float r = length(vUv - .5) * 2.; gl_FragColor = vec4(col * k * (pow(max(0., 1. - r), 3.) * .9 + pow(max(0., 1. - r * 4.), 2.) * .8), 1.); }' }));+ m.renderOrder = 12; m.userData.set = k => { m.material.uniforms.k.value = k; }; return m;+}+// the paper train: engine + 7 carriages; set(xHead, yOf, lit[i] 0..1)+export function train(S, U, z, scale = 1, col = '#151d3c') {+ const Ls = L * scale, Hs = HC * scale, cars = [];+ for (let i = 0; i < NCAR; i++) {+ const loco = i === 0;+ const m = S.add(sheet({ U, w: Ls * 1.5, h: Hs * 1.4, ay: -Hs * .5, z, trans: .12, glow: 2.6, glowCol: '#ffc46a', ppm: 9000 / scale * 1.2, glowRes: 1,+ draw: x => { x.fillStyle = PAPER; x.translate(0, -Hs * .5); car(x, null, Ls, Hs, loco); }, glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-1, -1, 2, 2); g.translate(0, -Hs * .5); car(null, g, Ls, Hs, loco); } }));+ tint(m, col); cars.push(m);+ }+ const head = S.add(glowDisc(.025 * scale));+ return {+ cars, head, L: Ls,+ set(xh, yOf, lit, headK = 1, bob = 0) {+ for (let i = 0; i < NCAR; i++) {+ const xi = xh - i * (Ls + .0025 * scale) - (i ? Ls * .12 : 0), a = Math.atan2(yOf(xi + .001) - yOf(xi - .001), .002);+ cars[i].position.set(xi, yOf(xi) - .0022 * scale + bob * Math.abs(Math.sin(xi * 900)), z); cars[i].rotation.z = a;+ cars[i].material.userData.u.uGlowLit.value = typeof lit === 'function' ? lit(i) : lit;+ }+ const a = Math.atan2(yOf(xh + .001) - yOf(xh - .001), .002);+ head.position.set(xh + Math.cos(a) * Ls * .68, yOf(xh) + .0055 * scale, z + .001); head.userData.set(headK);+ U.uBeamO.value.set(xh + Math.cos(a) * Ls * .7, yOf(xh) + .006 * scale, 1.3 * headK); U.uBeamD.value.set(a - .05, .1, .09 * scale);+ },+ };+}+export function fir(x, u, base, h) { const w = h * .32; x.beginPath(); x.moveTo(u, base + h);+ for (let k = 0; k < 4; k++) { const t1 = (k + 1) / 4; x.lineTo(u + w * (.35 + .65 * t1), base + h * (1 - t1)); x.lineTo(u + w * .3 * (1 - t1) + w * .12, base + h * (1 - t1) + h * .04); }+ x.lineTo(u + h * .025, base - .01); x.lineTo(u - h * .025, base - .01);+ for (let k = 3; k >= 0; k--) { const t1 = (k + 1) / 4; x.lineTo(u - w * .3 * (1 - t1) - w * .12, base + h * (1 - t1) + h * .04); x.lineTo(u - w * (.35 + .65 * t1), base + h * (1 - t1)); }+ x.closePath(); x.fill(); }+const sky = (S, z, stops, stars = 260) => S.add(skyPanel({ w: 1.0, h: .5, z, stops, stars, starMinY: -.02 }));+export function band(x, x0, x1, f, bottom = -.3) { x.beginPath(); x.moveTo(x0, bottom); for (let u = x0; u <= x1 + .001; u += .002) x.lineTo(u, f(u)); x.lineTo(x1, bottom); x.closePath(); x.fill(); }+export function haltSign(U, name, x, y, z) { // a small name board on two posts, cream paper with dark letters+ return sheet({ U, w: .034, h: .02, x, y, z, trans: .3, shadow: false, ppm: 16000, finish: { rim: 0, under: 0 }, draw: c => {+ c.fillStyle = '#0e1532'; c.fillRect(-.012, -.01, .0012, .012); c.fillRect(.0108, -.01, .0012, .012);+ c.fillStyle = '#d8c8a0'; c.fillRect(-.015, .0, .03, .0075); text(c, name, 0, .0037, .0042, SERIF, { fill: '#1a1a2a', weight: 700 }); } });+}+export function lampPost(U, x, y, z, h = .036) { // a lamp post; its lantern glows+ return sheet({ U, w: .02, h: h + .01, x, y: y + h / 2, z, trans: .06, glow: 2.4, glowCol: '#ffc070', ppm: 12000, draw: c => { c.fillStyle = PAPER; c.translate(0, -h / 2);+ c.fillRect(-.0009, 0, .0018, h); c.fillRect(-.004, h - .001, .008, .0016); c.beginPath(); c.moveTo(-.0028, h - .0015); c.lineTo(.0028, h - .0015); c.lineTo(.0022, h - .0075); c.lineTo(-.0022, h - .0075); c.closePath(); c.fill();+ c.save(); c.fillStyle = '#c8a070'; c.fillRect(-.0016, h - .0072, .0032, .0046); c.restore(); },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.01, -.5, .02, 1); g.translate(0, -h / 2); g.fillStyle = '#fff'; g.fillRect(-.0016, h - .0072, .0032, .0046); } });+}++// ——————————————— S2 · alongside the train through the snowy forest: pines rush past in front, halts with lit houses on the slope ———————————————+const S2Y = x => -.006 + .012 * Math.sin(x * 2.6 - .4); // the line rises and falls gently through the forest+export function s2(E) {+ const H = E.H;+ const S = stage({ light: [0, .03, -.1], lightR: .12, lightCol: '#b8c8f0', key: 1.0, keyCol: '#c8d4ff', amb: .2, ambCol: '#5a6ca8', floor: .32, keyPos: [-.05, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ const skyM = sky(S, -.142, [[0, '#060b22'], [.45, '#0c1838'], [.8, '#192a54'], [1, '#283a6a']]);+ const W = 3.2, CX = W / 2 - .4;+ const far = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.128, trans: .85, ppm: 1800, draw: x => { x.fillStyle = PAPER; const R = mulberry(3), list = []; for (let u = -1.6; u < 1.6; u += .07 + R() * .05) list.push([u, .06 + R() * .07, .05 + R() * .03]); peaks(x, { x0: -1.6, x1: 1.6, base: .01, seed: 7, list }); } }));+ const ridge = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.112, trans: .5, ppm: 2400, draw: x => { x.fillStyle = PAPER; firs(x, { x0: -1.6, x1: 1.6, base: .0, h: .026, gap: .007, seed: 4, roll: .012 }); } }));+ // the snow slope behind the line, with a small lit house at every halt+ const HALTS = [[.42, 'ELM HALT'], [.8, 'STONE HALT'], [1.18, 'MILL HALT']];+ const slope = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.095, trans: .55, glow: 2.4, glowCol: '#ffbe68', ppm: 2600, glowRes: 1,+ draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.4, 2.8, u => S2Y(u) + .02 + .008 * Math.sin(u * 11));+ for (const [hx] of HALTS) { const by = S2Y(hx + .03) + .016; x.fillRect(hx + .01, by, .036, .02); x.beginPath(); x.moveTo(hx + .006, by + .02); x.lineTo(hx + .028, by + .033); x.lineTo(hx + .05, by + .02); x.closePath(); x.fill(); x.fillRect(hx + .036, by + .024, .004, .01);+ x.save(); x.fillStyle = '#c8a070'; x.fillRect(hx + .016, by + .005, .007, .008); x.fillRect(hx + .031, by + .005, .007, .008); x.restore(); } },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-1.6, -.2, 3.2, .4); g.translate(-CX, 0); g.fillStyle = '#fff'; for (const [hx] of HALTS) { const by = S2Y(hx + .03) + .016; g.fillRect(hx + .016, by + .005, .007, .008); g.fillRect(hx + .031, by + .005, .007, .008); } } }));+ const embank = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.08, trans: .12, ppm: 2400, draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.4, 2.8, u => S2Y(u) - .004);+ cut(x, () => { x.lineWidth = .0006; for (let i = 0; i < 400; i++) { const u = -.4 + i * .008; x.beginPath(); x.moveTo(u, S2Y(u) - .0085); x.lineTo(u + .004, S2Y(u + .004) - .0085); x.stroke(); } }); } }));+ const halts = HALTS.map(([hx, name]) => { const lp = S.add(lampPost(U, hx, S2Y(hx) - .006, -.0772, .045)); const sg = S.add(haltSign(U, name, hx - .062, S2Y(hx - .062) - .028, -.0771)); const ln = S.add(glowDisc(.012, '#ffc878')); return { lp, sg, ln, hx }; });+ const near = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.06, trans: .45, ppm: 2400, draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.4, 2.8, u => -.06 + .01 * Math.sin(u * 7)); firs(x, { x0: -.4, x1: 2.8, base: -.06, h: .045, gap: .04, seed: 9, roll: .01 }); } }));+ // the foreground pines: tall, close to the lens, they sweep across the frame and sell the speed+ const fg = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.028, trans: .04, ppm: 2400, shadow: false, draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.4, 2.8, u => -.105 + .01 * Math.sin(u * 5));+ const R = mulberry(41); for (let u = -.3; u < 2.8; u += .07 + R() * .1) fir(x, u, -.1, .1 + R() * .07); } }));+ const snow = S.add(sheet({ U, w: .6, h: .36, z: -.015, trans: .3, shadow: false, recv: false, ppm: 3000, finish: { grain: false, rim: 0, under: 0 }, draw: x => { x.fillStyle = PAPER; const R = mulberry(19); for (let i = 0; i < 180; i++) { x.beginPath(); x.arc((R() - .5) * .6, (R() - .5) * .36, .0005 + R() * .0009, 0, TAU); x.fill(); } } }));+ const tr = train(S, U, -.0785);+ tint(far, '#62769f'); tint(ridge, '#2c4070'); tint(slope, '#44588e'); tint(embank, '#23315c'); tint(near, '#34467c'); tint(fg, '#050a1e'); tint(snow, '#c8d4ee', .9);+ halts.forEach(h => tint(h.lp, '#0c1330'));+ return {+ S,+ update(t) {+ const k = t - E.T0, v = .135;+ const xh = .12 + v * k;+ tr.set(xh, S2Y, 1, 1, .0003);+ for (const h of halts) { h.ln.position.set(h.hx, S2Y(h.hx) - .006 + .045 - .0048, -.0768); h.ln.userData.set(.45); }+ const cx = xh - .13, up = eio(seg(k, 0, 8.2)), cz = lerp(.3, .26, up);+ snow.position.set(cx + .04 + .02 * Math.sin(t), .18 - ((t * .014) % .36), -.015); skyM.position.x = cx;+ aim(S.cam, [cx, lerp(-.03, .05, up), cz, cx + .012, lerp(-.012, .004, up), -.08], t, { hand: .0007 });+ this._f = cz + .079;+ },+ post() { return { focus: this._f, aper: 14, maxCoc: 14, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { return { expo: 1.0, vig: .45, sat: 1.04, contrast: .12, lift: [0, .004, .02], gain: [1, 1, 1] }; },+ };+}++// ——————————————— S3 · the tunnel: the train is swallowed, light by light; then true dark ———————————————+export function s3(E) {+ const H = E.H;+ const S = stage({ light: [.1, .02, -.1], lightR: .12, lightCol: '#a8b8e8', key: .9, keyCol: '#c0ccf8', amb: .18, ambCol: '#4a5a98', floor: .28, keyPos: [-.05, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ sky(S, -.142, [[0, '#050a1e'], [.5, '#0b1636'], [1, '#1a2a56']], 200);+ const far = S.add(sheet({ U, w: .9, h: .36, z: -.126, trans: .8, ppm: 3000, draw: x => { x.fillStyle = PAPER; peaks(x, { x0: -.45, x1: .45, base: .0, seed: 11, list: [[-.3, .08, .07], [-.15, .11, .08], [.0, .07, .06], [.18, .1, .08], [.34, .07, .06]] }); } }));+ // the cliff face with the portal: a stone arch; inside is black paper (the dark of the tunnel)+ const PX = .13, PW = .05, PH = .045;+ const inside = S.add(sheet({ U, w: .12, h: .1, x: PX, y: .0, z: -.0805, trans: 0, draw: x => { x.fillStyle = '#020308'; x.fillRect(-.06, -.05, .12, .1); } }));+ const cliff = S.add(sheet({ U, w: .9, h: .36, z: -.077, trans: .25, ppm: 5000, draw: x => { x.fillStyle = PAPER;+ band(x, PX - .06, .45, u => .16 - .02 * Math.sin(u * 20), -.3); band(x, -.45, .45, () => -.009);+ cut(x, () => { x.beginPath(); x.moveTo(PX - PW / 2, -.006); x.lineTo(PX - PW / 2, PH - PW / 2 - .006); x.arc(PX, PH - PW / 2 - .006, PW / 2, Math.PI, 0, true); x.lineTo(PX + PW / 2, -.006); x.closePath(); x.fill();+ x.lineWidth = .0008; for (let i = 0; i < 9; i++) { const a = Math.PI * (i + .5) / 9; x.beginPath(); x.moveTo(PX + Math.cos(a) * (PW / 2 + .002), PH - PW / 2 - .006 + Math.sin(a) * (PW / 2 + .002)); x.lineTo(PX + Math.cos(a) * (PW / 2 + .009), PH - PW / 2 - .006 + Math.sin(a) * (PW / 2 + .009)); x.stroke(); }+ for (let r = 0; r < 14; r++) for (let c = 0; c < 6; c++) { const yy = .06 + r * .008, xx = PX - .05 + c * .022 + (r % 2) * .011; if (yy < .15) { x.beginPath(); x.moveTo(xx, yy); x.lineTo(xx + .015, yy); x.stroke(); } } }); } }));+ const tr = train(S, U, -.0785);+ const snowBank = S.add(sheet({ U, w: .9, h: .36, z: -.05, trans: .1, ppm: 3000, draw: x => { x.fillStyle = PAPER; firs(x, { x0: -.45, x1: PX - .07, base: -.07, h: .06, gap: .028, seed: 21, roll: .012 }); band(x, -.45, .45, u => -.06 + .006 * Math.sin(u * 12)); } }));+ tint(far, '#6a7cae'); tint(cliff, '#26335f'); tint(snowBank, '#0b1230');+ return {+ S,+ update(t) {+ // the train comes in from the left and runs into the portal; the cliff (in front) hides every carriage that has gone in+ const xh = lerp(-.12, .46, (t - E.T0) / (H.portal + .9 - E.T0));+ tr.set(xh, () => -.006, 1, 1, .0003);+ tr.cars.forEach(m => { m.visible = m.position.x < PX - .004; });+ if (xh > PX - .01) { tr.head.userData.set(0); U.uBeamO.value.z = 0; }+ // camera: a slow push toward the portal, the last light goes in, then the frame goes to black+ const k = eio(seg(t, E.T0, H.dark[0]));+ aim(S.cam, [lerp(.0, .1, k), lerp(.02, .01, k), lerp(.38, .24, k), lerp(.02, .12, k), lerp(.01, .012, k), -.08], t, { hand: .0006 });+ this._t = t;+ },+ post() { return { focus: S.cam.position.z + .079, aper: 12, maxCoc: 12, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { const t = this._t; return { expo: 1.0, vig: .5, sat: 1.04, contrast: .12, lift: [0, .004, .02], gain: [1, 1, 1], fade: 1 - ss(seg(t, H.portal, H.dark[0])) }; },+ };+}++// ——————————————— S4 · out of the tunnel: the river valley; the town on the hill behind the bridge lights its windows as the train passes ———————————————+export function s4(E) {+ const H = E.H;+ const S = stage({ light: [0, .03, -.1], lightR: .12, lightCol: '#a8d0d8', key: 1.0, keyCol: '#c8e4ee', amb: .22, ambCol: '#4a7a88', floor: .3, keyPos: [-.05, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ const skyM = sky(S, -.142, [[0, '#04131c'], [.45, '#0a2330'], [.8, '#163a48'], [1, '#235060']], 240);+ const mn = S.add(moon({ x: .0, y: .078, z: -.138, r: .009, gain: 1.4, halo: 5, haloGain: .15 })); setMoon(mn, 1);+ const W = 1.8, CX = .35;+ const hills = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.128, trans: .85, ppm: 2400, draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.6, 1.3, u => .05 + .02 * Math.sin(u * 7 + 1) + .012 * Math.sin(u * 19)); } }));+ // the town on its hill: houses climb the slope above the bridge, each with one or two windows+ const HILL = u => .012 + .022 * Math.sin(u * 4.1 + .6) + .01 * Math.sin(u * 9);+ const WINS = [];+ { const R = mulberry(31); for (let hx = -.5; hx < 1.2; hx += .026 + R() * .022) { const w = .016 + R() * .008, h = .012 + R() * .01, by = HILL(hx) - .004 + (R() - .5) * .006; WINS.push({ hx, w, h, by, wins: [[hx - w * .2, by + h * .4], ...(R() < .5 ? [[hx + w * .22, by + h * .4]] : [])] }); } }+ const town = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.11, trans: .35, glow: 2.4, glowCol: '#ffbe68', ppm: 3200, glowRes: 1,+ draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.6, 1.3, u => HILL(u) - .002);+ for (const hh of WINS) { x.fillRect(hh.hx - hh.w / 2, hh.by, hh.w, hh.h); x.beginPath(); x.moveTo(hh.hx - hh.w * .62, hh.by + hh.h); x.lineTo(hh.hx, hh.by + hh.h + hh.w * .5); x.lineTo(hh.hx + hh.w * .62, hh.by + hh.h); x.closePath(); x.fill();+ x.save(); x.fillStyle = '#c8a070'; for (const [wx, wy] of hh.wins) x.fillRect(wx - .0018, wy, .0036, .0042); x.restore(); } },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.9, -.2, 1.8, .4); g.translate(-CX, 0); g.fillStyle = '#fff'; for (const hh of WINS) for (const [wx, wy] of hh.wins) g.fillRect(wx - .0018, wy, .0036, .0042); } }));+ // the river: flat water with small cut ripples, and warm paper flakes for the reflections (they appear under each lit window)+ const river = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.098, trans: .35, ppm: 3000, draw: x => { x.fillStyle = PAPER; x.translate(-CX, 0); band(x, -.6, 1.3, () => -.012);+ cut(x, () => { x.lineWidth = .0005; const R = mulberry(5); for (let i = 0; i < 300; i++) { const u = -.6 + R() * 1.9, y = -.016 - R() * .07; x.beginPath(); x.arc(u, y, .008, Math.PI * 1.2, Math.PI * 1.8); x.stroke(); } }); } }));+ const flakes = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.0965, trans: .3, glow: 2.0, glowCol: '#ffc878', ppm: 3000, shadow: false, recv: false, glowRes: 1,+ draw: x => { x.fillStyle = '#c8a070'; x.translate(-CX, 0); const R = mulberry(8); for (const hh of WINS) for (const [wx] of hh.wins) for (let k = 0; k < 3; k++) { const fx = wx + (R() - .5) * .004, fy = -.03 - k * .012 - R() * .006, w = .003 + R() * .003; x.beginPath(); x.moveTo(fx - w, fy); x.lineTo(fx - w * .3, fy + .0012); x.lineTo(fx + w, fy + .0004); x.lineTo(fx + w * .4, fy - .001); x.closePath(); x.fill(); } },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.9, -.2, 1.8, .4); g.fillStyle = '#fff'; g.translate(-CX, 0); const R = mulberry(8); for (const hh of WINS) for (const [wx] of hh.wins) for (let k = 0; k < 3; k++) { const fx = wx + (R() - .5) * .004, fy = -.03 - k * .012 - R() * .006, w = .003 + R() * .003; g.beginPath(); g.moveTo(fx - w, fy); g.lineTo(fx - w * .3, fy + .0012); g.lineTo(fx + w, fy + .0004); g.lineTo(fx + w * .4, fy - .001); g.closePath(); g.fill(); } } }));+ // a low bridge: deck and piers only (no truss in front of the town), the train above the water+ const BY = -.008;+ const bridge = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.08, trans: .1, ppm: 5000, draw: x => { x.fillStyle = PAPER; x.strokeStyle = PAPER; x.translate(-CX, 0);+ x.fillRect(-.6, BY - .007, 1.9, .005); x.lineWidth = .0007; x.beginPath(); for (let u = -.6; u < 1.3; u += .012) { x.moveTo(u, BY - .002); x.lineTo(u, BY - .007); } x.stroke();+ for (let u = -.55; u < 1.3; u += .16) { x.fillRect(u - .005, -.2, .01, .2 + BY - .007); x.beginPath(); x.ellipse(u + .08, BY - .02, .07, .012, 0, Math.PI, 0, true); x.lineTo(u + .15, BY - .007); x.lineTo(u + .01, BY - .007); x.closePath(); x.fill(); } } }));+ const tr = train(S, U, -.0785);+ const reeds = S.add(sheet({ U, w: W, h: .4, x: CX, z: -.04, trans: .06, ppm: 2400, draw: x => { x.fillStyle = PAPER; x.strokeStyle = PAPER; x.translate(-CX, 0); band(x, -.6, 1.3, u => -.1 + .006 * Math.sin(u * 9));+ x.lineCap = 'round'; const R = mulberry(4); for (let i = 0; i < 300; i++) { const u = -.6 + R() * 1.9, h = .015 + R() * .035; x.lineWidth = .0012; x.beginPath(); x.moveTo(u, -.1); x.quadraticCurveTo(u + .004, -.1 + h * .6, u + .008 * (R() - .3), -.1 + h); x.stroke(); } } }));+ tint(hills, '#5f8c94'); tint(town, '#2c5260'); tint(river, '#163440'); tint(bridge, '#0e2028'); tint(reeds, '#06141a'); tr.cars.forEach(m => tint(m, '#0f1d26'));+ const flash = S.add(glowDisc(.035, '#ffe6b0'));+ return {+ S,+ update(t) {+ const k = t - E.T0, xh = -.15 + .12 * k;+ tr.set(xh, () => BY, 1, 1, .0003);+ // the town's windows come on behind the train: lit where x < (train tail + a little), dark ahead+ const front = xh - .14;+ town.material.userData.u.uGR.value.set(front - 2, .0, 2, 1);+ flakes.material.userData.u.uGR.value.set(front - 2, -.05, 2, 1);+ flakes.position.x = CX + .0015 * Math.sin(t * 1.3); flakes.position.y = .0006 * Math.sin(t * 2.1);+ flash.position.set(-.15, .0, -.079); flash.userData.set(.6 * Math.exp(-k * 4));+ const cx = xh - .07, cz = lerp(.37, .33, eio(seg(k, 0, 8.5))), cy = lerp(.0, .016, eio(seg(k, 0, 8.5)));+ skyM.position.x = cx; mn.position.set(cx + .06, cy + .072, -.138);+ aim(S.cam, [cx, cy, cz, cx + .03, cy - .006, -.09], t, { hand: .0006 });+ this._f = cz + .079; this._k = k;+ },+ post() { return { focus: this._f, aper: 12, maxCoc: 12, bloom: { strength: .32, radius: .5, threshold: 1.1 } }; },+ grade() { return { expo: 1.0 + .2 * Math.exp(-this._k * 4), vig: .45, sat: 1.04, contrast: .12, lift: [0, .008, .014], gain: [1, 1, 1] }; },+ };+}++// ——————————————— S5 · the sea cliffs: crane down past thin clouds to the train on the curve of the cliff edge ———————————————+export function s5(E) {+ const H = E.H;+ const S = stage({ light: [.0, .02, -.1], lightR: .15, lightCol: '#b0b0e8', key: 1.0, keyCol: '#d0d0ff', amb: .2, ambCol: '#5a5aa0', floor: .3, keyPos: [-.05, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ sky(S, -.142, [[0, '#070a26'], [.5, '#151a48'], [.8, '#2c2c66'], [.92, '#5a4a7a'], [1, '#7a6488']], 300);+ const clouds = S.add(sheet({ U, w: .9, h: .36, z: -.136, trans: .9, ppm: 2400, shadow: false, draw: x => { x.fillStyle = PAPER; const R = mulberry(12);+ for (let i = 0; i < 6; i++) { const cx = -.4 + i * .16 + R() * .05, cy = .05 + R() * .08, w = .08 + R() * .07; x.beginPath(); x.ellipse(cx, cy, w, .004 + R() * .003, 0, 0, TAU); x.fill(); x.beginPath(); x.ellipse(cx + w * .3, cy + .003, w * .5, .003, 0, 0, TAU); x.fill(); } } }));+ const HZ = .035;+ // a far headland with one small light, then three seas: far waves small, near waves big+ const head = S.add(sheet({ U, w: .9, h: .36, z: -.125, trans: .6, glow: 2.2, glowCol: '#ffc878', ppm: 3000, draw: x => { x.fillStyle = PAPER; band(x, .12, .45, u => HZ + .018 * Math.min(1, (u - .12) / .08) + .004 * Math.sin(u * 40)); x.save(); x.fillStyle = '#c8a070'; x.fillRect(.25, HZ + .019, .0025, .0025); x.restore(); },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.45, -.18, .9, .36); g.fillStyle = '#fff'; g.fillRect(.25, HZ + .019, .0025, .0025); } }));+ const sea = [0, 1, 2].map(i => S.add(sheet({ U, w: .9, h: .36, z: -.12 + i * .012, trans: .7 - i * .2, ppm: 3000, draw: x => { x.fillStyle = PAPER; const A = [.0015, .003, .006][i], F = [70, 40, 22][i], Y = HZ - [0, .016, .036][i];+ band(x, -.45, .45, u => Y + A * Math.sin(u * F + i * 2) + A * .5 * Math.sin(u * F * 2.3 + i));+ cut(x, () => { x.lineWidth = [.0005, .0008, .0012][i]; const R = mulberry(i + 3), r = [.004, .008, .014][i]; for (let k = 0; k < [160, 90, 50][i]; k++) { const u = -.45 + R() * .9, y = Y - .004 - R() * .02 * (i + 1); x.beginPath(); x.arc(u, y, r, Math.PI * 1.15, Math.PI * 1.85); x.stroke(); } }); } })));+ const YC = u => -.02 + .03 * Math.cos((u - .02) * 3.2); // the cliff edge: the line arcs over a headland+ const cliff = S.add(sheet({ U, w: .9, h: .36, z: -.077, trans: .2, ppm: 4000, draw: x => { x.fillStyle = PAPER; band(x, -.45, .45, u => YC(u) - .004);+ cut(x, () => { x.lineWidth = .0006; for (let i = 0; i < 6; i++) { x.beginPath(); for (let u = -.45; u <= .45; u += .01) { const y = YC(u) - .02 - i * .015 - .004 * Math.sin(u * 30 + i); u > -.45 ? x.lineTo(u, y) : x.moveTo(u, y); } x.stroke(); } }); } }));+ const tr = train(S, U, -.0785);+ // the foreground: a dark rock headland on the left and grass on the cliff top, close to the lens+ const rocks = S.add(sheet({ U, w: .9, h: .36, z: -.035, trans: .04, ppm: 3000, shadow: false, draw: x => { x.fillStyle = PAPER;+ x.beginPath(); x.moveTo(-.45, -.18); x.lineTo(-.45, .02); x.lineTo(-.38, .028); x.lineTo(-.31, .01); x.lineTo(-.27, -.02); x.lineTo(-.22, -.06); x.lineTo(-.17, -.09); x.lineTo(-.1, -.11); x.lineTo(.45, -.115); x.lineTo(.45, -.18); x.closePath(); x.fill();+ x.lineCap = 'round'; x.strokeStyle = PAPER; const R = mulberry(6); for (let i = 0; i < 120; i++) { const u = -.1 + R() * .55, h = .006 + R() * .014; x.lineWidth = .0012; x.beginPath(); x.moveTo(u, -.113); x.lineTo(u + .004 * (R() - .5), -.113 + h); x.stroke(); } } }));+ tint(clouds, '#6a5c8e', .8); tint(head, '#3a3a76'); sea.forEach((m, i) => tint(m, ['#7272b0', '#4c4c8e', '#2e2e68'][i])); tint(cliff, '#262a58'); tint(rocks, '#04061a'); tr.cars.forEach(m => tint(m, '#11142e'));+ return {+ S,+ update(t) {+ const k = t - E.T0, xh = -.2 + .085 * k - .004 * k * k; // slowing down+ tr.set(xh, YC, 1, 1, .0003);+ sea.forEach((m, i) => { m.position.x = .004 * Math.sin(t * (.6 + i * .2) + i) * (i + 1); });+ clouds.position.x = .002 * k;+ head.material.userData.u.uGlowLit.value = .6 + .4 * (Math.sin(t * 2.2) > .7 ? 1 : 0);+ const c = eio(seg(k, 0, 4.4));+ aim(S.cam, [lerp(-.03, .0, c), lerp(.06, .002, c), lerp(.38, .32, c), lerp(-.03, .01, c), lerp(.07, -.004, c), -.09], t, { hand: .0006 });+ this._f = S.cam.position.z + .079;+ },+ post() { return { focus: this._f, aper: 12, maxCoc: 12, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { return { expo: 1.0, vig: .45, sat: 1.04, contrast: .12, lift: [.006, .002, .02], gain: [1, 1, 1] }; },+ };+}++// ——————————————— S6 · the terminus by the sea: close along the carriages as the windows go out, the last one holds a beat; then only the station light ———————————————+export function s6(E) {+ const H = E.H;+ const LX = .235, LY = -.012; // the station lamp on the platform, right of the engine+ const S = stage({ light: [LX, LY + .05, -.076], lightR: .07, lightCol: '#ffbe70', key: .9, keyCol: '#c8c8ff', amb: .22, ambCol: '#5a5aa0', floor: .1, keyPos: [-.08, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ sky(S, -.142, [[0, '#080b2a'], [.5, '#181e52'], [.78, '#33336e'], [.9, '#6a5684'], [1, '#9a7890']], 260);+ const hills = S.add(sheet({ U, w: .9, h: .36, z: -.13, trans: .7, ppm: 2400, draw: x => { x.fillStyle = PAPER; band(x, -.45, .45, u => .028 + .012 * Math.sin(u * 6 + 1) + .006 * Math.sin(u * 17)); } }));+ const sea = S.add(sheet({ U, w: .9, h: .36, z: -.12, trans: .7, ppm: 3000, draw: x => { x.fillStyle = PAPER; band(x, -.45, .45, u => .022 + .0012 * Math.sin(u * 70)); cut(x, () => { x.lineWidth = .0006; const R = mulberry(9); for (let k = 0; k < 160; k++) { const u = -.45 + R() * .9, y = .016 - R() * .05; x.beginPath(); x.arc(u, y, .006, Math.PI * 1.15, Math.PI * 1.85); x.stroke(); } }); } }));+ // a low sea wall behind the track: it takes the train's shadow+ const BY = -.008, STOP = .15;+ const wall = S.add(sheet({ U, w: .9, h: .36, z: -.0835, trans: .2, ppm: 4000, draw: x => { x.fillStyle = PAPER; x.fillRect(-.45, -.2, .9, .2 + BY + .006); cut(x, () => { x.lineWidth = .0006; for (let r = 0; r < 8; r++) for (let c = 0; c < 40; c++) { const yy = BY - .003 - r * .007, xx = -.45 + c * .024 + (r % 2) * .012; x.beginPath(); x.moveTo(xx, yy); x.lineTo(xx + .02, yy); x.stroke(); } }); } }));+ const tr = train(S, U, -.0785);+ // the platform in front, the canopy over it (scalloped valance, posts), a railing, the name board under the canopy on the left+ const plat = S.add(sheet({ U, w: .9, h: .36, z: -.0735, trans: .12, ppm: 4500, draw: x => { x.fillStyle = PAPER; x.fillRect(-.45, -.2, .9, .2 + LY);+ cut(x, () => { x.fillRect(-.45, LY - .005, .9, .0012); x.lineWidth = .0005; for (let c = 0; c < 60; c++) { const xx = -.45 + c * .016; x.beginPath(); x.moveTo(xx, LY - .009); x.lineTo(xx, LY - .03); x.stroke(); } });+ for (let u = -.3; u <= .2; u += .1) x.fillRect(u - .0013, LY, .0026, .052); // canopy posts+ x.fillRect(-.33, LY + .052, .56, .006); // canopy beam+ x.beginPath(); x.moveTo(-.34, LY + .058); x.lineTo(-.02, LY + .074); x.lineTo(.24, LY + .058); x.closePath(); x.fill(); // roof+ for (let u = -.33; u < .23; u += .012) { x.beginPath(); x.arc(u + .006, LY + .052, .006, Math.PI, 0, true); x.fill(); } // scalloped valance+ x.fillRect(-.45, LY + .012, .9, .0012); for (let u = -.45; u < .45; u += .008) x.fillRect(u, LY, .0008, .012); // railing+ } }));+ const board = S.add(sheet({ U, w: .05, h: .03, x: -.2, y: LY + .036, z: -.0732, trans: .3, shadow: false, ppm: 14000, finish: { rim: 0, under: 0 }, draw: c => {+ c.fillStyle = '#0e1532'; c.fillRect(-.012, .006, .0008, .01); c.fillRect(.0112, .006, .0008, .01);+ c.fillStyle = '#d8c8a0'; c.fillRect(-.018, -.006, .036, .012); text(c, 'SEA END', 0, .0, .0062, SERIF, { fill: '#1a1a2a', weight: 700 }); } }));+ const lamp = S.add(lampPost(U, LX, LY, -.073, .05));+ const lampGlow = S.add(glowDisc(.02, '#ffc878'));+ const pool = S.add(glowDisc(.07, '#ffb860')); pool.scale.set(1, .22, 1);+ const front = S.add(sheet({ U, w: .9, h: .36, z: -.045, trans: .04, ppm: 3000, shadow: false, draw: x => { x.fillStyle = PAPER; band(x, -.45, .45, u => -.1 + .004 * Math.sin(u * 20)); x.fillRect(.3, -.2, .006, .17); x.fillRect(-.36, -.2, .006, .15); } }));+ // the end card: a paper ticket that drops from above on a thread. Main panel (left of the perforation): a small route line,+ // the title in English then Chinese, a rule, the style name, the credit; the stub carries only the red stamp.+ const TW = .15, TH = .066, PERF = TW / 2 - .034, MX = (-TW / 2 + PERF) / 2;+ const ticket = S.add(sheet({ U, w: TW, h: TH + .2, ax: 0, ay: .1 + TH / 2, z: -.0715, trans: .45, shadow: false, recv: false, ppm: 14000, finish: { rim: .4, under: .15 }, draw: c => {+ c.save(); c.translate(0, -.1);+ c.fillStyle = '#5a4a3a'; c.fillRect(-.0004, TH / 2, .0008, .2);+ c.fillStyle = '#f2e0b6'; c.fillRect(-TW / 2, -TH / 2, TW, TH);+ c.strokeStyle = '#c9ae7e'; c.lineWidth = .0006; c.strokeRect(-TW / 2 + .003, -TH / 2 + .003, TW - .006, TH - .006);+ c.globalCompositeOperation = 'destination-out';+ for (const [sx, sy] of [[-1, -1], [-1, 1], [1, -1], [1, 1]]) { c.beginPath(); c.arc(sx * TW / 2, sy * TH / 2, .005, 0, TAU); c.fill(); }+ c.beginPath(); c.arc(-TW / 2 + .0085, TH / 2 - .011, .0026, 0, TAU); c.fill();+ for (let y = -TH / 2 + .004; y < TH / 2 - .003; y += .0042) { c.beginPath(); c.arc(PERF, y, .0007, 0, TAU); c.fill(); }+ c.globalCompositeOperation = 'source-over';+ const ink = '#22170f', soft = '#5a3e2a';+ const run = (str, font, size, weight) => { c.save(); c.setTransform(1, 0, 0, 1, 0, 0); c.font = `${weight} ${size * 1000}px ${font}`; const w = c.measureText(str).width * .001; c.restore(); return w; };+ text(c, 'FROM PINE HALT → TO SEA END', MX, .0235, .0036, SERIF, { fill: soft, weight: 600 });+ text(c, 'The Last Night Train', MX, .0125, .0098, SERIF, { fill: ink, weight: 700 });+ text(c, '末班夜车', MX, .0, .0066, '"NotoSerifSC"', { fill: ink, weight: 600 });+ c.fillStyle = '#b89a6a'; c.fillRect(MX - .03, -.0072, .06, .0005);+ { const a = '纸雕灯影', b = 'Paper-cut Lightbox', sa = .0042, sb = .0046, gap = .003, wa = run(a, '"NotoSerifSC"', sa, 500), wb = run(b, SERIF, sb, 600), x0 = MX - (wa + gap + wb) / 2;+ text(c, a, x0, -.0125, sa, '"NotoSerifSC"', { fill: soft, weight: 500, align: 'left' }); text(c, b, x0 + wa + gap, -.0125, sb, SERIF, { fill: soft, weight: 600, align: 'left' }); }+ text(c, 'LemoLab × Claude Opus 5.5', MX, -.0228, .0062, SERIF, { fill: ink, weight: 700 });+ c.save(); c.translate((PERF + TW / 2) / 2, 0); c.rotate(-.22); c.strokeStyle = '#b3302a'; c.lineWidth = .0013; c.beginPath(); c.arc(0, 0, .0105, 0, TAU); c.stroke();+ c.lineWidth = .0006; c.beginPath(); c.arc(0, 0, .0085, 0, TAU); c.stroke();+ text(c, '车', 0, .0006, .0092, '"NotoSerifSC"', { fill: '#b3302a', weight: 700 }); c.restore();+ c.restore(); } }));+ ticket.material.color.setScalar(1.18);+ tint(hills, '#5a5088'); tint(sea, '#6a6aaa'); tint(wall, '#2e3266'); tint(plat, '#151a40'); tint(lamp, '#0c1030'); tint(front, '#04061a'); tr.cars.forEach(m => tint(m, '#10142e'));+ const carX = i => STOP - i * (L + .0025) - (i ? L * .12 : 0);+ return {+ S,+ update(t) {+ const k = clamp((t - E.T0) / (H.stop - E.T0)), xh = lerp(STOP - .065, STOP, 1 - (1 - k) * (1 - k));+ const lit = i => 1 - ss(seg(t, H.off[i], H.off[i] + .18));+ tr.set(xh, () => BY, lit, 1 - ss(seg(t, H.off[0] - .3, H.off[0])), t < H.stop ? .0003 : 0);+ const fl = 1 + .04 * Math.sin(t * 7.3) * Math.sin(t * 3.1);+ lampGlow.position.set(LX, LY + .05 - .0048, -.0726); lampGlow.userData.set(.55 * fl);+ pool.position.set(LX - .02, LY + .001, -.0728); pool.userData.set(.8 * fl);+ U.uLit.value = .9 * fl;+ // the ticket drops on its thread, overshoots and swings to rest+ const d = seg(t, H.card, H.card + 1.1), sw = Math.max(0, t - H.card - .7);+ ticket.visible = t > H.card;+ ticket.position.set(-.03, lerp(.46, .3, Math.min(1, back(d, 1.1))), -.0715); ticket.rotation.z = .06 * Math.exp(-sw * 1.6) * Math.sin(sw * 5.5);+ // camera: wide on the arrival → close along the carriages, following the windows going out → a beat on the last window → pull back to the lamp and the sea+ const iF = clamp((t - H.off[0]) / (H.off[6] - H.off[0]) * 6, 0, 6) + seg(t, H.off[6] + .2, H.off[7] - .2);+ const followX = lerp(carX(0), carX(7), iF / 7);+ const a = eio(seg(t, H.stop - .2, H.off[0] + .1)), b = eio(seg(t, H.off[7] + .4, 49.6));+ const p = [lerp(lerp(.06, followX + .02, a), .05, b), lerp(lerp(.006, .004, a), .014, b), lerp(lerp(.33, .2, a), .42, b), lerp(lerp(.06, followX, a), .05, b), lerp(lerp(.0, .002, a), .014, b), -.08];+ aim(S.cam, p, t, { hand: .0005 });+ this._f = p[2] + .079;+ },+ post() { return { focus: this._f, aper: 12, maxCoc: 12, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { return { expo: 1.0, vig: .45, sat: 1.04, contrast: .12, lift: [.006, .002, .02], gain: [1, 1, 1] }; },+ };+}diff --git a/styles/paper-lantern/demo/src/shots/index.js b/styles/paper-lantern/demo/src/shots/index.jsdeleted file mode 100644index f84c120..0000000--- a/styles/paper-lantern/demo/src/shots/index.js+++ /dev/null@@ -1,45 +0,0 @@-// Shot list: start is anchored to narration lines; in = entrance transition-import * as s01 from './s01_night.js';-import * as sheetShot from './sheet.js';-import * as s02 from './s02_kitchen.js';-import * as s03 from './s03_press.js';-import * as s04 from './s04_scroll.js';-import * as s05 from './s05_table.js';-import * as s06 from './s06_pack.js';-import * as s07 from './s07_journey.js';-import * as s08 from './s08_window.js';-import * as s09 from './s09_change.js';-import * as s10 from './s10_pass.js';-import * as s11 from './s11_city.js';-import * as s12 from './s12_apartment.js';-import * as s13 from './s13_note.js';-import * as s14 from './s14_bite.js';-import * as s15 from './s15_gran_open.js';-import * as s16 from './s16_mutual.js';-import * as s17 from './s17_sushi.js';-import * as s18 from './s18_finale.js';-export function SHOTS(C, DUR) {- const L = id => C[id].at;- if (location.search.includes('sheet')) return [{ id: 'SHEET', start: 0, build: sheetShot.build }];- return [- { id: 'S01', start: 0, build: E => s01.build({ ...E, titleIn: C.L02.end + .35 }) },- { id: 'S02', start: L('L03') - 1.2, in: { type: 'dissolve', dur: 1.2 }, build: s02.build },- { id: 'S03', start: L('L04') - .1, build: s03.build },- { id: 'S04', start: L('L06') - .5, in: { type: 'dissolve', dur: .9 }, build: s04.build },- { id: 'S05', start: L('L07') - .6, in: { type: 'dissolve', dur: .9 }, build: s05.build },- { id: 'S06', start: L('L09') - .3, in: { type: 'dissolve', dur: .6 }, build: s06.build },- { id: 'S07', start: L('L10') + .9, in: { type: 'dissolve', dur: 1.0 }, build: s07.build },- { id: 'S08', start: L('L12') - .3, in: { type: 'dissolve', dur: .7 }, build: s08.build },- { id: 'S09', start: L('L13') - .5, in: { type: 'dissolve', dur: 1.0 }, build: s09.build },- { id: 'S10', start: L('L14') - .4, in: { type: 'dissolve', dur: .7 }, build: s10.build },- { id: 'S11', start: L('L15') - .4, in: { type: 'dissolve', dur: .8 }, build: s11.build },- { id: 'S12', start: L('L16') - .3, in: { type: 'dissolve', dur: .7 }, build: s12.build },- { id: 'S13', start: L('L17') - .35, in: { type: 'dissolve', dur: .5 }, build: E => s13.build(E, 'gran') },- { id: 'S14', start: L('L18') - .7, in: { type: 'dissolve', dur: .6 }, build: s14.build },- { id: 'S15', start: L('L19') - .4, in: { type: 'dissolve', dur: .9 }, build: s15.build },- { id: 'S15b', start: L('L20') - .3, in: { type: 'dissolve', dur: .5 }, build: E => s13.build(E, 'girl') },- { id: 'S16', start: L('L21') - .5, in: { type: 'dissolve', dur: .9 }, build: s16.build },- { id: 'S17', start: L('L22') - .6, build: s17.build },- { id: 'S18', start: L('L24') - .6, in: { type: 'dissolve', dur: 1.0 }, build: s18.build },- ];-}diff --git a/styles/paper-lantern/demo/src/shots/s01_night.js b/styles/paper-lantern/demo/src/shots/s01_night.jsdeleted file mode 100644index 2357289..0000000--- a/styles/paper-lantern/demo/src/shots/s01_night.js+++ /dev/null@@ -1,109 +0,0 @@-// S1 · Mid-Autumn night (lights on → title): moon, auspicious clouds, mountain range, waterside village, osmanthus tree, lanterns-import { sheet, skyPanel, moon, setMoon, vtext, text } from '../paper.js';-import { karst, ridge, xiangyun, waves, waterTop, osmanthus, reeds, jiangnanHouse, pavilion, lantern, FONT } from '../art.js';-import { stage, aim } from '../stage.js';-import { lightbox, BOX } from '../room.js';-import { seg, ss, eio, lerp, clamp, mulberry } from '../lib.js';--export const MOON = [-.05, .05, -.125];--export async function build(E) {- const S = stage({ light: MOON, lightR: .15, lightCol: '#ffe2ae', key: 1.0, amb: .3, ambCol: '#7d90c8', keyCol: '#d6dcff', keyPos: [0, .155, .005], keyTarget: [0, -.06, -.1], keyAngle: 1.1 });- S.amb.intensity = 0;- const { U } = S;- const sky = S.add(skyPanel({ w: .56, h: .33, z: -.135, stops: [[0, '#0a1330'], [.45, '#172a58'], [.75, '#2e4478'], [1, '#43598a']], stars: 260, starMinY: -.02 }));- const mn = S.add(moon({ x: MOON[0], y: MOON[1], z: MOON[2], r: .04, gain: 1.75, halo: 4.2, haloGain: .3 }));-- const clouds = S.add(sheet({ U, w: .558, h: .328, z: -.112, trans: .9, finish: { rim: .5 }, draw: x => {- x.fillStyle = '#c3cbe8';- xiangyun(x, -.092, .02, .0105, 1, { tail: 3 });- xiangyun(x, .065, .1, .0075, -1, { tail: 2.4 });- xiangyun(x, .22, .035, .006, 1);- xiangyun(x, -.22, .1, .0065, 1);- } }));- const far = S.add(sheet({ U, w: .558, h: .328, z: -.098, trans: .7, draw: x => {- x.fillStyle = '#6a86c2';- karst(x, { x0: -.28, x1: .28, base: -.035, peaks: [[-.31, .05, .026], [-.25, .04, .022], [-.15, .068, .026], [-.07, .035, .018], [.05, .075, .03], [.12, .05, .022], [.22, .065, .026], [.31, .046, .026]], rough: .0005, carve: .0005 });- } }));- const mid = S.add(sheet({ U, w: .558, h: .328, z: -.08, trans: .45, draw: x => {- x.fillStyle = '#3f5a92';- karst(x, { x0: -.28, x1: .28, base: -.05, peaks: [[-.34, .045, .035], [-.22, .055, .03], [-.12, .032, .026], [.17, .052, .026], [.265, .068, .028], [.35, .04, .026]], rough: .0004, seed: 4, carve: .0006 });- ridge(x, { x0: -.28, x1: .28, base: -.056, amp: .005, seed: 9, freq: 30 });- } }));- const village = S.add(sheet({ U, w: .558, h: .328, z: -.062, trans: .25, glow: 2.2, glowCol: '#ffb862', draw: x => drawVillage(x, null), glowDraw: g => drawVillage(null, g) }));- const river = S.add(sheet({ U, w: .558, h: .328, z: -.046, trans: .3, glow: 1.2, glowCol: '#ffe0a6', draw: x => {- x.fillStyle = '#22325e'; waterTop(x, { x0: -.28, x1: .28, base: -.07, amp: .001, len: .05 });- x.save(); x.beginPath(); x.rect(-.28, -.2, .56, .126); x.clip();- waves(x, { x0: -.28, x1: .28, y0: -.076, y1: -.2, r: .006, fill: '#22325e', line: '#34487a', lw: .0006 });- x.restore();- moonTrail(x, '#e9cf96');- }, glowDraw: g => moonTrail(g, '#fff') }));- const tree = S.add(sheet({ U, w: .558, h: .328, z: -.03, trans: .12, glow: .55, glowCol: '#ffc766', draw: x => {- x.fillStyle = '#17224a'; osmanthus(x, { cx: -.215, by: -.115, h: .16, flowers: '#d9a24a', seed: 5, leaves: 80, nFlowers: 60 });- x.fillStyle = '#17224a'; bridge(x);- }, glowDraw: g => { g.fillStyle = '#000'; osmanthus(g, { cx: -.215, by: -.115, h: .16, flowers: '#fff', seed: 5, leaves: 80, nFlowers: 60 }); } }));- const fg = S.add(sheet({ U, w: .558, h: .328, z: -.014, trans: .05, draw: x => {- x.fillStyle = '#0e1532'; x.strokeStyle = '#0e1532';- ridge(x, { x0: -.28, x1: .28, base: -.112, amp: .006, seed: 3, freq: 14 });- reeds(x, { x0: .08, x1: .32, by: -.116, h: .05, n: 40, seed: 8 });- reeds(x, { x0: -.34, x1: -.14, by: -.116, h: .038, n: 26, seed: 12 });- } }));- const lant = S.add(sheet({ U, w: .2, h: .3, x: .19, y: .1, z: .004, trans: .05, glow: 1.25, glowCol: '#ff8a48', shadow: false, recv: false, ay: .13, draw: x => {- x.fillStyle = '#0d1328'; lantern(x, { cx: -.012, cy: -.02, r: .013, stringLen: .2 }); lantern(x, { cx: .022, cy: .012, r: .01, stringLen: .2 });- }, glowDraw: g => { const o = { col: '#000', rib: '#000', cap: '#000', string: false, tassel: false }; lantern(g, { ...o, cx: -.012, cy: -.02, r: .013 }, g); lantern(g, { ...o, cx: .022, cy: .012, r: .01 }, g); } }));- const title = S.add(sheet({ U, w: .1, h: .13, x: .128, y: .06, z: -.104, trans: .25, shadow: false, recv: false, finish: { rim: .6 }, draw: x => {- vtext(x, '一个月饼', .016, .045, .02, FONT.brush, { fill: '#f1dbac', gap: 1.02 });- vtext(x, '的相思', -.012, .025, .02, FONT.brush, { fill: '#f1dbac', gap: 1.02 });- x.fillStyle = '#b3302a'; x.fillRect(-.022, -.05, .015, .015);- vtext(x, '中秋', -.0145, -.0395, .0058, FONT.brush, { fill: '#f7e6c8', gap: 1.0 });- } }));-- const R = await lightbox(S, E, { spill: 7 });- const layers = [clouds, far, mid, village, river, tree, fg, lant];- const hide = new URLSearchParams(location.search).get('hide'); if (hide) for (const [k, v] of Object.entries({ clouds, far, mid, village, river, tree, fg, lant, title })) if (hide.split(',').includes(k)) v.visible = false;- return {- S,- update(t) {- const km = ss(seg(t, .5, 3.2)); setMoon(mn, km);- sky.material.color.setScalar(.03 + .97 * ss(seg(t, .8, 3.5)));- layers.forEach((m, i) => { const u = m.material.userData.u; m.userData.trans0 ??= u.uTrans.value; u.uTrans.value = m.userData.trans0 * ss(seg(t, 1.2 + i * .42, 3.6 + i * .42)); });- S.key.intensity = S.base.key * ss(seg(t, 3.4, 6.2)); S.amb.intensity = S.base.amb * ss(seg(t, 1.5, 4.5));- village.material.userData.u.uGlowLit.value = ss(seg(t, 5.2, 7.2)); river.material.userData.u.uGlowLit.value = km * (.85 + .15 * Math.sin(t * 2.1));- tree.material.userData.u.uGlowLit.value = ss(seg(t, 3.5, 6)); lant.material.userData.u.uGlowLit.value = ss(seg(t, 6, 8)) * (1 + .06 * Math.sin(t * 7.3) * Math.sin(t * 3.1));- const tk = ss(seg(t, E.titleIn, E.titleIn + 1.6)); title.visible = tk > 0;- title.position.y = .06 - .005 * (1 - tk); title.material.userData.u.uTrans.value = .25 * tk; title.material.color.setScalar(tk);- lant.rotation.z = .03 * Math.sin(t * .9) + .012 * Math.sin(t * 2.3);- clouds.position.x = t * .0005;- R.spill.intensity = 7 * ss(seg(t, .8, 4.5)) * (1 + .03 * Math.sin(t * 5.3));- // Camera: wide shot of the lightbox from inside the room → push into the frame → slow push- const a = eio(seg(t, 2.6, 9.6)), b = eio(seg(t, 9.6, E.dur + 1));- const z = lerp(lerp(1.3, .56, a), .5, b);- aim(S.cam, [lerp(.0, .005, a) - .01 * b, lerp(.12, -.004, a) + .008 * b, lerp(1.45, z, a > 0 ? 1 : 0) * 0 + (a > 0 ? z : lerp(1.45, 1.3, seg(t, 0, 2.6))), lerp(-.01, -.004, a) - .01 * b, lerp(-.04, .002, a) + .012 * b, -.07], t);- this._fz = lerp(.014, -.062, ss(seg(t, 6, 9)));- },- post() { return { focus: S.cam.position.z - (this._fz ?? -.062), aper: lerp(26, 14, ss(seg(0, 0, 1))), maxCoc: 14, bloom: { strength: .32, radius: .55, threshold: 1.25 } }; },- grade() { return { expo: 1.08, vig: .42, sat: 1.05, contrast: .1 }; },- };-- function drawVillage(x, g) {- const wall = '#5a70a6', tile = '#1b284f';- if (x) { x.fillStyle = tile; ridge(x, { x0: -.28, x1: .28, base: -.07, amp: .003, seed: 2, freq: 20 }); }- const houses = [[-.07, -.071, .038, .018], [-.02, -.07, .046, .02], [.034, -.068, .036, .024], [.083, -.071, .05, .019], [.138, -.067, .034, .023], [.185, -.071, .044, .019]];- houses.forEach(([cx, by, w, h], i) => {- const wins = i % 2 ? [[w * .16, h * .35, w * .14, h * .3], [w * .7, h * .35, w * .14, h * .3]] : [[w * .2, h * .35, w * .15, h * .3]];- jiangnanHouse(x, { cx, by, w, h, windows: wins, wall, tile }, g);- });- if (x) { x.fillStyle = tile; pavilion(x, { cx: .245, by: -.073, w: .026, h: .04 }); }- }- function moonTrail(x, col) {- const R = mulberry(21); x.fillStyle = col;- for (let i = 0; i < 40; i++) { const y = -.075 - i * .0022 - R() * .001, w = (.022 - i * .00035) * (.2 + R() * .9), c = MOON[0] * .9 + (R() - .5) * .01;- x.beginPath(); x.ellipse(c, y, w / 2, .00035 + R() * .0004, 0, 0, Math.PI * 2); x.fill(); }- }- function bridge(x) {- x.beginPath(); x.moveTo(.0, -.086); x.quadraticCurveTo(.07, -.05, .14, -.086); x.lineTo(.14, -.092); x.lineTo(0, -.092); x.closePath(); x.fill();- x.globalCompositeOperation = 'destination-out'; x.beginPath(); x.ellipse(.07, -.093, .03, .026, 0, 0, Math.PI); x.fill(); x.globalCompositeOperation = 'source-over';- for (let i = 0; i < 9; i++) { const u = (i + .5) / 9; x.fillRect(.012 + u * .116, -.08 + Math.sin(u * Math.PI) * .026 - .003, .0012, .007); }- x.lineWidth = .0009; x.strokeStyle = x.fillStyle; x.beginPath(); x.moveTo(.01, -.083); x.quadraticCurveTo(.07, -.043, .13, -.083); x.stroke();- }-}diff --git a/styles/paper-lantern/demo/src/shots/s02_kitchen.js b/styles/paper-lantern/demo/src/shots/s02_kitchen.jsdeleted file mode 100644index 64d371e..0000000--- a/styles/paper-lantern/demo/src/shots/s02_kitchen.js+++ /dev/null@@ -1,96 +0,0 @@-// S2 · Grandma's kitchen (“我是一块月饼,出生在外婆的厨房。” "I am a mooncake, born in Grandma's kitchen.")-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon } from '../paper.js';-import { osmanthus, lantern, mooncake, xiangyun, FONT } from '../art.js';-import { roundWindow, steamers, stove, jar, bowl, pendant, calendar, table, cut } from '../props.js';-import { grannyStand, arm, GRAN_SHOULDER } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp, clamp, mulberry, TAU } from '../lib.js';--export function kitchenSet(S, o = {}) {- const { U } = S;- const WIN = o.win || [.1, .052];- const sky = S.add(skyPanel({ w: .6, h: .36, z: -.14, stops: [[0, '#0d1838'], [1, '#2e4274']], stars: 60 }));- const mn = S.add(moon({ x: WIN[0] + .012, y: WIN[1] + .012, z: -.135, r: .018, gain: 1.9, halo: 3.5, haloGain: .35 }));- const branch = S.add(sheet({ U, w: .2, h: .16, x: WIN[0], y: WIN[1], z: -.125, trans: .3, glow: .5, glowCol: '#ffcf70', draw: x => { x.fillStyle = '#26345c'; osmanthus(x, { cx: .05, by: -.1, h: .1, flowers: '#d9a24a', seed: 3, leaves: 30, nFlowers: 25 }); }, glowDraw: g => { g.fillStyle = '#000'; osmanthus(g, { cx: .05, by: -.1, h: .1, flowers: '#fff', seed: 3, leaves: 30, nFlowers: 25 }); } }));- const wall = S.add(sheet({ U, w: .6, h: .36, z: -.112, trans: .9, draw: x => {- x.fillStyle = '#b08058'; x.fillRect(-.3, -.18, .6, .36);- x.fillStyle = '#9a5f2e'; for (let i = 0; i < 9; i++) x.fillRect(-.3, -.18 + i * .045, .6, .0012); // horizontal lines suggesting brick joints- x.fillStyle = '#5a321a'; roundWindow(x, WIN[0], WIN[1], .042, .0016, 'ice');- x.fillStyle = '#5a321a'; x.fillRect(-.3, .118, .6, .014); // roof beam- } }));- const deco = S.add(sheet({ U, w: .6, h: .36, z: -.1, trans: .25, glow: 0, draw: x => {- calendar(x, -.02, .06, .026, '#efe2c4', '#3a2014', '#b8322a');- x.fillStyle = '#4a2814'; // hanging strings of chillies and garlic- x.fillRect(-.075, .06, .0012, .06);- for (let i = 0; i < 9; i++) { x.fillStyle = i % 2 ? '#a3291f' : '#b8322a'; x.beginPath(); x.ellipse(-.075 + (i % 2 ? .004 : -.004), .052 - i * .0055, .0035, .0065, (i % 2 ? .5 : -.5), 0, TAU); x.fill(); }- x.fillStyle = '#e9dcc0'; for (let i = 0; i < 4; i++) { x.beginPath(); x.arc(-.058, .06 - i * .008, .0045, 0, TAU); x.fill(); }- x.fillStyle = '#4a2814'; x.fillRect(-.058, .06, .001, .06);- } }));- const back = S.add(sheet({ U, w: .6, h: .36, z: -.084, trans: .2, glow: 1.4, glowCol: '#ff9a40', draw: x => {- x.fillStyle = '#6e3b1f';- x.fillRect(-.27, .0, .1, .004); x.fillRect(-.27, .045, .1, .004); // shelf on the left- x.fillStyle = '#6e3b1f'; jar(x, -.25, .004, .022, .026); jar(x, -.225, .004, .016, .02); bowl(x, -.195, .004, .022, .01); bowl(x, -.195, .014, .02, .009);- jar(x, -.255, .049, .016, .022); jar(x, -.232, .049, .02, .028); x.fillRect(-.212, .049, .012, .03);- stove(x, .205, -.1, .11, .07, '#6e3b1f', '#ffb45a');- steamers(x, .205, -.022, .075, 3, '#8a5129', '#6e3b1f');- }, glowDraw: g => { g.fillStyle = '#fff'; g.beginPath(); g.moveTo(.205 - .11 * .14, -.1); g.lineTo(.205 - .11 * .14, -.1 + .07 * .3); g.arc(.205, -.1 + .07 * .3, .11 * .14, Math.PI, 0, true); g.lineTo(.205 + .11 * .14, -.1); g.fill(); } }));- // Steam- const steam = S.add(sheet({ U, w: .12, h: .16, x: .205, y: .09, z: -.08, trans: .9, shadow: false, recv: false, draw: x => {- x.strokeStyle = '#f3e3c8'; x.lineCap = 'round';- for (const [dx, ph, w] of [[-.015, 0, .006], [.008, 1.7, .0075], [.025, 3.1, .005]]) {- x.lineWidth = w; x.beginPath();- for (let i = 0; i <= 40; i++) { const u = i / 40, y = -.07 + u * .14, px = dx + .008 * Math.sin(u * 7 + ph) * u; i ? x.lineTo(px, y) : x.moveTo(px, y); }- x.stroke();- }- } }));- steam.material.transparent = true; steam.material.alphaToCoverage = false; steam.material.depthWrite = false;- const lamp = S.add(sheet({ U, w: .08, h: .1, x: -.02, y: .1, z: -.068, trans: .1, glow: 3.2, glowCol: '#ffc878', ay: .04, draw: x => pendant(x, 0, .02, .045, '#3a1d10'), glowDraw: g => pendant(g, 0, .02, .045, '#000', g) }));- return { sky, mn, branch, wall, deco, back, steam, lamp };-}--export function build(E) {- const LAMP = [-.02, .075, -.068];- const S = stage({ light: LAMP, lightR: .11, lightCol: '#ffcf96', key: 1.0, amb: .16, ambCol: '#c08a60', keyCol: '#ffd9ae', keyPos: [-.02, .3, .28] });- const { U } = S;- const K = kitchenSet(S);- // Grandma (standing behind the table, kneading dough)- const GX = -.085, GY = -.118, GS = .165;- const gran = S.add(sheet({ U, w: .12, h: .2, x: GX, y: GY + .08, z: -.056, trans: .08, draw: x => { x.fillStyle = '#2e170d'; x.translate(0, -.08); grannyStand(x, GS, { pin: '#2e170d' }); } }));- const shoulder = [GX + GRAN_SHOULDER[0] * GS, GY + GRAN_SHOULDER[1] * GS];- const armS = S.add(sheet({ U, w: .12, h: .12, x: shoulder[0], y: shoulder[1], z: -.0555, trans: .08, ax: 0, ay: 0, draw: x => { x.fillStyle = '#2e170d'; arm(x, GS, -.75, .85, { sleeve: 1.25, wrist: .2 }); } }));- const armF = S.add(sheet({ U, w: .12, h: .12, x: shoulder[0], y: shoulder[1], z: -.0505, trans: .08, draw: x => { x.fillStyle = '#3a1e12'; arm(x, GS, -.95, 1.15, { sleeve: 1.25, wrist: -.1 }); } }));- // Table + dough + bowl + rolling pin + a plate of finished mooncakes- const tbl = S.add(sheet({ U, w: .6, h: .3, z: -.04, trans: .08, draw: x => {- x.fillStyle = '#3a1c0e'; table(x, -.01, -.04, .3, .08, .01);- x.fillStyle = '#e8cf9d'; x.beginPath(); x.ellipse(-.02, -.033, .02, .008, 0, 0, TAU); x.fill(); // dough- x.fillStyle = '#3a1c0e'; bowl(x, .05, -.04, .036, .018); x.fillStyle = '#7a3a22'; x.beginPath(); x.ellipse(.05, -.023, .016, .003, 0, 0, TAU); x.fill();- x.fillStyle = '#6b4024'; x.beginPath(); x.roundRect(-.07, -.04, .05, .005, .0025); x.fill();- x.fillStyle = '#3a1c0e'; x.beginPath(); x.roundRect(.075, -.04, .07, .005, .002); x.fill(); // tray- } }));- const cakes = S.add(sheet({ U, w: .08, h: .03, x: .11, y: -.028, z: -.039, trans: 0, metal: .75, rough: .38, envMap: E.env, envI: .8, draw: x => {- for (let i = 0; i < 3; i++) { x.fillStyle = '#d19a45'; x.beginPath(); x.roundRect(-.03 + i * .021, -.008, .018, .012, .003); x.fill(); x.fillStyle = '#a86c28'; x.fillRect(-.03 + i * .021, -.004, .018, .0012); }- } }));- const fg = S.add(sheet({ U, w: .62, h: .38, z: -.014, trans: .04, draw: x => {- x.fillStyle = '#1a0c06';- x.fillRect(-.31, -.19, .6, .06); // foreground stove edge- x.fillRect(-.31, -.19, .045, .38); // door frame- x.beginPath(); x.moveTo(-.265, .19); x.quadraticCurveTo(-.24, .06, -.262, -.02); x.lineTo(-.265, -.02); x.fill(); // door curtain- jar(x, .22, -.13, .05, .06);- lantern(x, { cx: .23, cy: .11, r: .014, col: '#1a0c06', rib: '#1a0c06', cap: '#1a0c06', stringLen: .1 });- } }));- return {- S,- update(t) {- const k = Math.sin(t * 5.2); // kneading rhythm- armS.rotation.z = .1 * k; armF.rotation.z = -.1 * k;- K.steam.position.y = .09 + (t * .004) % .01; K.steam.material.opacity = .35 + .1 * Math.sin(t * 1.3);- K.lamp.rotation.z = .01 * Math.sin(t * .8);- K.lamp.material.userData.u.uGlowLit.value = 1 + .04 * Math.sin(t * 9.1) * Math.sin(t * 3.7);- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(.02, -.02, u), lerp(.0, -.012, u), lerp(.5, .38, u), lerp(.02, -.025, u), lerp(-.005, -.025, u), -.06], t);- },- post() { return { focus: S.cam.position.z + .056, aper: 16, maxCoc: 12, bloom: { strength: .4, radius: .6, threshold: 1.1 } }; },- grade() { return { expo: 1.02, vig: .45, sat: 1.02, contrast: .1, lift: [.012, .006, .0], gain: [1.02, 1., .96] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s03_press.js b/styles/paper-lantern/demo/src/shots/s03_press.jsdeleted file mode 100644index abfe30a..0000000--- a/styles/paper-lantern/demo/src/shots/s03_press.js+++ /dev/null@@ -1,129 +0,0 @@-// S3 · Top shot: knead the dough → wrap the filling → the wooden mould comes down with a “啪” (smack) → the character “圆” (round / reunion) is imprinted → baked golden-import * as THREE from 'three';-import { sheet, text } from '../paper.js';-import { FONT, leaf } from '../art.js';-import { arm } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, ei, lerp, clamp, mulberry, TAU, back } from '../lib.js';--// Mooncake top pattern: kind='color' | 'bump'; r radius; ch central character; wobble how hand-made and crooked it is-export function cakeFace(x, r, kind, o = {}) {- const B = kind === 'bump', R = mulberry(o.seed || 3), wob = o.wobble || 0;- const W = a => 1 + wob * (Math.sin(a * 3 + 1) * .5 + Math.sin(a * 5 + 2) * .3);- const petals = o.petals ?? 16;- const rim = a => r * W(a) * (1 - .055 * Math.pow(Math.abs(Math.cos(a * petals / 2)), .7));- const poly = f => { x.beginPath(); for (let i = 0; i <= 240; i++) { const a = i / 240 * TAU, rr = f(a); i ? x.lineTo(Math.cos(a) * rr, Math.sin(a) * rr) : x.moveTo(Math.cos(a) * rr, Math.sin(a) * rr); } x.closePath(); };- // Side wall / base colour- x.fillStyle = B ? '#9a9a9a' : (o.base || '#fff'); poly(rim); x.fill();- // Raised scalloped border at the outer rim- x.fillStyle = B ? '#e6e6e6' : (o.hi || '#fff'); poly(a => rim(a) * .97); x.fill();- x.fillStyle = B ? '#707070' : (o.lo || '#e2d2b8'); poly(a => r * .78 * W(a)); x.fill();- x.fillStyle = B ? '#b0b0b0' : (o.base || '#fff'); poly(a => r * .74 * W(a)); x.fill();- // Grooves between the petals- x.strokeStyle = B ? '#5a5a5a' : (o.lo || '#e2d2b8'); x.lineWidth = r * .03; x.lineCap = 'round';- for (let i = 0; i < petals; i++) { const a = (i + .5) / petals * TAU; x.beginPath(); x.moveTo(Math.cos(a) * r * .8, Math.sin(a) * r * .8); x.lineTo(Math.cos(a) * r * .93, Math.sin(a) * r * .93); x.stroke(); }- // Eight-petal scrolling-vine motif- for (let i = 0; i < 8; i++) {- const a = i / 8 * TAU + .2; x.save(); x.rotate(a);- x.fillStyle = B ? '#dcdcdc' : (o.hi || '#fff');- x.beginPath(); x.moveTo(r * .38, 0); x.quadraticCurveTo(r * .55, r * .16, r * .7, 0); x.quadraticCurveTo(r * .55, -r * .06, r * .38, 0); x.fill();- x.beginPath(); x.arc(r * .64, r * .07, r * .03, 0, TAU); x.fill();- x.restore();- }- // Bead border- x.fillStyle = B ? '#e0e0e0' : (o.hi || '#fff');- for (let i = 0; i < 40; i++) { const a = i / 40 * TAU; x.beginPath(); x.arc(Math.cos(a) * r * .34 * W(a), Math.sin(a) * r * .34 * W(a), r * .018, 0, TAU); x.fill(); }- // Centre: round frame + character- x.fillStyle = B ? '#606060' : (o.lo || '#e2d2b8'); x.beginPath(); x.arc(0, 0, r * .3, 0, TAU); x.fill();- x.fillStyle = B ? '#9c9c9c' : (o.base || '#fff'); x.beginPath(); x.arc(0, 0, r * .27, 0, TAU); x.fill();- const ch = o.ch ?? '圆';- if (ch.length === 1) text(x, ch, 0, -r * .01, r * .4, o.font || FONT.brush, { fill: B ? '#f4f4f4' : (o.hi || '#fff'), rot: o.chRot || 0 });- else { text(x, ch[0], 0, r * .1, r * .2, o.font || FONT.hand, { fill: B ? '#f4f4f4' : (o.hi || '#fff'), rot: .08 }); text(x, ch[1], r * .01, -r * .11, r * .2, o.font || FONT.hand, { fill: B ? '#f4f4f4' : (o.hi || '#fff'), rot: -.1 }); }-}--export function build(E) {- const S = stage({ light: [0, 0, -.06], lightR: .2, lightCol: '#ffd9a8', key: 1.5, amb: .28, ambCol: '#d0a070', keyCol: '#ffe2bc', keyPos: [-.12, .22, .32], keyTarget: [0, 0, -.06], shadowR: 8 });- const { U } = S;- const R = mulberry(4);- // Board: wood grain + flour + scattered osmanthus, bowl, rolling pin- S.add(sheet({ U, w: .56, h: .34, z: -.06, trans: .15, draw: x => {- x.fillStyle = '#b07a48'; x.fillRect(-.28, -.17, .56, .34);- for (let i = 0; i < 90; i++) { const y = -.17 + R() * .34; x.strokeStyle = `rgba(${R() < .5 ? '90,50,24' : '214,160,105'},${.15 + R() * .25})`; x.lineWidth = .0004 + R() * .0012; x.beginPath(); x.moveTo(-.28, y); for (let k = 0; k <= 20; k++) x.lineTo(-.28 + k * .028, y + Math.sin(k * .7 + i) * .0015 + (R() - .5) * .0006); x.stroke(); }- for (let i = 0; i < 26; i++) { const px = (R() - .5) * .3, py = (R() - .5) * .2, rr = .01 + R() * .03, g = x.createRadialGradient(px, py, 0, px, py, rr); g.addColorStop(0, 'rgba(250,244,230,.55)'); g.addColorStop(1, 'rgba(250,244,230,0)'); x.fillStyle = g; x.fillRect(px - rr, py - rr, rr * 2, rr * 2); }- x.fillStyle = 'rgba(252,248,238,.8)'; for (let i = 0; i < 700; i++) { const a = R() * TAU, rr = .04 + Math.pow(R(), 2) * .1; x.beginPath(); x.arc(Math.cos(a) * rr, Math.sin(a) * rr * .8, .0004 + R() * .0006, 0, TAU); x.fill(); }- // Bowl (filling)- x.fillStyle = '#6e3a1e'; x.beginPath(); x.arc(-.17, .085, .05, 0, TAU); x.fill(); x.fillStyle = '#8c4f2b'; x.beginPath(); x.arc(-.17, .085, .043, 0, TAU); x.fill();- x.fillStyle = '#4a1f10'; x.beginPath(); x.arc(-.17, .085, .038, 0, TAU); x.fill();- x.fillStyle = '#5c2a16'; for (let i = 0; i < 12; i++) { x.beginPath(); x.arc(-.17 + (R() - .5) * .05, .085 + (R() - .5) * .05, .004 + R() * .005, 0, TAU); x.fill(); }- // Rolling pin- x.fillStyle = '#8a5a30'; x.save(); x.translate(-.12, -.11); x.rotate(.25); x.beginPath(); x.roundRect(-.1, -.009, .2, .018, .009); x.fill(); x.fillStyle = '#6a4020'; x.fillRect(-.1, -.002, .2, .002); x.restore();- // Small dough balls- for (const [px, py] of [[.17, .1], [.2, .07], [.215, .11]]) { const g = x.createRadialGradient(px - .004, py + .004, 0, px, py, .018); g.addColorStop(0, '#f6e6c4'); g.addColorStop(1, '#d9bb88'); x.fillStyle = g; x.beginPath(); x.arc(px, py, .017, 0, TAU); x.fill(); }- // Osmanthus- x.fillStyle = '#e8b14a'; for (let i = 0; i < 30; i++) { const px = (R() - .5) * .5, py = (R() - .5) * .3; if (Math.hypot(px, py) < .06) continue; for (let k = 0; k < 4; k++) { x.beginPath(); x.arc(px + Math.cos(k * TAU / 4) * .0016, py + Math.sin(k * TAU / 4) * .0016, .0014, 0, TAU); x.fill(); } }- } }));- // Dough: first the rolled-out wrapper (being kneaded), then after the filling ball drops it is wrapped into a round ball- const ball = (x, c0, c1, c2, r) => { const g = x.createRadialGradient(-r * .25, r * .3, r * .05, 0, 0, r); g.addColorStop(0, c0); g.addColorStop(.7, c1); g.addColorStop(1, c2); x.fillStyle = g; x.beginPath(); x.arc(0, 0, r, 0, TAU); x.fill(); };- const sheetD = S.add(sheet({ U, w: .12, h: .12, z: -.0535, trans: .2, finish: { rim: .15 }, draw: x => { ball(x, '#f4e4c2', '#ead3a6', '#dcc08e', .05); x.strokeStyle = 'rgba(190,160,110,.35)'; x.lineWidth = .0008; for (let i = 0; i < 5; i++) { x.beginPath(); x.arc(0, 0, .012 + i * .008, 0, TAU); x.stroke(); } } }));- const fill = S.add(sheet({ U, w: .06, h: .06, z: .05, trans: .1, draw: x => ball(x, '#8a4128', '#5e2614', '#44190c', .02) }));- const dough = S.add(sheet({ U, w: .09, h: .09, z: -.052, trans: .2, finish: { rim: .2 }, draw: x => ball(x, '#fbeccb', '#ead0a0', '#cfae78', .035) }));- // Mooncake (after pressing): white dough blank → golden baked crust, switched by a circular front advancing from the inside out- const cakeO = (lo, base, hi) => ({ U, w: .09, h: .09, z: -.0515, trans: .15, envMap: E.env, bumpBlur: 2.5, bumpDraw: x => cakeFace(x, .038, 'bump'), draw: x => cakeFace(x, .038, 'color', { base, hi, lo }) });- const paleC = S.add(sheet({ ...cakeO('#c4ab80', '#e9d7b2', '#f6ead0'), metal: 0, rough: .7, bump: 7, envI: .6 })); paleC.material.color.setScalar(.9);- const cake = S.add(sheet({ ...cakeO('#6a3812', '#b8742c', '#e9b25c'), metal: .55, rough: .34, bump: 9, envI: 1.2 })); cake.position.z = -.0513;- // Wooden mould (back side + carved handle) + Grandma's hands- const mold = new THREE.Group(); S.scene.add(mold);- const moldS = sheet({ U, w: .2, h: .2, trans: .05, draw: x => {- x.fillStyle = '#5c311a'; x.beginPath(); x.roundRect(-.05, -.05, .1, .1, .012); x.fill();- x.save(); x.rotate(-.6); x.beginPath(); x.roundRect(.04, -.012, .12, .024, .01); x.fill(); x.restore();- x.strokeStyle = 'rgba(30,12,4,.5)'; x.lineWidth = .0008; for (let i = 0; i < 16; i++) { x.beginPath(); x.moveTo(-.048, -.045 + i * .006); x.bezierCurveTo(-.02, -.043 + i * .006, .02, -.047 + i * .006, .048, -.044 + i * .006); x.stroke(); }- x.strokeStyle = '#3a1c0c'; x.lineWidth = .002; x.strokeRect(-.042, -.042, .084, .084);- text(x, '福', 0, 0, .04, FONT.brush, { fill: '#3e1f0e' });- } });- const hand = sheet({ U, w: .2, h: .2, trans: .05, draw: x => {- x.fillStyle = '#2d160c'; x.save(); x.translate(.11, -.07); arm(x, .5, 2.55, -.05, { L1: .12, L2: .12, w: .06, sleeve: 1.2, wrist: .1 }); x.restore();- } });- hand.position.z = .002; mold.add(moldS, hand);- // Flour dust- const dust = S.add(sheet({ U, w: .24, h: .24, z: -.045, trans: .6, shadow: false, recv: false, finish: { rim: 0, under: 0, grain: false }, draw: x => {- const R2 = mulberry(8); x.fillStyle = '#fbf6ea';- for (let i = 0; i < 260; i++) { const a = R2() * TAU, rr = .045 + Math.pow(R2(), 1.5) * .07; x.beginPath(); x.arc(Math.cos(a) * rr, Math.sin(a) * rr, .0006 + R2() * .0014, 0, TAU); x.fill(); }- } }));- dust.material.transparent = true; dust.material.alphaToCoverage = false; dust.material.depthWrite = false; dust.material.alphaTest = .01;-- const tHit = E.word('L04', 13) + .02; // “啪” (smack)- const tLift = E.cue('L05') - .25, tBake = E.cue('L05') + .35, tYuan = E.word('L05', 8);- return {- S,- update(t) {- // Kneading (wrapper rises, falls and turns) → filling ball drops → wrapped into a round ball- const kn = seg(t, 0, .9), wrap = ss(seg(t, 1.05, 1.45));- sheetD.rotation.z = .6 * Math.sin(t * 3) * (1 - wrap); sheetD.scale.set((1 + .05 * Math.sin(t * 11) * (1 - kn * .5)) * lerp(1, .6, wrap), (1 - .05 * Math.sin(t * 11)) * lerp(1, .6, wrap), 1);- const drop = eio(seg(t, .6, 1.05)); fill.position.set(0, 0, lerp(.12, -.051, drop)); fill.visible = t > .55 && wrap < .5; fill.scale.setScalar(lerp(1, .8, wrap));- sheetD.visible = wrap < .98; dough.visible = wrap > .5; dough.scale.setScalar(lerp(.9, 1, ss(seg(t, 1.2, 1.6))) * (1 + .02 * Math.sin(t * 7)));- // Wooden mould: enters frame → hovers → smack → holds → lifts- const inK = eo(seg(t, 1.5, tHit - .35)), slam = ei(seg(t, tHit - .12, tHit)), lift = eio(seg(t, tLift, tLift + .7));- let mz = lerp(.26, .05, inK); mz = lerp(mz, -.0475, slam); mz = lerp(mz, .3, lift);- mold.position.set(lerp(.09, 0, inK) + lift * .12, lerp(.07, 0, inK) + lift * .1, mz);- mold.rotation.z = lerp(.25, 0, inK) + lift * .2;- mold.visible = t > 1.45 && lift < .99;- const hit = t >= tHit;- if (hit) dough.visible = sheetD.visible = fill.visible = false; paleC.visible = cake.visible = hit;- // Dust- const dk = seg(t, tHit, tHit + 1.1); dust.visible = hit && dk < 1; dust.scale.setScalar(.7 + .6 * eo(dk)); dust.material.opacity = .9 * (1 - dk);- // Baking: dough white → gold; a metallic sheen gradually appears- const bk = ss(seg(t, tBake, tBake + 1.4));- const rr = bk * .05; cake.material.userData.u.uClip.value.set(0, 0, rr, 0); paleC.material.userData.u.uClip.value.set(0, 0, rr, 1);- // Key light sweeps across (a flash on the character “圆”)- const sweep = seg(t, tYuan - .5, tYuan + .9);- S.key.position.set(lerp(-.14, .16, sweep), .22, .32); S.key.intensity = S.base.key * (1 + .25 * Math.exp(-Math.pow((t - tYuan - .2) / .25, 2)));- // Camera: top-down, a jolt on impact, slow push after the mould lifts- const shake = hit ? .0025 * Math.exp(-(t - tHit) * 9) * Math.sin((t - tHit) * 70) : 0;- const push = eio(seg(t, tLift, E.dur));- const z = lerp(.36, .21, push) - (t < tHit ? .02 * seg(t, 0, tHit) : 0);- aim(S.cam, [.012 + shake, -.02 + shake * .6, z, 0, lerp(-.004, 0, push), -.052], t, { roll: lerp(.08, -.05, eio(clamp(t / E.dur))) });- },- post(t) { return { focus: S.cam.position.z + .052, aper: 12, maxCoc: 16, bloom: { strength: .3, radius: .5, threshold: 1.3 } }; },- grade() { return { expo: 1.0, vig: .5, sat: 1.04, contrast: .12, lift: [.012, .006, 0], gain: [1.03, 1, .95] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s04_scroll.js b/styles/paper-lantern/demo/src/shots/s04_scroll.jsdeleted file mode 100644index 9518e8c..0000000--- a/styles/paper-lantern/demo/src/shots/s04_scroll.js+++ /dev/null@@ -1,92 +0,0 @@-// S4 · Ming-dynasty custom: two people exchanging mooncakes on a bridge + an unrolling scroll (《西湖游览志余》, Xihu Youlan Zhiyu)-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon, text, vtext } from '../paper.js';-import { willow, xiangyun, reeds, waves, waterTop, osmanthus, lantern, FONT } from '../art.js';-import { spline } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--// Robes of the ancients (facing right; origin = soles; hat: 'wing' wusha (乌纱) official's cap with side wings | 'scarf' head scarf)-export function robed(x, s, o = {}) {- spline(x, s, [[-.03, .99], [.03, .985], [.058, .955], [.06, .935], [.072, .915, 1], [.06, .906], [.062, .89], [.055, .872], [.03, .862], [.03, .83], [.07, .8], [.1, .7], [.12, .5], [.15, .2], [.18, .02], [.19, 0, 1], [-.17, 0, 1], [-.15, .1], [-.12, .4], [-.09, .65], [-.075, .8], [-.05, .86], [-.06, .93]]);- x.fill();- if (o.hat === 'wing') { x.beginPath(); x.ellipse(0, .99 * s, .062 * s, .035 * s, 0, Math.PI, 0, true); x.fill(); x.fillRect(-.16 * s, .965 * s, .32 * s, .012 * s); x.beginPath(); x.ellipse(-.16 * s, .971 * s, .02 * s, .012 * s, 0, 0, TAU); x.ellipse(.16 * s, .971 * s, .02 * s, .012 * s, 0, 0, TAU); x.fill(); }- else { x.beginPath(); x.ellipse(-.005 * s, .985 * s, .06 * s, .045 * s, 0, 0, TAU); x.fill(); x.beginPath(); x.moveTo(-.05 * s, .97 * s); x.quadraticCurveTo(-.11 * s, .9 * s, -.1 * s, .8 * s); x.lineTo(-.08 * s, .82 * s); x.quadraticCurveTo(-.08 * s, .92 * s, -.03 * s, .96 * s); x.fill(); }- // Both arms reaching forward + wide sleeves (holding an object / bowing with clasped hands)- const a = o.reach ?? .0;- x.beginPath(); x.moveTo(.02 * s, .8 * s); x.quadraticCurveTo(.16 * s, (.72 + a) * s, .24 * s, (.66 + a) * s); x.lineTo(.25 * s, (.6 + a) * s); x.quadraticCurveTo(.2 * s, (.52 + a) * s, .12 * s, (.5 + a * .5) * s); x.quadraticCurveTo(.06 * s, .55 * s, .0, .62 * s); x.closePath(); x.fill();- x.beginPath(); x.ellipse(.26 * s, (.64 + a) * s, .025 * s, .018 * s, 0, 0, TAU); x.fill();- if (o.bow) { /* the bow is done by an outside rotation */ }-}--export function build(E) {- const MN = [-.11, .06, -.125];- const S = stage({ light: MN, lightR: .16, lightCol: '#ffe6b8', key: 1.0, amb: .3, ambCol: '#d8b890', keyCol: '#fff0da' });- const { U } = S;- S.add(skyPanel({ w: .62, h: .38, z: -.135, stops: [[0, '#b98a52'], [.6, '#d9b47c'], [1, '#e8cc98']], stars: 0 }));- const mn = S.add(moon({ x: MN[0], y: MN[1], z: MN[2], r: .042, gain: 1.35, halo: 3.2, haloGain: .25, core: '#fffaf0', mid: '#fdf1d6', edge: '#f3dcae' }));- S.add(sheet({ U, w: .62, h: .36, z: -.11, trans: .8, draw: x => { x.fillStyle = '#f1dfba'; xiangyun(x, -.03, .1, .008, -1, { tail: 3 }); xiangyun(x, -.2, .02, .0075, 1); } }));- // Rooflines of a distant city gate tower- S.add(sheet({ U, w: .62, h: .36, z: -.09, trans: .5, draw: x => {- x.fillStyle = '#c29458';- x.fillRect(-.31, -.18, .62, .16);- const roof = (cx, by, w, h) => { x.beginPath(); x.moveTo(cx - w * .62, by + h * .15); x.quadraticCurveTo(cx - w * .45, by, cx - w * .3, by + h * .6); x.lineTo(cx + w * .3, by + h * .6); x.quadraticCurveTo(cx + w * .45, by, cx + w * .62, by + h * .15); x.lineTo(cx + w * .5, by - h * .1); x.lineTo(cx - w * .5, by - h * .1); x.closePath(); x.fill(); };- const R = mulberry(3);- for (let i = 0; i < 16; i++) { const cx = -.3 + i * .04 + R() * .01, h = .012 + R() * .012; x.fillRect(cx - .016, -.02, .032, h); roof(cx, -.02 + h, .04, .01); }- x.fillRect(.02, -.02, .08, .05); roof(.06, .03, .1, .022); x.fillRect(.035, .045, .05, .018); roof(.06, .063, .075, .018); // city gate tower- } }));- // River and bridge, willows- const midL = S.add(sheet({ U, w: .62, h: .36, z: -.068, trans: .3, draw: x => {- x.fillStyle = '#9a6a3a'; waterTop(x, { x0: -.31, x1: .31, base: -.03, amp: .0008, len: .04 });- x.save(); x.beginPath(); x.rect(-.31, -.18, .62, .148); x.clip(); waves(x, { x0: -.31, x1: .31, y0: -.036, y1: -.18, r: .006, fill: '#9a6a3a', line: '#b88a55', lw: .0006 }); x.restore();- } }));- const bridge = S.add(sheet({ U, w: .62, h: .36, z: -.052, trans: .15, draw: x => {- x.fillStyle = '#6b4222';- x.beginPath(); x.moveTo(-.2, -.07); x.quadraticCurveTo(-.08, -.0, .04, -.07); x.lineTo(.04, -.085); x.lineTo(-.2, -.085); x.closePath(); x.fill();- x.save(); x.globalCompositeOperation = 'destination-out'; x.beginPath(); x.ellipse(-.08, -.086, .05, .045, 0, 0, Math.PI); x.fill(); x.restore();- x.lineWidth = .0012; x.strokeStyle = '#6b4222'; x.beginPath(); x.moveTo(-.19, -.058); x.quadraticCurveTo(-.08, .012, .03, -.058); x.stroke();- for (let i = 0; i < 11; i++) { const u = (i + .5) / 11, px = -.19 + u * .22, py = -.07 + Math.sin(u * Math.PI) * .035; x.fillRect(px - .0008, py, .0016, .011); }- willow(x, { cx: -.27, by: -.1, h: .2, strands: 22, seed: 5 });- } }));- // Two people exchanging gifts (left one holds the box, right one bows with clasped hands)- const giver = S.add(sheet({ U, w: .1, h: .12, x: -.115, y: -.028, z: -.045, trans: .06, ay: -.05, draw: x => { x.fillStyle = '#3e2412'; x.translate(0, -.05); robed(x, .085, { hat: 'wing', reach: -.02 }); x.fillStyle = '#a3291f'; x.fillRect(.085 * .21, .085 * .6, .085 * .11, .085 * .07); x.fillStyle = '#d9a441'; x.fillRect(.085 * .21, .085 * .63, .085 * .11, .085 * .012); } }));- const taker = S.add(sheet({ U, w: .1, h: .12, x: -.04, y: -.022, z: -.046, trans: .06, ay: -.05, draw: x => { x.fillStyle = '#3e2412'; x.translate(0, -.05); x.scale(-1, 1); robed(x, .08, { hat: 'scarf', reach: .02 }); } }));- // Scroll: the roller is at the right end, unrolls to the left- const SW = .2, SH = .19, SX = .215, SY = .01;- const scroll = S.add(sheet({ U, w: SW, h: SH, x: SX - SW / 2, y: SY, z: -.03, ax: SW / 2, trans: .35, finish: { rim: .25 }, draw: x => {- x.fillStyle = '#f3e7cb'; x.fillRect(-SW / 2, -SH / 2, SW, SH);- x.fillStyle = '#8a5a2e'; x.fillRect(-SW / 2, SH / 2 - .01, SW, .004); x.fillRect(-SW / 2, -SH / 2 + .006, SW, .004);- const F = FONT.brush, cs = .0148, ink = '#2a170c';- vtext(x, '八月十五日谓之中秋', .07, .062, cs, F, { fill: ink, gap: 1.02 });- vtext(x, '民间以月饼相遗', .045, .062, cs, F, { fill: ink, gap: 1.02 });- vtext(x, '取团圆之义', .02, .062, cs, F, { fill: ink, gap: 1.02 });- vtext(x, '明·田汝成', -.006, .062, .0072, F, { fill: '#5a3a22', gap: 1.08 }); vtext(x, '︽西湖游览志余︾', -.016, .062, .0072, F, { fill: '#5a3a22', gap: 1.08 });- x.fillStyle = '#b3302a'; x.fillRect(-.045, -.062, .015, .015); vtext(x, '团圆', -.0375, -.0508, .0055, F, { fill: '#f6e3c3', gap: 1.05 });- } }));- const rodDraw = x => { x.fillStyle = '#4a2a14'; x.beginPath(); x.roundRect(-.005, -SH / 2 - .012, .01, SH + .024, .004); x.fill(); x.fillStyle = '#2a170c'; x.beginPath(); x.arc(0, SH / 2 + .012, .006, 0, TAU); x.arc(0, -SH / 2 - .012, .006, 0, TAU); x.fill(); };- const rodR = S.add(sheet({ U, w: .03, h: SH + .05, x: SX, y: SY, z: -.028, trans: .05, draw: rodDraw }));- const rodL = S.add(sheet({ U, w: .03, h: SH + .05, x: SX, y: SY, z: -.028, trans: .05, draw: x => { x.fillStyle = '#e9dbbd'; x.beginPath(); x.roundRect(-.008, -SH / 2, .016, SH, .006); x.fill(); rodDraw(x); } }));- S.add(sheet({ U, w: .62, h: .38, z: -.012, trans: .04, draw: x => {- x.fillStyle = '#2c180b'; x.strokeStyle = '#2c180b';- x.fillRect(-.31, -.19, .62, .045);- reeds(x, { x0: -.3, x1: -.05, by: -.145, h: .045, n: 30, seed: 5 });- osmanthus(x, { cx: .3, by: .08, h: .12, flowers: '#6a4a24', seed: 9, leaves: 40, nFlowers: 30 });- } }));- const scrollMap = scroll.material.map;- scrollMap.wrapS = THREE.ClampToEdgeWrapping;- const tOpen = E.cue('L06') + .6;- return {- S,- update(t) {- const k = Math.max(.001, eo(seg(t, tOpen, tOpen + 2.4)));- scroll.scale.x = k; scrollMap.repeat.x = k; scrollMap.offset.x = 1 - k;- rodL.position.x = SX - SW * k;- // Handing over the box: left one leans forward, right one bows with clasped hands- const g = ss(seg(t, .3, 1.6)); giver.rotation.z = -.1 * g; giver.position.x = -.115 + .006 * g; taker.rotation.z = .16 * ss(seg(t, .9, 2)) * (1 - .3 * ss(seg(t, 2.6, 3.4)));- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.075, .1, u), lerp(-.005, .004, u), lerp(.38, .4, u), lerp(-.075, .115, u), lerp(-.012, .008, u), -.05], t);- },- post() { return { focus: S.cam.position.z + .04, aper: 14, maxCoc: 12, bloom: { strength: .3, radius: .5, threshold: 1.3 } }; },- grade() { return { expo: 1.0, vig: .45, sat: .95, contrast: .1, lift: [.02, .012, 0], gain: [1.02, 1, .94] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s05_table.js b/styles/paper-lantern/demo/src/shots/s05_table.jsdeleted file mode 100644index 19420e9..0000000--- a/styles/paper-lantern/demo/src/shots/s05_table.js+++ /dev/null@@ -1,74 +0,0 @@-// S5 · The empty seat (L07) → Xiaoman's photo on the wall (L08)-import * as THREE from 'three';-import { sheet, skyPanel, moon, text } from '../paper.js';-import { osmanthus, lantern, FONT } from '../art.js';-import { roundWindow, bowl, teapot, pendant, chair, cut } from '../props.js';-import { grannySit, girlStand, childStand, arm, spline, GRAN_SHOULDER } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp, clamp, mulberry, TAU } from '../lib.js';--export function portrait(x, w, h, o = {}) { // photo frame + half-length portrait of Xiaoman- x.fillStyle = o.frame || '#3a2010'; x.beginPath(); x.roundRect(-w / 2, -h / 2, w, h, w * .04); x.fill();- x.fillStyle = '#c7d3dc'; x.fillRect(-w * .42, -h * .42, w * .84, h * .84);- const g = x.createLinearGradient(0, h * .42, 0, -h * .42); g.addColorStop(0, '#9fb3c8'); g.addColorStop(1, '#e8e0cf'); x.fillStyle = g; x.fillRect(-w * .42, -h * .42, w * .84, h * .84);- x.save(); x.beginPath(); x.rect(-w * .42, -h * .42, w * .84, h * .84); x.clip();- x.fillStyle = '#6f829a'; for (let i = 0; i < 7; i++) x.fillRect(-w * .42 + i * w * .13, -h * .42, w * .08, h * (.25 + (i * 37 % 5) * .06)); // distant city- x.fillStyle = o.ink || '#2b1d18'; x.translate(-w * .02, -h * .95); girlStand(x, h * 1.05);- x.restore();-}--export function build(E) {- const WIN = [-.07, .055], PH = [.105, .05];- const S = stage({ light: [-.02, .08, -.07], lightR: .13, lightCol: '#ffd29a', key: .9, amb: .17, ambCol: '#c08a60', keyCol: '#ffdcb4' });- const { U } = S;- S.add(skyPanel({ w: .6, h: .36, z: -.14, stops: [[0, '#0d1838'], [1, '#2e4274']], stars: 60 }));- S.add(moon({ x: WIN[0] - .01, y: WIN[1] + .01, z: -.135, r: .017, gain: 1.9, halo: 3.5, haloGain: .35 }));- S.add(sheet({ U, w: .6, h: .36, z: -.112, trans: .9, draw: x => {- x.fillStyle = '#b08058'; x.fillRect(-.3, -.18, .6, .36);- x.fillStyle = '#9a6a44'; for (let i = 0; i < 9; i++) x.fillRect(-.3, -.18 + i * .045, .6, .0012);- x.fillStyle = '#5a321a'; roundWindow(x, WIN[0], WIN[1], .04, .0015, 'grid');- x.fillStyle = '#5a321a'; x.fillRect(-.3, .118, .6, .014);- } }));- // On the wall: 福 (fortune) character + Xiaoman's photo- S.add(sheet({ U, w: .6, h: .36, z: -.104, trans: .2, draw: x => {- x.save(); x.translate(.02, .06); x.rotate(Math.PI / 4); x.fillStyle = '#b8322a'; x.fillRect(-.016, -.016, .032, .032); x.restore();- text(x, '福', .02, .059, .022, FONT.brush, { fill: '#e9c26a' });- } }));- const photo = S.add(sheet({ U, w: .06, h: .075, x: PH[0], y: PH[1], z: -.1, trans: .25, draw: x => portrait(x, .05, .064) }));- // Pendant lamp- S.add(sheet({ U, w: .08, h: .1, x: -.02, y: .105, z: -.07, trans: .1, glow: 3, glowCol: '#ffc878', ay: .04, draw: x => pendant(x, 0, .02, .042, '#3a1d10'), glowDraw: g => pendant(g, 0, .02, .042, '#000', g) }));- // Grandma sits on the left; empty chair on the right- const GX = -.105, GY = -.096, GS = .15;- const gran = S.add(sheet({ U, w: .5, h: .36, z: -.064, trans: .06, draw: x => { x.fillStyle = '#2e170d'; chair(x, GX - .005, -.14, .1, 1); x.translate(GX, GY); grannySit(x, GS, { pin: '#2e170d' }); x.translate(GRAN_SHOULDER[0] * GS, (GRAN_SHOULDER[1] - .48) * GS); arm(x, GS, -.35, .5, { sleeve: 1.25 }); } }));- const empty = S.add(sheet({ U, w: .5, h: .36, z: -.052, trans: .06, draw: x => { x.fillStyle = '#2e170d'; chair(x, .11, -.14, .1, -1); } }));- // Round table + dishes + mooncakes + tea set + bowl and chopsticks at the empty seat- S.add(sheet({ U, w: .5, h: .3, z: -.046, trans: .08, draw: x => {- x.fillStyle = '#3a1c0e';- x.fillRect(-.075, -.05, .15, .01); x.fillRect(-.07, -.06, .14, .01); x.fillRect(-.008, -.13, .016, .07); x.fillRect(-.04, -.135, .08, .008);- x.fillStyle = '#3a1c0e'; bowl(x, -.045, -.04, .03, .012); teapot(x, .0, -.04, .022); bowl(x, .045, -.04, .03, .012);- x.fillStyle = '#6e2c18'; x.beginPath(); x.ellipse(-.045, -.028, .012, .0025, 0, 0, TAU); x.fill();- x.fillStyle = '#3a1c0e'; x.fillRect(.056, -.04, .002, .02); x.fillRect(.06, -.04, .002, .02); // chopsticks at the empty seat- } }));- const plate = S.add(sheet({ U, w: .06, h: .03, x: -.02, y: -.034, z: -.044, trans: 0, metal: .6, rough: .36, envMap: E.env, envI: .9, draw: x => {- x.fillStyle = '#c7873a'; for (const [dx, dy] of [[-.012, -.002], [.004, -.002], [-.004, .006]]) { x.beginPath(); x.roundRect(dx - .008, dy - .005, .016, .009, .003); x.fill(); }- } }));- const fg = S.add(sheet({ U, w: .62, h: .38, z: -.014, trans: .04, draw: x => {- x.fillStyle = '#1a0c06'; x.fillRect(-.31, -.19, .62, .05);- lantern(x, { cx: -.21, cy: .1, r: .016, col: '#1a0c06', rib: '#1a0c06', cap: '#1a0c06', stringLen: .1 });- x.fillRect(.27, -.19, .04, .38);- } }));- const tPan = E.cue('L07') + .4, tPush = E.cue('L08') - .1;- let fz = -.064;- return {- S,- update(t) {- const pan = eio(seg(t, tPan, tPan + 2.4)), push = eio(seg(t, tPush, tPush + 3.4));- const cx = lerp(lerp(-.075, .085, pan), PH[0], push), cy = lerp(lerp(-.03, -.035, pan), PH[1], push);- const z = lerp(lerp(.34, .32, pan), .15, push);- aim(S.cam, [cx + lerp(.01, 0, push), cy - .006, z, cx, cy, -.08], t);- fz = lerp(lerp(-.064, -.052, ss(seg(t, tPan + .6, tPan + 1.8))), -.1, push);- },- post() { return { focus: S.cam.position.z - fz, aper: 18, maxCoc: 16, bloom: { strength: .38, radius: .6, threshold: 1.1 } }; },- grade() { return { expo: 1.0, vig: .5, sat: .98, contrast: .1, lift: [.012, .006, 0], gain: [1.02, 1, .96] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s06_pack.js b/styles/paper-lantern/demo/src/shots/s06_pack.jsdeleted file mode 100644index 2a560e2..0000000--- a/styles/paper-lantern/demo/src/shots/s06_pack.js+++ /dev/null@@ -1,74 +0,0 @@-// S6 · Packing: mooncake goes into the gift box → note slip laid on top → address written → lid closed (“于是,我出发了” "And so, I set off")-import * as THREE from 'three';-import { sheet, skyPanel, text, vtext } from '../paper.js';-import { osmanthus, FONT } from '../art.js';-import { boxFront, label, cake3q, pendant } from '../props.js';-import { arm } from '../people.js';-import { cakeFace } from './s03_press.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, ei, lerp, clamp, back, TAU } from '../lib.js';--export function giftBox(S, E, o = {}) { // returns {inner, front, lid}; box centre cx, bottom by, width w, front-face height h- const { U } = S, { cx = 0, by = -.06, w = .17, h = .07, z = -.06, col = '#9e2a20', dark = '#5e1510', gold = '#d9a441', to = '小满 收' } = o;- const inner = S.add(sheet({ U, w: w + .02, h: h + .06, x: cx, y: by + h / 2 + .02, z: z - .012, trans: .2, draw: x => {- x.fillStyle = dark; x.fillRect(-w / 2, -h / 2 - .02, w, h + .03);- x.fillStyle = '#c99a4a'; x.fillRect(-w / 2 + .004, -h / 2 - .02, w - .008, h * .15); // gold lining paper- } }));- const front = S.add(sheet({ U, w: w + .02, h: h + .02, x: cx, y: by + h / 2, z, trans: .2, draw: x => {- boxFront(x, 0, -h / 2, w, h, col, gold);- if (to) label(x, w * .22, 0, w * .3, h * .52, [[to, h * .07, h * .16], ['外婆 寄', -h * .13, h * .09]], { rot: -.04, font: FONT.xing });- text(x, '月', -w * .24, 0, h * .38, FONT.brush, { fill: gold });- } }));- const lid = S.add(sheet({ U, w: w + .03, h: h * .5, x: cx, y: by + h + .004, z: z + .003, trans: .2, draw: x => {- x.fillStyle = col; x.fillRect(-w / 2 - .005, -h * .2, w + .01, h * .4);- x.strokeStyle = gold; x.lineWidth = h * .025; x.strokeRect(-w / 2, -h * .15, w, h * .3);- for (let i = 0; i < 9; i++) { x.fillStyle = gold; x.beginPath(); x.arc(-w * .4 + i * w * .1, 0, h * .03, 0, TAU); x.fill(); }- text(x, '中秋', 0, 0, h * .2, FONT.brush, { fill: gold });- } }));- return { inner, front, lid };-}--export function build(E) {- const S = stage({ light: [-.05, .1, -.1], lightR: .2, lightCol: '#ffcf96', key: 1.2, amb: .2, ambCol: '#c08a60', keyCol: '#ffdcb4', keyPos: [-.05, .28, .26] });- const { U } = S;- S.add(skyPanel({ w: .6, h: .36, z: -.14, stops: [[0, '#3a1e10'], [.6, '#7a4524'], [1, '#9a5a30']] }));- S.add(sheet({ U, w: .6, h: .36, z: -.12, trans: .6, glow: 2.2, glowCol: '#ffc070', draw: x => { x.fillStyle = '#6a3a1c'; x.fillRect(-.3, -.18, .6, .36); x.fillStyle = '#4a2612'; for (let i = 0; i < 8; i++) x.fillRect(-.3, -.18 + i * .05, .6, .002); pendant(x, -.12, .09, .05, '#3a1d10'); }, glowDraw: g => pendant(g, -.12, .09, .05, '#000', g) }));- const B = giftBox(S, E, { cx: .0, by: -.06, z: -.06 });- const cakeDraw = x => cake3q(x, 0, 0, .03, y => cakeFace(y, .03, 'color', { base: '#b8742c', hi: '#e9b25c', lo: '#6a3812' }));- const cake = S.add(sheet({ U, w: .08, h: .06, z: -.0655, trans: .1, metal: .55, rough: .35, envMap: E.env, envI: 1.1, draw: cakeDraw }));- const handL = S.add(sheet({ U, w: .2, h: .2, z: -.064, trans: .05, draw: x => { x.fillStyle = '#2e170d'; x.translate(-.1, .06); arm(x, .4, -.35, -.25, { L1: .12, L2: .1, w: .05, sleeve: 1.25 }); } }));- const handR = S.add(sheet({ U, w: .2, h: .2, z: -.064, trans: .05, draw: x => { x.fillStyle = '#2e170d'; x.translate(.1, .06); x.scale(-1, 1); arm(x, .4, -.35, -.25, { L1: .12, L2: .1, w: .05, sleeve: 1.25 }); } }));- const note = S.add(sheet({ U, w: .09, h: .05, z: -.063, trans: .6, draw: x => {- x.fillStyle = '#f5ecd6'; x.save(); x.rotate(.05); x.fillRect(-.035, -.012, .07, .024); x.fillStyle = '#c0392b'; x.fillRect(-.035, .008, .07, .0012);- x.fillStyle = '#b8a888'; x.fillRect(-.0005, -.012, .001, .024); x.restore();- } }));- const hand3 = S.add(sheet({ U, w: .2, h: .2, z: -.062, trans: .05, draw: x => { x.fillStyle = '#2e170d'; x.translate(.12, .08); x.scale(-1, 1); arm(x, .4, -.5, -.1, { L1: .12, L2: .1, w: .05, sleeve: 1.25 }); } }));- S.add(sheet({ U, w: .6, h: .3, z: -.05, trans: .05, draw: x => { x.fillStyle = '#2a1409'; x.fillRect(-.3, -.15, .6, .09); x.fillStyle = '#3a1c0e'; x.fillRect(-.3, -.062, .6, .004); } }));- S.add(sheet({ U, w: .62, h: .38, z: -.012, trans: .05, glow: .4, glowCol: '#ffc766', draw: x => { x.fillStyle = '#1a0c06'; osmanthus(x, { cx: -.2, by: -.16, h: .16, flowers: '#6a4a24', seed: 11, leaves: 50, nFlowers: 40 }); x.fillRect(-.24, -.19, .08, .05); } }));- const t0 = E.cue('L09'), tNote = E.word('L09', 8) + .1, tLabel = E.word('L09', 14) - .1, tLid = E.cue('L10') - .45, tEnd = E.dur;- return {- S,- update(t) {- // Both hands put the mooncake into the box- const dn = eio(seg(t, .1, 1.5)), out = eio(seg(t, 1.5, 2.1));- const cy = lerp(.06, -.03, dn);- cake.position.set(0, cy, -.0655);- handL.position.set(-.036 - out * .08, cy - .005 + out * .05, 0); handR.position.set(.036 + out * .08, cy - .005 + out * .05, 0);- handL.position.z = handR.position.z = -.064;- // Note slip- const nt = eio(seg(t, tNote - .7, tNote)), no = eio(seg(t, tNote + .1, tNote + .7));- note.position.set(lerp(.1, .0, nt), lerp(.08, .012, nt), -.063); note.rotation.z = lerp(.4, 0, nt); note.visible = t > tNote - .75;- hand3.position.set(lerp(.1, .0, nt) + no * .1, lerp(.08, .012, nt) + no * .06, -.062); hand3.visible = note.visible && no < .99;- // Lid closing- const ld = ei(seg(t, tLid - .5, tLid));- B.lid.position.y = lerp(.16, -.06 + .07 + .004, ld);- // Camera: medium shot → push in on the label → after the lid closes, push toward “中秋” (Mid-Autumn) on the lid and darken- const toLabel = eio(seg(t, tLabel - .3, tLabel + .9)), toLid = eio(seg(t, tLid, tEnd));- const px = lerp(lerp(0, .036, toLabel), 0, toLid), py = lerp(lerp(.0, -.03, toLabel), .012, toLid), z = lerp(lerp(.3, .2, toLabel), .15, toLid);- const shake = t > tLid ? .0012 * Math.exp(-(t - tLid) * 10) * Math.sin((t - tLid) * 60) : 0;- aim(S.cam, [px, py + .004 + shake, z, px, py + shake, -.06], t);- },- post() { return { focus: S.cam.position.z + .06, aper: 14, maxCoc: 14, bloom: { strength: .35, radius: .6, threshold: 1.2 } }; },- grade(t) { return { expo: 1.0, vig: .5, sat: 1.0, contrast: .1, lift: [.012, .006, 0], fade: 1 - ss(seg(t, tEnd - 1.0, tEnd)) }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s07_journey.js b/styles/paper-lantern/demo/src/shots/s07_journey.jsdeleted file mode 100644index 2961682..0000000--- a/styles/paper-lantern/demo/src/shots/s07_journey.js+++ /dev/null@@ -1,85 +0,0 @@-// S7 · Setting off: over the mountains, across the river, a night train (green-skinned train) crosses the frame, the moon following all the way-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon } from '../paper.js';-import { karst, ridge, xiangyun, waves, waterTop, pine, reeds, osmanthus, FONT } from '../art.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp, clamp, mulberry, TAU } from '../lib.js';--// Green-skinned train: locomotive on the right; by = rail level; returns length-export function train(x, x0, by, n, o = {}, g = null) {- const cw = o.cw ?? .07, ch = o.ch ?? .02, gap = cw * .04, col = o.col || '#1d4a3a', roof = o.roof || '#123026', win = o.win || '#f7c56d';- for (let i = 0; i < n; i++) {- const L = x0 + i * (cw + gap);- if (!g) {- x.fillStyle = col; x.beginPath(); x.roundRect(L, by + ch * .18, cw, ch, ch * .12); x.fill();- x.fillStyle = roof; x.beginPath(); x.roundRect(L + cw * .02, by + ch * 1.12, cw * .96, ch * .16, ch * .08); x.fill();- x.fillStyle = '#e8d9a8'; x.fillRect(L, by + ch * .42, cw, ch * .05); // waist stripe- x.fillStyle = '#111'; for (const k of [.15, .3, .7, .85]) { x.beginPath(); x.arc(L + cw * k, by + ch * .12, ch * .12, 0, TAU); x.fill(); }- }- const c = g || x;- c.fillStyle = g ? '#fff' : win;- for (let k = 0; k < 7; k++) { if (o.dark && (i * 7 + k) % 5 === 2) continue; c.fillRect(L + cw * (.08 + k * .125), by + ch * .6, cw * .08, ch * .38); }- }- // Locomotive- const L = x0 + n * (cw + gap), hw = cw * .75;- if (!g) {- x.fillStyle = col; x.beginPath(); x.moveTo(L, by + ch * .18); x.lineTo(L + hw * .8, by + ch * .18); x.quadraticCurveTo(L + hw, by + ch * .2, L + hw, by + ch * .6); x.quadraticCurveTo(L + hw, by + ch * 1.1, L + hw * .7, by + ch * 1.18); x.lineTo(L, by + ch * 1.18); x.closePath(); x.fill();- x.fillStyle = '#111'; for (const k of [.2, .5, .8]) { x.beginPath(); x.arc(L + hw * k, by + ch * .12, ch * .14, 0, TAU); x.fill(); }- x.fillStyle = win; x.beginPath(); x.moveTo(L + hw * .62, by + ch * .75); x.lineTo(L + hw * .85, by + ch * .75); x.quadraticCurveTo(L + hw * .95, by + ch * .9, L + hw * .7, by + ch * 1.05); x.lineTo(L + hw * .62, by + ch * 1.05); x.closePath(); x.fill();- } else { g.fillStyle = '#fff'; g.beginPath(); g.moveTo(L + hw * .62, by + ch * .75); g.lineTo(L + hw * .85, by + ch * .75); g.quadraticCurveTo(L + hw * .95, by + ch * .9, L + hw * .7, by + ch * 1.05); g.lineTo(L + hw * .62, by + ch * 1.05); g.closePath(); g.fill();- const hl = g.createLinearGradient(L + hw, 0, L + hw + .08, 0); hl.addColorStop(0, 'rgba(255,255,255,.8)'); hl.addColorStop(1, 'rgba(255,255,255,0)'); g.fillStyle = hl; g.beginPath(); g.moveTo(L + hw, by + ch * .5); g.lineTo(L + hw + .08, by + ch * .1); g.lineTo(L + hw + .08, by + ch * 1.1); g.closePath(); g.fill(); }- return n * (cw + gap) + hw;-}--export function build(E) {- const S = stage({ light: [0, .06, -.13], lightR: .25, lightCol: '#ffe2ae', key: .9, amb: .3, ambCol: '#7d90c8', keyCol: '#d0d8ff' });- const { U } = S;- const sky = S.add(skyPanel({ w: .75, h: .42, z: -.14, stops: [[0, '#0a1330'], [.5, '#182c5a'], [1, '#3a5184']], stars: 200, starMinY: -.05 }));- const mn = S.add(moon({ x: .1, y: .07, z: -.135, r: .03, gain: 1.8, halo: 4.5, haloGain: .35 }));- const W = 2.0, CX = .5; // panorama width 2 m, centre x=.5- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.115, trans: .8, ppm: 2400, draw: x => { x.fillStyle = '#c3cbe8'; const R = mulberry(3); for (let i = 0; i < 12; i++) xiangyun(x, -1 + i * .17 + R() * .05, .06 + R() * .07, .006 + R() * .003, R() < .5 ? 1 : -1, { tail: 2.5 }); } }));- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.1, trans: .7, ppm: 2600, draw: x => {- x.fillStyle = '#6a86c2'; const R = mulberry(5), pk = []; for (let u = -1; u < 1; u += .045 + R() * .03) pk.push([u, .03 + R() * .05, .02 + R() * .012]);- karst(x, { x0: -1, x1: 1, base: -.03, peaks: pk, carve: .0005 });- } }));- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.085, trans: .45, ppm: 3000, draw: x => {- x.fillStyle = '#3f5a92'; const R = mulberry(8), pk = []; for (let u = -1; u < 1; u += .06 + R() * .05) pk.push([u, .02 + R() * .05, .025 + R() * .015]);- karst(x, { x0: -1, x1: 1, base: -.045, peaks: pk, carve: .0006, seed: 4 });- } }));- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.07, trans: .3, ppm: 3000, glow: 1.1, glowCol: '#ffe0a6', draw: x => {- x.fillStyle = '#22325e'; waterTop(x, { x0: -1, x1: 1, base: -.055, amp: .001, len: .05 });- x.save(); x.beginPath(); x.rect(-1, -.2, 2, .142); x.clip(); waves(x, { x0: -1, x1: 1, y0: -.062, y1: -.2, r: .006, fill: '#22325e', line: '#34487a', lw: .0006 }); x.restore();- // Sailing boats- for (const [bx, s] of [[-.55, .03], [.12, .025], [.62, .032]]) { x.fillStyle = '#1a2850'; x.beginPath(); x.moveTo(bx - s, -.06); x.lineTo(bx + s, -.06); x.lineTo(bx + s * .7, -.068); x.lineTo(bx - s * .7, -.068); x.fill(); x.beginPath(); x.moveTo(bx, -.06); x.lineTo(bx, -.06 + s * 1.5); x.quadraticCurveTo(bx + s * .7, -.06 + s * .8, bx + s * .1, -.06 + s * .1); x.fill(); }- } }));- // Bridge + track (bridge spans x -0.1 ~ 1.1)- const BY = -.04;- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.052, trans: .12, ppm: 3600, draw: x => {- x.fillStyle = '#16213f';- x.fillRect(-1, BY - .006 - .5 * 0, 2, .006); // bridge deck- for (let i = 0; i < 16; i++) { const px = -.62 + i * .08; x.fillRect(px - .006, -.2, .012, .2 + BY - .006); }- x.save(); x.globalCompositeOperation = 'destination-out'; for (let i = 0; i < 15; i++) { const px = -.58 + i * .08; x.beginPath(); x.ellipse(px, -.07, .034, .025, 0, 0, Math.PI); x.fill(); } x.restore();- x.lineWidth = .0012; x.strokeStyle = '#16213f'; for (let i = 0; i < 60; i++) { const px = -.9 + i * .03; x.beginPath(); x.moveTo(px, BY); x.lineTo(px + .015, BY + .012); x.lineTo(px + .03, BY); x.stroke(); } x.fillRect(-1, BY + .012, 2, .0012);- x.fillStyle = '#16213f'; ridge(x, { x0: -1, x1: -.66, base: -.05, amp: .01, seed: 2, freq: 20 }); ridge(x, { x0: .6, x1: 1, base: -.05, amp: .01, seed: 5, freq: 20 });- } }));- const tr = S.add(sheet({ U, w: .8, h: .06, z: -.049, trans: .15, glow: 2.2, glowCol: '#ffc060', shadow: true, draw: x => train(x, -.38, 0, 8), glowDraw: g => train(null, -.38, 0, 8, {}, g), glowRes: 1 }));- // Foreground pine and osmanthus trees- S.add(sheet({ U, w: W, h: .4, x: CX, z: -.028, trans: .06, ppm: 3200, draw: x => {- x.fillStyle = '#0f1734'; const R = mulberry(12);- for (let i = 0; i < 6; i++) { const px = -.85 + i * .33 + R() * .06; if (i % 2) pine(x, { cx: px, by: -.24, h: .15 + R() * .04, seed: i }); else osmanthus(x, { cx: px, by: -.22, h: .1 + R() * .03, seed: i, leaves: 40 }); }- ridge(x, { x0: -1, x1: 1, base: -.12, amp: .008, seed: 7, freq: 16 });- } }));- S.add(sheet({ U, w: W, h: .4, x: CX, z: .012, trans: .02, ppm: 2400, draw: x => { x.fillStyle = '#080d20'; x.strokeStyle = '#080d20'; ridge(x, { x0: -1, x1: 1, base: -.14, amp: .012, seed: 9, freq: 10 }); reeds(x, { x0: -1, x1: 1, by: -.15, h: .06, n: 120, seed: 3 }); } }));- return {- S,- update(t) {- const u = t / E.dur, cx = lerp(-.05, .55, eio(clamp(u * .9 + .05)));- sky.position.x = cx; mn.position.x = cx + .09 - .02 * u;- const tx = lerp(-.35, 1.0, clamp(t / (E.dur + 1)));- tr.position.set(tx, BY + .001 + .0006 * Math.abs(Math.sin(t * 9)), -.049); tr.rotation.z = .002 * Math.sin(t * 4.5);- aim(S.cam, [cx, -.012, .42, cx + .01, -.02, -.06], t, { hand: .0008 });- },- post() { return { focus: S.cam.position.z + .05, aper: 14, maxCoc: 14, bloom: { strength: .4, radius: .6, threshold: 1.1 } }; },- grade(t) { return { expo: 1.05, vig: .42, sat: 1.05, contrast: .1 }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s08_window.js b/styles/paper-lantern/demo/src/shots/s08_window.jsdeleted file mode 100644index 1d037d4..0000000--- a/styles/paper-lantern/demo/src/shots/s08_window.js+++ /dev/null@@ -1,52 +0,0 @@-// S8 · Night-train window: tree shadows rush backward outside, the moon stays still; the gift box on the little table sways with the train (“原来这就是想家” "So this is what homesickness is")-import * as THREE from 'three';-import { sheet, skyPanel, moon } from '../paper.js';-import { karst, pine, osmanthus, ridge, FONT } from '../art.js';-import { boxFront } from '../props.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp, clamp, mulberry, TAU } from '../lib.js';--function scroller(S, o) { // tileable scrolling paper layer- const m = S.add(sheet({ U: S.U, w: o.w, h: o.h, x: o.x || 0, y: o.y || 0, z: o.z, trans: o.trans, ppm: o.ppm || 3000, draw: x => { for (const k of [-1, 0, 1]) { x.save(); x.translate(k * o.w, 0); o.draw(x); x.restore(); } } }));- m.material.map.wrapS = THREE.RepeatWrapping; return m;-}--export function build(E) {- const WN = [0, .035], WW = .2, WH = .12;- const S = stage({ light: [.05, .07, -.14], lightR: .12, lightCol: '#e0e8ff', key: 1.1, amb: .25, ambCol: '#c08a60', keyCol: '#ffd9ae', keyPos: [-.06, .25, .26] });- const { U } = S;- S.add(skyPanel({ w: .5, h: .3, z: -.15, stops: [[0, '#0b1636'], [.6, '#1c3163'], [1, '#34497c']], stars: 90 }));- S.add(moon({ x: .055, y: .065, z: -.145, r: .02, gain: 1.9, halo: 4, haloGain: .35 }));- const far = scroller(S, { w: .6, h: .3, z: -.125, trans: .6, draw: x => { x.fillStyle = '#4f6aa2'; const R = mulberry(2), pk = []; for (let u = -.3; u < .3; u += .04 + R() * .02) pk.push([u, .02 + R() * .03, .018]); karst(x, { x0: -.3, x1: .3, base: -.01, peaks: pk, carve: .0005 }); } });- const near = scroller(S, { w: .6, h: .3, z: -.1, trans: .15, draw: x => { x.fillStyle = '#131c3c'; const R = mulberry(6); for (let i = 0; i < 6; i++) { const px = -.28 + i * .1 + R() * .03; if (i % 2) pine(x, { cx: px, by: -.1, h: .12 + R() * .05, seed: i }); else osmanthus(x, { cx: px, by: -.1, h: .1 + R() * .03, seed: i, leaves: 20 }); } ridge(x, { x0: -.3, x1: .3, base: -.02, amp: .004, seed: 3, freq: 30 }); x.fillRect(-.3, -.15, .6, .12); } });- const poles = scroller(S, { w: .9, h: .3, z: -.085, trans: .05, draw: x => { x.fillStyle = '#0a1024'; x.fillRect(-.45, .085, .9, .0008); x.fillRect(-.45, .075, .9, .0008); x.fillRect(-.3, -.15, .006, .25); x.fillRect(-.31, .08, .026, .003); } });- // Carriage inner wall: window cut out- const wall = S.add(sheet({ U, w: .5, h: .3, z: -.06, trans: .15, draw: x => {- x.fillStyle = '#6e4428'; x.fillRect(-.25, -.15, .5, .3);- x.fillStyle = '#5a361f'; for (let i = 0; i < 12; i++) x.fillRect(-.25 + i * .045, -.15, .0015, .3); x.fillRect(-.25, -.045, .5, .004);- x.save(); x.globalCompositeOperation = 'destination-out'; x.beginPath(); x.roundRect(WN[0] - WW / 2, WN[1] - WH / 2, WW, WH, .014); x.fill(); x.restore();- x.fillStyle = '#3e2414'; x.lineWidth = .006; x.strokeStyle = '#3e2414'; x.beginPath(); x.roundRect(WN[0] - WW / 2, WN[1] - WH / 2, WW, WH, .014); x.stroke();- x.fillRect(WN[0] - WW / 2, WN[1] - .002, WW, .003); // window's horizontal frame bar- // Curtains (tied back at both sides)- x.fillStyle = '#2f5a48';- for (const s of [-1, 1]) { x.beginPath(); x.moveTo(s * (WW / 2 + .01), WN[1] + WH / 2 + .01); x.lineTo(s * (WW / 2 - .02), WN[1] + WH / 2 + .01); x.quadraticCurveTo(s * (WW / 2 - .012), WN[1], s * (WW / 2 + .005), WN[1] - .03); x.quadraticCurveTo(s * (WW / 2 + .012), WN[1] - .06, s * (WW / 2 + .03), WN[1] - .065); x.lineTo(s * (WW / 2 + .03), WN[1] + WH / 2 + .01); x.closePath(); x.fill(); }- x.fillStyle = '#e8d9a8'; for (const s of [-1, 1]) x.fillRect(s * (WW / 2 + .004) - .008, WN[1] - .032, .016, .004);- } }));- // Little table + gift box + teacup- const tbl = S.add(sheet({ U, w: .5, h: .3, z: -.048, trans: .05, draw: x => { x.fillStyle = '#2e1a0e'; x.fillRect(-.12, -.035, .24, .008); x.fillRect(-.004, -.15, .008, .12); x.beginPath(); x.moveTo(-.06, -.043); x.lineTo(.06, -.043); x.lineTo(.004, -.07); x.lineTo(-.004, -.07); x.fill(); } }));- const box = S.add(sheet({ U, w: .1, h: .06, x: -.03, y: -.008, z: -.046, trans: .15, draw: x => { boxFront(x, 0, -.02, .075, .036, '#9e2a20', '#d9a441'); x.fillStyle = '#9e2a20'; x.fillRect(-.04, .015, .08, .006); } }));- const cup = S.add(sheet({ U, w: .04, h: .05, x: .065, y: -.015, z: -.046, trans: .5, draw: x => { x.fillStyle = 'rgba(230,240,235,.9)'; x.beginPath(); x.moveTo(-.008, -.012); x.lineTo(.008, -.012); x.lineTo(.01, .014); x.lineTo(-.01, .014); x.fill(); x.fillStyle = '#b8862e'; x.fillRect(-.009, -.01, .018, .016); } }));- S.add(sheet({ U, w: .52, h: .32, z: -.015, trans: .03, draw: x => { x.fillStyle = '#150b05'; x.beginPath(); x.roundRect(-.26, -.16, .07, .22, .02); x.fill(); x.beginPath(); x.roundRect(.19, -.16, .07, .24, .02); x.fill(); x.fillStyle = '#e8dcc2'; x.fillRect(.195, .03, .06, .035); } }));- return {- S,- update(t) {- far.material.map.offset.x = t * .012; near.material.map.offset.x = t * .16; poles.material.map.offset.x = t * .35;- const rock = Math.sin(t * 7.5) * .5 + Math.sin(t * 13.1) * .3;- box.rotation.z = .012 * rock; box.position.y = -.008 + .0006 * Math.abs(Math.sin(t * 9)); cup.position.y = -.015 + .0005 * Math.abs(Math.sin(t * 9 + 1));- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(.0, -.02, u), lerp(.0, -.005, u) + .0006 * Math.sin(t * 8), lerp(.36, .27, u), lerp(.005, -.02, u), lerp(.01, .0, u), -.06], t, { roll: .004 * Math.sin(t * 3.1), hand: .0008 });- },- post() { return { focus: S.cam.position.z + .046, aper: 16, maxCoc: 14, bloom: { strength: .35, radius: .6, threshold: 1.2 } }; },- grade() { return { expo: 1.0, vig: .5, sat: 1.0, contrast: .1, lift: [.012, .006, 0], gain: [1.03, 1, .95] }; }, // keep the carriage interior warm (the same values S06 leaves in effect, written out explicitly here instead of inherited)- };-}diff --git a/styles/paper-lantern/demo/src/shots/s09_change.js b/styles/paper-lantern/demo/src/shots/s09_change.jsdeleted file mode 100644index 710d980..0000000--- a/styles/paper-lantern/demo/src/shots/s09_change.js+++ /dev/null@@ -1,81 +0,0 @@-// S9 · Chang'e: Chang'e and her streamers flying past the big moon, the Jade Rabbit on the clouds; the camera tilts down to the human world, people on a rooftop looking up at the moon-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon, paperMat, tex, paint } from '../paper.js';-import { osmanthus, xiangyun, jiangnanHouse, lantern, reeds, ridge, FONT } from '../art.js';-import { change, rabbit, ribbon, childStand, grannyStand, girlStand } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--// Streamer mesh: a long thin strip along x, vertices updated every frame by a wave-function ribbonMesh(U, len, w, col) {- const geo = new THREE.PlaneGeometry(len, w, 48, 1); geo.translate(-len / 2, 0, 0);- const c = paint(len, w, x => { x.fillStyle = col; x.fillRect(-len / 2, -w / 2, len, w); }, 2000);- const m = new THREE.Mesh(geo, paperMat(tex(c), U, { trans: .5 })); m.material.side = THREE.DoubleSide; m.castShadow = true;- const base = geo.attributes.position.array.slice();- m.userData.wave = (t, amp, k, sp, ph) => {- const p = geo.attributes.position.array;- for (let i = 0; i < p.length; i += 3) {- const u = -base[i] / len, taper = 1 - .75 * u;- p[i] = base[i]; p[i + 1] = base[i + 1] * taper + amp * u * Math.sin(k * u * TAU - t * sp + ph) - u * u * amp * .6;- }- geo.attributes.position.needsUpdate = true;- };- return m;-}--export function build(E) {- const MN = [0, .075, -.13];- const S = stage({ light: MN, lightR: .13, lightCol: '#ffe8bc', key: .8, amb: .3, ambCol: '#8a9cc8', keyCol: '#d6dcff' });- const { U } = S;- S.add(skyPanel({ w: .7, h: .6, y: -.05, z: -.145, stops: [[0, '#0a1230'], [.45, '#16285a'], [.8, '#2a3f72'], [1, '#3a4f80']], stars: 320 }));- const mn = S.add(moon({ x: MN[0], y: MN[1], z: MN[2], r: .08, gain: 1.35, halo: 2.4, haloGain: .22, art: x => {- x.globalCompositeOperation = 'source-atop'; x.fillStyle = 'rgba(200,160,110,.28)';- osmanthus(x, { cx: .035, by: -.075, h: .07, seed: 7, leaves: 25, cut: true });- x.fillRect(-.07, -.062, .08, .012); x.beginPath(); x.moveTo(-.075, -.05); x.quadraticCurveTo(-.03, -.035, .015, -.05); x.lineTo(.005, -.045); x.lineTo(-.065, -.045); x.fill(); // Guanghan Palace (广寒宫, the moon palace)- x.fillRect(-.055, -.05, .04, .01); x.beginPath(); x.moveTo(-.062, -.04); x.quadraticCurveTo(-.035, -.03, -.008, -.04); x.fill();- } }));- const clouds = S.add(sheet({ U, w: .7, h: .5, y: -.02, z: -.115, trans: .85, draw: x => { x.fillStyle = '#c3cbe8'; xiangyun(x, -.09, .02, .012, 1, { tail: 3 }); xiangyun(x, .1, .005, .011, -1, { tail: 2.6 }); xiangyun(x, -.2, .1, .008, 1); xiangyun(x, .21, .12, .007, -1); } }));- const bunny = S.add(sheet({ U, w: .08, h: .06, x: .085, y: .02, z: -.108, trans: .3, draw: x => { x.fillStyle = '#e9e2d0'; x.translate(0, -.015); rabbit(x, .03); x.fillStyle = '#b89a6a'; x.fillRect(.012, 0, .012, .008); } }));- // Chang'e + two streamers- const ce = new THREE.Group(); S.scene.add(ce);- const body = sheet({ U, w: .2, h: .16, trans: .25, draw: x => { x.fillStyle = '#231c3a'; change(x, .115); } });- const rb1 = ribbonMesh(U, .17, .006, '#b8322a'), rb2 = ribbonMesh(U, .14, .005, '#d9a441');- rb1.position.set(.0, .02, .001); rb2.position.set(-.006, .008, -.001);- ce.add(body, rb1, rb2);- // Human world: rooftops, lit windows, people looking up at the moon- const town = S.add(sheet({ U, w: .7, h: .3, y: -.085, z: -.07, trans: .3, glow: 2, glowCol: '#ffb862', draw: x => drawTown(x, null), glowDraw: g => drawTown(null, g) }));- const people = S.add(sheet({ U, w: .7, h: .3, y: -.06, z: -.05, trans: .1, glow: 1.5, glowCol: '#ff8a48', draw: x => {- x.fillStyle = '#141c38'; x.fillRect(-.35, -.15, .7, .06);- // A family on the rooftop terrace: Grandma pointing at the moon, a child- x.fillRect(-.15, -.09, .12, .004);- x.save(); x.translate(-.12, -.086); grannyStand(x, .045); x.restore();- x.save(); x.translate(-.095, -.086); childStand(x, .026); x.restore();- x.save(); x.translate(.14, -.09); girlStand(x, .045); x.restore();- x.save(); x.translate(.17, -.09); x.scale(-1, 1); girlStand(x, .042); x.restore();- lantern(x, { cx: -.02, cy: -.05, r: .006, stringLen: .03 }); lantern(x, { cx: .03, cy: -.045, r: .005, stringLen: .03 });- x.strokeStyle = '#141c38'; reeds(x, { x0: -.35, x1: .35, by: -.095, h: .02, n: 50, seed: 9 });- }, glowDraw: g => { const o = { col: '#000', rib: '#000', cap: '#000', string: false, tassel: false }; lantern(g, { ...o, cx: -.02, cy: -.05, r: .006 }, g); lantern(g, { ...o, cx: .03, cy: -.045, r: .005 }, g); } }));- const tDown = E.word('L13', 24) - .4; // “好让地上想家的人” ("so that those on earth who miss home")- return {- S,- update(t) {- const fl = clamp(t / (tDown + 1));- ce.position.set(lerp(-.09, .07, eio(fl)), .07 + lerp(-.02, .02, fl) + .004 * Math.sin(t * 1.3), -.09); ce.rotation.z = .12 + .03 * Math.sin(t * .9);- rb1.userData.wave(t, .016, 1.2, 3.2, 0); rb2.userData.wave(t, .013, 1.4, 3.6, 1.5);- bunny.position.y = .02 + .003 * Math.sin(t * 1.7); clouds.position.x = t * .002;- const dn = eio(seg(t, tDown, E.dur - .2));- aim(S.cam, [lerp(-.02, 0, fl), lerp(.07, -.12, dn), lerp(.34, .44, dn), lerp(-.01, 0, fl), lerp(.07, -.08, dn), -.1], t);- },- post() { return { focus: lerp(.44, S.cam.position.z + .06, 1), aper: 12, maxCoc: 12, bloom: { strength: .35, radius: .6, threshold: 1.25 } }; },- grade() { return { expo: 1.05, vig: .45, sat: 1.02, contrast: .1 }; },- };- function drawTown(x, g) {- const R = mulberry(4), c = x || g;- if (x) { x.fillStyle = '#26345e'; ridge(x, { x0: -.35, x1: .35, base: -.02, amp: .004, seed: 1, freq: 30 }); }- for (let i = 0; i < 14; i++) {- const cx = -.33 + i * .05 + R() * .01, w = .036 + R() * .014, h = .02 + R() * .02, by = -.05 + R() * .01;- const wins = [[w * .2, h * .35, w * .15, h * .3], [w * .62, h * .35, w * .15, h * .3]];- jiangnanHouse(x, { cx, by, w, h, windows: wins, wall: '#3b4e80', tile: '#1b284f' }, g);- }- }-}diff --git a/styles/paper-lantern/demo/src/shots/s10_pass.js b/styles/paper-lantern/demo/src/shots/s10_pass.jsdeleted file mode 100644index a530fa4..0000000--- a/styles/paper-lantern/demo/src/shots/s10_pass.js+++ /dev/null@@ -1,64 +0,0 @@-// S10 · Passing each other: two night trains meet; another box (“外婆 收”, "To: Grandma") flashes past in the opposite train's window; time slows at the moment they pass-import * as THREE from 'three';-import { sheet, skyPanel, moon, text } from '../paper.js';-import { karst, ridge, FONT } from '../art.js';-import { boxFront } from '../props.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, lerp, clamp, mulberry, TAU } from '../lib.js';--// Carriage side: windows cut out (you can see inside); inner=true draws the carriage interior (warm light + seat backs)-export function carriage(x, n, cw, ch, col, inner, g) {- for (let i = 0; i < n; i++) {- const L = -n * cw / 2 + i * cw;- if (inner) {- if (g) { g.fillStyle = '#fff'; g.fillRect(L, -ch * .12, cw, ch * .5); continue; }- x.fillStyle = '#e9b86c'; x.fillRect(L, -ch * .12, cw, ch * .5);- x.fillStyle = '#9a5a2a'; for (let k = 0; k < 4; k++) { x.beginPath(); x.roundRect(L + cw * (.06 + k * .23), -ch * .12, cw * .06, ch * .26, ch * .03); x.fill(); }- continue;- }- x.fillStyle = col; x.beginPath(); x.roundRect(L + cw * .01, -ch / 2, cw * .98, ch, ch * .08); x.fill();- x.fillStyle = '#e8d9a8'; x.fillRect(L, -ch * .22, cw, ch * .035); x.fillStyle = 'rgba(0,0,0,.25)'; x.fillRect(L + cw * .01, ch * .42, cw * .98, ch * .08);- x.save(); x.globalCompositeOperation = 'destination-out'; x.fillStyle = '#000';- for (let k = 0; k < 4; k++) x.fillRect(L + cw * (.09 + k * .23), -ch * .08, cw * .15, ch * .42);- x.restore();- }-}--const erf = x => { const s = Math.sign(x), a = Math.abs(x), t = 1 / (1 + .3275911 * a); return s * (1 - (((((1.061405429 * t - 1.453152027) * t) + 1.421413741) * t - .284496736) * t + .254829592) * t * Math.exp(-a * a)); };--export function build(E) {- const S = stage({ light: [.08, .08, -.14], lightR: .2, lightCol: '#e0e6ff', key: .9, amb: .28, ambCol: '#7d90c8', keyCol: '#d6dcff' });- const { U } = S;- S.add(skyPanel({ w: .7, h: .4, z: -.15, stops: [[0, '#0a1330'], [.6, '#1a2d5c'], [1, '#34497c']], stars: 150 }));- S.add(moon({ x: .1, y: .085, z: -.145, r: .022, gain: 1.8, halo: 4, haloGain: .3 }));- S.add(sheet({ U, w: .8, h: .4, z: -.13, trans: .6, draw: x => { x.fillStyle = '#4f6aa2'; const R = mulberry(9), pk = []; for (let u = -.4; u < .4; u += .04 + R() * .02) pk.push([u, .015 + R() * .03, .018]); karst(x, { x0: -.4, x1: .4, base: .0, peaks: pk, carve: .0005 }); } }));- // The opposite train (southbound, speeding left), with a blue gift box in the window- const CW = .11, CH = .05, NC = 10, K = 1.45;- const farIn = S.add(sheet({ U, w: CW * NC, h: .08, y: .035, z: -.106, trans: .3, glow: .9, glowCol: '#ffc36a', ppm: 3000, draw: x => carriage(x, NC, CW, CH, '', true), glowDraw: g => carriage(null, NC, CW, CH, '', true, g) }));- const far = S.add(sheet({ U, w: CW * NC, h: .08, y: .035, z: -.1, trans: .15, ppm: 3600, draw: x => carriage(x, NC, CW, CH, '#1d4a3a', false) }));- const otherBox = S.add(sheet({ U, w: .03, h: .03, y: .03, z: -.103, trans: .2, draw: x => { boxFront(x, 0, -.008, .022, .012, '#2a4f7a', '#e0c070'); x.fillStyle = '#f2ead6'; x.save(); x.rotate(-.05); x.fillRect(.0, -.005, .009, .006); x.restore(); text(x, '外婆收', .0045, -.002, .0016, FONT.hand, { fill: '#2a1a12' }); } }));- // Near: our train (northbound), the red gift box in the window- const nearIn = S.add(sheet({ U, w: CW * K * 8, h: .13, y: -.06, z: -.058, trans: .3, glow: .9, glowCol: '#ffc36a', ppm: 3600, draw: x => carriage(x, 8, CW * K, CH * K, '', true), glowDraw: g => carriage(null, 8, CW * K, CH * K, '', true, g) }));- const near = S.add(sheet({ U, w: CW * K * 8, h: .13, y: -.06, z: -.05, trans: .1, ppm: 4200, draw: x => carriage(x, 8, CW * K, CH * K, '#1f5140', false) }));- const myBox = S.add(sheet({ U, w: .05, h: .04, y: -.065, z: -.054, trans: .2, draw: x => { boxFront(x, 0, -.01, .034, .017, '#9e2a20', '#d9a441'); x.fillStyle = '#f2ead6'; x.save(); x.rotate(.04); x.fillRect(.003, -.007, .012, .009); x.restore(); } }));- S.add(sheet({ U, w: .8, h: .4, z: -.02, trans: .03, draw: x => { x.fillStyle = '#070c1c'; x.fillRect(-.4, -.2, .8, .065); for (let i = 0; i < 12; i++) x.fillRect(-.4 + i * .07, -.14, .004, .03); } }));- const tMeet = E.cue('L14') + 1.0; // “擦肩而过” ("pass each other by")- // Our carriage: almost still relative to the camera; opposite train: fast first, slow at the meeting, then fast again- const myWin = { x: -CW * K * 8 / 2 + 4 * CW * K + CW * K * (.09 + 1 * .23) + CW * K * .075 };- return {- S,- update(t) {- const drift = t * .004;- near.position.x = nearIn.position.x = -myWin.x - drift; myBox.position.x = near.position.x + myWin.x; near.position.y = nearIn.position.y = -.06 + .0007 * Math.sin(t * 9); myBox.position.y = -.057 + .0007 * Math.sin(t * 9);- // Opposite train: with the meeting instant as 0, speed drops to 12% near the meeting (time slows) —— position = integral of the speed curve- const dt = t - tMeet, sg = .35, F = dt - .88 * sg * Math.sqrt(Math.PI / 2) * erf(dt / (sg * Math.SQRT2));- const bl = -CW * NC / 2 + 5 * CW + CW * (.09 + 2 * .23) + CW * .075;- const fx = -bl - drift - .42 * F;- far.position.x = farIn.position.x = fx; otherBox.position.x = fx + bl;- otherBox.position.y = .04 + .0007 * Math.sin(t * 9 + 1);- aim(S.cam, [-.002 - drift * .3, -.02, .34, -.002 - drift * .3, -.012, -.08], t, { hand: .0008 });- },- post() { return { focus: S.cam.position.z + .07, aper: 16, maxCoc: 16, bloom: { strength: .38, radius: .6, threshold: 1.1 } }; },- grade(t) { return { expo: 1.02, vig: .45, sat: 1.02, contrast: .1 }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s11_city.js b/styles/paper-lantern/demo/src/shots/s11_city.jsdeleted file mode 100644index 36ac593..0000000--- a/styles/paper-lantern/demo/src/shots/s11_city.js+++ /dev/null@@ -1,64 +0,0 @@-// S11 · Xiaoman's city: high-rises rising layer by layer, lights very bright, the moon far away and faint-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon } from '../paper.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, back, lerp, clamp, mulberry, TAU } from '../lib.js';--// A row of buildings: random heights, flat/spire/stepped tops; window grid (the glow version draws only the lit windows)-export function towers(x, g, o) {- const R = mulberry(o.seed || 1), c = x || g;- let px = o.x0;- while (px < o.x1) {- const w = o.wmin + R() * (o.wmax - o.wmin), h = o.hmin + R() * (o.hmax - o.hmin), top = o.by + h, kind = R();- if (x) {- x.fillStyle = o.col; x.fillRect(px, o.by - .2, w, h + .2);- if (kind < .25) { x.fillRect(px + w * .2, top, w * .6, h * .06); x.fillRect(px + w * .47, top + h * .06, w * .06, h * .12); }- else if (kind < .45) { x.beginPath(); x.moveTo(px, top); x.lineTo(px + w / 2, top + w * .5); x.lineTo(px + w, top); x.fill(); }- else if (kind < .6) { x.fillRect(px + w * .15, top, w * .7, h * .05); x.fillRect(px + w * .3, top + h * .05, w * .4, h * .04); }- }- const cols = Math.max(2, Math.round(w / o.cell)), rows = Math.round(h / (o.cell * 1.4));- for (let r = 1; r < rows; r++) for (let k = 0; k < cols; k++) {- const lit = R() < o.lit, wx = px + (k + .25) / cols * w, wy = o.by + r / rows * h, ww = w / cols * .5, wh = o.cell * .6;- if (g) { if (lit) { g.fillStyle = R() < .15 ? '#9fe' : '#fff'; g.fillRect(wx, wy, ww, wh); } }- else { x.fillStyle = lit ? (R() < .15 ? '#bfe6ff' : o.win) : o.dark; x.fillRect(wx, wy, ww, wh); }- }- if (o.neon && R() < .3 && g) { g.fillStyle = R() < .5 ? '#ff5fa0' : '#5ff0ff'; g.fillRect(px + w * .1, o.by + h * .6, w * .8, o.cell * .5); }- if (o.neon && x && R() < .3) { x.fillStyle = R() < .5 ? '#ff7fb0' : '#7ff0ff'; x.fillRect(px + w * .1, o.by + h * .6, w * .8, o.cell * .5); }- px += w + o.gap * R();- }-}--export function build(E) {- const MN = [.12, .1, -.14];- const S = stage({ light: [0, -.02, -.14], lightR: .2, lightCol: '#c9b8ff', key: .8, amb: .3, ambCol: '#8a86c8', keyCol: '#d8d4ff' });- const { U } = S;- S.add(skyPanel({ w: .7, h: .5, y: .03, z: -.15, stops: [[0, '#150f2e'], [.5, '#2a2152'], [.85, '#4a3a6e'], [1, '#6a4a70']], stars: 25 }));- const mn = S.add(moon({ x: MN[0], y: MN[1], z: MN[2], r: .013, gain: .9, halo: 3, haloGain: .12, core: '#f4ecdc', mid: '#e8dcc8', edge: '#d8c8b0' }));- // Smog band- const haze = S.add(sheet({ U, w: .7, h: .4, z: -.13, trans: .9, shadow: false, recv: false, finish: { rim: 0, under: 0 }, draw: x => { const gr = x.createLinearGradient(0, .04, 0, -.06); gr.addColorStop(0, 'rgba(160,130,190,0)'); gr.addColorStop(.6, 'rgba(160,130,190,.35)'); gr.addColorStop(1, 'rgba(160,130,190,.1)'); x.fillStyle = gr; x.fillRect(-.35, -.2, .7, .4); } }));- haze.material.transparent = true; haze.material.alphaToCoverage = false; haze.material.alphaTest = .005; haze.material.depthWrite = false;- const rows = [- { z: -.12, col: '#4a3f7a', win: '#e8d0a0', dark: '#3e346a', seed: 3, hmin: .06, hmax: .15, wmin: .02, wmax: .04, cell: .004, lit: .3, trans: .5, glow: 1.2 },- { z: -.1, col: '#342b5e', win: '#f2cf8a', dark: '#2b2350', seed: 7, hmin: .05, hmax: .13, wmin: .025, wmax: .05, cell: .005, lit: .35, trans: .3, glow: 1.6, neon: true },- { z: -.08, col: '#231c44', win: '#f7d38f', dark: '#1d173a', seed: 11, hmin: .04, hmax: .11, wmin: .03, wmax: .06, cell: .006, lit: .4, trans: .2, glow: 2, neon: true },- { z: -.06, col: '#161230', win: '#fbd797', dark: '#120f28', seed: 17, hmin: .03, hmax: .08, wmin: .035, wmax: .07, cell: .007, lit: .45, trans: .1, glow: 2.2, neon: true },- ];- const layers = rows.map((r, i) => S.add(sheet({ U, w: .7, h: .4, z: r.z, trans: r.trans, glow: r.glow, glowCol: '#ffd08a', ppm: 4400,- draw: x => towers(x, null, { ...r, x0: -.35, x1: .35, by: -.07 - i * .012, gap: .006 }), glowDraw: g => towers(null, g, { ...r, x0: -.35, x1: .35, by: -.07 - i * .012, gap: .006 }), glowRes: .8 })));- // Elevated road and light streaks of traffic- const road = S.add(sheet({ U, w: .7, h: .4, z: -.04, trans: .1, glow: 2.5, glowCol: '#ffffff', draw: x => { x.fillStyle = '#0c0a1e'; x.fillRect(-.35, -.2, .7, .1); x.fillRect(-.35, -.1, .7, .006); for (let i = 0; i < 10; i++) x.fillRect(-.33 + i * .075, -.2, .008, .1); },- glowDraw: g => { const R = mulberry(2); for (let i = 0; i < 40; i++) { const px = -.35 + R() * .7, w = .01 + R() * .03; g.fillStyle = R() < .5 ? '#ff6040' : '#fff4d0'; g.fillRect(px, -.093 + (R() < .5 ? 0 : .002), w, .0012); } } }));- return {- S,- update(t) {- // the buildings rise in turn from bottom to top (feel of a pop-up book)- layers.forEach((m, i) => { const k = back(seg(t, .1 + i * .28, .9 + i * .28), 1.2); m.position.y = -.16 * (1 - k); });- road.material.emissiveMap.wrapS = THREE.RepeatWrapping; road.material.emissiveMap.offset.x = -t * .05;- setMoon(mn, .9 + .1 * Math.sin(t * .7));- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.02, .03, u), lerp(-.04, .02, u), lerp(.36, .4, u), lerp(-.01, .06, u), lerp(-.04, .05, u), -.1], t);- },- post() { return { focus: S.cam.position.z + .08, aper: 12, maxCoc: 12, bloom: { strength: .5, radius: .6, threshold: 1.0 } }; },- grade() { return { expo: 1.05, vig: .45, sat: 1.05, contrast: .12, lift: [.006, .0, .02], gain: [.98, .98, 1.03] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s12_apartment.js b/styles/paper-lantern/demo/src/shots/s12_apartment.jsdeleted file mode 100644index d7f7ea5..0000000--- a/styles/paper-lantern/demo/src/shots/s12_apartment.js+++ /dev/null@@ -1,60 +0,0 @@-// S12 · Xiaoman comes back to her apartment after working late: the city outside the window, the box Grandma sent on the table; she lifts the lid and warm light pours out-import * as THREE from 'three';-import { burst, sheet, skyPanel, moon } from '../paper.js';-import { boxFront } from '../props.js';-import { girlSit, arm, GIRL_SHOULDER } from '../people.js';-import { chair } from '../props.js';-import { towers } from './s11_city.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--export function cityWindow(S, o = {}) { // big window on the wall + city outside it (shared by S12/S14)- const { U } = S, WX = o.wx ?? -.09, WY = o.wy ?? .045, WW = o.ww ?? .2, WH = o.wh ?? .13;- S.add(skyPanel({ w: .6, h: .36, z: -.15, stops: [[0, '#150f2e'], [.6, '#2a2152'], [1, '#5a4270']], stars: 20 }));- const mn = S.add(moon({ x: WX + WW * .3, y: WY + WH * .32, z: -.145, r: .01, gain: 1.1, halo: 3, haloGain: .15, core: '#f4ecdc', mid: '#e8dcc8', edge: '#d8c8b0' }));- const city = S.add(sheet({ U, w: .6, h: .36, z: -.13, trans: .4, glow: 1.4, glowCol: '#ffd08a', ppm: 3600, draw: x => towers(x, null, { x0: -.3, x1: .3, by: WY - WH / 2 - .01, col: '#2e2656', win: '#f2cf8a', dark: '#262048', seed: 5, hmin: .03, hmax: .1, wmin: .015, wmax: .03, cell: .003, lit: .35, gap: .004, neon: true }), glowDraw: g => towers(null, g, { x0: -.3, x1: .3, by: WY - WH / 2 - .01, col: '', seed: 5, hmin: .03, hmax: .1, wmin: .015, wmax: .03, cell: .003, lit: .35, gap: .004, neon: true }), glowRes: .8 }));- const wall = S.add(sheet({ U, w: .6, h: .36, z: -.1, trans: .6, draw: x => {- x.fillStyle = o.wall || '#7e76a0'; x.fillRect(-.3, -.18, .6, .36);- x.save(); x.globalCompositeOperation = 'destination-out'; x.fillRect(WX - WW / 2, WY - WH / 2, WW, WH); x.restore();- x.fillStyle = '#23203a'; x.lineWidth = .004; x.strokeStyle = '#23203a'; x.strokeRect(WX - WW / 2, WY - WH / 2, WW, WH); x.fillRect(WX - .0015, WY - WH / 2, .003, WH);- x.fillStyle = '#6c6890'; x.fillRect(WX - WW / 2 - .01, WY - WH / 2 - .008, WW + .02, .006); // windowsill- } }));- return { mn, city, wall, W: [WX, WY, WW, WH] };-}--export function build(E) {- const S = stage({ light: [.14, .02, -.08], lightR: .12, lightCol: '#ffcf96', key: 1.0, amb: .25, ambCol: '#8a86c8', keyCol: '#ffe0bc', keyPos: [.08, .28, .26] });- const { U } = S;- const CW = cityWindow(S);- // Desk lamp + table + chair- S.add(sheet({ U, w: .6, h: .36, z: -.075, trans: .15, glow: 2.6, glowCol: '#ffc878', draw: x => {- x.fillStyle = '#1e1a30'; x.fillRect(.19, -.03, .004, .07); x.beginPath(); x.moveTo(.17, .05); x.lineTo(.215, .05); x.lineTo(.2, .075); x.lineTo(.185, .075); x.closePath(); x.fill(); x.fillRect(.18, -.032, .03, .004);- x.fillStyle = '#ffe2a8'; x.beginPath(); x.ellipse(.1925, .049, .02, .003, 0, 0, TAU); x.fill();- }, glowDraw: g => { g.fillStyle = '#fff'; g.beginPath(); g.ellipse(.1925, .049, .02, .003, 0, 0, TAU); g.fill(); } }));- const GX = -.02, GY = -.07, GS = .16;- const girl = S.add(sheet({ U, w: .6, h: .36, z: -.06, trans: .06, draw: x => { x.fillStyle = '#16132a'; chair(x, GX - .01, -.165, .1, 1); x.translate(GX, GY); girlSit(x, GS); } }));- const sh = [GX + GIRL_SHOULDER[0] * GS, GY + (GIRL_SHOULDER[1] - .5) * GS];- const armS = S.add(sheet({ U, w: .14, h: .14, x: sh[0], y: sh[1], z: -.0595, trans: .06, draw: x => { x.fillStyle = '#16132a'; arm(x, GS, -.2, .25, { w: .04 }); } }));- S.add(sheet({ U, w: .6, h: .36, z: -.052, trans: .05, draw: x => { x.fillStyle = '#1a1628'; x.fillRect(.0, -.032, .26, .007); x.fillRect(.02, -.18, .006, .15); x.fillRect(.23, -.18, .006, .15);- x.fillStyle = '#2a2640'; x.save(); x.translate(.2, -.025); x.fillRect(-.028, 0, .045, .003); x.rotate(-1.35); x.fillRect(0, 0, .028, .002); x.restore(); } })); // table + laptop- const box = S.add(sheet({ U, w: .08, h: .04, x: .1, y: -.014, z: -.05, trans: .2, draw: x => boxFront(x, 0, -.011, .06, .025, '#9e2a20', '#d9a441') }));- const lid = S.add(sheet({ U, recv: false, shadow: false, w: .08, h: .02, x: .1, y: .0015, z: -.049, trans: .2, draw: x => { x.fillStyle = '#9e2a20'; x.fillRect(-.032, -.004, .064, .008); x.fillStyle = '#d9a441'; x.fillRect(-.03, -.001, .06, .0015); } }));- // Warm light pouring out of the box (additive light beam)- const glow = burst(.1, .07);- glow.position.set(.1, .033, -.0505); S.scene.add(glow);- S.add(sheet({ U, w: .62, h: .38, z: -.015, trans: .03, draw: x => { x.fillStyle = '#0c0a18'; x.fillRect(-.31, -.19, .62, .03); x.beginPath(); x.moveTo(.31, .19); x.lineTo(.24, .19); x.quadraticCurveTo(.26, .0, .25, -.19); x.lineTo(.31, -.19); x.fill(); } }));- const tOpen = E.word('L16', 6) - .1; // “拆开盒子” ("opens the box")- return {- S,- update(t) {- const op = eio(seg(t, tOpen, tOpen + .8));- armS.rotation.z = lerp(0, .35, ss(seg(t, tOpen - .8, tOpen))) - .1 * op;- lid.position.set(.1 + op * .03, .0015 + op * .012, -.049); lid.rotation.z = -op * .18;- const gk = ss(seg(t, tOpen + .2, tOpen + 1.2)); glow.userData.set(gk * 1.1); glow.scale.set(1, .6 + .4 * gk, 1);- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.02, .05, u), lerp(.0, -.01, u), lerp(.4, .3, u), lerp(-.01, .06, u), lerp(-.005, -.012, u), -.07], t);- },- post() { return { focus: S.cam.position.z + .055, aper: 16, maxCoc: 14, bloom: { strength: .42, radius: .6, threshold: 1.05 } }; },- grade() { return { expo: 1.02, vig: .5, sat: 1.0, contrast: .1, lift: [.006, 0, .018], gain: [1, .99, 1.02] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s13_note.js b/styles/paper-lantern/demo/src/shots/s13_note.jsdeleted file mode 100644index a86a0d5..0000000--- a/styles/paper-lantern/demo/src/shots/s13_note.js+++ /dev/null@@ -1,70 +0,0 @@-// S13 / S16b · Top shot inside the box: mooncake + note slip, the handwriting written out column by column / line by line-// variant 'gran': Grandma's vertical xingshu (行书, running-script) handwriting; 'girl': Xiaoman's horizontal handwriting + a crooked “外婆” (Grandma) mooncake-import * as THREE from 'three';-import { sheet, text, vtext } from '../paper.js';-import { FONT } from '../art.js';-import { cakeFace } from './s03_press.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--// Paper strips "written out" line by line / column by column: anchor on the edge where writing starts, scale + texture clipping (glyphs are not squashed)-function reveal(m, k, axis) {- const map = m.material.map; k = Math.max(.001, k);- if (axis === 'y') { m.scale.y = k; map.repeat.y = k; map.offset.y = 1 - k; }- else { m.scale.x = k; map.repeat.x = k; map.offset.x = 0; }-}--export function build(E, V = 'gran') {- const girl = V === 'girl';- const S = stage({ light: [0, 0, -.06], lightR: .2, lightCol: '#ffd9a8', key: 1.35, amb: .3, ambCol: girl ? '#d0a070' : '#b89ac8', keyCol: '#ffe6c4', keyPos: [-.1, .2, .3], keyTarget: [0, 0, -.06], shadowR: 8 });- const { U } = S;- const boxCol = girl ? '#2a4f7a' : '#9e2a20', lining = girl ? '#f1ece0' : '#c99a4a';- // Inside the box (top view): box walls + lining paper- S.add(sheet({ U, w: .5, h: .32, z: -.07, trans: .2, draw: x => {- x.fillStyle = girl ? '#6a4a36' : '#3a3050'; x.fillRect(-.25, -.16, .5, .32); // tabletop- x.fillStyle = boxCol; x.fillRect(-.19, -.11, .38, .22);- x.fillStyle = lining; x.fillRect(-.175, -.095, .35, .19);- if (!girl) { x.strokeStyle = '#a87a30'; x.lineWidth = .0008; for (let i = 0; i < 12; i++) { x.beginPath(); x.moveTo(-.175, -.095 + i * .016); x.lineTo(.175, -.095 + i * .016 + .01); x.stroke(); } }- else { x.fillStyle = 'rgba(0,0,0,.06)'; for (let i = 0; i < 30; i++) x.fillRect(-.175 + i * .012, -.095, .0008, .19); }- } }));- const cx = girl ? .085 : -.075;- const cake = S.add(sheet({ U, w: .1, h: .1, x: cx, y: -.005, z: -.064, trans: .1, envMap: E.env, envI: girl ? .6 : 1.1, metal: girl ? .15 : .55, rough: girl ? .5 : .34, bump: 8, bumpBlur: 2.5,- draw: x => cakeFace(x, .042, 'color', girl ? { base: '#c9924a', hi: '#e2b068', lo: '#8a5a2a', ch: '外婆', wobble: .07, petals: 11, seed: 5 } : { base: '#b8742c', hi: '#e9b25c', lo: '#6a3812' }),- bumpDraw: x => cakeFace(x, .042, 'bump', girl ? { ch: '外婆', wobble: .07, petals: 11, seed: 5 } : {}) }));- if (girl) cake.rotation.z = .25;- // Note slip- const NX = girl ? -.06 : .075, NW = girl ? .15 : .11, NH = girl ? .1 : .15;- const paper = S.add(sheet({ U, w: NW + .01, h: NH + .01, x: NX, y: .0, z: -.063, trans: .5, draw: x => {- x.fillStyle = girl ? '#fbf7ee' : '#f4ead2'; x.fillRect(-NW / 2, -NH / 2, NW, NH);- if (girl) { x.strokeStyle = '#a8c4e0'; x.lineWidth = .0006; for (let i = 0; i < 7; i++) { x.beginPath(); x.moveTo(-NW / 2 + .006, NH / 2 - .02 - i * .013); x.lineTo(NW / 2 - .006, NH / 2 - .02 - i * .013); x.stroke(); } }- else { x.fillStyle = 'rgba(192,57,43,.55)'; for (let i = 0; i < 5; i++) x.fillRect(-NW / 2 + .012 + i * .021, -NH / 2 + .008, .0006, NH - .016); }- x.fillStyle = 'rgba(0,0,0,.08)'; x.fillRect(-NW / 2, -.0004, NW, .0008); // crease- } }));- paper.rotation.z = girl ? -.05 : .04;- // Text: one paper strip per column/line, written out in turn- const lines = girl- ? [['外婆,', -.052, .03, .0105], ['今年换我给你做。', -.052, .017, .0105], ['— 小满', .02, -.022, .0085]]- : [['月亮圆了,', .036, .06, .0135], ['就算你回过家了。', .014, .06, .0135], ['外婆', -.03, -.03, .01]];- const inks = lines.map(([s, lx, ly, sz], i) => {- const vert = !girl, len = [...s].length * sz * (vert ? 1.08 : 1.0), wv = vert ? sz * 1.4 : len + sz, hv = vert ? len + sz : sz * 1.6;- const m = S.add(sheet({ U, w: wv, h: hv, x: NX + (vert ? lx : lx + wv / 2), y: vert ? ly - hv / 2 : ly, z: -.0625, ax: vert ? 0 : -wv / 2, ay: vert ? hv / 2 : 0, trans: .3, shadow: false, finish: { rim: 0, under: 0, grain: false },- draw: x => vert ? vtext(x, s, 0, hv / 2 - sz * .6, sz, FONT.xing, { fill: '#2a170c', gap: 1.08 }) : text(x, s, -wv / 2 + sz * .1, 0, sz, FONT.hand, { fill: '#27405e', align: 'left' }) }));- m.rotation.z = paper.rotation.z; return m;- });- // A little moon drawn on Xiaoman's note- let doodle = null;- if (girl) doodle = S.add(sheet({ U, w: .03, h: .03, x: NX + .05, y: -.03, z: -.0625, trans: .3, shadow: false, finish: { rim: 0, under: 0, grain: false }, draw: x => { x.strokeStyle = '#d98a2a'; x.lineWidth = .0012; x.beginPath(); x.arc(0, 0, .008, 0, TAU); x.stroke(); x.fillStyle = '#d98a2a'; for (let i = 0; i < 8; i++) { const a = i / 8 * TAU; x.fillRect(Math.cos(a) * .012 - .0006, Math.sin(a) * .012 - .0006, .0012, .0012); } } }));- const id = girl ? 'L20' : 'L17', t0 = E.cue(id) + (girl ? 3.3 : -.1), per = girl ? .8 : .85;- return {- S,- update(t) {- inks.forEach((m, i) => reveal(m, eo(seg(t, t0 + i * per, t0 + i * per + per * 1.05)), girl ? 'x' : 'y'));- if (doodle) doodle.scale.setScalar(Math.max(.001, eo(seg(t, t0 + 3 * per, t0 + 3 * per + .5))));- const u = eio(clamp(t / E.dur));- const fx = girl ? lerp(.01, -.02, u) : lerp(NX * .5, NX * .7, u);- aim(S.cam, [fx, lerp(-.01, .0, u), lerp(girl ? .31 : .3, .24, u), fx, lerp(-.005, .004, u), -.064], t, { roll: lerp(girl ? -.06 : .06, 0, u) });- },- post() { return { focus: S.cam.position.z + .0625, aper: 14, maxCoc: 16, bloom: { strength: .3, radius: .5, threshold: 1.3 } }; },- grade() { return girl ? { expo: 1.02, vig: .5, sat: 1.02, contrast: .1, lift: [.012, .006, 0] } : { expo: 1.0, vig: .5, sat: 1.0, contrast: .1, lift: [.006, 0, .014] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s14_bite.js b/styles/paper-lantern/demo/src/shots/s14_bite.jsdeleted file mode 100644index 7607843..0000000--- a/styles/paper-lantern/demo/src/shots/s14_bite.js+++ /dev/null@@ -1,72 +0,0 @@-// S14 · Taking a bite: close-up of Xiaoman in profile; the city outside the window turns into her childhood: Grandma holding her hand under the osmanthus tree, looking at the moon; her eyes redden (a glint of tears)-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon } from '../paper.js';-import { osmanthus, karst, jiangnanHouse, FONT } from '../art.js';-import { girlStand, grannyStand, childStand, arm, GIRL_SHOULDER } from '../people.js';-import { cake3q } from '../props.js';-import { cakeFace } from './s03_press.js';-import { towers } from './s11_city.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--export function build(E) {- const S = stage({ light: [-.02, .06, -.12], lightR: .16, lightCol: '#ffe6c0', key: .9, amb: .22, ambCol: '#8a86c8', keyCol: '#ffe0bc', keyPos: [.1, .25, .26] });- const { U } = S;- const WX = .09, WY = .03, WW = .2, WH = .15;- S.add(skyPanel({ w: .5, h: .32, z: -.15, stops: [[0, '#150f2e'], [.6, '#2a2152'], [1, '#5a4270']], stars: 30 }));- const mn = S.add(moon({ x: WX + .03, y: WY + .045, z: -.145, r: .016, gain: 1.4, halo: 3.5, haloGain: .25 }));- const city = S.add(sheet({ U, w: .5, h: .32, z: -.13, trans: .4, glow: 1.4, glowCol: '#ffd08a', ppm: 3600, draw: x => towers(x, null, { x0: -.1, x1: .25, by: WY - WH / 2, col: '#2e2656', win: '#f2cf8a', dark: '#262048', seed: 8, hmin: .03, hmax: .09, wmin: .015, wmax: .03, cell: .003, lit: .35, gap: .004 }), glowDraw: g => towers(null, g, { x0: -.1, x1: .25, by: WY - WH / 2, col: '', seed: 8, hmin: .03, hmax: .09, wmin: .015, wmax: .03, cell: .003, lit: .35, gap: .004 }), glowRes: .8 }));- // Memory: warm-coloured old times (in front of the city, fading in)- const mem = S.add(sheet({ U, w: .5, h: .32, z: -.125, trans: .6, glow: 1.2, glowCol: '#ffc766', draw: x => {- const gr = x.createLinearGradient(0, WY + WH / 2, 0, WY - WH / 2); gr.addColorStop(0, '#6a4a70'); gr.addColorStop(1, '#c08a58'); x.fillStyle = gr; x.fillRect(WX - WW / 2, WY - WH / 2, WW, WH);- x.fillStyle = '#8a5a48'; karst(x, { x0: WX - WW / 2, x1: WX + WW / 2, base: WY - .02, peaks: [[WX - .06, .025, .02], [WX + .01, .035, .025], [WX + .07, .02, .02]] });- x.fillStyle = '#4a2a20'; x.fillRect(WX - WW / 2, WY - WH / 2, WW, .035);- osmanthus(x, { cx: WX - .05, by: WY - WH / 2 + .03, h: .09, flowers: '#e8b04a', seed: 4, leaves: 30, nFlowers: 40 });- x.fillStyle = '#4a2a20'; x.save(); x.translate(WX + .03, WY - WH / 2 + .033); grannyStand(x, .05); x.translate(.018, 0); childStand(x, .028); x.restore();- }, glowDraw: g => { g.fillStyle = '#000'; osmanthus(g, { cx: WX - .05, by: WY - WH / 2 + .03, h: .09, flowers: '#fff', seed: 4, leaves: 30, nFlowers: 40 }); } }));- mem.material.transparent = true; mem.material.alphaToCoverage = false; mem.material.depthWrite = false;- S.add(sheet({ U, w: .5, h: .32, z: -.1, trans: .7, draw: x => {- x.fillStyle = '#8a7fa8'; x.fillRect(-.25, -.16, .5, .32); x.fillStyle = '#7a7098'; for (let i = 0; i < 10; i++) x.fillRect(-.25 + i * .05, -.16, .0012, .32);- x.save(); x.globalCompositeOperation = 'destination-out'; x.fillRect(WX - WW / 2, WY - WH / 2, WW, WH); x.restore();- x.strokeStyle = '#1e1b32'; x.lineWidth = .004; x.strokeRect(WX - WW / 2, WY - WH / 2, WW, WH); x.fillStyle = '#1e1b32'; x.fillRect(WX - .0015, WY - WH / 2, .003, WH);- } }));- // Xiaoman in profile (large half-length figure)- const GS = .42, GX = -.08, GY = -.34;- const girl = S.add(sheet({ U, w: .5, h: .32, z: -.06, trans: .05, draw: x => { x.fillStyle = '#15122a'; x.translate(GX, GY); girlStand(x, GS); } }));- const sh = [GX + GIRL_SHOULDER[0] * GS, GY + GIRL_SHOULDER[1] * GS];- // Hand + mooncake (raised to the mouth)- const hand = new THREE.Group(); hand.position.set(sh[0], sh[1], -.058); S.scene.add(hand);- const armM = sheet({ U, w: .3, h: .3, trans: .05, draw: x => { x.fillStyle = '#1b1732'; arm(x, GS, .05, 2.26, { w: .04, wrist: -.4 }); } });- hand.add(armM);- const face = x => cakeFace(x, .018, 'color', { base: '#b8742c', hi: '#e9b25c', lo: '#6a3812' });- const mk = bite => sheet({ U, w: .05, h: .04, trans: .1, metal: .5, rough: .36, envMap: E.env, envI: 1.1, draw: x => { cake3q(x, 0, 0, .018, face, { k: .5 }); if (bite) { x.save(); x.globalCompositeOperation = 'destination-out'; for (const [bx, by, r] of [[.017, .003, .007], [.02, -.004, .006], [.014, .009, .005]]) { x.beginPath(); x.arc(bx, by, r, 0, TAU); x.fill(); } x.restore(); } } });- const cakeA = mk(false), cakeB = mk(true);- const handTip = (() => { const L1 = .175 * GS, L2 = .155 * GS, a = .05, b = 2.26; return [Math.cos(a) * L1 + Math.cos(a + b) * L2, Math.sin(a) * L1 + Math.sin(a + b) * L2]; })();- for (const c of [cakeA, cakeB]) { c.position.set(handTip[0] + .01, handTip[1] + .006, .001); c.rotation.z = .35; hand.add(c); }- cakeB.visible = false;- // Tear glint- const tear = new THREE.Mesh(new THREE.CircleGeometry(.0011, 16), new THREE.MeshBasicMaterial({ color: new THREE.Color('#e8f0ff').multiplyScalar(1.3), transparent: true }));- const eye = [GX + .066 * GS, GY + .94 * GS]; tear.position.set(eye[0], eye[1], -.059); S.scene.add(tear);- S.add(sheet({ U, w: .52, h: .34, z: -.015, trans: .02, draw: x => { x.fillStyle = '#0a0816'; x.fillRect(-.26, -.17, .52, .03); } }));- const tB = E.word('L18', 1) + .05, tMem0 = E.word('L18', 5) - .2, tMem1 = E.word('L18', 11) + .3, tTear = E.word('L18', 15) - .25;- return {- S,- update(t) {- // raise the hand (already rising 0.6s before the shot starts) → bite → lower- const up = eio(seg(t, 0, tB)), dn = eio(seg(t, tB + .45, tB + 1.4));- hand.rotation.z = lerp(-.55, 0, up) - .2 * dn; hand.position.y = sh[1] - .03 * (1 - up) - .012 * dn;- cakeA.visible = t < tB + .05; cakeB.visible = !cakeA.visible;- const chew = t > tB && t < tB + 1.2 ? .002 * Math.sin((t - tB) * 18) * (1 - (t - tB) / 1.2) : 0;- girl.position.y = chew * .3;- // the view outside the window turns into the memory- const mk2 = ss(seg(t, tMem0, tMem0 + 1.0)) * (1 - ss(seg(t, tMem1 + 1.2, tMem1 + 2.2)));- mem.material.opacity = mk2; mem.visible = mk2 > .01; mem.material.userData.u.uGlowLit.value = mk2;- // tear glint: flashes once, then slowly slides down a little- const tk = seg(t, tTear, tTear + 1.6); tear.visible = t > tTear; tear.material.opacity = Math.sin(Math.PI * clamp(tk * 1.1)) * .75; tear.position.set(eye[0] - .004 * eo(tk), eye[1] - .006 - .016 * eo(tk), -.059);- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.005, .005, u), lerp(.05, .052, u), lerp(.3, .25, u), lerp(.0, .01, u), lerp(.04, .045, u), -.07], t);- },- post() { return { focus: S.cam.position.z + .06, aper: 20, maxCoc: 18, bloom: { strength: .4, radius: .6, threshold: 1.1 } }; },- grade() { return { expo: 1.02, vig: .52, sat: 1.0, contrast: .1, lift: [.006, 0, .018] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s15_gran_open.js b/styles/paper-lantern/demo/src/shots/s15_gran_open.jsdeleted file mode 100644index 037d7fb..0000000--- a/styles/paper-lantern/demo/src/shots/s15_gran_open.js+++ /dev/null@@ -1,40 +0,0 @@-// S15 · The same night, Grandma also receives a box (a blue one, sent by Xiaoman)-import * as THREE from 'three';-import { burst, sheet } from '../paper.js';-import { boxFront, label, chair, table, bowl } from '../props.js';-import { grannySit, arm, GRAN_SHOULDER } from '../people.js';-import { kitchenSet } from './s02_kitchen.js';-import { stage, aim } from '../stage.js';-import { FONT } from '../art.js';-import { seg, ss, eio, lerp, clamp, TAU } from '../lib.js';--export function build(E) {- const S = stage({ light: [-.02, .075, -.068], lightR: .11, lightCol: '#ffcf96', key: 1.0, amb: .16, ambCol: '#c08a60', keyCol: '#ffd9ae', keyPos: [-.02, .3, .28] });- const { U } = S;- const K = kitchenSet(S);- const GX = -.06, GY = -.096, GS = .15;- S.add(sheet({ U, w: .6, h: .36, z: -.058, trans: .06, draw: x => { x.fillStyle = '#2e170d'; chair(x, GX - .005, -.14, .1, 1); x.translate(GX, GY); grannySit(x, GS, { pin: '#2e170d' }); } }));- const sh = [GX + GRAN_SHOULDER[0] * GS, GY + (GRAN_SHOULDER[1] - .48) * GS];- const armS = S.add(sheet({ U, w: .14, h: .14, x: sh[0], y: sh[1], z: -.0575, trans: .06, draw: x => { x.fillStyle = '#2e170d'; arm(x, GS, -.25, .2, { sleeve: 1.25 }); } }));- S.add(sheet({ U, w: .6, h: .36, z: -.046, trans: .06, draw: x => { x.fillStyle = '#3a1c0e'; table(x, .03, -.04, .22, .1, .01); } }));- const box = S.add(sheet({ U, w: .08, h: .05, x: .06, y: -.024, z: -.045, trans: .2, draw: x => { boxFront(x, 0, -.016, .064, .03, '#2a4f7a', '#e0c070'); label(x, .014, -.001, .024, .016, [['外婆 收', .001, .0045]], { font: FONT.hand, ink: '#27405e', rot: .06 }); } }));- const lid = S.add(sheet({ U, recv: false, shadow: false, w: .08, h: .02, x: .06, y: -.0085, z: -.044, trans: .2, draw: x => { x.fillStyle = '#2a4f7a'; x.fillRect(-.034, -.004, .068, .008); x.fillStyle = '#e0c070'; x.fillRect(-.032, -.001, .064, .0015); } }));- const glow = burst(.1, .07);- glow.position.set(.06, .025, -.0455); S.scene.add(glow);- S.add(sheet({ U, w: .62, h: .38, z: -.014, trans: .04, draw: x => { x.fillStyle = '#1a0c06'; x.fillRect(-.31, -.19, .62, .05); x.fillRect(.27, -.19, .04, .38); } }));- const tOpen = E.word('L19', 6) - .2;- return {- S,- update(t) {- const reach = ss(seg(t, tOpen - 1, tOpen)), op = eio(seg(t, tOpen, tOpen + .9));- armS.rotation.z = lerp(-.1, .2, reach) + .15 * op;- lid.position.set(.06 - op * .028, -.0085 + op * .012, -.044); lid.rotation.z = op * .18;- const gk = ss(seg(t, tOpen + .2, tOpen + 1.2)); glow.userData.set(gk * 1.0);- K.steam.material.opacity = .3; K.lamp.material.userData.u.uGlowLit.value = 1 + .04 * Math.sin(t * 9.1);- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.01, .03, u), lerp(-.01, -.018, u), lerp(.36, .26, u), lerp(.0, .035, u), lerp(-.02, -.02, u), -.06], t);- },- post() { return { focus: S.cam.position.z + .05, aper: 16, maxCoc: 14, bloom: { strength: .4, radius: .6, threshold: 1.1 } }; },- grade() { return { expo: 1.02, vig: .5, sat: 1.02, contrast: .1, lift: [.012, .006, 0], gain: [1.02, 1, .96] }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s16_mutual.js b/styles/paper-lantern/demo/src/shots/s16_mutual.jsdeleted file mode 100644index e6ecca6..0000000--- a/styles/paper-lantern/demo/src/shots/s16_mutual.js+++ /dev/null@@ -1,81 +0,0 @@-// S16 · The “相” in 相思 (missing each other) is the “相” of 互相 (mutual): Grandma's window on the left, Xiaoman's on the right, the same moon in the middle; two beams of light link the windows to the moon-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon, text } from '../paper.js';-import { karst, ridge, xiangyun, waves, waterTop, osmanthus, jiangnanHouse, reeds, FONT } from '../art.js';-import { grannySit, girlSit, arm, spline } from '../people.js';-import { towers } from './s11_city.js';-import { cloudCurtain } from './s17_sushi.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp, mulberry, TAU } from '../lib.js';--export const MM = [0, .07, -.13];-// Shared set of "two windows + one moon" (used in S16 and in the closing lightbox; sized to fit the lightbox's inner cavity .56×.33)-export function mutualSet(S, E, o = {}) {- const { U } = S;- const sky = S.add(skyPanel({ w: .56, h: .33, z: -.14, stops: [[0, '#0a1330'], [.5, '#1a2c5c'], [.85, '#34487c'], [1, '#4a5a86']], stars: 240, starMinY: -.03 }));- const mn = S.add(moon({ x: MM[0], y: MM[1], z: MM[2], r: .045, gain: 1.7, halo: 4.2, haloGain: .32 }));- S.add(sheet({ U, w: .558, h: .328, z: -.115, trans: .85, draw: x => { x.fillStyle = '#c3cbe8'; xiangyun(x, -.075, .045, .009, 1, { tail: 3 }); xiangyun(x, .08, .1, .007, -1, { tail: 2.4 }); xiangyun(x, .2, .03, .0055, -1); xiangyun(x, -.21, .11, .006, 1); } }));- S.add(sheet({ U, w: .558, h: .328, z: -.1, trans: .7, draw: x => { x.fillStyle = '#6a86c2'; karst(x, { x0: -.28, x1: .28, base: -.03, peaks: [[-.2, .04, .025], [-.12, .06, .025], [-.04, .035, .02], [.05, .05, .025], [.13, .065, .025], [.21, .04, .022]], carve: .0005 }); } }));- S.add(sheet({ U, w: .558, h: .328, z: -.085, trans: .4, glow: 1, glowCol: '#ffe0a6', draw: x => {- x.fillStyle = '#22325e'; waterTop(x, { x0: -.28, x1: .28, base: -.05, amp: .001, len: .05 });- x.save(); x.beginPath(); x.rect(-.28, -.2, .56, .145); x.clip(); waves(x, { x0: -.28, x1: .28, y0: -.057, y1: -.2, r: .006, fill: '#22325e', line: '#34487a', lw: .0006 }); x.restore();- x.fillStyle = '#e9cf96'; const R = mulberry(3); for (let i = 0; i < 30; i++) { const w = .02 * (.3 + R() * .8); x.beginPath(); x.ellipse((R() - .5) * .01, -.058 - i * .0025, w / 2, .0004, 0, 0, TAU); x.fill(); }- }, glowDraw: g => { g.fillStyle = '#fff'; const R = mulberry(3); for (let i = 0; i < 30; i++) { const w = .02 * (.3 + R() * .8); g.beginPath(); g.ellipse((R() - .5) * .01, -.058 - i * .0025, w / 2, .0004, 0, 0, TAU); g.fill(); } } }));- // Left: Grandma's home (round window lit, Grandma inside holding up a mooncake)- const left = S.add(sheet({ U, w: .558, h: .328, z: -.06, trans: .2, glow: 2.2, glowCol: '#ffb862', draw: x => drawLeft(x, null), glowDraw: g => drawLeft(null, g) }));- // Right: Xiaoman's tower (one window lit, Xiaoman inside holding up a mooncake)- const right = S.add(sheet({ U, w: .558, h: .328, z: -.06, trans: .2, glow: 2.2, glowCol: '#ffd08a', draw: x => drawRight(x, null), glowDraw: g => drawRight(null, g) }));- S.add(sheet({ U, w: .558, h: .328, z: -.03, trans: .05, draw: x => { x.fillStyle = '#0e1532'; x.strokeStyle = '#0e1532'; ridge(x, { x0: -.28, x1: .28, base: -.14, amp: .006, seed: 3, freq: 14 }); reeds(x, { x0: -.05, x1: .05, by: -.14, h: .03, n: 20, seed: 8 }); } }));- // Two beams of light: arcs from the windows to the moon (done with a circular clip centred on the moon, growing from the outside inward)- const arcs = S.add(sheet({ U, w: .558, h: .328, z: -.07, trans: 0, glow: 3, glowCol: '#ffd990', shadow: false, recv: false, finish: { rim: 0, under: 0, grain: false }, draw: x => drawArcs(x, '#f6dca0'), glowDraw: g => drawArcs(g, '#fff'), glowRes: 1 }));- return { sky, mn, left, right, arcs };-- function drawLeft(x, g) {- const c = x || g;- if (x) { x.fillStyle = '#1d2a52'; ridge(x, { x0: -.28, x1: -.05, base: -.1, amp: .004, seed: 2, freq: 20 }); x.fillRect(-.28, -.2, .23, .1); osmanthus(x, { cx: -.24, by: -.1, h: .1, flowers: '#d9a24a', seed: 5, leaves: 40, nFlowers: 30 }); }- const hx = -.14, hy = -.1, hw = .1, hh = .055;- if (x) { jiangnanHouse(x, { cx: hx, by: hy, w: hw, h: hh, windows: [], wall: '#4a5f96', tile: '#1b284f' }); }- // Round window- const wx = hx + .01, wy = hy + hh * .5, wr = .016;- if (g) { g.fillStyle = '#fff'; g.beginPath(); g.arc(wx, wy, wr, 0, TAU); g.fill(); g.fillStyle = '#000'; g.save(); g.translate(wx - .004, wy - wr); grannySit(g, .04); g.restore(); return; }- x.fillStyle = '#f4c46e'; x.beginPath(); x.arc(wx, wy, wr, 0, TAU); x.fill();- x.save(); x.beginPath(); x.arc(wx, wy, wr, 0, TAU); x.clip(); x.fillStyle = '#3a1d10'; x.translate(wx - .004, wy - wr); grannySit(x, .04); x.translate(0, .04 * .29); arm(x, .04, 1.0, -.2, { sleeve: 1.2 }); x.fillStyle = '#b8742c'; x.beginPath(); x.arc(.04 * .3, .04 * .44, .003, 0, TAU); x.fill(); x.restore();- x.strokeStyle = '#1b284f'; x.lineWidth = .0015; x.beginPath(); x.arc(wx, wy, wr, 0, TAU); x.stroke();- }- function drawRight(x, g) {- const bx = .15, by = -.1, bw = .07, bh = .14;- if (x) { x.fillStyle = '#1d1a3e'; x.fillRect(.05, -.2, .23, .1); towers(x, null, { x0: .05, x1: .28, by: -.1, col: '#2a2456', win: '#e8cc90', dark: '#231e4a', seed: 21, hmin: .04, hmax: .09, wmin: .02, wmax: .035, cell: .004, lit: .25, gap: .004 }); x.fillStyle = '#1d1a3e'; x.fillRect(bx - bw / 2, by, bw, bh); x.fillRect(bx - bw * .3, by + bh, bw * .6, .01); }- else towers(null, g, { x0: .05, x1: .28, by: -.1, col: '', seed: 21, hmin: .04, hmax: .09, wmin: .02, wmax: .035, cell: .004, lit: .25, gap: .004 });- const wx = bx - .012, wy = by + bh * .62, ww = .028, wh = .022;- if (g) { g.fillStyle = '#fff'; g.fillRect(wx - ww / 2, wy - wh / 2, ww, wh); g.fillStyle = '#000'; g.save(); g.translate(wx + .004, wy - wh / 2); g.scale(-1, 1); girlSit(g, .04); g.restore(); return; }- x.fillStyle = '#f7d38f'; x.fillRect(wx - ww / 2, wy - wh / 2, ww, wh);- x.save(); x.beginPath(); x.rect(wx - ww / 2, wy - wh / 2, ww, wh); x.clip(); x.fillStyle = '#2a1d3a'; x.translate(wx + .004, wy - wh / 2); x.scale(-1, 1); girlSit(x, .04); x.translate(0, .04 * .275); arm(x, .04, 1.0, -.2); x.fillStyle = '#b8742c'; x.beginPath(); x.arc(.04 * .3, .04 * .42, .003, 0, TAU); x.fill(); x.restore();- for (let i = 0; i < 18; i++) { const R = mulberry(40 + i); if (R() < .6) continue; x.fillStyle = '#e8cc90'; x.fillRect(bx - bw / 2 + .006 + (i % 3) * .022, by + .01 + Math.floor(i / 3) * .02, .012, .008); }- }- function drawArcs(c, col) {- c.strokeStyle = col; c.lineCap = 'round'; c.setLineDash([.0025, .004]); c.lineWidth = .0012;- c.beginPath(); c.moveTo(-.13, -.07); c.quadraticCurveTo(-.1, .06, MM[0] - .03, MM[1] - .01); c.stroke();- c.beginPath(); c.moveTo(.138, -.013); c.quadraticCurveTo(.11, .07, MM[0] + .03, MM[1] - .01); c.stroke();- c.setLineDash([]);- }-}--export function build(E) {- const S = stage({ light: MM, lightR: .16, lightCol: '#ffe2ae', key: .9, amb: .28, ambCol: '#7d90c8', keyCol: '#d6dcff' });- const M = mutualSet(S, E);- const tA = E.cue('L21') + .2, tB = E.word('L21', 7) + .1; // the beams grow to the moon starting from the character “互” (mutual)- const curtain = cloudCurtain(S, .15);- return {- S,- update(t) {- const k = eio(seg(t, tA, tB + 1.4)); M.arcs.material.userData.u.uClip.value.set(MM[0], MM[1], lerp(.3, .0, k), 1);- M.arcs.visible = k > .001;- setMoon(M.mn, 1 + .15 * ss(seg(t, tB + .8, tB + 1.8)));- const cl = eio(seg(t, E.dur - 1.2, E.dur)); curtain[0].position.x = .035 + (1 - cl) * .35; curtain[1].position.x = -.035 - (1 - cl) * .35; curtain.forEach(c => c.visible = cl > .001);- const u = eio(clamp(t / E.dur));- aim(S.cam, [0, lerp(.05, .0, u), lerp(.3, .5, u), 0, lerp(.055, .0, u), -.08], t);- },- post() { return { focus: S.cam.position.z + .06, aper: 12, maxCoc: 12, bloom: { strength: .42, radius: .65, threshold: 1.1 } }; },- grade() { return { expo: 1.05, vig: .42, sat: 1.05, contrast: .1 }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s17_sushi.js b/styles/paper-lantern/demo/src/shots/s17_sushi.jsdeleted file mode 100644index 84c1f53..0000000--- a/styles/paper-lantern/demo/src/shots/s17_sushi.js+++ /dev/null@@ -1,78 +0,0 @@-// S17 · A Mid-Autumn more than nine hundred years ago: Su Shi by the river raising his cup to the moon; “但愿人长久,千里共婵娟” ("may we all live long, and share the moon's beauty a thousand miles apart") written out column by column-import * as THREE from 'three';-import { sheet, skyPanel, moon, setMoon, vtext, text } from '../paper.js';-import { karst, xiangyun, waves, waterTop, willow, reeds, ridge, FONT } from '../art.js';-import { sushi, spline, SUSHI_SHOULDER } from '../people.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, ei, lerp, clamp, mulberry, TAU } from '../lib.js';--export function cloudCurtain(S, z) { // foreground auspicious-cloud curtain (for transitions): two panels left and right, the leading edge a string of cloud heads, swirls carved into the face- const mk = side => S.add(sheet({ U: S.U, w: .5, h: .4, z, trans: .7, shadow: false, recv: false, draw: x => {- const R = mulberry(side > 0 ? 3 : 7), edge = side > 0 ? -.03 : .03;- x.fillStyle = '#cfc4dc'; x.fillRect(side > 0 ? edge : -.25, -.2, .25 - Math.abs(edge) + .0, .4);- x.beginPath(); for (let i = 0; i < 12; i++) { const y = -.2 + i * .036, r = .024 + R() * .01; x.moveTo(edge + r, y); x.arc(edge - side * .004, y, r, 0, TAU); } x.fill();- x.save(); x.globalCompositeOperation = 'destination-out'; x.strokeStyle = '#000'; x.lineCap = 'round';- for (let i = 0; i < 12; i++) { const cy = -.2 + i * .036, cx = edge - side * .004, r = .02; x.lineWidth = .0022; x.beginPath(); for (let k = 0; k <= 30; k++) { const u = k / 30, th = -side * u * 1.7 * TAU + 1, rr = r * (.15 + .6 * u); k ? x.lineTo(cx + Math.cos(th) * rr, cy + Math.sin(th) * rr) : x.moveTo(cx + Math.cos(th) * rr, cy + Math.sin(th) * rr); } x.stroke(); }- x.restore();- } }));- return [mk(1), mk(-1)];-}--export function build(E) {- const MN = [.025, .08, -.13];- const S = stage({ light: MN, lightR: .15, lightCol: '#ffe6b8', key: .85, amb: .28, ambCol: '#7d8cc0', keyCol: '#d6dcff' });- const { U } = S;- S.add(skyPanel({ w: .6, h: .36, z: -.14, stops: [[0, '#0b1230'], [.55, '#1c2c58'], [1, '#3e4f80']], stars: 200, starMinY: -.02 }));- const mn = S.add(moon({ x: MN[0], y: MN[1], z: MN[2], r: .038, gain: 1.7, halo: 4.2, haloGain: .32 }));- S.add(sheet({ U, w: .6, h: .36, z: -.115, trans: .85, draw: x => { x.fillStyle = '#c3cbe8'; xiangyun(x, .06, .04, .009, -1, { tail: 3 }); xiangyun(x, -.12, .1, .007, 1); } }));- S.add(sheet({ U, w: .6, h: .36, z: -.1, trans: .7, draw: x => { x.fillStyle = '#6a86c2'; karst(x, { x0: -.3, x1: .3, base: -.03, peaks: [[-.25, .05, .025], [-.16, .07, .03], [-.07, .04, .02], [.02, .06, .025], [.12, .045, .02], [.22, .07, .028]], carve: .0005 }); } }));- S.add(sheet({ U, w: .6, h: .36, z: -.08, trans: .4, glow: 1.1, glowCol: '#ffe0a6', draw: x => {- x.fillStyle = '#22325e'; waterTop(x, { x0: -.3, x1: .3, base: -.045, amp: .001, len: .05 });- x.save(); x.beginPath(); x.rect(-.3, -.2, .6, .15); x.clip(); waves(x, { x0: -.3, x1: .3, y0: -.052, y1: -.2, r: .006, fill: '#22325e', line: '#34487a', lw: .0006 }); x.restore();- trail(x, '#e9cf96');- x.fillStyle = '#1a2850'; x.beginPath(); x.moveTo(.0, -.07); x.lineTo(.06, -.07); x.lineTo(.05, -.078); x.lineTo(.01, -.078); x.fill(); x.fillRect(.028, -.07, .002, .03); // small boat- }, glowDraw: g => trail(g, '#fff') }));- function trail(x, col) { x.fillStyle = col; const R = mulberry(5); for (let i = 0; i < 34; i++) { const w = .022 * (.3 + R() * .8); x.beginPath(); x.ellipse(MN[0] + (R() - .5) * .01, -.053 - i * .0026, w / 2, .0004, 0, 0, TAU); x.fill(); } }- // Riverbank, willows, Su Shi- S.add(sheet({ U, w: .6, h: .36, z: -.055, trans: .12, draw: x => {- x.fillStyle = '#141e40';- x.beginPath(); x.moveTo(-.3, -.2); x.lineTo(-.3, -.06); x.quadraticCurveTo(-.2, -.055, -.12, -.075); x.quadraticCurveTo(-.08, -.085, -.04, -.095); x.lineTo(-.02, -.2); x.fill();- willow(x, { cx: -.23, by: -.07, h: .19, strands: 26, seed: 8 });- } }));- const SX = -.078, SY = -.07, SS = .09;- const su = S.add(sheet({ U, w: .2, h: .2, x: SX, y: SY + .06, z: -.05, trans: .06, draw: x => { x.fillStyle = '#10183a'; x.translate(0, -.06); sushi(x, SS); } }));- const sh = [SX + SUSHI_SHOULDER[0] * SS, SY + SUSHI_SHOULDER[1] * SS];- const armS = S.add(sheet({ U, w: .08, h: .08, x: sh[0], y: sh[1], z: -.0495, trans: .06, draw: x => { // arm raised holding the cup + hanging wide sleeve- const k = SS * 2; x.fillStyle = '#10183a';- spline(x, k, [[-.012, .025], [.04, .03], [.09, .075], [.112, .088, 1], [.12, .07], [.1, .045], [.095, .0], [.085, -.07], [.06, -.13, 1], [.03, -.09], [.0, -.05], [-.02, -.02]]);- x.fill();- x.beginPath(); x.ellipse(.118 * k, .086 * k, .014 * k, .01 * k, .9, 0, TAU); x.fill();- x.beginPath(); x.moveTo(.112 * k, .1 * k); x.lineTo(.142 * k, .1 * k); x.lineTo(.136 * k, .12 * k); x.lineTo(.118 * k, .12 * k); x.closePath(); x.fill(); x.fillRect(.124 * k, .09 * k, .006 * k, .012 * k); // wine cup- } }));- // Rocks by the river- S.add(sheet({ U, w: .2, h: .06, x: SX, y: SY - .004, z: -.051, trans: .06, draw: x => { x.fillStyle = '#10183a'; spline(x, 1, [[-.06, -.03, 1], [-.05, -.004], [-.025, .004], [.01, .003], [.04, -.002], [.07, -.03, 1]]); x.fill(); } }));- S.add(sheet({ U, w: .62, h: .38, z: -.015, trans: .03, draw: x => { x.fillStyle = '#070c1e'; x.strokeStyle = '#070c1e'; ridge(x, { x0: -.31, x1: .31, base: -.15, amp: .008, seed: 4, freq: 12 }); reeds(x, { x0: -.31, x1: -.1, by: -.155, h: .05, n: 36, seed: 2 }); } }));- // Poem lines: two columns of gold characters, written out column by column; vermilion seal “东坡” (Dongpo)- const cols = [['但愿人长久', .165, E.cue('L23') - .05], ['千里共婵娟', .132, E.word('L23', 5) - .05]];- const CS = .021, CH = CS * 1.06 * 5 + CS * .5;- const poem = cols.map(([s, cx, t0]) => {- const m = S.add(sheet({ U, w: CS * 1.5, h: CH, x: cx, y: .1 - CH / 2, z: -.11, ay: CH / 2, trans: .4, shadow: false, recv: false, finish: { rim: .6 }, draw: x => vtext(x, s, 0, CH / 2 - CS * .6, CS, FONT.brush, { fill: '#f0d596', gap: 1.06 }) }));- m.userData.t0 = t0; return m;- });- const seal = S.add(sheet({ U, w: .02, h: .02, x: .112, y: -.0, z: -.11, trans: .2, shadow: false, recv: false, draw: x => { x.fillStyle = '#b3302a'; x.fillRect(-.007, -.007, .014, .014); vtext(x, '东坡', 0, .0032, .0052, FONT.brush, { fill: '#f6e3c3', gap: 1.05 }); } }));- const curtain = cloudCurtain(S, .15);- return {- S,- update(t) {- // auspicious-cloud curtain parts- const op = eio(seg(t, .0, 1.3)); curtain[0].position.x = .035 + op * .35; curtain[1].position.x = -.035 - op * .35; curtain.forEach(c => c.visible = op < .99);- armS.rotation.z = lerp(-.35, 0, eio(seg(t, .6, 2.6))) + .012 * Math.sin(t * 1.1);- poem.forEach(m => { const k = Math.max(.001, eo(seg(t, m.userData.t0, m.userData.t0 + 1.25))); m.scale.y = k; m.material.map.repeat.y = k; m.material.map.offset.y = 1 - k; m.visible = t > m.userData.t0 - .02; });- seal.visible = t > cols[1][2] + 1.2; seal.scale.setScalar(Math.max(.001, eo(seg(t, cols[1][2] + 1.2, cols[1][2] + 1.5))));- const u = eio(clamp(t / E.dur));- aim(S.cam, [lerp(-.015, .02, u), lerp(.0, .012, u), lerp(.4, .42, u), lerp(-.015, .025, u), lerp(.005, .02, u), -.07], t);- },- post() { return { focus: S.cam.position.z + .05, aper: 12, maxCoc: 12, bloom: { strength: .4, radius: .6, threshold: 1.1 } }; },- grade() { return { expo: 1.05, vig: .45, sat: 1.02, contrast: .1 }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/s18_finale.js b/styles/paper-lantern/demo/src/shots/s18_finale.jsdeleted file mode 100644index 8bc89f0..0000000--- a/styles/paper-lantern/demo/src/shots/s18_finale.js+++ /dev/null@@ -1,32 +0,0 @@-// S18 · Ending: inside the lightbox are the "two windows and one moon", the camera pulls out to the front of the table; “中秋快乐” ("Happy Mid-Autumn")-import * as THREE from 'three';-import { sheet, text } from '../paper.js';-import { FONT } from '../art.js';-import { mutualSet, MM } from './s16_mutual.js';-import { lightbox } from '../room.js';-import { stage, aim } from '../stage.js';-import { seg, ss, eio, eo, lerp, clamp } from '../lib.js';--export async function build(E) {- const S = stage({ light: MM, lightR: .16, lightCol: '#ffe2ae', key: .9, amb: 0, ambCol: '#7d90c8', keyCol: '#d6dcff', keyPos: [0, .155, .005], keyTarget: [0, -.06, -.1], keyAngle: 1.1 });- const M = mutualSet(S, E);- M.arcs.material.userData.u.uClip.value.set(0, 0, 100, 0);- const title = S.add(sheet({ U: S.U, w: .28, h: .07, x: 0, y: -.005, z: -.092, trans: .3, shadow: false, recv: false, finish: { rim: .6 }, draw: x => { text(x, '中秋快乐', 0, 0, .046, FONT.brush, { fill: '#f3d998' }); x.fillStyle = '#b3302a'; x.fillRect(.105, -.022, .014, .014); text(x, '团圆', .112, -.015, .0055, FONT.brush, { fill: '#f6e3c3' }); } }));- // Credit: a line of gold paper-cut text on the foreground slope at the bottom of the lightbox (same paper as 「中秋快乐」), fades in after the title has settled- const sign = S.add(sheet({ U: S.U, w: .26, h: .02, x: 0, y: -.1515, z: -.024, trans: .3, shadow: false, recv: false, finish: { rim: .5 }, draw: x => text(x, 'LemoLab × Claude Opus 5.5', 0, 0, .0115, FONT.song, { fill: '#f3d998', weight: 600 }) }));- const R = await lightbox(S, E, { spill: 7 });- const tT = E.cue('L25') - .15, tOut = E.cue('L24') - .2;- return {- S,- update(t) {- const k = eo(seg(t, tT, tT + 1.2)); title.visible = k > 0; title.material.color.setScalar(k); title.position.y = -.004 + .004 * k; title.scale.setScalar(.94 + .06 * k);- const ks = ss(seg(t, tT + 1.0, tT + 2.0)); sign.visible = ks > 0; sign.material.color.setScalar(ks);- const out = eio(seg(t, tOut, tT + 2.4));- aim(S.cam, [0, lerp(.0, .07, out), lerp(.5, 1.08, out), 0, lerp(.0, -.025, out), -.07], t, { hand: .0006 });- this._fz = lerp(-.08, .0, ss(seg(t, tOut + 1, tT + 1.5)));- R.spill.intensity = 7 * (1 + .03 * Math.sin(t * 5.3));- },- post() { return { focus: S.cam.position.z - (this._fz ?? -.08), aper: 18, maxCoc: 14, bloom: { strength: .38, radius: .6, threshold: 1.15 } }; },- grade() { return { expo: 1.05, vig: .45, sat: 1.03, contrast: .1 }; },- };-}diff --git a/styles/paper-lantern/demo/src/shots/sheet.js b/styles/paper-lantern/demo/src/shots/sheet.jsdeleted file mode 100644index 6d210d9..0000000--- a/styles/paper-lantern/demo/src/shots/sheet.js+++ /dev/null@@ -1,22 +0,0 @@-import { sheet, skyPanel } from '../paper.js';-import { mooncake } from '../art.js';-import * as H from '../people.js';-import { stage, aim } from '../stage.js';-export function build(E) {- const S = stage({ key: 1.2, amb: .5, keyCol: '#fff1dd' });- S.add(skyPanel({ w: 1, h: .6, z: -.1, stops: [[0, '#e9d9b8'], [1, '#d8c29a']] }));- S.add(sheet({ U: S.U, w: .6, h: .34, z: -.02, trans: .1, draw: x => {- x.fillStyle = '#2a1a14';- x.save(); x.translate(-.25, -.15); H.grannyStand(x, .15, { pin: '#2a1a14' }); x.translate(0, .77 * .15); H.arm(x, .15, -1.25, .9, { sleeve: 1.2 }); x.restore();- x.save(); x.translate(-.14, -.08); H.grannySit(x, .15); x.translate(0, .29 * .15); H.arm(x, .15, -.7, .7, { sleeve: 1.2 }); x.restore();- x.save(); x.translate(-.02, -.08); H.girlSit(x, .16); x.translate(0, .275 * .16); H.arm(x, .16, -.4, 1.9); x.restore();- x.save(); x.translate(.09, -.15); H.girlStand(x, .17); x.translate(0, .775 * .17); H.arm(x, .17, -1.5, .15); x.restore();- x.save(); x.translate(.16, -.15); H.childStand(x, .08); x.restore();- x.save(); x.translate(.23, -.15); H.sushi(x, .16); x.restore();- x.save(); x.translate(-.2, .07); H.change(x, .14); x.restore();- H.ribbon(x, [[-.2,.1],[-.24,.08],[-.28,.1],[-.32,.075],[-.36,.09]], .004, .0015);- x.save(); x.translate(.0, .06); H.rabbit(x, .05); x.restore();- mooncake(x, { cx: .15, cy: .09, r: .04 });- } }));- return { S, update(t) { aim(S.cam, [0, 0, .7, 0, 0, -.02], t, { hand: 0 }); }, post() { return { focus: .72, aper: 0, maxCoc: 0, bloom: { strength: 0 } }; }, grade() { return { expo: 1, vig: .1 }; } };-}diff --git a/styles/paper-lantern/demo/src/stage.js b/styles/paper-lantern/demo/src/stage.jsindex ca3b791..46be082 100644--- a/styles/paper-lantern/demo/src/stage.js+++ b/styles/paper-lantern/demo/src/stage.js@@ -7,6 +7,7 @@ export function stage(o = {}) {const U = {uLight: { value: new THREE.Vector3(...(o.light || [0, .05, -.12])) }, uLightR: { value: o.lightR ?? .14 },uLightCol: { value: new THREE.Color(o.lightCol || '#ffe0a8') }, uLit: { value: 1 },+ uFloor: { value: o.floor ?? .22 }, uBeamO: { value: new THREE.Vector3(0, 0, 0) }, uBeamD: { value: new THREE.Vector3(0, .05, .3) }, uBeamCol: { value: new THREE.Color(o.beamCol || '#ffcf86') },};const cam = new THREE.PerspectiveCamera(o.fov ?? 26, 16 / 9, .01, 30);// Top LED: shines from above the front of the box toward the lower back, so shadows fall on the paper layers behinddiff --git a/styles/paper-lantern/demo/src/world.js b/styles/paper-lantern/demo/src/world.jsnew file mode 100644index 0000000..2343a0a--- /dev/null+++ b/styles/paper-lantern/demo/src/world.js@@ -0,0 +1,198 @@+// v3 look frame: the last night train crossing a snowy valley on a curved viaduct. Deep night blue, warm light only in points.+import * as THREE from 'three';+import { sheet, skyPanel, moon, setMoon, text } from './paper.js';+import { stage, aim } from './stage.js';+import { mulberry, lerp, clamp, TAU, ss, seg, eio, eo, ei } from './lib.js';++export const PAPER = '#9a9a9a', BASE = new THREE.Color(PAPER).r;+export const tint = (m, hex, k = 1) => m.material.color.set(hex).multiplyScalar(k / BASE);+export const cut = (x, fn) => { x.save(); x.globalCompositeOperation = 'destination-out'; x.fillStyle = '#000'; x.strokeStyle = '#000'; fn(); x.restore(); };++// snowy peaks: sharp-ish summits, carved contour slits that let the layer behind show through+export function peaks(x, o) {+ const { x0, x1, base, list, seed = 1 } = o, R = mulberry(seed);+ const h = u => { let y = 0; for (const [cx, hh, w] of list) { const d = Math.abs(u - cx) / w; y = Math.max(y, hh * Math.max(0, 1 - Math.pow(d, 1.25))); } return y; };+ x.beginPath(); x.moveTo(x0, base - .3);+ for (let u = x0; u <= x1 + .001; u += .0015) x.lineTo(u, base + h(u) + .0008 * Math.sin(u * 400 + seed));+ x.lineTo(x1, base - .3); x.closePath(); x.fill();+ cut(x, () => { // snow line + ridge slits on each peak+ x.lineWidth = o.lw ?? .0007; x.lineCap = 'round';+ for (const [cx, hh, w] of list) {+ for (const f of [.72, .5]) { if (hh * f < .01) continue;+ x.beginPath(); let st = false;+ for (let u = cx - w; u <= cx + w; u += .0015) { const d = Math.abs(u - cx) / w, top = hh * Math.max(0, 1 - Math.pow(d, 1.25));+ const y = base + top * f + .004 * Math.sin(u * 160 + cx * 30); if (top * f > .004 && y < base + top - .003) { st ? x.lineTo(u, y) : x.moveTo(u, y); st = true; } else st = false; }+ x.stroke(); }+ x.beginPath(); x.moveTo(cx, base + hh - .004); x.lineTo(cx + w * .18 * (R() - .3), base + hh * .55); x.stroke();+ }+ });+}+// a row of conifers on a ridge line+export function firs(x, o) {+ const { x0, x1, base, h, gap, seed = 3, ground = .3 } = o, R = mulberry(seed);+ x.beginPath(); x.moveTo(x0, base - ground); x.lineTo(x0, base);+ for (let u = x0; u < x1; u += .002) x.lineTo(u, base + (o.roll ?? .004) * Math.sin(u * 23 + seed));+ x.lineTo(x1, base); x.lineTo(x1, base - ground); x.closePath(); x.fill();+ for (let u = x0 + R() * gap; u < x1; u += gap * (.6 + R() * .8)) {+ const hh = h * (.6 + R() * .6), w = hh * .32, by = base + (o.roll ?? .004) * Math.sin(u * 23 + seed) - .001;+ x.beginPath(); x.moveTo(u, by + hh);+ for (let k = 0; k < 4; k++) { const t0 = k / 4, t1 = (k + 1) / 4; x.lineTo(u + w * (.35 + .65 * t1), by + hh * (1 - t1)); x.lineTo(u + w * .3 * (1 - t1) + w * .12, by + hh * (1 - t1) + hh * .04); }+ x.lineTo(u + .0012, by - .002); x.lineTo(u - .0012, by - .002);+ for (let k = 3; k >= 0; k--) { const t1 = (k + 1) / 4; x.lineTo(u - w * .3 * (1 - t1) - w * .12, by + hh * (1 - t1) + hh * .04); x.lineTo(u - w * (.35 + .65 * t1), by + hh * (1 - t1)); }+ x.closePath(); x.fill();+ }+}+// the track: flat through the halt, then a gentle curve down across the valley (by x, metres)+const TY = x => { const s = Math.max(0, (x + .15) / .48); return -.006 - .045 * s * s; };+const TRACK = u => { const x = lerp(-.15, .33, u); return [x, TY(x)]; }; // u: the valley part only (viaduct)+const slope = x => Math.atan2(TY(x + .001) - TY(x - .001), .002);+// arc length along the track from x = -1 (for spacing the carriages)+const AX = [], AS = []; { let sAcc = 0, px = -1, py = TY(-1); for (let x = -1; x <= .7; x += .0005) { sAcc += Math.hypot(x - px, TY(x) - py); AX.push(x); AS.push(sAcc); px = x; py = TY(x); } }+const xAtS = s => { let lo = 0, hi = AS.length - 1; while (hi - lo > 1) { const m = (lo + hi) >> 1; if (AS[m] < s) lo = m; else hi = m; } return AX[lo]; };+const sAtX = x => AS[Math.min(AS.length - 1, Math.max(0, Math.round((x + 1) / .0005)))];+function viaduct(x) {+ // the halt: a stone embankment and a platform edge, flat, left of the valley+ x.beginPath(); x.moveTo(-.4, TY(-.4) - .003); x.lineTo(-.15, TY(-.15) - .003); x.lineTo(-.15, -.2); x.lineTo(-.4, -.2); x.closePath(); x.fill();+ x.fillRect(-.36, -.012, .2, .004); // platform edge+ cut(x, () => { x.lineWidth = .0005; for (let r = 0; r < 6; r++) for (let c = 0; c < 14; c++) { const yy = -.02 - r * .008, xx = -.38 + c * .016 + (r % 2) * .008; x.beginPath(); x.moveTo(xx, yy); x.lineTo(xx + .012, yy); x.stroke(); } });+ // deck and spandrel band along the curve, round arches cut out between the piers, piers down into the valley+ const n = 22;+ x.beginPath();+ for (let i = 0; i <= 200; i++) { const [px, py] = TRACK(i / 200); i ? x.lineTo(px, py - .003) : x.moveTo(px, py - .003); }+ for (let i = 200; i >= 0; i--) { const [px, py] = TRACK(i / 200); x.lineTo(px, py - .03); }+ x.closePath(); x.fill();+ for (let i = 0; i <= n; i++) { const [px, py] = TRACK(i / n); x.beginPath(); x.moveTo(px - .004, py - .02); x.lineTo(px - .0055, -.2); x.lineTo(px + .0055, -.2); x.lineTo(px + .004, py - .02); x.closePath(); x.fill(); }+ cut(x, () => {+ for (let i = 0; i < n; i++) { const [ax, ay] = TRACK(i / n), [bx, by] = TRACK((i + 1) / n), cx = (ax + bx) / 2, cy = (ay + by) / 2, w = (bx - ax) / 2 - .005;+ x.beginPath(); x.ellipse(cx, cy - .031, w, .019, 0, 0, Math.PI); x.fill(); }+ x.lineWidth = .0006; for (let i = 0; i < 160; i++) { const [px, py] = TRACK(i / 160); x.beginPath(); x.moveTo(px - .0012, py - .007); x.lineTo(px + .0012, py - .007); x.stroke(); } // a row of small slits under the rail+ });+}+// one carriage, local frame: x along the track, y up from the rail+export function car(x, g, L, H, loco) {+ const c = x || g;+ if (x) {+ x.beginPath(); x.roundRect(-L / 2, H * .14, L, H * .86, H * .16); x.fill();+ x.fillRect(-L / 2 + L * .03, H * 1.0, L * .94, H * .1); // roof line+ for (const k of [-.36, -.24, .24, .36]) { x.beginPath(); x.arc(L * k, H * .1, H * .11, 0, TAU); x.fill(); }+ cut(x, () => { x.fillRect(-L / 2, H * .38, L, H * .035); }); // waist line, cut through+ if (loco) { x.beginPath(); x.moveTo(L / 2 - .001, H * .14); x.quadraticCurveTo(L / 2 + L * .32, H * .2, L / 2 + L * .14, H * .98); x.lineTo(L / 2 - .001, H * .98); x.closePath(); x.fill(); }+ }+ const win = (dx) => c.fillRect(dx, H * .5, L * .07, H * .3);+ if (g) g.fillStyle = '#fff';+ if (x) { x.save(); x.fillStyle = '#c8a070'; for (let k = 0; k < (loco ? 2 : 8); k++) win(-L / 2 + L * (.07 + k * .112)); x.restore(); } // window panes: pale paper, lit by the glow map+ else for (let k = 0; k < (loco ? 2 : 8); k++) win(-L / 2 + L * (.07 + k * .112));+ if (loco && g) { g.beginPath(); g.arc(L / 2 + L * .2, H * .45, H * .09, 0, TAU); g.fill(); }+}++export function world(E) {+ const S = stage({ light: [.12, .03, -.1], lightR: .12, lightCol: '#b8c8f0', key: 1.0, keyCol: '#c8d4ff', amb: .2, ambCol: '#5a6ca8', floor: .32, keyPos: [-.05, .3, .3], keyTarget: [0, -.03, -.09], keyAngle: 1.0 });+ const { U } = S;+ S.add(skyPanel({ w: .8, h: .46, z: -.142, stops: [[0, '#060b22'], [.45, '#0d1a40'], [.8, '#1c2d5e'], [1, '#2c4074']], stars: 340, starMinY: -.02, gain: 1 }));+ const mn = S.add(moon({ x: .155, y: .098, z: -.138, r: .0095, gain: 1.5, halo: 5, haloGain: .16 })); setMoon(mn, 1);+ const H = E.H;+ const far = S.add(sheet({ U, w: .74, h: .36, z: -.126, trans: .85, ppm: 3600, draw: x => { x.fillStyle = PAPER;+ peaks(x, { x0: -.37, x1: .37, base: .0, seed: 2, list: [[-.31, .07, .06], [-.22, .1, .07], [-.11, .065, .05], [-.03, .085, .06], [.07, .12, .08], [.17, .075, .05], [.27, .095, .07], [.35, .06, .05]] }); } }));+ const mid = S.add(sheet({ U, w: .74, h: .36, z: -.112, trans: .6, ppm: 3600, draw: x => { x.fillStyle = PAPER;+ peaks(x, { x0: -.37, x1: .37, base: -.02, seed: 5, lw: .0008, list: [[-.34, .05, .07], [-.24, .075, .06], [-.13, .045, .06], [-.02, .06, .07], [.1, .045, .05], [.21, .068, .07], [.33, .05, .06]] }); } }));+ const CAB = [[-.12, -.031], [.05, -.034], [.135, -.03]];+ const ridgeFar = S.add(sheet({ U, w: .74, h: .36, z: -.1, trans: .42, ppm: 4200, glow: 2.2, glowCol: '#ffbe68', draw: x => { x.fillStyle = PAPER; firs(x, { x0: -.37, x1: .37, base: -.035, h: .018, gap: .006, seed: 4, roll: .006 });+ for (const [cx, cy] of CAB) { x.fillRect(cx - .005, cy, .01, .006); x.beginPath(); x.moveTo(cx - .007, cy + .006); x.lineTo(cx, cy + .011); x.lineTo(cx + .007, cy + .006); x.closePath(); x.fill(); x.save(); x.fillStyle = '#c8a070'; x.fillRect(cx - .0018, cy + .0015, .0028, .0025); x.restore(); } },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.37, -.18, .74, .36); g.fillStyle = '#fff'; for (const [cx, cy] of CAB) g.fillRect(cx - .0018, cy + .0015, .0028, .0025); }, glowRes: 1 }));+ // mist in the valley: a pale, very translucent paper band with a soft cut edge+ const mist = S.add(sheet({ U, w: .74, h: .36, z: -.091, trans: .95, ppm: 3000, shadow: false, draw: x => { x.fillStyle = PAPER;+ x.beginPath(); x.moveTo(-.37, -.2); for (let u = -.37; u <= .37; u += .004) x.lineTo(u, -.05 + .006 * Math.sin(u * 30) + .003 * Math.sin(u * 77)); x.lineTo(.37, -.2); x.closePath(); x.fill(); } }));+ const via = S.add(sheet({ U, w: .74, h: .36, z: -.08, trans: .1, ppm: 6000, draw: x => { x.fillStyle = PAPER; x.strokeStyle = PAPER; viaduct(x); } }));+ // the train: the engine and 7 carriages, each its own sheet following the track; windows burn warm+ const L = .043, Hc = .015, N = 8;+ const cars = [];+ for (let i = 0; i < N; i++) {+ const loco = i === 0;+ const m = S.add(sheet({ U, w: L * 1.5, h: Hc * 1.4, ay: -Hc * .5, z: -.0785, trans: .12, glow: 2.6, glowCol: '#ffc46a', ppm: 9000, glowRes: 1,+ draw: x => { x.fillStyle = PAPER; x.translate(0, -Hc * .5); car(x, null, L, Hc, loco); }, glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-1, -1, 2, 2); g.translate(0, -Hc * .5); car(null, g, L, Hc, loco); } }));+ cars.push(m);+ }+ const flare = S.add(new THREE.Mesh(new THREE.PlaneGeometry(.05, .05), new THREE.ShaderMaterial({ uniforms: { col: { value: new THREE.Color('#ffd590') }, k: { value: 0 } }, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,+ vertexShader: 'varying vec2 vUv; void main(){ vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.); }',+ fragmentShader: 'varying vec2 vUv; uniform vec3 col; uniform float k; void main(){ float r = length(vUv - .5) * 2.; gl_FragColor = vec4(col * k * (pow(max(0., 1. - r), 3.) * .9 + pow(max(0., 1. - r * 4.), 2.) * .8), 1.); }' })));+ flare.renderOrder = 12;+ const lampFlare = S.add(new THREE.Mesh(new THREE.PlaneGeometry(.03, .03), flare.material.clone())); lampFlare.renderOrder = 12;+ // the halt: a small station house with one lit window, a lamp post, a name board; behind the train+ const HX = -.3;+ const halt = S.add(sheet({ U, w: .12, h: .07, x: HX, y: .047, z: -.0806, trans: .08, glow: 2.4, glowCol: '#ffbf6a', ppm: 9000,+ draw: x => { x.fillStyle = PAPER;+ x.beginPath(); x.moveTo(-.06, -.035); x.quadraticCurveTo(-.01, -.012, .05, -.035); x.closePath(); x.fill(); x.fillRect(-.06, -.035, .11, .002); // a small snowy rise+ x.fillRect(-.024, -.022, .04, .02); x.beginPath(); x.moveTo(-.028, -.002); x.lineTo(-.004, .012); x.lineTo(.02, -.002); x.closePath(); x.fill(); x.fillRect(.006, .002, .004, .008); // house, roof, chimney+ x.save(); x.fillStyle = '#c8a070'; x.fillRect(-.016, -.016, .007, .008); x.fillRect(-.004, -.016, .007, .008); x.restore(); },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.06, -.035, .12, .07); g.fillStyle = '#fff'; g.fillRect(-.016, -.016, .007, .008); g.fillRect(-.004, -.016, .007, .008); } }));+ // the front platform edge with the lamp post and the name board (in front of the train)+ const PX = -.168;+ const plat = S.add(sheet({ U, w: .3, h: .08, x: -.3, y: -.03, z: -.0772, trans: .06, glow: 2.4, glowCol: '#ffc070', ppm: 9000,+ draw: x => { x.fillStyle = PAPER; x.fillRect(-.15, -.04, .3, .029); x.translate(PX + .3, 0);+ x.fillRect(-.0009, -.012, .0018, .036); x.fillRect(-.004, .023, .008, .0016); x.beginPath(); x.moveTo(-.0028, .0225); x.lineTo(.0028, .0225); x.lineTo(.0022, .0165); x.lineTo(-.0022, .0165); x.closePath(); x.fill();+ x.fillRect(-.06, -.012, .0012, .014); x.fillRect(-.0405, -.012, .0012, .014);+ x.save(); x.fillStyle = '#c8a070'; x.fillRect(-.0016, .0172, .0032, .0046); x.restore(); },+ glowDraw: g => { g.fillStyle = '#000'; g.fillRect(-.15, -.04, .3, .08); g.translate(PX + .3, 0); g.fillStyle = '#fff'; g.fillRect(-.0016, .0172, .0032, .0046); } }));+ const board = S.add(sheet({ U, w: .03, h: .01, x: PX - .05, y: -.03 + .0055, z: -.0771, trans: .3, shadow: false, ppm: 16000, finish: { rim: 0, under: 0 },+ draw: x => { x.fillStyle = '#d8c8a0'; x.fillRect(-.012, -.0036, .024, .0072); text(x, 'PINE HALT', 0, -.0002, .0038, '"Cormorant"', { fill: '#1a1a2a', weight: 700 }); } }));+ const puffs = [];+ const ridgeNear = S.add(sheet({ U, w: .74, h: .36, z: -.058, trans: .15, ppm: 4500, draw: x => { x.fillStyle = PAPER; firs(x, { x0: -.37, x1: .37, base: -.088, h: .034, gap: .011, seed: 8, roll: .01 }); cut(x, () => x.fillRect(-.37, -.07, .23, .1)); } }));+ const front = S.add(sheet({ U, w: .74, h: .36, z: -.03, trans: .04, ppm: 4500, draw: x => { x.fillStyle = PAPER;+ firs(x, { x0: -.37, x1: -.31, base: -.128, h: .11, gap: .03, seed: 12, roll: .014 }); firs(x, { x0: .2, x1: .37, base: -.13, h: .095, gap: .028, seed: 15, roll: .012 });+ x.beginPath(); x.moveTo(-.37, -.2); for (let u = -.37; u <= .37; u += .004) x.lineTo(u, -.135 + .01 * Math.sin(u * 9 + 1) + .004 * Math.sin(u * 31)); x.lineTo(.37, -.2); x.closePath(); x.fill(); } }));+ // falling snow on a near transparent sheet (soft, out of focus)+ const snow = [0, 1].map(j => S.add(sheet({ U, w: .6, h: .36, z: -.012 - j * .004, trans: .3, shadow: false, recv: false, ppm: 3000, finish: { grain: false, rim: 0, under: 0 }, draw: x => { x.fillStyle = PAPER; const R = mulberry(9 + j); for (let i = 0; i < 160; i++) { x.beginPath(); x.arc((R() - .5) * .6, (R() - .5) * .36, .0005 + R() * .0009, 0, TAU); x.fill(); } } })));+ tint(far, '#7385b6'); tint(mid, '#4b6294'); tint(ridgeFar, '#34487c'); tint(mist, '#7b8fc0', .9); tint(via, '#1b2650'); cars.forEach(m => tint(m, '#151d3c')); tint(halt, '#121a38'); tint(plat, '#0e1532'); tint(ridgeNear, '#141c3e'); tint(front, '#080d24'); snow.forEach(m => tint(m, '#c8d4ee', .9));+ const sign = E.sign ? S.add(signStrip(U, -.088, -.115, .084)) : null;+ const headS0 = sAtX(-.13);+ return {+ S,+ update(t) {+ const fl = 1 + .05 * Math.sin(t * 7.3) * Math.sin(t * 3.1);+ U.uLit.value = .85;+ // the halt lamp, then the windows car by car (engine first), then the headlight+ const lamp = ss(seg(t, H.lamp, H.lamp + .25)) * fl;+ halt.material.userData.u.uGlowLit.value = .5 + .5 * ss(seg(t, H.lamp + .4, H.lamp + .7));+ // the train: standing, then pulling away (ease-in), carriages spaced by arc length+ const dAcc = tt => .02 * Math.pow(Math.max(0, tt - H.depart), 1.9), vC = .02 * 1.9 * Math.pow(10 - H.depart, .9);+ const d = t < H.depart ? 0 : t < 10 ? dAcc(t) : dAcc(10) + vC * (t - 10);+ const sHead = headS0 + d;+ for (let i = 0; i < N; i++) {+ const si = sHead - i * (L + .0025) - (i ? L * .12 : 0), xi = xAtS(si);+ const m = cars[i]; m.position.set(xi, TY(xi) - .0022 + (t > H.depart ? .0003 * Math.abs(Math.sin(t * 22 + i)) : 0), -.0785); m.rotation.z = slope(xi);+ const on = ss(seg(t, H.cars[i], H.cars[i] + .12)); m.material.userData.u.uGlowLit.value = on * (1 + .03 * Math.sin(t * 9 + i * 2));+ }+ const hx = xAtS(sHead), ha = slope(hx), hk = ss(seg(t, H.head, H.head + .3));+ flare.position.set(hx + Math.cos(ha) * L * .68, TY(hx) + .0055, -.0775); flare.material.uniforms.k.value = hk;+ U.uBeamO.value.set(hx + Math.cos(ha) * L * .7, TY(hx) + .006, 1.3 * hk); U.uBeamD.value.set(ha - .05, .1, .09);+ lampFlare.position.set(PX, -.03 + .0195, -.0768); lampFlare.material.uniforms.k.value = .45 * lamp; plat.material.userData.u.uGlowLit.value = lamp;+ // smoke: a puff on the horn and at each of the first wheel turns+ const dAt = tt => (tt < H.depart ? 0 : .02 * Math.pow(tt - H.depart, 1.9));+ puffs.forEach((m, i) => { const t0 = H.horn - .1 + i * .55, k = seg(t, t0, t0 + 2.4); m.visible = k > 0 && k < 1;+ const px = xAtS(headS0 + dAt(t0)) - L * .25; m.position.set(px - .012 * k, TY(px) + .016 + .028 * eo(k), -.0795); m.scale.setScalar(.6 + 1.2 * eo(k)); m.material.color.set('#aab8dc').multiplyScalar((1 - k) / BASE); });+ snow.forEach((m, j) => { const p = ((t * (.012 + j * .005) + j * .18) % .36); m.position.set(.03 * Math.sin(t * .3 + j), .18 - p - .0, -.012 - j * .004); });+ if (sign) sign.userData.reveal(eo(seg(t, H.sign, H.sign + .9)));+ // camera: close on the halt and the standing train; as it pulls away, follow and pull back to the valley+ const a = eio(seg(t, H.depart - .4, 10.4));+ const pre = eio(seg(t, 0, H.depart)); const cx = lerp(lerp(-.232, -.205, pre), .005, a), cz = lerp(lerp(.235, .205, pre), .43, a), cy = lerp(lerp(.006, .008, pre), -.006, a);+ const b = eio(seg(t, 10.2, 13.8));+ aim(S.cam, [cx + .09 * b, cy - .004 * b, cz, lerp(lerp(-.225, -.2, pre), .015, a) + .11 * b, lerp(.012, -.012, a) - .004 * b, -.08], t, { hand: .0006 });+ this._f = cz + .079;+ },+ post() { return { focus: this._f, aper: 10, maxCoc: 10, bloom: { strength: .3, radius: .5, threshold: 1.15 } }; },+ grade() { return { expo: 1.0, vig: .45, sat: 1.04, contrast: .12, lift: [0, .004, .02], gain: [1.0, 1.0, 1.0] }; },+ };+}++// the credit strip: cream paper with a red seal, grows from its left edge (texture repeat follows the mesh scale)+export function signStrip(U, z, x, y) {+ const w = .11, h = .0135;+ const m = sheet({ U, w, h, z, x, y, ax: -w / 2, trans: .35, shadow: false, recv: false, ppm: 12000, finish: { rim: .5, under: .2 }, draw: c => {+ c.fillStyle = '#efd9aa'; c.beginPath(); c.moveTo(-w / 2, -h / 2); c.lineTo(w / 2 - h * .25, -h / 2); c.lineTo(w / 2, 0); c.lineTo(w / 2 - h * .25, h / 2); c.lineTo(-w / 2, h / 2); c.closePath(); c.fill();+ c.fillStyle = '#b3302a'; c.fillRect(-w / 2 + h * .3, -h * .3, h * .6, h * .6);+ text(c, '车', -w / 2 + h * .6, -h * .02, h * .42, '"NotoSerifSC"', { fill: '#f7e6c8', weight: 700 });+ text(c, 'LemoLab × Claude Opus 5.5', -w / 2 + h * 1.15, -h * .04, h * .5, '"Cormorant"', { fill: '#2a1d14', weight: 600, align: 'left' });+ } });+ m.userData.reveal = k => { k = clamp(k, .0001, 1); m.scale.x = k; m.material.map.repeat.x = k; m.visible = k > .002; };+ return m;+}diff --git a/styles/paper-lantern/demo/stills/styleframe.jpg b/styles/paper-lantern/demo/stills/styleframe.jpgindex 00fbe90..1ed0771 100644Binary files a/styles/paper-lantern/demo/stills/styleframe.jpg and b/styles/paper-lantern/demo/stills/styleframe.jpg differdiff --git a/styles/paper-lantern/demo/timeline.json b/styles/paper-lantern/demo/timeline.jsonnew file mode 100644index 0000000..41f0a93--- /dev/null+++ b/styles/paper-lantern/demo/timeline.json@@ -0,0 +1,231 @@+{+ "DUR": 51.0,+ "L": {+ "L1": {+ "at": 1.0,+ "dur": 4.145,+ "end": 5.145,+ "en": "Tonight, the old night train makes its last run.",+ "zh": "今夜,这列老夜车跑最后一趟。"+ },+ "L2a": {+ "at": 10.6,+ "dur": 1.557,+ "end": 12.157,+ "en": "From the snow,",+ "zh": "从雪山,"+ },+ "L2b": {+ "at": 12.6,+ "dur": 2.756,+ "end": 15.356,+ "en": "all the way down to the sea.",+ "zh": "一路开到海边。"+ },+ "L3a": {+ "at": 16.2,+ "dur": 1.669,+ "end": 17.869,+ "en": "For 40 years,",+ "zh": "40 年来,"+ },+ "L3b": {+ "at": 18.25,+ "dur": 4.111,+ "end": 22.361,+ "en": "it stopped at every small station on the line.",+ "zh": "它在沿线每个小站都停。"+ },+ "L4": {+ "at": 22.4,+ "dur": 2.63,+ "end": 25.03,+ "en": "Then came the long tunnel.",+ "zh": "然后,是那条长长的隧道。"+ },+ "L5a": {+ "at": 27.3,+ "dur": 3.425,+ "end": 30.725,+ "en": "On the other side, the snow was gone,",+ "zh": "出了隧道,雪不见了,"+ },+ "L5b": {+ "at": 31.0,+ "dur": 3.903,+ "end": 34.903,+ "en": "and the river towns kept their lights on for it.",+ "zh": "沿河的小镇都为它亮着灯。"+ },+ "L6": {+ "at": 35.8,+ "dur": 3.828,+ "end": 39.628,+ "en": "At the end of the line, the ocean was waiting.",+ "zh": "线路的尽头,大海在等它。"+ },+ "L7": {+ "at": 41.6,+ "dur": 3.478,+ "end": 45.078,+ "en": "One by one, the windows went dark.",+ "zh": "车窗一扇一扇暗了下去。"+ },+ "L8": {+ "at": 45.7,+ "dur": 4.231,+ "end": 49.931,+ "en": "But the station light stays on, for the next train.",+ "zh": "可站台的灯还亮着,等下一班车。"+ }+ },+ "cues": [+ {+ "id": "L1",+ "t0": 0.85,+ "t1": 5.745,+ "zh": "今夜,这列老夜车跑最后一趟。",+ "en": "Tonight, the old night train makes its last run."+ },+ {+ "id": "L2a",+ "t0": 10.45,+ "t1": 12.44,+ "zh": "从雪山,",+ "en": "From the snow,"+ },+ {+ "id": "L2b",+ "t0": 12.45,+ "t1": 15.956,+ "zh": "一路开到海边。",+ "en": "all the way down to the sea."+ },+ {+ "id": "L3a",+ "t0": 16.05,+ "t1": 18.09,+ "zh": "40 年来,",+ "en": "For 40 years,"+ },+ {+ "id": "L3b",+ "t0": 18.1,+ "t1": 22.24,+ "zh": "它在沿线每个小站都停。",+ "en": "it stopped at every small station on the line."+ },+ {+ "id": "L4",+ "t0": 22.25,+ "t1": 25.63,+ "zh": "然后,是那条长长的隧道。",+ "en": "Then came the long tunnel."+ },+ {+ "id": "L5a",+ "t0": 27.15,+ "t1": 30.84,+ "zh": "出了隧道,雪不见了,",+ "en": "On the other side, the snow was gone,"+ },+ {+ "id": "L5b",+ "t0": 30.85,+ "t1": 35.503,+ "zh": "沿河的小镇都为它亮着灯。",+ "en": "and the river towns kept their lights on for it."+ },+ {+ "id": "L6",+ "t0": 35.65,+ "t1": 40.228,+ "zh": "线路的尽头,大海在等它。",+ "en": "At the end of the line, the ocean was waiting."+ },+ {+ "id": "L7",+ "t0": 41.45,+ "t1": 45.54,+ "zh": "车窗一扇一扇暗了下去。",+ "en": "One by one, the windows went dark."+ },+ {+ "id": "L8",+ "t0": 45.55,+ "t1": 51.3,+ "zh": "可站台的灯还亮着,等下一班车。",+ "en": "But the station light stays on, for the next train."+ }+ ],+ "HIT": {+ "lamp": 0.4,+ "cars": [+ 1.5,+ 1.84,+ 2.18,+ 2.52,+ 2.8600000000000003,+ 3.2,+ 3.54,+ 3.8800000000000003+ ],+ "head": 5.25,+ "horn": 5.5,+ "depart": 5.9,+ "sign": 7.5,+ "portal": 25.3,+ "dark": [+ 25.5,+ 25.75+ ],+ "stop": 41.0,+ "off": [+ 42.0,+ 42.42,+ 42.84,+ 43.26,+ 43.68,+ 44.1,+ 44.52,+ 45.75+ ],+ "card": 47.5+ },+ "SHOTS": [+ [+ "S1",+ 0.0,+ null+ ],+ [+ "S2",+ 13.8,+ "dissolve"+ ],+ [+ "S3",+ 22.0,+ "dissolve"+ ],+ [+ "S4",+ 25.75,+ "cut"+ ],+ [+ "S5",+ 35.4,+ "dissolve"+ ],+ [+ "S6",+ 40.2,+ "dissolve"+ ]+ ],+ "CUT": [+ 0.0,+ 10.0+ ]+}\ No newline at end of filediff --git a/styles/paper-lantern/demo/tools/fonts.py b/styles/paper-lantern/demo/tools/fonts.pynew file mode 100644index 0000000..8ed97df--- /dev/null+++ b/styles/paper-lantern/demo/tools/fonts.py@@ -0,0 +1,22 @@+"""Fetch the two OFL fonts this demo uses into demo/fonts/ (they are not in git):+Cormorant Garamond (variable) from the Google Fonts repository, and Noto Serif SC (variable), subset to the characters+the film draws (subtitles, titles, the end card). python tools/fonts.py (needs fontTools: the library's .venv has it)"""+import json, os, sys, urllib.request+HERE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+F = os.path.join(HERE, 'fonts'); os.makedirs(F, exist_ok=True)+RAW = 'https://github.com/google/fonts/raw/main/ofl/'+def get(url, dst):+ if not os.path.exists(dst): print('fetch', url); urllib.request.urlretrieve(url, dst)+get(RAW + 'cormorantgaramond/CormorantGaramond%5Bwght%5D.ttf', os.path.join(F, 'CormorantGaramond-VF.ttf'))+get(RAW + 'cormorantgaramond/OFL.txt', os.path.join(F, 'OFL-CormorantGaramond.txt'))+get(RAW + 'notoserifsc/OFL.txt', os.path.join(F, 'OFL-NotoSerifSC.txt'))+sub = os.path.join(F, 'NotoSerifSC-sub.ttf')+if not os.path.exists(sub):+ full = os.path.join(F, 'NotoSerifSC-VF.ttf')+ get(RAW + 'notoserifsc/NotoSerifSC%5Bwght%5D.ttf', full)+ tl = json.load(open(os.path.join(HERE, 'timeline.json'), encoding='utf-8'))+ chars = ''.join(sorted(set(''.join(c['zh'] for c in tl['cues']) + '末班夜车纸雕灯影风格车')))+ from fontTools import subset+ subset.main([full, f'--text={chars}', '--unicodes=U+0020-007E,U+00D7,U+2192,U+3000-303F,U+FF01-FF5E', f'--output-file={sub}'])+ os.remove(full)+print('fonts ok')diff --git a/styles/paper-lantern/demo/tools/subcheck.py b/styles/paper-lantern/demo/tools/subcheck.pynew file mode 100644index 0000000..d0d5622--- /dev/null+++ b/styles/paper-lantern/demo/tools/subcheck.py@@ -0,0 +1,21 @@+"""Is the ground under every subtitle dark? For each cue, one frame at its middle: in the subtitle box, the share of+non-text pixels darker than L 0.35 (text = bright and unsaturated). python tools/subcheck.py film.mp4 [offset]"""+import json, os, subprocess, sys+import numpy as np+HERE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+film, off = sys.argv[1], float(sys.argv[2]) if len(sys.argv) > 2 else 0+cues = json.load(open(os.path.join(HERE, 'timeline.json')))['cues']+worst = 1+for c in cues:+ t = (c['t0'] + c['t1']) / 2 - off+ if t < 0: continue+ raw = subprocess.run(['ffmpeg', '-loglevel', 'error', '-ss', f'{t:.3f}', '-i', film, '-frames:v', '1', '-f', 'rawvideo', '-pix_fmt', 'rgb24', '-'], capture_output=True).stdout+ if len(raw) < 1920 * 1080 * 3: continue+ im = np.frombuffer(raw, np.uint8).reshape(1080, 1920, 3) / 255.+ box = im[930:1025, 720:1200]+ L = box @ np.array([.2126, .7152, .0722]); sat = box.max(2) - box.min(2)+ text = (L > .55) & (sat < .2)+ dark = ((L < .35) & ~text).sum() / max(1, (~text).sum())+ worst = min(worst, dark)+ print(f"{c['id']:4} {t:6.2f}s dark {dark * 100:5.1f}% {c['en']}")+print('worst', round(worst * 100, 1), '%')diff --git a/styles/paper-lantern/demo/tools/timeline.py b/styles/paper-lantern/demo/tools/timeline.pynew file mode 100644index 0000000..50c165e--- /dev/null+++ b/styles/paper-lantern/demo/tools/timeline.py@@ -0,0 +1,39 @@+"""The Last Night Train — the one timeline: narration starts, bilingual cues, hit points, shot list.+python3 tools/timeline.py [film.srt] [cut.srt] → timeline.json (+ subtitles)"""+import json, os, sys+HERE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+dur = json.load(open(os.path.join(HERE, 'voices/dur.json')))+lines = json.load(open(os.path.join(HERE, 'voices/lines.json')))+AT = {'L1': 1.0, 'L2a': 10.6, 'L2b': 12.6, 'L3a': 16.2, 'L3b': 18.25, 'L4': 22.4, 'L5a': 27.3, 'L5b': 31.0, 'L6': 35.8, 'L7': 41.6, 'L8': 45.7}+ZH = {'L1': '今夜,这列老夜车跑最后一趟。', 'L2a': '从雪山,', 'L2b': '一路开到海边。',+ 'L3a': '40 年来,', 'L3b': '它在沿线每个小站都停。', 'L4': '然后,是那条长长的隧道。',+ 'L5a': '出了隧道,雪不见了,', 'L5b': '沿河的小镇都为它亮着灯。',+ 'L6': '线路的尽头,大海在等它。', 'L7': '车窗一扇一扇暗了下去。', 'L8': '可站台的灯还亮着,等下一班车。'}+EN = {'L3a': 'For 40 years,'}+L = {l['id']: {'at': AT[l['id']], 'dur': dur[l['id']], 'end': round(AT[l['id']] + dur[l['id']], 3), 'en': EN.get(l['id'], l['text']), 'zh': ZH[l['id']]} for l in lines}+DUR = 51.0+ids = list(AT); cues = []+for n, i in enumerate(ids):+ t0, t1 = L[i]['at'] - .15, max(L[i]['at'] + 1.8, L[i]['end'] + .6)+ if n + 1 < len(ids): t1 = min(t1, L[ids[n + 1]]['at'] - .16)+ else: t1 = DUR + .3 # the last line stays to the end of the film (no fade under the end card)+ cues.append({'id': i, 't0': round(t0, 3), 't1': round(t1, 3), 'zh': ZH[i], 'en': L[i]['en']})+HIT = {+ 'lamp': .4, # the halt's lamp flickers on+ 'cars': [1.5 + k * .34 for k in range(8)], # the windows light up car by car, engine first+ 'head': 5.25, 'horn': 5.5, 'depart': 5.9, # headlight, the horn, wheels start+ 'sign': 7.5, # 10 s cut only: the credit strip grows+ 'portal': 25.3, 'dark': [25.5, 25.75], # the tunnel: a blink of true dark and silence (0.25 s), then the river+ 'stop': 41.0, 'off': [42.0 + k * .42 for k in range(7)] + [45.75], # the terminus: windows go out one by one; the last one holds a beat, then goes+ 'card': 47.5,+}+DUR = 51.0+SHOTS = [['S1', 0.0, None], ['S2', 13.8, 'dissolve'], ['S3', 22.0, 'dissolve'], ['S4', 25.75, 'cut'], ['S5', 35.4, 'dissolve'], ['S6', 40.2, 'dissolve']]+CUT = [0.0, 10.0]+json.dump({'DUR': DUR, 'L': L, 'cues': cues, 'HIT': HIT, 'SHOTS': SHOTS, 'CUT': CUT}, open(os.path.join(HERE, 'timeline.json'), 'w'), indent=1, ensure_ascii=False)+def fmt(s): ms = int(round(max(0, s) * 1000)); return f"{ms // 3600000:02d}:{ms // 60000 % 60:02d}:{ms // 1000 % 60:02d},{ms % 1000:03d}"+def srt(cs, off, p): open(p, 'w', encoding='utf-8').write('\n'.join(f"{k + 1}\n{fmt(c['t0'] - off)} --> {fmt(min(c['t1'], DUR) - off)}\n{c['zh']}\n{c['en']}\n" for k, c in enumerate(cs)))+srt(cues, 0, sys.argv[1] if len(sys.argv) > 1 else os.path.join(HERE, 'demo-full.srt'))+if len(sys.argv) > 2: srt([dict(c, t0=max(c['t0'], CUT[0]), t1=min(c['t1'], CUT[1])) for c in cues if c['t1'] > CUT[0] + .3 and c['t0'] < CUT[1] - .3], CUT[0], sys.argv[2])+print('timeline.json DUR', DUR, 'min hold', min(round(c['t1'] - c['t0'], 2) for c in cues))+for c in cues: print(f" {c['id']:4} {c['t0']:6.2f}–{c['t1']:6.2f} {c['en']}")diff --git a/styles/paper-lantern/demo/tts.py b/styles/paper-lantern/demo/tts.pydeleted file mode 100644index 5992c54..0000000--- a/styles/paper-lantern/demo/tts.py+++ /dev/null@@ -1,16 +0,0 @@-"""edge-tts Chinese voice-over: python tts.py → vo/<id>.wav (48k mono, leading/trailing silence trimmed) + vo/dur.json"""-import json, subprocess, os, numpy as np, soundfile as sf-import os as _os; _os.chdir(_os.path.dirname(_os.path.abspath(__file__))) # paths relative to demo/-V, RATE, PITCH = 'zh-CN-XiaoxiaoNeural', '+10%', '-2Hz'-lines = json.load(open('script.json')); dur = {}-for L in lines:- mp3 = f"vo/{L['id']}.mp3"; wav = f"vo/{L['id']}.wav"- r = L.get('rate', RATE)- if not os.path.exists(mp3) or L.get('redo'):- subprocess.run(['edge-tts', '--voice', V, f'--rate={r}', f'--pitch={PITCH}', '--text', L.get('say', L['text']), '--write-media', mp3], check=True, capture_output=True)- subprocess.run(['ffmpeg', '-y', '-loglevel', 'error', '-i', mp3, '-ar', '48000', '-ac', '1', wav], check=True)- a, sr = sf.read(wav); thr = np.abs(a).max() * .02; nz = np.where(np.abs(a) > thr)[0]- a = a[max(0, nz[0] - int(.02 * sr)): nz[-1] + int(.12 * sr)]- sf.write(wav, a, sr); dur[L['id']] = round(len(a) / sr, 3); print(L['id'], dur[L['id']], round(len(L['text'])/dur[L['id']],2))-json.dump(dur, open('vo/dur.json', 'w'), indent=1)-print('total', round(sum(dur.values()), 1))diff --git a/styles/paper-lantern/demo/vo/dur.json b/styles/paper-lantern/demo/vo/dur.jsondeleted file mode 100644index 293110d..0000000--- a/styles/paper-lantern/demo/vo/dur.json+++ /dev/null@@ -1,27 +0,0 @@-{- "L01": 4.046,- "L02": 2.793,- "L03": 2.684,- "L04": 3.894,- "L05": 2.249,- "L06": 4.377,- "L07": 3.358,- "L08": 4.209,- "L09": 4.053,- "L10": 1.398,- "L11": 3.111,- "L12": 3.539,- "L13": 7.667,- "L14": 4.769,- "L15": 5.064,- "L16": 3.487,- "L17": 2.31,- "L18": 4.232,- "L19": 2.861,- "L20": 5.352,- "L21": 2.784,- "L22": 3.903,- "L23": 2.726,- "L24": 2.935,- "L25": 1.069-}\ No newline at end of filediff --git a/styles/paper-lantern/demo/vo/words.json b/styles/paper-lantern/demo/vo/words.jsondeleted file mode 100644index 2fde401..0000000--- a/styles/paper-lantern/demo/vo/words.json+++ /dev/null@@ -1,1977 +0,0 @@-{-"L01": [-[-"农",-0.0,-0.22-],-[-"历",-0.22,-0.36-],-[-"8",-0.36,-0.56-],-[-"月",-0.56,-0.76-],-[-"15,",-0.76,-1.06-],-[-"秋",-1.52,-1.6-],-[-"天",-1.6,-1.82-],-[-"刚",-1.82,-1.98-],-[-"好",-1.98,-2.16-],-[-"走",-2.16,-2.36-],-[-"到",-2.36,-2.52-],-[-"一",-2.52,-2.68-],-[-"半,",-2.68,-2.92-],-[-"所以",-3.2,-3.36-],-[-"叫",-3.36,-3.52-],-[-"中",-3.52,-3.7-],-[-"秋。",-3.7,-3.94-]-],-"L02": [-[-"这",-0.0,-0.26-],-[-"一",-0.26,-0.44-],-[-"夜,",-0.44,-0.72-],-[-"月",-0.9,-0.98-],-[-"亮",-0.98,-1.1-],-[-"最",-1.1,-1.36-],-[-"圆,",-1.36,-1.72-],-[-"想",-1.94,-2.02-],-[-"念",-2.02,-2.14-],-[-"也",-2.14,-2.34-],-[-"最",-2.34,-2.58-],-[-"重。",-2.58,-2.7-]-],-"L03": [-[-"我是",-0.0,-0.26-],-[-"一",-0.26,-0.54-],-[-"块",-0.54,-0.56-],-[-"月",-0.56,-0.82-],-[-"饼,",-0.82,-1.14-],-[-"出",-1.34,-1.4-],-[-"生",-1.4,-1.56-],-[-"在",-1.56,-1.74-],-[-"外",-1.74,-1.96-],-[-"婆",-1.96,-2.08-],-[-"的",-2.08,-2.28-],-[-"厨",-2.28,-2.42-],-[-"房。",-2.42,-2.6-]-],-"L04": [-[-"揉",-0.0,-0.26-],-[-"面、",-0.26,-0.58-],-[-"包",-0.8,-0.88-],-[-"馅,",-0.88,-1.36-],-[-"再",-1.54,-1.54-],-[-"用",-1.54,-1.68-],-[-"外",-1.68,-1.86-],-[-"公",-1.86,-2.06-],-[-"客",-2.06,-2.18-],-[-"的",-2.18,-2.36-],-[-"木",-2.36,-2.46-],-[-"模",-2.46,-2.66-],-[-"字,",-2.66,-3.04-],-[-"趴",-3.2,-3.32-],-[-"地",-3.32,-3.52-],-[-"一",-3.52,-3.66-],-[-"压。",-3.66,-3.82-]-],-"L05": [-[-"我的",-0.0,-0.28-],-[-"脸",-0.28,-0.48-],-[-"上",-0.48,-0.82-],-[-"就",-0.82,-1.1-],-[-"印",-1.1,-1.28-],-[-"上",-1.28,-1.44-],-[-"了",-1.44,-1.58-],-[-"一个",-1.58,-1.76-],-[-"圆",-1.76,-2.04-],-[-"字。",-2.04,-2.14-]-],-"L06": [-[-"早",-0.0,-0.2-],-[-"在",-0.2,-0.38-],-[-"明",-0.38,-0.6-],-[-"朝,",-0.6,-0.96-],-[-"中",-1.22,-1.26-],-[-"秋",-1.26,-1.42-],-[-"送",-1.42,-1.58-],-[-"月",-1.58,-1.84-],-[-"饼",-1.84,-2.08-],-[-"就",-2.08,-2.34-],-[-"成",-2.34,-2.46-],-[-"了",-2.46,-2.6-],-[-"习",-2.6,-2.84-],-[-"俗,",-2.84,-3.12-],-[-"涂",-3.28,-3.46-],-[-"的",-3.46,-3.62-],-[-"就是",-3.62,-3.78-],-[-"团",-3.78,-4.12-],-[-"圆。",-4.12,-4.32-]-],-"L07": [-[-"可",-0.0,-0.2-],-[-"今年,",-0.2,-0.66-],-[-"外",-1.08,-1.14-],-[-"婆",-1.14,-1.28-],-[-"的",-1.28,-1.44-],-[-"饭",-1.44,-1.58-],-[-"桌",-1.58,-1.74-],-[-"上,",-1.74,-2.06-],-[-"又",-2.3,-2.36-],-[-"空",-2.36,-2.5-],-[-"着",-2.5,-2.72-],-[-"一个",-2.72,-2.88-],-[-"位",-2.88,-3.1-],-[-"子。",-3.1,-3.32-]-],-"L08": [-[-"小",-0.0,-0.24-],-[-"满",-0.24,-0.44-],-[-"在",-0.44,-0.62-],-[-"很",-0.62,-0.86-],-[-"远",-0.86,-0.96-],-[-"的",-0.96,-1.14-],-[-"城",-1.14,-1.26-],-[-"市",-1.26,-1.36-],-[-"上",-1.36,-1.6-],-[-"班,",-1.6,-1.92-],-[-"已经",-2.28,-2.34-],-[-"三",-2.34,-2.54-],-[-"年",-2.54,-2.86-],-[-"没",-2.86,-3.16-],-[-"回",-3.16,-3.3-],-[-"家",-3.3,-3.46-],-[-"过",-3.46,-3.58-],-[-"中",-3.58,-3.8-],-[-"秋",-3.8,-3.96-],-[-"了。",-3.96,-4.18-]-],-"L09": [-[-"外",-0.0,-0.2-],-[-"婆",-0.2,-0.54-],-[-"把",-0.54,-0.72-],-[-"我",-0.72,-0.86-],-[-"装",-0.86,-1.0-],-[-"进",-1.0,-1.2-],-[-"盒",-1.2,-1.42-],-[-"子,",-1.42,-1.78-],-[-"压",-1.94,-2.08-],-[-"上",-2.08,-2.26-],-[-"一",-2.26,-2.4-],-[-"张",-2.4,-2.5-],-[-"字",-2.5,-2.66-],-[-"条,",-2.66,-2.94-],-[-"写",-3.18,-3.32-],-[-"好了",-3.32,-3.52-],-[-"地",-3.52,-3.82-],-[-"址。",-3.82,-3.94-]-],-"L10": [-[-"于",-0.0,-0.2-],-[-"是,",-0.2,-0.56-],-[-"我",-0.72,-0.86-],-[-"出",-0.86,-1.06-],-[-"发",-1.06,-1.18-],-[-"了。",-1.18,-1.36-]-],-"L11": [-[-"翻",-0.0,-0.2-],-[-"过",-0.2,-0.4-],-[-"山、",-0.4,-0.68-],-[-"跨",-0.88,-1.0-],-[-"过",-1.0,-1.12-],-[-"江,",-1.12,-1.4-],-[-"在",-1.78,-1.8-],-[-"夜",-1.8,-2.0-],-[-"车",-2.0,-2.12-],-[-"里",-2.12,-2.32-],-[-"摇",-2.32,-2.52-],-[-"摇",-2.52,-2.66-],-[-"晃",-2.66,-2.9-],-[-"晃。",-2.9,-3.02-]-],-"L12": [-[-"第一",-0.0,-0.26-],-[-"次",-0.26,-0.44-],-[-"离",-0.44,-0.64-],-[-"开",-0.64,-0.76-],-[-"外",-0.76,-0.96-],-[-"婆,",-0.96,-1.28-],-[-"我",-1.54,-1.64-],-[-"才",-1.64,-1.76-],-[-"知道,",-1.76,-2.18-],-[-"原",-2.44,-2.5-],-[-"来",-2.5,-2.66-],-[-"这",-2.66,-2.84-],-[-"就是",-2.84,-3.02-],-[-"想",-3.02,-3.26-],-[-"家。",-3.26,-3.4-]-],-"L13": [-[-"外",-0.0,-0.18-],-[-"婆",-0.18,-0.32-],-[-"讲",-0.32,-0.64-],-[-"过,",-0.64,-1.0-],-[-"月",-1.18,-1.26-],-[-"亮",-1.26,-1.4-],-[-"上",-1.4,-1.56-],-[-"住",-1.56,-1.7-],-[-"着",-1.7,-1.9-],-[-"嫦",-1.9,-2.1-],-[-"娥,",-2.1,-2.42-],-[-"她",-2.6,-2.72-],-[-"回",-2.72,-2.9-],-[-"不了",-2.9,-3.12-],-[-"家,",-3.12,-3.42-],-[-"就",-3.68,-3.8-],-[-"把",-3.8,-3.92-],-[-"月",-3.92,-4.14-],-[-"亮",-4.14,-4.28-],-[-"点",-4.28,-4.4-],-[-"的",-4.4,-4.58-],-[-"格",-4.58,-4.66-],-[-"外",-4.66,-4.86-],-[-"亮,",-4.86,-5.12-],-[-"好",-5.42,-5.48-],-[-"让",-5.48,-5.6-],-[-"地",-5.6,-5.8-],-[-"上",-5.8,-5.96-],-[-"想",-5.96,-6.12-],-[-"家",-6.12,-6.32-],-[-"的人,",-6.32,-6.68-],-[-"都",-6.88,-7.06-],-[-"看",-7.06,-7.26-],-[-"得",-7.26,-7.44-],-[-"见。",-7.44,-7.58-]-],-"L14": [-[-"半",-0.0,-0.18-],-[-"路",-0.18,-0.32-],-[-"上,",-0.32,-0.7-],-[-"一个",-0.9,-1.04-],-[-"盒",-1.04,-1.3-],-[-"子",-1.3,-1.44-],-[-"和",-1.44,-1.56-],-[-"我",-1.56,-1.72-],-[-"擦",-1.72,-1.84-],-[-"肩",-1.84,-2.0-],-[-"而",-2.0,-2.2-],-[-"过。",-2.2,-2.44-],-[-"他",-2.96,-3.08-],-[-"往",-3.08,-3.2-],-[-"南",-3.2,-3.38-],-[-"走,",-3.38,-3.74-],-[-"走",-4.0,-4.08-],-[-"得",-4.08,-4.2-],-[-"很",-4.2,-4.48-],-[-"急。",-4.48,-4.64-]-],-"L15": [-[-"终",-0.0,-0.24-],-[-"于,",-0.24,-0.62-],-[-"我",-0.8,-0.9-],-[-"到了",-0.9,-1.04-],-[-"小",-1.04,-1.3-],-[-"满",-1.3,-1.42-],-[-"的",-1.42,-1.64-],-[-"城",-1.64,-1.82-],-[-"市。",-1.82,-2.24-],-[-"楼",-2.24,-2.64-],-[-"很",-2.64,-2.88-],-[-"高,",-2.88,-3.18-],-[-"灯",-3.36,-3.48-],-[-"很",-3.48,-3.72-],-[-"亮,",-3.72,-3.96-],-[-"月",-4.22,-4.32-],-[-"亮",-4.32,-4.44-],-[-"却",-4.44,-4.6-],-[-"很",-4.6,-4.86-],-[-"远。",-4.86,-4.98-]-],-"L16": [-[-"他",-0.0,-0.24-],-[-"加",-0.24,-0.32-],-[-"完",-0.32,-0.44-],-[-"班",-0.44,-0.6-],-[-"回",-0.6,-0.92-],-[-"来,",-0.92,-1.2-],-[-"拆",-1.34,-1.44-],-[-"开",-1.44,-1.6-],-[-"盒",-1.6,-1.82-],-[-"子,",-1.82,-2.14-],-[-"看",-2.38,-2.54-],-[-"见",-2.54,-2.64-],-[-"了",-2.64,-2.76-],-[-"外",-2.76,-2.92-],-[-"婆",-2.92,-3.1-],-[-"的",-3.1,-3.24-],-[-"字。",-3.24,-3.38-]-],-"L17": [-[-"月",-0.0,-0.2-],-[-"亮",-0.2,-0.4-],-[-"圆",-0.4,-0.58-],-[-"了,",-0.58,-0.94-],-[-"就",-1.18,-1.26-],-[-"算",-1.26,-1.38-],-[-"你",-1.38,-1.6-],-[-"回",-1.6,-1.7-],-[-"过",-1.7,-1.86-],-[-"家",-1.86,-2.06-],-[-"了。",-2.06,-2.28-]-],-"L18": [-[-"他",-0.0,-0.18-],-[-"咬",-0.18,-0.3-],-[-"了",-0.3,-0.52-],-[-"一",-0.52,-0.66-],-[-"口,",-0.66,-0.9-],-[-"是",-1.1,-1.24-],-[-"小",-1.24,-1.44-],-[-"时候",-1.44,-1.66-],-[-"的",-1.66,-1.84-],-[-"味",-1.84,-1.98-],-[-"道。",-1.98,-2.56-],-[-"眼",-2.96,-3.0-],-[-"睛,",-3.0,-3.32-],-[-"一下",-3.46,-3.66-],-[-"就",-3.66,-3.84-],-[-"红",-3.84,-4.0-],-[-"了。",-4.0,-4.18-]-],-"L19": [-[-"同",-0.0,-0.22-],-[-"一个",-0.22,-0.42-],-[-"晚上,",-0.42,-0.92-],-[-"外",-1.32,-1.36-],-[-"婆",-1.36,-1.56-],-[-"也",-1.56,-1.78-],-[-"收",-1.78,-1.92-],-[-"到了",-1.92,-2.12-],-[-"一个",-2.12,-2.38-],-[-"盒",-2.38,-2.64-],-[-"子。",-2.64,-2.78-]-],-"L20": [-[-"里",-0.0,-0.18-],-[-"面",-0.18,-0.34-],-[-"是",-0.34,-0.52-],-[-"一",-0.52,-0.68-],-[-"块",-0.68,-0.76-],-[-"歪",-0.76,-1.02-],-[-"歪",-1.02,-1.18-],-[-"扭",-1.18,-1.34-],-[-"扭",-1.34,-1.44-],-[-"的",-1.44,-1.58-],-[-"月",-1.58,-1.78-],-[-"饼,",-1.78,-2.06-],-[-"还",-2.28,-2.32-],-[-"有一",-2.32,-2.5-],-[-"张",-2.5,-2.68-],-[-"字",-2.68,-2.88-],-[-"条,",-2.88,-3.16-],-[-"外",-3.46,-3.68-],-[-"婆,",-3.68,-4.04-],-[-"今年",-4.26,-4.44-],-[-"换",-4.44,-4.64-],-[-"我",-4.64,-4.84-],-[-"给",-4.84,-4.94-],-[-"你",-4.94,-5.1-],-[-"做。",-5.1,-5.28-]-],-"L21": [-[-"原",-0.0,-0.22-],-[-"来,",-0.22,-0.76-],-[-"相",-0.98,-1.02-],-[-"思",-1.02,-1.16-],-[-"的",-1.16,-1.38-],-[-"香",-1.38,-1.56-],-[-"是",-1.56,-1.94-],-[-"互",-1.94,-2.16-],-[-"相",-2.16,-2.34-],-[-"的",-2.34,-2.56-],-[-"香。",-2.56,-2.66-]-],-"L22": [-[-"九",-0.0,-0.2-],-[-"百",-0.2,-0.34-],-[-"多",-0.34,-0.56-],-[-"年前",-0.56,-0.8-],-[-"的",-0.8,-1.0-],-[-"中",-1.0,-1.08-],-[-"秋,",-1.08,-1.5-],-[-"苏",-1.72,-1.82-],-[-"氏",-1.82,-2.0-],-[-"想",-2.0,-2.18-],-[-"念",-2.18,-2.32-],-[-"弟",-2.32,-2.62-],-[-"弟,",-2.62,-2.88-],-[-"写",-3.1,-3.22-],-[-"下",-3.22,-3.42-],-[-"了",-3.42,-3.6-],-[-"一",-3.6,-3.72-],-[-"句。",-3.72,-3.82-]-],-"L23": [-[-"但",-0.0,-0.24-],-[-"愿",-0.24,-0.4-],-[-"人",-0.4,-0.64-],-[-"长",-0.64,-0.94-],-[-"久,",-0.94,-1.28-],-[-"千",-1.66,-1.72-],-[-"里",-1.72,-1.96-],-[-"共",-1.96,-2.16-],-[-"禅",-2.16,-2.46-],-[-"绢。",-2.46,-2.62-]-],-"L24": [-[-"隔",-0.0,-0.18-],-[-"着",-0.18,-0.36-],-[-"尖",-0.36,-0.56-],-[-"里,",-0.56,-0.86-],-[-"我们",-1.1,-1.22-],-[-"看",-1.22,-1.5-],-[-"的是",-1.5,-1.98-],-[-"同",-1.98,-2.24-],-[-"一个",-2.24,-2.44-],-[-"月",-2.44,-2.72-],-[-"亮。",-2.72,-2.84-]-],-"L25": [-[-"中",-0.0,-0.24-],-[-"秋",-0.24,-0.48-],-[-"快",-0.48,-0.78-],-[-"乐!",-0.78,-0.98-]-]-}\ No newline at end of filediff --git a/styles/paper-lantern/demo/voices/dur.json b/styles/paper-lantern/demo/voices/dur.jsonnew file mode 100644index 0000000..fa806ac--- /dev/null+++ b/styles/paper-lantern/demo/voices/dur.json@@ -0,0 +1,13 @@+{+ "L1": 4.145,+ "L2a": 1.557,+ "L2b": 2.756,+ "L3a": 1.669,+ "L3b": 4.111,+ "L4": 2.63,+ "L5a": 3.425,+ "L5b": 3.903,+ "L6": 3.828,+ "L7": 3.478,+ "L8": 4.231+}\ No newline at end of filediff --git a/styles/paper-lantern/demo/voices/lines.json b/styles/paper-lantern/demo/voices/lines.jsonnew file mode 100644index 0000000..85433e0--- /dev/null+++ b/styles/paper-lantern/demo/voices/lines.json@@ -0,0 +1,68 @@+[+ {+ "id": "L1",+ "text": "Tonight, the old night train makes its last run.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L2a",+ "text": "From the snow,",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L2b",+ "text": "all the way down to the sea.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L3a",+ "text": "For forty years,",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L3b",+ "text": "it stopped at every small station on the line.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L4",+ "text": "Then came the long tunnel.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L5a",+ "text": "On the other side, the snow was gone,",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L5b",+ "text": "and the river towns kept their lights on for it.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L6",+ "text": "At the end of the line, the ocean was waiting.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L7",+ "text": "One by one, the windows went dark.",+ "voice": "bm_george",+ "speed": 0.78+ },+ {+ "id": "L8",+ "text": "But the station light stays on, for the next train.",+ "voice": "bm_george",+ "speed": 0.78+ }+]\ No newline at end of filediff --git a/styles/paper-lantern/demo/voices/words.json b/styles/paper-lantern/demo/voices/words.jsonnew file mode 100644index 0000000..a9b1af8--- /dev/null+++ b/styles/paper-lantern/demo/voices/words.json@@ -0,0 +1,429 @@+{+"L1": [+[+"Tonight,",+-0.6,+0.44+],+[+"the",+0.86,+0.92+],+[+"old",+0.92,+1.22+],+[+"night",+1.22,+1.56+],+[+"train",+1.56,+2.08+],+[+"makes",+2.08,+2.54+],+[+"its",+2.54,+2.8+],+[+"last",+2.8,+3.18+],+[+"run.",+3.18,+3.74+]+],+"L2a": [+[+"From",+-0.6,+0.22+],+[+"the",+0.22,+0.44+],+[+"snow.",+0.44,+0.88+]+],+"L2b": [+[+"All",+-0.6,+0.24+],+[+"the",+0.24,+0.46+],+[+"way",+0.46,+0.72+],+[+"down",+0.72,+1.26+],+[+"to",+1.26,+1.8+],+[+"the",+1.8,+1.92+],+[+"sea.",+1.92,+2.24+]+],+"L3a": [+[+"for",+-0.6,+0.14+],+[+"40",+0.14,+0.66+],+[+"years.",+0.66,+1.18+]+],+"L3b": [+[+"It",+-0.6,+0.12+],+[+"stopped",+0.12,+0.54+],+[+"at",+0.54,+1.0+],+[+"every",+1.0,+1.38+],+[+"small",+1.38,+1.88+],+[+"station",+1.88,+2.5+],+[+"on",+2.5,+3.14+],+[+"the",+3.14,+3.32+],+[+"line.",+3.32,+3.6+]+],+"L4": [+[+"Then",+-0.6,+0.28+],+[+"came",+0.28,+0.74+],+[+"the",+0.74,+1.26+],+[+"long",+1.26,+1.52+],+[+"tunnel.",+1.52,+2.12+]+],+"L5a": [+[+"On",+-0.6,+0.18+],+[+"the",+0.18,+0.34+],+[+"other",+0.34,+0.58+],+[+"side,",+0.58,+1.16+],+[+"the",+1.58,+1.72+],+[+"snow",+1.72,+2.08+],+[+"was",+2.08,+2.5+],+[+"gone.",+2.5,+2.86+]+],+"L5b": [+[+"and",+-0.6,+0.14+],+[+"the",+0.14,+0.24+],+[+"river",+0.24,+0.48+],+[+"towns",+0.48,+1.12+],+[+"kept",+1.12,+1.94+],+[+"their",+1.94,+2.26+],+[+"lights",+2.26,+2.6+],+[+"on",+2.6,+3.0+],+[+"for",+3.0,+3.36+],+[+"it.",+3.36,+3.68+]+],+"L6": [+[+"At",+-0.6,+0.16+],+[+"the",+0.16,+0.32+],+[+"end",+0.32,+0.58+],+[+"of",+0.58,+0.78+],+[+"the",+0.78,+0.9+],+[+"line,",+0.9,+1.32+],+[+"the",+1.78,+1.98+],+[+"ocean",+1.98,+2.44+],+[+"was",+2.44,+2.84+],+[+"waiting.",+2.84,+3.36+]+],+"L7": [+[+"One",+-0.6,+0.26+],+[+"by",+0.26,+0.56+],+[+"one,",+0.56,+0.98+],+[+"the",+1.46,+1.62+],+[+"windows",+1.62,+2.04+],+[+"went",+2.04,+2.52+],+[+"dark.",+2.52,+2.98+]+],+"L8": [+[+"But",+-0.6,+0.12+],+[+"the",+0.12,+0.24+],+[+"station",+0.24,+0.7+],+[+"light",+0.7,+1.2+],+[+"stays",+1.2,+1.76+],+[+"on",+1.76,+2.28+],+[+"for",+2.28,+2.8+],+[+"the",+2.8,+2.96+],+[+"next",+2.96,+3.24+],+[+"train.",+3.24,+3.72+]+]+}\ No newline at end of filediff --git a/styles/paper-lantern/demo/words.py b/styles/paper-lantern/demo/words.pydeleted file mode 100644index 5dcdd91..0000000--- a/styles/paper-lantern/demo/words.py+++ /dev/null@@ -1,10 +0,0 @@-import json, sys-import os as _os; _os.chdir(_os.path.dirname(_os.path.abspath(__file__))) # paths relative to demo/-from faster_whisper import WhisperModel-m = WhisperModel('medium', device='cpu', compute_type='int8')-out = {}-for lid in sys.argv[1:]:- segs, _ = m.transcribe(f"vo/{lid}.wav", language='zh', word_timestamps=True, initial_prompt='以下是普通话的句子。')- out[lid] = [(w.word, round(w.start, 2), round(w.end, 2)) for s in segs for w in s.words]- print(lid, out[lid])-json.dump(out, open('vo/words.json', 'w'), ensure_ascii=False, indent=0)diff --git a/styles/paper-lantern/paper-lantern.srt b/styles/paper-lantern/paper-lantern.srtindex 39592a7..2861980 100644--- a/styles/paper-lantern/paper-lantern.srt+++ b/styles/paper-lantern/paper-lantern.srt@@ -1,99 +1,54 @@1-00:00:02,500 --> 00:00:06,896-农历八月十五 秋天刚好走到一半 所以叫中秋+00:00:00,850 --> 00:00:05,745+今夜,这列老夜车跑最后一趟。+Tonight, the old night train makes its last run.2-00:00:07,146 --> 00:00:10,289-这一夜 月亮最圆 想念也最重+00:00:10,450 --> 00:00:12,440+从雪山,+From the snow,3-00:00:14,139 --> 00:00:17,173-我是一块月饼 出生在外婆的厨房+00:00:12,450 --> 00:00:15,956+一路开到海边。+all the way down to the sea.4-00:00:17,173 --> 00:00:21,217-揉面 包馅 再用外公刻的木模子 啪地一压+00:00:16,050 --> 00:00:18,090+40 年来,+For 40 years,5-00:00:21,217 --> 00:00:23,816-我的脸上 就印上了一个“圆”字+00:00:18,100 --> 00:00:22,240+它在沿线每个小站都停。+it stopped at every small station on the line.6-00:00:24,466 --> 00:00:29,193-早在明朝 中秋送月饼就成了习俗 图的就是团圆+00:00:22,250 --> 00:00:25,630+然后,是那条长长的隧道。+Then came the long tunnel.7-00:00:30,243 --> 00:00:33,951-可今年 外婆的饭桌上 又空着一个位子+00:00:27,150 --> 00:00:30,840+出了隧道,雪不见了,+On the other side, the snow was gone,8-00:00:34,101 --> 00:00:38,660-小满在很远的城市上班 已经三年没回家过中秋了+00:00:30,850 --> 00:00:35,503+沿河的小镇都为它亮着灯。+and the river towns kept their lights on for it.9-00:00:39,310 --> 00:00:43,713-外婆把我装进盒子 压上一张字条 写好了地址+00:00:35,650 --> 00:00:40,228+线路的尽头,大海在等它。+At the end of the line, the ocean was waiting.10-00:00:43,713 --> 00:00:45,461-于是 我出发了+00:00:41,450 --> 00:00:45,540+车窗一扇一扇暗了下去。+One by one, the windows went dark.11-00:00:46,711 --> 00:00:50,172-翻过山 跨过江 在夜车里摇摇晃晃--12-00:00:50,322 --> 00:00:54,211-第一次离开外婆 我才知道 原来这就是想家--13-00:00:54,761 --> 00:01:02,778-外婆讲过 月亮上住着嫦娥 她回不了家 就把月亮点得格外亮 好让地上想家的人 都看得见--14-00:01:03,228 --> 00:01:08,347-半路上 一个盒子和我擦肩而过 它往南走 走得很急--15-00:01:09,297 --> 00:01:14,711-终于 我到了小满的城市 楼很高 灯很亮 月亮却很远--16-00:01:15,161 --> 00:01:18,898-她加完班回来 拆开盒子 看见了外婆的字--17-00:01:18,898 --> 00:01:21,558-“月亮圆了 就算你回过家了 ”--18-00:01:22,408 --> 00:01:26,990-她咬了一口 是小时候的味道 眼睛 一下就红了--19-00:01:28,240 --> 00:01:31,451-同一个晚上 外婆也收到了一个盒子--20-00:01:31,551 --> 00:01:37,253-里面是一块歪歪扭扭的月饼 还有一张字条 “外婆 今年换我给你做 ”--21-00:01:38,303 --> 00:01:41,437-原来 相思的“相” 是互相的相--22-00:01:42,687 --> 00:01:46,940-九百多年前的中秋 苏轼想念弟弟 写下了一句--23-00:01:46,940 --> 00:01:50,016-但愿人长久 千里共婵娟--24-00:01:51,666 --> 00:01:54,951-隔着千里 我们看的 是同一个月亮--25-00:01:55,601 --> 00:01:57,020-中秋快乐+00:00:45,550 --> 00:00:51,000+可站台的灯还亮着,等下一班车。+But the station light stays on, for the next train.diff --git a/styles/paper-lantern/poster.jpg b/styles/paper-lantern/poster.jpgindex 00fbe90..d162bd5 100644Binary files a/styles/paper-lantern/poster.jpg and b/styles/paper-lantern/poster.jpg differdiff --git a/styles/paper-lantern/style.json b/styles/paper-lantern/style.jsonindex 7f62985..85c24b6 100644--- a/styles/paper-lantern/style.json+++ b/styles/paper-lantern/style.json@@ -5,14 +5,14 @@"cn": "纸雕灯影","category_en": "East Asian Traditions","category_cn": "东方传统",- "film": "A Mooncake's Longing",- "line": "A single mooncake tells the Mid-Autumn story of reunion and longing inside a glowing paper-cut lightbox.",- "line_cn": "一枚月饼讲中秋的团圆与思念,纸雕灯箱层层透光。",+ "film": "The Last Night Train",+ "line": "An old night train makes its last run, from a snowy mountain halt through a long tunnel to the sea, its lit windows going out one by one at the end of the line.",+ "line_cn": "一列老夜车跑最后一趟:从雪山小站穿过长隧道开到海边,到站后车窗一扇扇熄灭。","uses": [- "Festivals",- "Gift brands",- "Cultural stories"+ "Journeys and travel",+ "Farewells and anniversaries",+ "Places and their stories"],- "frame_sec": 60.9,- "dur": 121.8+ "frame_sec": 9.6,+ "dur": 51.0}