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
Transit Map: a printed metro map that grows line by line under a moving camera
lemomo-ai498b324a23c7
diff --git a/styles/transit-map/DEMO.md b/styles/transit-map/DEMO.mdnew file mode 100644index 0000000..251da81--- /dev/null+++ b/styles/transit-map/DEMO.md@@ -0,0 +1,85 @@+# Transit Map — our demo++One example among many. Don't reuse its story, arc, shots, props or timings.++Demo: *6 Kilometres* 《6 公里》 (47.0 s) · `transit-map.mp4` · source in [`demo/`](demo/)++In 1993 the Shanghai Metro was one 6 km section of Line 1 with five stations. On a printed schematic the network grows year by year to 21 lines and 906 km; halfway through, London and Shanghai are drawn as two lines on one time axis. No narration and so no subtitles: everything the viewer reads is printed on the sheet or on the counter, a Chinese line above an English line. **Unofficial fan film, not affiliated with the operator.** Line colours and station names are public facts; no operator logo or branded bullet appears, and the schematic is our own drawing. Every number and its source is in [`demo/FACTS.md`](demo/FACTS.md).++## Story & structure++Logline: it all started with 6 kilometres.++Arc: a train's headlights in a tunnel flare white and collapse into a red dot on the map (1993) → the pen draws the first section, five stops, the counter reads 6.0 → Line 1 reaches the railway station (1995) → the camera rides Line 2 across the city; its interchange ring falls onto People's Square; the camera drops low as the line dives under the Huangpu (1999) → a long pull-back while a decade of lines burst out at once (2000–2010, 420 km) → a glide down the sheet to a printed time-line panel: London 1863 → 402 km in 163 years, Shanghai 1993 → 420 km in 17 years, judged after a still hold → back up for a low sweep over today's network with every train running (906 km, the daily ridership record) → push back to the first section under a paper veil: "you are here", "it all started with 6 km" → end card.++Three structures were weighed: a top view that only zooms (clear, but a flat picture moving), the finished 2026 network rewound to 1993 (a first second full of small type and no place to land), and the one we made, which changes the camera every 3–5 s and lands on the first section again.++Native moves spent: *the pen tip* (first section, Line 2), *the interchange that falls* (People's Square), *the tunnel under the water* (Line 2), *levels of detail* (2000–2010 pull-back), *time lines* (the verdict), *the odometer* (throughout), *the plate by the lens* (the sweep), *you are here* (ending).++## Shots++Film time in seconds; zoom in px per grid step (G). The picture is written in story time and mapped to film time by `WARP` in `timeline.js`: the 1995 beat plays at 0.4× so its counter values can be read, and the verdict holds 0.8 s longer.++| # | Time | Shot | Camera | Native move / note |+|---|---|---|---|---|+| 1 | 0.0–1.4 | running tunnel, lamps streaking, oncoming headlights grow and light the lining; white-out from 1.1 | forward rush | screen-space tunnel |+| 2 | 1.4–6.2 | match cut: the white collapses into the red dot of Jinjiang Park; the tip draws five stops (Xinlonghua under its 1993 name), counter 0 → 6.0; printed callout "1993.5.28 · 1 号线首段 · 6 公里 · 5 站"; a train shuttles | keeps the first stop and the tip both in frame, tilt 30° → 7°, zoom 260 → 130, aperture 16 → 6 | **signature 1**: headlight → dot; hold 4.3–6.2 |+| 3 | 6.2–9.0 | 1995: Line 1 to the railway station; the counter lands 1995 / 16.1 and holds | slow pull-back to the north-east, zoom 86 | |+| 4 | 9.0–13.0 | 1999: Line 2 from Zhongshan Park; a capsule falls and lands on People's Square at 10.48 with shock rings; 10.75–12.05 the line runs dashed under the Huangpu | rides the tip at tilt 24°, zoom 150, aim 1.6 G ahead; drops to tilt 61° (zoom 185, aperture 26) over the river, rises at Lujiazui | **signature 2**: the interchange falls |+| 5 | 13.0–14.3 | 2000: Line 3 along the west | rise and pull back | |+| 6 | 14.3–21.7 | 2002–2010: lines burst out with bullets and years; only hub names; counter lands 420.0 at 19.9 | continuous pull-back, zoom 78 → 52, tilt 12° → 0° | levels of detail |+| 7 | 21.7–24.95 | glide down the sheet to the time-line panel; London draws 1863 → 2026, Shanghai 1993 → 2010 → 2026 in a blink | slides over the paper, tilt up to 26°, eases in | |+| 8 | 24.95–30.5 | the panel alone on paper: both lines, both start values (6 km), 402 / 420 / 906 km and the axis; 27.5 brackets "163 年 → 402 公里", 27.9 "17 年 → 420 公里" stamped in red | locked top view: 2.55 s before the verdict, 3 s after | **signature 3**: time lines |+| 9 | 30.5–32.4 | 2011–2024 lines complete; counter lands 906.0 | rises off the panel across the tilted sheet (tilt 30°, zoom 42); the table shows | |+| 10 | 32.4–37.1 | every line runs trains; only ten hub names; a cream enamel People's Square name plate on its post stands in the lower-right corner, out of focus; ridership drums land 1339.7 万 at 35.4 | low sweep, tilt 57° → 62°, heading 26° → −14°, zoom 102, aperture 24 | the plate by the lens |+| 11 | 37.1–44.0 | the network fades under a paper veil, the first section stays red; "you are here"; "一切从 6 公里开始 / It all started with 6 km" and the unofficial note | rise to top view, push 62 → 142; hold 42.1–44.0 | you are here |+| 12 | 44.0–47.0 | end card | hard cut to the sheet's corner | |++## Score structure++120 BPM, D major, chords D–Bm–G–A one per bar. The station chime (vibraphone A5 → F♯5 with glockenspiel an octave up) opens the map at 1.55, lands 2010 at 19.9, rings the verdict at 27.5, the ridership record at 35.4, "you are here" at 39.9 and the end card at 44.5 (film time). Grooves run in film time so the tempo never stretches with the slow 1995 beat.++| Section | Time | Palette |+|---|---|---|+| Tunnel | 0–1.4 | brown-noise rumble rising, wheel clacks accelerating, a two-tone horn at 0.55, a band-passed riser into the flare; the music is muted until the cut |+| First section | 1.4–6.2 | the chime; a glockenspiel + marimba pluck per stop (D–E–F♯–A–B); string pad from 2.0; a harp arpeggio on the callout; shuttle clacks |+| 1995–2000 | 6.3–14.3 | marimba ostinato in eighths, pizzicato bass on beats, kick every bar; the falling capsule is a descending whistle, its landing a bass drum, timpani, gran cassa and a horn/trombone D chord; under the river the whole score is low-passed to 520 Hz with a water bed; clarinet answers Line 3 |+| Burst | 14.3–21.7 | each new line adds one voice on the groove (glass, flute, spiccato violins, xylophone, horn, harp, trumpet, cellos, vibraphone, oboe), snare backbeat from 2007, roll into a landing hit with horns, crash and the chime |+| Time lines | 21.7–30.5 | woodblock beats, a cello rising with the London line and a pizzicato tick every 20 years it passes; a ten-note glockenspiel run for Shanghai; a thin string chord with hi-hat during the hold; 27.15–27.5 the music drops away; tubular bell and chime on the verdict, timpani and horns on the stamp |+| Now | 30.5–37.1 | snare roll and swell up the rise, then the full groove (strings, horns, spiccato, xylophone, snare) with rail clacks in eighths across the stereo field; a swish as the plate passes; ratchet ticks while the ridership drums roll |+| Back | 37.1–44.0 | the ensemble lifts away; a bowed-vibraphone pad; the chime alone; a harp under the caption |+| End | 44.0–47.0 | harp D chord, horns and strings, the chime once more, a 0.7 s fade |++Mix (`audio.py`): music × 0.9 under the effects; 38 Hz high-pass and a −5 dB shelf under 75 Hz; bus compression (threshold 0.16, ratio 2.8); loudness loop measured with ffmpeg ebur128. The mix measures −16.0 LUFS integrated, true peak −4.9 dBTP, LRA 6.9 LU, energy below 50 Hz 17.6 dB under the full band; the master measures −13.9 LUFS.++## Palette & props++- Paper #F2EEE5 on a near-black table; ink #1B1C1E; river #BCD6EA with #8FB5D6 edges; first-section red #E3002B; London navy #24346E.+- Line colours as commonly published (1 #E3002B, 2 #82BF25, 3 #FCD600, 4 #461D84, 5 #944D9A, 6 #D40068, 7 #ED6F00, 8 #0094D8, 9 #87CAED, 10 #C6AFD4, 11 #871C2B, 12 #007A60, 13 #E999C0, 14 #626020, 15 #BCA886, 16 #98D1C0, 17 #BC796F, 18 #C4984F, Pujiang #B5B5B6, Maglev #008B9A, airport link #3D688A). The Maglev is the one thin line (a second rail mode).+- Props: the schematic (about 150 named stations, 21 lines, generated minor stops), the Huangpu and Suzhou Creek, the north-west cartouche "上海地铁 / Shanghai Metro", the first-section callout, the Expo star, the time-line panel in the sheet's lower margin, the enamel counter (year, route length, daily record), the People's Square name plate, the end-card frame.++## End card++In the sheet's lower-right corner, inked at the end: a red line runs to a terminus ring; 6 公里 / 6 Kilometres; 地铁线路图 / Transit Map; LemoLab × Claude Opus 5.5; 非官方致敬片,与运营方无关 / Unofficial fan film, not affiliated with the operator. 3.0 s. The "LemoLab × Claude Opus 5.5" sign-off belongs to this library's demo only; a user's film carries no LemoLab credit and no copy of this card.++## Build notes++```+demo/+ build.sh one command: fonts, events, score + mix, picture, master, reading-time check, poster and style frame+ index.html two canvases (WebGL plane, 2D overlay), fonts, scripts+ net.js the network as data + expand() (octilinear bends)+ gl.js makePlane(): paper, light, sheet edge, depth of field, vignette+ film.js geometry, phases, labels, camera, inked region, map drawing, events, window.TEXTS+ timeline.js facts (FX), WARP, phases, camera keys, annotations, time-line panel, counter, tunnel, plate, cues+ audio.py score + effects + loudness loop -> mix.wav (reads events.json)+ tools/ subset.py (Noto Sans SC subset from the characters in the JS), sheet.sh (contact sheet for review)+ fonts/ Inter, the Noto Sans SC subset, OFL texts+ FACTS.md, CREDITS+```++- Build: `sh styles/transit-map/demo/build.sh` from the library root. It downloads Inter and Noto Sans SC when missing (OFL, github.com/google/fonts) and the vcsl, freepats and vsco2ce sample packs (`sh tools/fetch.sh instruments <lib>`), subsets the CJK font, exports `events.json`, writes `mix.wav`, renders at 30 fps with three workers, masters with `core/render/mux.sh` (grain 1), runs `readcheck.mjs` and takes the poster and `demo/stills/styleframe.jpg` at 36.2 s. The picture renders in well under a minute on an Apple-silicon Mac; the whole build takes a few minutes.+- Reading time: `window.TEXTS(t)` reports every line meant to be read (callout, station names, counter rows, the time-line panel, caption, end card) with its screen box; `readcheck.mjs` passes on all 76 pieces. Map labels show by shot (an allow-list in `timeline.js`, `labelOnly`) so no name flashes past too briefly.+- Order when editing: `net.js` / `timeline.js` → `tools/subset.py` when text changes → `node core/render/events.mjs styles/transit-map/demo` → `.venv/bin/python styles/transit-map/demo/audio.py` → render. `sh styles/transit-map/demo/tools/sheet.sh` makes a 0.5 s contact sheet in `demo/out/`.+- 1080p frames take 30–250 ms (most 35–60 ms); the inked region is redrawn every frame at up to 4096². Needs WebGL2 with `EXT_color_buffer_float` (the depth-of-field pass reads a half-float buffer).+- Demo-specific pitfalls: the 1993 station 新龙华 was renamed 上海南站 (1999), so the label switches at 1999; Line 4 is a loop whose start and end are the same station (phases name the last occurrence explicitly); Lines 3 and 4 share the western corridor and are drawn as offset parallels; the counter must never show an unsourced year-end total, hence the spinning drums between landings.diff --git a/styles/transit-map/STYLE.md b/styles/transit-map/STYLE.mdnew file mode 100644index 0000000..578b559--- /dev/null+++ b/styles/transit-map/STYLE.md@@ -0,0 +1,163 @@+# Transit Map — Style Prompt++> A metro schematic printed on a physical sheet: lines held to eight directions, white stops, black-outlined interchange capsules, water as a flat blue band. The network is drawn on by glowing pen tips while a real perspective camera moves over the paper: it rides a tip, drops low where a line dives under water, pulls back through levels of detail and sweeps across the densest knot at a low angle with a shallow focus.+> References (grammar only): the octilinear schematic tradition of metro diagrams (Beck's Underground diagram, Vignelli's New York map), the stamp of a printed cartouche, flatbed and macro photography of maps lying on a table. Copy none of their layouts, typefaces, icons or line bullets; never name them in the film.++## 1. Essence, and what it is not++- **Eight directions only.** Every line segment, river edge and coastline is horizontal, vertical or at 45°; every corner is one fillet radius. A line never wiggles.+- **Growth is drawing.** A line exists as far as its pen tip has travelled; stops light when the tip passes; an interchange appears only when the second line actually arrives, and it lands with weight.+- **Ink on a sheet.** The map is printed on paper with tooth and fibres, lit by one raking light, and the sheet lies on a dark table. The camera sees it as an object: in perspective, with depth of field, and with its edge in wide or low shots.+- **Words are printed.** Station names, callouts and cartouches are ink on the sheet; running numbers live on one small mechanical counter. Every text line holds one language.+- **One map, many scales.** The same sheet serves a single station and the whole network; detail appears and disappears with scale.++Not Data Storytelling (even a time chart is drawn as two lines with stops), not Blueprint (no white-on-blue linework), not Isometric Infographic (the map is flat; depth comes from the camera), not a 3D city map (no extruded buildings, no terrain), not a keynote (no slides, header bars, centred titles or page turns).++## 2. Materials & rendering++**The unit is the grid step, G.** Every coordinate and size on the sheet is given in G. Named stations sit on a 0.1 G lattice and at least 0.7 G apart along a line; a city network spans about 30 × 30 G and the sheet adds margins for the cartouche and any printed panel (about 45 × 47 G in our demo). The camera's zoom is read in screen pixels per G at the focus point (1080p).++| Mark | Geometry (G) |+|---|---|+| Line | 0.15 wide, round caps; corner fillet radius 0.34 |+| Thin line (a second rail mode) | 0.07 wide; fillet 0.30 |+| Parallel lines sharing a corridor | each offset ±0.10 from the shared axis (0.20 centre to centre, 0.05 of paper between); three or more: 0.20 steps |+| Stop | white disc r 0.085, ring 0.046 in the line colour |+| Terminus | an ordinary stop; when the end of a line matters (a destination, an end card) a white ring r 0.15 with a 0.06 ink outline |+| Minor stop (generated tick) | white disc r 0.065, ring 0.036; at most one per 0.78 G of track |+| Interchange capsule | the bounding box of every line point at the station, padded 0.13 on all sides; corner radius = half the shorter side (a stadium); white fill; ink outline 0.055 (0.07 for a major hub) |+| Water | river band 0.76 with a darker edge 0.025 each side; creeks 0.15 with 0.02 edges; round joins |+| Tunnel under water | the line dashed 0.16 on / 0.11 off, plus two ink casing lines 0.02 at 55 % opacity, 0.05 outside each edge of the line |+| Pen tip | white core r 0.11, ring 0.05 in the line colour, soft halo r 0.8 in the line colour (45 % at the centre) |+| Line bullet | disc r 0.25 in the line colour; numeral 800 weight, 0.27 (one figure), 0.22 (two), 0.15 (a short word); opening year 0.17 bold ink, centred 0.30 below |+| Train | white capsule 0.40 × 0.14, ink outline 0.026, three windows 0.064 × 0.056 in the line colour |++- **Interchange shape follows the station.** Points side by side make a horizontal stadium, stacked points a vertical one; lines that cross at one point make a circle r 0.13 with the ink outline, which reads as an interchange next to the 0.085 stop because of its black edge. A capsule never rotates to 45°; a diagonal spread becomes a rounded square.+- **Two passes.** A 2D canvas inks only the region the camera sees into a texture (about 1.35× the screen density at the focus, capped at 4096², mipmapped, anisotropic filtering), limited in depth to a few camera distances so low views don't starve; a WebGL pass intersects each pixel's ray with the sheet plane, prints the ink onto procedural paper and computes depth of field from the plane's known depth.+- **Paper**: warm off-white, procedural and tileable, sampled in world coordinates so it never slides. Three layers: a cloud of value at about 9 G period with detail down to 0.04 G, a tooth at about 2.4 G period, and short fibres 0.02–0.1 G long. Paper value varies by no more than ±3 % (fibres darken up to 3 % more); ink is multiplied by the tooth so flat colour varies 7–10 % and is never flat. Stronger than this and the sheet reads as plaster.+- **Light**: one raking light from one corner of the sheet (north-west in our demo), about 33° above the paper, neutral in colour and fixed for the whole film; it lifts that corner about 7 % above the opposite one. A specular sheen (up to +10 %, narrow lobe) appears only when the camera tilts more than about 30° from straight down and is full at 65°. Warmth comes from the paper and the table, never from a tinted light.+- **The sheet edge** sits on a near-black warm table (about #1B1918) with a contact shadow that fades over about 0.2 G. Far away the table goes into a warm dark haze so the horizon never aliases.+- **Grade**: a light vignette (up to −24 % in the corners), a 1.02 gamma, a light film grain at the master; no colour cast, no bloom except the pen-tip halo.+- **Screen space only for the instrument** (the counter) and objects near the lens (a station plate standing on the sheet, a tunnel before the map). Everything else is anchored to the sheet.++## 3. Colour logic++- Neutral ground: warm off-white paper; ink near-black for text and interchange outlines; secondary text in warm grey; water one pale blue with a darker edge, its labels in a mid blue.+- **Line colours carry identity and nothing else.** A real network uses its published colours; an invented one picks hues spaced around the wheel at similar weight, never two neighbours alike.+- **Mode is carried by line form, never by hue.** Each line keeps its colour whatever kind of vehicle runs on it:++| Mode | Line | Stops | Bullet |+|---|---|---|---|+| Metro, suburban rail | solid 0.15 G | stop disc | disc with a figure |+| Another rail mode (tram, light rail, maglev, people mover) | solid thin 0.07 G | minor-stop disc | disc with a short word |+| Bus, BRT | hollow 0.15 G: the colour as two 0.04 G edges, paper between | named stops only, as minor-stop discs | rounded square |+| Ferry, boat | thin 0.07 G with a 0.03 G paper casing, drawn on top of the water band, solid | pier: white rounded square 0.17 G with a ring in the line colour | rounded square |+| Under water or underground | the line's own form, dashed, with the ink casing (§2) | none inside the tunnel | — |+| Walking transfer | two capsules joined by a 0.06 G white bar with the same ink outline; out of station: an ink dotted line, dots 0.03 G every 0.08 G | — | — |++ Dashes mean "below": a ferry is never dashed, a tunnel always is.+- **Red (or the oldest line's colour) is the story's accent**: the first section, the "you are here" dot, the stamp of a verdict. A second, dark neutral (navy) stands for anything compared against.+- Light colours (yellow, lilac, aqua, light green, sand) carry ink inside bullets; deep colours carry white.+- A paper wash (veil, 60 % paper over the sheet) fades the network back when one part must lead; stations under it keep about 20 %; never a dark overlay.++Example (our demo): paper #F2EEE5, ink #1B1C1E, secondary text #4A4740, river #BCD6EA / #8FB5D6, river labels #5F88AD, accent #E3002B, comparison navy #24346E.++## 4. Type & subtitles++- **Faces**: a neutral grotesk for Latin and figures (Inter in the demo) and a CJK sans of matching weight (Noto Sans SC, subset to the characters used). OFL, self-hosted. Native language above, second language below, one line each, never wrapped.+- **Sizes on the sheet**, in G (native / second language): hub label 0.30 / 0.17 bold; interchange 0.23 / 0.14 semibold; named stop 0.20 / 0.14 semibold; the second line in warm grey, 0.03 G below. Callout: date figures 0.58 heavy, native line 0.34, second line 0.24. Printed panel titles 0.58–0.60 / 0.36–0.38. Cartouche title 0.64 / 0.30, its note 0.24 in grey. Water names 0.22 / 0.17, set along the band.+- **Labels**: a paper-coloured halo (0.05 G stroke at 92 %) under every label. Placement is automatic: eight candidates around the station's edge (in order of preference: east, west, north-east and south-east, north and south, north-west and south-west), each scored against every line of the **finished** network and against labels already placed, hubs and interchanges first. It runs once, before the first frame, so a label never jumps while lines are drawn and lines that arrive later never cross it. A hand preference may override the score for a few stations.+- **Levels of detail by zoom**: minor stops fade in between 55 and 85 px per G, interchange names between 62 and 90, named-stop names between 100 and 130; hubs keep their names at every scale and grow when pulled out (× (85 / zoom)^0.6, at most 1.75), anchored to the station edge so they grow away from it without changing side. Which names show may also be chosen by shot, never flashed by time.+- **Legibility is measured where the text lands**: font size on the sheet × the zoom at that point, foreshortened by the tilt. Text the viewer must read keeps the native line ≥ 20 px at 1080p and the second line ≥ 12 px (≥ 16 px on the counter); a two-line label counts only when its block is ≥ 26 px tall on screen. Below that, hide it by level of detail or move the camera.+- **Callouts** are printed on the paper: a bar 0.10 G wide in the accent (or the line being drawn), then the date in heavy figures, one native line, one second-language line; they wipe on from the bar in about 0.5 s. When a callout must sit over lines it gets a paper-coloured block with a soft shadow, no border.+- **Cartouche**: in one corner of the sheet, an ink bar, the map's name in both languages and a one-line note in grey. It is furniture: the camera finds it, it is not a title card.+- **The counter**: a dark enamel plate in the top-left corner (about 660 px wide, 86 px per row, rounded 14 px, four screws), rows with the native label above (24 px), the second label below (17 px), cream rolling drums (38 × 60 px, heavy figures), units at the right. Drums land only on sourced values; in between they spin blurred so no invented figure can be read.+- Reading time: hold every line ≥ (CJK characters ÷ 4.5 + other characters ÷ 15) + 1.5 s.++## 5. Motion quality++- 30 fps. Pen tips move on monotone keyframes; a tip may slow on a station and accelerate between them, never stop dead mid-segment.+- Stops pop from 0.6× with a small overshoot in about 0.28 s and a ring in the line colour that spreads from 0.10 to 0.42 G and fades in 0.6 s. Minor stops pop the same way at a smaller size.+- Interchanges scale down from 2× in 0.22 s with an ink ring spreading to 0.64 G. A major interchange falls from above in about 0.4 s (from 3.4× its size, its shadow offset and blurred, sharpening as it lands), then rings in ink and in the colours of the lines that met spread to 1.4–2.6 G in 0.9 s.+- Line bullets spring in with a back ease and carry the opening year; they fade when the story moves past their chapter.+- Trains: white capsules running at a constant speed (about 2 G/s), one per 4 G of track in each direction, only on finished track.+- What never moves: the geometry of anything already built, label positions, the paper and its light.+- A still of the style shows the medium in motion: at least one pen tip with its halo or trains on finished track, the counter landed, and a tilted view with depth of field.++## 6. Camera grammar++A pinhole camera with a 32° vertical field of view (about a 42 mm lens on full frame), aimed at a point on the sheet. **Tilt** is the angle from straight down (0° = top view); **heading** turns the view about the vertical; there is never any roll. Zoom is in px per G at the aim point; focus is always on the aim point. Depth of field is analytic: blur radius = aperture × |depth − focus depth| ÷ depth, in pixels at 1080p, capped at 26 px, so the far sheet blurs up to the aperture value and the near edge more.++| Move | Tilt / zoom / aperture | What it expresses | Can serve |+|---|---|---|---|+| ride the pen tip, aim about 1.5 G ahead of it | tilt 15–30°, heading within ±15°, 130–260 px/G, aperture 16 | building, one step at a time | the first section; a single new line; a route described stop by stop |+| drop low where a line meets water | tilt ~60°, 185 px/G, aperture 26, eased in and out over ~0.5 s | crossing, risk, a threshold | a river or strait; a border; going underground |+| continuous pull-back with level-of-detail changes | tilt 12° → 0°, 80 → 50 px/G, aperture 6 → 0 | growth, scale arriving | years passing; a network filling in; "how big it became" |+| low oblique sweep with shallow focus | tilt 57–62°, heading swinging about 40°, ~100 px/G, aperture 24, inked depth extended | density, life, the present tense | the busiest core; everything running at once |+| glide across the sheet to another panel | tilt rises to ~25° mid-move and back to 0°, aperture up to 8 | changing the question, same object | a comparison chart; a legend; a timeline printed in the margin |+| rise until the sheet edge and the table show | tilt ~30°, ~40 px/G | the whole, the object | an overview; a chapter break |+| push in to one segment under a paper veil | tilt 4° → 0°, 60 → 140 px/G, aperture 3 → 0 | memory, origin | where it began; "you are here" |+| locked frame | tilt 0°, aperture 0 | reading, judging | any comparison or verdict (hold ≥ 2.5 s before the verdict) |++The camera is never lower than about 25° above the paper (tilt ≤ 65°): lower, and the sheet stops reading as a map. Top views carry no blur; any tilt above 10° carries some.++Framing: the subject sits off-centre with room ahead of a moving tip; the counter owns the top-left corner and nothing important goes under it. Transitions: match cuts on round shapes (a headlight, a lamp, a coin becomes a station dot), glides across the sheet, hard cuts to a new panel. No page turns, no fades to black mid-film.++## 7. Sound palette++- **Tuned percussion** for drawing and stops: glockenspiel, marimba, vibraphone; a stop is a pluck, an interchange a pop with a low thump.+- **A two-note station chime** as the motif, returning at the turns of the story.+- **Layering by line**: each new line adds one voice to a running ostinato (flute, spiccato strings, xylophone, horn staccato, harp, trumpet, oboe…), so the arrangement grows with the network. Accelerate by adding voices, not by changing tempo; a groove written in film time never stretches when picture time is slowed.+- **Matter**: a felt-tip glide under every drawing tip; rail clacks in pairs for trains; ratchet ticks for the counter; a filtered, submerged mix while a line runs under water; a descending whistle and a low hit for a capsule that falls.+- **Silence**: one beat of near-silence before a verdict; the end thins to a pad and the chime.+- Mix: music under the effects, sub-bass shelved (< 50 Hz well below the rest), true peak ≤ −3 dBTP, about −16 LUFS before the master's −14.++## 8. Native moves++- **The pen tip.** A glowing tip draws a line at the camera's pace; stops light behind it. *Fits content like:* a product roadmap; a migration route; a career, job by job.+- **The interchange that falls.** When two lines meet for the first time the capsule drops onto the paper with its shadow, then shock rings in both colours. *Fits content like:* two teams merging; a treaty; two rivers joining.+- **The tunnel under the water.** Inside the water band a line turns dashed with a casing; the camera drops low to watch it cross. *Fits content like:* a cable under the sea; a deadline crossed; going public.+- **Time lines.** Two networks drawn as two lines over one year axis, stops at sourced milestones, brackets for the spans. *Fits content like:* two companies' growth; two countries' rollouts; a project against its plan.+- **Levels of detail.** Pulling back, minor stops and their names fade first, interchange names next, hubs stay. *Fits content like:* zooming from a street to a city; from a team to a company; from a gene to a genome map.+- **You are here.** The network fades under a paper veil, one segment stays lit, a red dot pulses. *Fits content like:* an origin story; a recap; a call to visit.+- **The odometer.** Rolling drums that land only on true values: a year, a running total, a time of day, a count. *Fits content like:* kilometres, users, stores, sensors.+- **The plate by the lens.** A station name plate stands on the sheet near the camera, out of focus, as the low sweep passes it. *Fits content like:* a place that matters; a stop someone uses every day; a product's home.++## 9. Pitfalls of the medium++- **Off-grid geometry**: any segment not at 0/45/90° breaks the style. Route between points with an automatic bend (straight then diagonal, or the reverse) and validate every segment.+- **Labels over lines, or labels that jump**: give labels a paper halo and place them once against the finished network, before the first frame. Placing against what is drawn so far makes labels hop as lines arrive.+- **Parallel lines sharing a corridor** collide: offset each line by ±0.10 G and let one capsule enclose all points of the station.+- **Too much text in wide shots**: hide minor names by zoom, not by time.+- **A flat map**: a top view all the way through reads as a slideshow. Tilt, focus and the sheet edge are what make it an object; a still of the style should show at least one tilted view with depth of field.+- **Paper too loud**: tooth and fibres stronger than a few percent turn the sheet into plaster or canvas.+- **Mode by colour**: a ferry or bus line in a "ferry blue" breaks colour as identity. Use the line forms in §3.+- **Real networks**: published colours and station names are facts, logos and branded bullets are not; the film is an unofficial tribute and says so on screen. Check every date and length against official sources; encyclopaedia figures for opening sections are often for a different span, and stations are renamed.+- **Counters that interpolate** invent numbers. Land only on sourced values; spin between them.+- **Texture resolution in tilted views**: limit the far distance of the inked region and let depth of field hide the softness.+- **Stale ink**: when the inked texture is reused, reset the 2D transform before clearing it, or last frame's ink ghosts every other frame.++## 10. Engine++The pipeline, independent of any code: (1) the network as data: stations with native and second-language names and a tier, lines as lists of stations, offsets and bends on the G lattice; (2) expand each route into an octilinear polyline, fillet the corners, measure arc length; (3) precompute everything time-dependent once: when each tip passes each station (by bisection on its keyframes), when a station becomes an interchange, label placement on the finished network; (4) per frame: camera → the region of the sheet it sees → ink that region into a texture → lay it on the plane, print it on paper, light it, blur it by depth → draw the screen-space instrument.++In our demo (`demo/`):++- `net.js`: the network as data, `expand()` (automatic octilinear bends).+- `film.js`: fillets and arc length (`rounded`, `pointAt`, `subPath`), tunnel intervals, generated minor stops, growth phases and light-up times, `placeLabels()`, the camera (`basis`, `toScreen`, `toPlane`), the inked region (`regionFor`), map drawing, events for the score, `window.TEXTS` for the reading-time check.+- `gl.js`: `makePlane(canvas, paper)`: plane, paper, raking light, sheen, sheet edge, depth of field, vignette.+- `timeline.js`: the film's direction (facts, phases, camera keys, annotations, panel, counter, overlays, cues). A new film replaces it and `net.js`.+- The demo engine draws the solid, thin and tunnel forms; the hollow (bus), cased (ferry) and connector forms of §3 are one or two extra strokes in the same line loop.+- Minimal use, unlike the demo: an invented tram network of three stations and two lines with `thin: true` in `net.js`, one phase per line in `timeline.js`, a camera that rides the first tip; the shared stop becomes a capsule on its own.++## 11. Variation space++The agent decides the network (real or invented), what a line stands for, the order of growth, the camera route, which comparison (if any) gets a printed panel, the accent colour and what the counter counts.++- **Structures**: a single line built stop by stop, ending on its terminus; two rival networks growing on one sheet, then compared; a network shrinking line by line (closures) and one survivor.+- **Openings**: a lamp or coin in close-up match-cut to a station dot; a blank sheet where the first tip starts at frame one; a low sweep over a finished map that rewinds to its first stop.+- **Endings**: a terminus ring that becomes the end card's frame; the camera rising until the sheet's edge and the table show; a train leaving the last station off the sheet.++---++How our demo was made (story, shots, score, end card, build): [DEMO.md](DEMO.md). Read it after your treatment exists.diff --git a/styles/transit-map/demo/CREDITS b/styles/transit-map/demo/CREDITSnew file mode 100644index 0000000..3a4a1f9--- /dev/null+++ b/styles/transit-map/demo/CREDITS@@ -0,0 +1,32 @@+6 Kilometres (6 公里) — Transit Map (Lemo-Opuscar) · LemoLab × Claude Opus 5.5++Unofficial fan film, not affiliated with Shanghai Shentong Metro or Transport for London. No operator logo, branded+line bullet or official map is used: the schematic, its geometry and every mark are our own drawing in code.+Line colours and station names are public facts (see FACTS.md).++IMAGES, FOOTAGE, MODELS+- None. The map, paper, table, tunnel, counter and station plate are drawn in code (net.js, film.js, gl.js,+ timeline.js). No photographs, no scans, no AI-generated images, no 3D models.++FONTS (SIL Open Font License 1.1, licence texts in fonts/; not in git, build.sh downloads them from github.com/google/fonts)+- Inter (variable, Inter[opsz,wght].ttf) — The Inter Project Authors (Latin text, figures, counter drums)+ fonts/OFL-Inter.txt+- Noto Sans SC (variable, NotoSansSC[wght].ttf) — Google / Adobe (Chinese text), subset by tools/subset.py to the+ characters the film prints (fonts/NotoSansSC-sub.ttf)+ fonts/OFL-NotoSansSC.txt++MUSIC & SOUND+- Original score and sound design, written for this film in audio.py: synthesis in numpy (tunnel rumble, wheel and+ rail clacks, horn, risers, whistle, water bed, felt-tip glide, counter ticks) through the library's core/audio/sfx.py,+ plus sampled instruments played through the library's core/audio/sampler.py:+ bass drum, cellos (sustain, spiccato), clarinet staccato, contrabass (sustain, pizzicato), crash cymbal, flute+ staccato, glass, glockenspiel, gran cassa, harp, hi-hat, horn (sustain, staccato), marimba, oboe staccato, snare+ (two kits), suspended cymbal, timpani, trombone, trumpet staccato, tubular bells, vibraphone (soft, hard, bowed),+ violas, violins (sustain, pizzicato, spiccato), woodblock, xylophone.+- Samples (CC0): FreePats project (freepats.zenvoid.org), VS Chamber Orchestra: Community Edition (Versilian+ Studios), Versilian Community Sample Library (Versilian Studios). Downloaded with sh tools/fetch.sh instruments+ freepats | vsco2ce | vcsl.++FACTS+- See FACTS.md: The Paper (澎湃新闻) and the Shanghai Metro official WeChat account, Xinhua, Xinmin Weekly, Jiefang+ Daily, Beijing Youth Daily, London Transport Museum, Transport for London. Every figure on screen is quoted there.diff --git a/styles/transit-map/demo/FACTS.md b/styles/transit-map/demo/FACTS.mdnew file mode 100644index 0000000..78cf144--- /dev/null+++ b/styles/transit-map/demo/FACTS.md@@ -0,0 +1,33 @@+# FACTS · 《6 公里》++Every number on screen, its source and the quoted wording. Checked 2026-10-24/25; opening years re-checked 2026-10-28. Values live in `timeline.js` (`FX`).++| On screen | Value | Source | Quoted wording |+|---|---|---|---|+| First section date | 1993.5.28 | The Paper (澎湃新闻), 2023-05-28, https://www.thepaper.cn/newsDetail_forward_23236386 ; Shanghai Metro official WeChat (shmetro), 2023-05-25, https://mp.weixin.qq.com/s/rB4x9smT5bt-5Pva95-8yg | "1993年5月28日,上海地铁1号线南段(徐家汇站至锦江乐园站)开通观光试运营,线路全长6千米,共设车站5座,开启了上海的轨道交通时代。" / "1993年5月28日,上海地铁1号线南段锦江乐园站至徐家汇站通车试运行" |+| First section length | 6 公里 / 6 km | The Paper, as above | "线路全长6千米,共设车站5座" |+| First section stations | 5 站: 锦江乐园, 新龙华, 漕宝路, 上海体育馆, 徐家汇 | The Paper, as above; the 1993 name 新龙华: The Paper (今日闵行, pictures from shmetro), https://www.thepaper.cn/newsDetail_forward_23259606 | "共设车站5座"; "乘客在当年的'新龙华站'候车"; "新龙华站(今上海南站站附近)" |+| 1995, Line 1 to Shanghai Railway Station, network 16.1 km | 16.1 | The Paper 23236386; zh.wikipedia 上海轨道交通1号线 (supporting) | "1995年:4月10日,地铁1号线向社会开放试运营。"; "工程全线(上海火车站站—锦江乐园站)试运营,总长16.1公里" |+| 1999, Line 2 (中山公园—龙阳路), first line under the Huangpu | 1999 | The Paper 23236386; Jiefang Daily 2000-06-10 via Sina, https://news.sina.com.cn/china/2000-06-10/96410.html ; Shanghai Release via The Paper, https://m.thepaper.cn/newsDetail_forward_22843411 | "1999年:9月20日,上海地铁2号线基本建成试通车。"; "从浦西的中山公园站至浦东的龙阳路站,全长16.3公里"; "绿色的2号线是上海第一条穿越黄浦江" |+| Opening years on the line bullets | 3: 2000 · Maglev: 2002 · 5: 2003 · 4: 2005 · 6, 8, 9: 2007 · 7, 11: 2009 · 10, 13: 2010 · 12, 16: 2013 · 17: 2017 · Pujiang: 2018 · 18: 2020 · 14, 15: 2021 · Airport link: 2024 | The Paper 23236386 (the 30-year chronology "上海地铁站线开通全记录", built from Shanghai Metro's own record); Airport link: The Paper, 2024-12-27, https://www.thepaper.cn/newsDetail_forward_29760221 ; Maglev also: Beijing Youth Daily via Sina, https://news.sina.com.cn/c/2003-01-03/0506860702.shtml | 3: "上海地铁明珠线(3号线)一期工程(上海南站站至江湾镇站)" (2000); Maglev: "上海磁浮列车示范线(龙阳路站至浦东国际机场站)开通试运营" (2002-12-31); 5: "上海地铁5号线(莘庄站至闵行开发区站)开通试运营" (2003); 4: "上海地铁4号线“C”字型线路(大木桥路站至蓝村路站)开通试运营" (2005); 6: "上海地铁6号线(港城路站至灵岩南路站)开通试运营", 8: "上海地铁8号线一期(市光路站至耀华路站,除周家渡站)开通试运营", 9: "上海地铁9号线一期(松江新城站至桂林路站)开通试运营" (2007-12-29); 7: "上海地铁7号线一期(上海大学站至花木路站,除后滩站)开通试运营" (2009-12-05); 11: "上海地铁11号线一期主线…开通试运营" (2009-12-31); 10: "上海地铁10号线一期(新江湾城站至航中路站)开通试运营" (2010-04-10); 13: "上海地铁13号线世博段(马当路站至世博大道站)开通试运营" (2010-04-20); 12: "上海地铁12号线东段(金海路站至天潼路站)开通试运营", 16: "上海地铁16号线(罗山路站至滴水湖站)开通试运营" (2013-12-29); 17: "上海地铁17号线全线开通试运营" (2017-12-30); Pujiang: "上海地铁浦江线开通试运营" (2018-03-31); 18: "上海地铁18号线一期南段(御桥站至航头站)开通试运营" (2020-12-26); 15: "上海地铁15号线(除桂林路站)开通试运营" (2021-01-23); 14: "上海地铁14号线(除龙居路站)" (2021-12-30); Airport link: "27日,连通虹桥和浦东两大机场的上海轨道交通市域线机场联络线(以下简称“市域机场线”)也开通初期运营。" |+| 2010: 420 km (counter and time line) | 420 | 新民周刊 2022-03-14, https://img1.xinmin.cn/xmzk/2022-03-14/200314.pdf ; first past 400 km with Line 10 on 2010-04-10: https://img1.xinmin.cn/xmzk/2022-03-14/060314.pdf | "世博会开幕前,上海实现了 420 公里运营里程、282 座车站数的目标"; "自 2010 年世博会前夕随着 10 号线的建成,上海地铁运营里程超过 400 公里" |+| 1993 → 2010 = 17 years | 17 | arithmetic from the two rows above | |+| Today (2026): 906 km, 21 lines | 906 | Xinhua, 2025-12-27, http://www.news.cn/20251227/ab4daa463ea64289bafea8800917e3c8/c.html (no new line or section opened 2026-01 to 2026-10, per CAMET H1 2026 bulletin and the absence of any opening report) | "至此,上海轨道交通全网运营线路共21条,运营总里程达到906公里,车站总数523座。" (includes Maglev and the airport link; excludes the Jinshan railway) |+| Daily ridership record | 1339.7 万人次 (13.4 million), 2024.3.8 | The Paper, https://www.thepaper.cn/newsDetail_forward_26618192 | "2024年3月8日上海地铁总客流为1339.7万人次(不含磁浮线)。" |+| London opened 1863, first section about 6 km | 1863 · 6 km | London Transport Museum, https://www.ltmuseum.co.uk/visit/museum-guide/worlds-first-underground ; length: Metropolitan Railway, 3.75 miles (Day & Reed 2008, p. 14, via en.wikipedia) | "The first section of the Metropolitan opened from Paddington to Farringdon on 10 January 1863."; "The 3.75-mile (6 km) railway opened to the public on 10 January 1863" |+| London today 402 km | 402 | TfL, https://tfl.gov.uk/corporate/about-tfl/what-we-do/london-underground | "London Underground, better known as the Tube, has 11 lines covering 402km and serving 272 stations." |+| 1863 → 2026 = 163 years | 163 | arithmetic | |++## Figures checked and not used++- **First section: 6 km and 1993-05-28, not 4.4 km.** Chinese official and press sources give 6 km and 5 stations for 锦江乐园—徐家汇, opened for (sightseeing) trial operation on 1993-05-28 (tickets on sale from 1993-04-09 per 今日闵行). The 4.4 km found in English Wikipedia is a different span, 徐家汇—上海南站 (four stations). The film's title follows: 《6 公里》.+- **"London took a hundred-odd years to reach 400 km"**: no reliable source gives the year London reached ~400 km. The time line states only what is sourced: London 1863 (6 km) → 2026 (402 km), 163 years; Shanghai 1993 (6 km) → 2010 (420 km), 17 years, → 2026 (906 km).+- **"The world's longest metro network"** is not claimed anywhere on screen: by the Ministry of Transport (Aug 2026) Beijing has 909.0 km and Shanghai 881.5 km (counted differently); Shanghai's own figure is 906 km.++## Counter rule++The route-length drums land only on sourced values (6.0, 16.1, 420.0, 906.0). Between 1995 and 2010, and between 2010 and 2026, the drums spin blurred and settle on the next value, so no unsourced intermediate figure is ever readable. During the first section (1.75–4.35 s) the counter measures the drawn line from 0 to 6.0.++## Line colours and names++Line colours are the commonly published values (official colour names from Shanghai Release: 1 正红, 2 绿, 3 黄 …; hex values from the community table on en.wikipedia `Module:Adjacent stations/Shanghai Metro`). English station names follow the network's usual signage (上海体育馆 = Shanghai Indoor Stadium, not Shanghai Stadium). The schematic geometry is our own drawing; topology of the main interchanges follows the real network, minor stations are generated ticks.diff --git a/styles/transit-map/demo/audio.py b/styles/transit-map/demo/audio.pynew file mode 100644index 0000000..3d51bf4--- /dev/null+++ b/styles/transit-map/demo/audio.py@@ -0,0 +1,265 @@+"""Score + sound for 《6 公里》 -> mix.wav (48 kHz stereo, exactly DUR seconds).+Run from the library root:+ node core/render/events.mjs styles/transit-map/demo (writes events.json from the picture)+ .venv/bin/python styles/transit-map/demo/audio.py+(sh styles/transit-map/demo/build.sh runs the whole chain.)+120 BPM (beat 0.5 s), D major. The station chime (A5 -> F#5, 'ding-dong') is the motif: the cut into the map,+the 2010 landing, the verdict, 'you are here', the end card. Each new line adds an instrument to the groove."""+import sys, os, json+HERE = os.path.dirname(os.path.abspath(__file__)); LIB = os.path.abspath(os.path.join(HERE, '../../..'))+sys.path.insert(0, LIB)+import numpy as np, soundfile as sf+from core.audio import sampler as S+from core.audio.sfx import SR, add, limit, whoosh, click, clack, pop, thump, ding, noise, bp, hp, lp, t_, env_exp, norm, brown, compress, crash++S.seed(23)+rng = np.random.default_rng(5)+EV = json.load(open(os.path.join(HERE, 'events.json')))+DUR = EV['dur']; ev = EV['ev']; N = int(round(DUR * SR))+# the score is written in story time (tau, as in timeline.js) and placed in film time through the same WARP+WARP = [[0, 0], [6.2, 6.2], [9.0, 7.3], [29.7, 28.0], [30.5, 28.0], [47.0, 44.5]]+def T(u):+ for (ta, ua), (tb, ub) in zip(WARP, WARP[1:]):+ if ub > ua and ua <= u < ub: return ta + (tb - ta) * (u - ua) / (ub - ua)+ return WARP[-1][0] if u >= WARP[-1][1] else u+_add = add+def add(buf, x, at, gain=1.0, pan=0.0, raw=False): _add(buf, x, at if raw else T(at), gain, pan)+cue = {e['type']: e['tau'] for e in ev if e['type'] not in ('stop', 'x', 'minor', 'depart', 'year')}+used = set(); mus = []+def n(t, inst, pitch, dur, vel, pan=0, gain=1.0, raw=False, **kw):+ if not raw: t = T(t)+ if t < 0 or t >= DUR: return+ used.add(inst); mus.append(dict(t=float(t), inst=inst, pitch=pitch, dur=dur, vel=vel, pan=pan, gain=gain, **kw))+M = S.midi+CH = {'D': ['D3', 'A3', 'D4', 'F#4'], 'Bm': ['B2', 'F#3', 'B3', 'D4'], 'G': ['G2', 'D3', 'G3', 'B3'], 'A': ['A2', 'E3', 'A3', 'C#4'], 'Em': ['E3', 'B3', 'E4', 'G4']}+ROOT = {'D': 'D2', 'Bm': 'B1', 'G': 'G1', 'A': 'A1', 'Em': 'E2'}+PROG = ['D', 'Bm', 'G', 'A'] # one chord per bar (2 s)+def chord_at(t, t0): return PROG[int((t - t0) // 2.0) % 4]+def chime(t, v=.7, pan=0, g=.7): # the station chime motif+ n(t, 'vibraphone_hard', 'A5', 1.4, v, pan, g); n(t + .32, 'vibraphone_hard', 'F#5', 2.2, v * .92, pan, g)+ n(t, 'glockenspiel', 'A6', .8, v * .55, pan, g * .5); n(t + .32, 'glockenspiel', 'F#6', 1.2, v * .5, pan, g * .5)++# ---------------------------------------------------------------- 1.4–6.2 the first section+chime(cue['chime'], .72)+n(2.0, 'violins', 'F#5', 4.2, .32, -.3, .45, attack=1.2, release=1.0); n(2.0, 'cellos', 'D3', 4.2, .34, .3, .45, attack=1.2, release=1.0)+n(2.0, 'violas', 'A4', 4.2, .28, 0, .35, attack=1.4, release=1.0)+for k, p in enumerate(['D5', 'F#5', 'A5', 'D6']): n(cue['plaque'] + k * .07, 'harp', p, 2.0, .5, -.3 + k * .2, .5)+first = [e for e in ev if e['type'] == 'stop' and e['tau'] < 6]+for k, e in enumerate(sorted(first, key=lambda e: e['tau'])):+ n(e['tau'], 'glockenspiel', ['D6', 'E6', 'F#6', 'A6', 'B6'][min(k, 4)], .9, .55, e['pan'], .55)+ n(e['tau'], 'marimba', ['D5', 'E5', 'F#5', 'A5', 'B5'][min(k, 4)], .5, .5, e['pan'], .45)++# ---------------------------------------------------------------- 6.2–20 groove in D (bar = 2 s from 6.3)+G0 = 6.3+def groove(a, b, dense=1.0, kick=True, gain=1.0): # runs in film time so the tempo never stretches+ a, b = T(a), T(b); t = a; i = 0+ while t < b - 1e-6:+ ch = chord_at(t, T(G0)); tones = CH[ch]+ p = M(tones[[0, 2, 1, 3, 2, 1, 3, 2][i % 8]]) + 12+ n(t, 'marimba', p, .3, (.45 + .1 * (i % 2 == 0)) * dense, -.25 + .5 * (i % 2), .5 * gain, raw=True)+ if i % 2 == 0: n(t, 'contrabass_pizz', ROOT[ch], .45, .7 if i % 4 == 0 else .52, 0, .85 * gain, raw=True)+ if kick and i % 4 == 0: n(t, 'bass_drum', None, None, .42, 0, .5 * gain, raw=True)+ t += .25; i += 1+groove(G0, 8.36)+groove(8.78, 20.0, gain=1.0)+# the ring falls (8.36) and lands on People's Square (8.78)+drop = cue['drop'] if 'drop' in cue else 8.78+n(drop, 'bass_drum', None, None, 1.0, 0, 1.0); n(drop, 'timpani', 'D3', 2.0, .95, 0, .9); n(drop, 'gran_cassa', None, None, .7, 0, .6)+for p, pan in (('D3', -.2), ('A3', .2), ('F#4', 0)): n(drop, 'horn', p, 1.4, .72, pan, .5, release=.6)+n(drop, 'trombone', 'D2', 1.0, .7, 0, .42, release=.5); n(drop, 'sus_cymbal', None, None, .45, .2, .35)+# under the river: the ensemble is filtered (done below); a bowed pad holds+n(9.15, 'vibraphone_bowed', 'F#4', 1.4, .45, 0, .45, attack=.3, release=.6)+# line 3 arrives: clarinet answers+for k, p in enumerate(['A4', 'B4', 'D5', 'E5', 'F#5', 'A5']): n(11.45 + k * .19, 'clarinet_stac', p, .2, .55, .3, .5)+# 2001–2010: each new line adds a voice (enters at the line's first departure)+LAYERS = {'M': ('glass', 0), '5': ('flute_stac', 12), '4': ('violins_spic', 12), '6': ('xylophone', 12), '8': ('horn_stac', 0),+ '9': ('harp', 12), '7': ('trumpet_stac', 0), '11': ('cellos_spic', 0), '10': ('vibraphone', 12), '13': ('oboe_stac', 12)}+first_dep = {}+for e in ev:+ if e['type'] == 'depart' and e['line'] not in first_dep: first_dep[e['line']] = e+burst = [(first_dep[k]['tau'], k) for k in LAYERS if k in first_dep and 12.5 < first_dep[k]['tau'] < 19]+G0f = T(G0)+for j, (t0, k) in enumerate(sorted(burst)):+ inst, oc = LAYERS[k]; pan = [-.6, .6, -.35, .35, -.8, .8, -.15, .15, -.5, .5][j % 10]+ pat = [[0, 2, 3], [1, 3, 2, 0], [2, 1, 0, 3], [3, 2], [0, 3, 1]][j % 5]+ t = (np.ceil((T(t0) - G0f) / .25) * .25) + G0f; i = 0 # on the groove's grid, in film time+ while t < T(20.0):+ if (i + j) % [2, 4, 3, 2, 4][j % 5] == 0:+ ch = chord_at(t, G0f); p = M(CH[ch][pat[i % len(pat)]]) + oc+ v = .42 + .06 * (i % 2 == 0)+ if inst in ('glass', 'vibraphone', 'harp'): n(t, inst, p + 12 if inst == 'glass' else p, .8, v, pan, .42, raw=True)+ else: n(t, inst, p, .22, v, pan, .38, raw=True)+ t += .25; i += 1+ n(t0, 'glockenspiel', 'A6', .6, .45, pan, .35)+# snare backbeat from 2007, roll into the landing+for t in np.arange(16.8, 18.2, 1.0): n(float(t), 'snare2', 'stick', None, .45, .1, .35)+n(17.62, 'snare', 'roll', 1.0, .55, 0, .45)+L10 = cue['landing']+n(L10, 'bass_drum', None, None, .95, 0, .9); n(L10, 'timpani', 'D3', 2.5, .85, 0, .8); n(L10, 'crash', None, None, .5, .2, .4)+for p, pan in (('D3', -.25), ('A3', .25), ('F#4', 0), ('D4', -.1)): n(L10, 'horn', p, 1.3, .62, pan, .45, release=.8)+n(L10, 'violins', 'A5', 1.4, .5, -.3, .5, release=.8); n(L10, 'cellos', 'D2', 1.4, .55, .3, .55, release=.8)+chime(L10 + .05, .62, .3, .55)++# ---------------------------------------------------------------- 20–28 one time axis+V = cue['verdict']+for t in np.arange(21.0, 25.5, .5): n(float(t), 'woodblock', None, None, .42 + .12 * ((t - 21.0) % 1 == 0), -.2, .5)+n(21.0, 'cellos', 'D3', 1.4, .55, -.2, .7, attack=.3); n(22.4, 'cellos', 'A3', 3.2, .4, -.2, .45, attack=.2, release=.8)+n(21.0, 'contrabass', 'D2', 4.5, .38, 0, .45, attack=.4, release=.6)+for y in range(1880, 2027, 20): # a tick as the London line passes each 20 years+ t = 21.0 + (y - 1863) / 163 * 1.4; n(t, 'violins_pizz', 'D5' if y % 40 else 'A5', .3, .45, -.4 + .8 * (y - 1863) / 163, .35)+for k, p in enumerate(['D5', 'E5', 'F#5', 'A5', 'B5', 'D6', 'E6', 'F#6', 'A6', 'D7']): # Shanghai: a fast run+ n(22.55 + k * .055, 'glockenspiel', p, .6, .5 + .03 * k, .4, .45)+n(23.3, 'violins', 'E5', 2.2, .4, -.3, .55, attack=.5, release=.3); n(23.3, 'violas', 'A4', 2.2, .38, .3, .5, attack=.5, release=.3); n(23.3, 'cellos', 'D3', 2.2, .4, 0, .5, attack=.5, release=.3)+for t in np.arange(23.3, 25.45, .25): n(float(t), 'hihat', None, None, .3, .3, .25)+# 25.5–26.0: the music stops for a beat; the verdict rings+n(V, 'tubular_bells', 'D5', 3.0, .7, 0, .6); chime(V + .05, .6, 0, .5)+n(V + .65, 'bass_drum', None, None, .7, 0, .6); n(V + .65, 'timpani', 'D3', 1.6, .6, 0, .55)+for p, pan in (('D3', -.25), ('A3', .25), ('F#4', 0)): n(V + .65, 'horn', p, 1.3, .5, pan, .42, release=.8)++# ---------------------------------------------------------------- 28–36 now: everything runs+n(28.0, 'snare', 'roll', 1.85, .5, 0, .42); n(28.0, 'violins', 'D5', 1.9, .35, -.3, .4, attack=1.2)+n(28.0, 'cellos', 'A2', 1.9, .4, .3, .45, attack=1.0)+G1 = 29.9+def groove2(a, b):+ a, b = T(a), T(b); t = a; i = 0+ while t < b - 1e-6:+ ch = chord_at(t, T(G1)); tones = CH[ch]+ n(t, 'marimba', M(tones[[0, 2, 1, 3, 2, 1, 3, 2][i % 8]]) + 12, .3, .5 + .1 * (i % 2 == 0), -.25 + .5 * (i % 2), .5, raw=True)+ if i % 2 == 0: n(t, 'contrabass_pizz', ROOT[ch], .45, .75 if i % 4 == 0 else .55, 0, .85, raw=True)+ if i % 4 == 0: n(t, 'bass_drum', None, None, .5, 0, .55, raw=True)+ if i % 4 == 2: n(t, 'snare2', 'stick', None, .45, .12, .3, raw=True)+ if i % 8 == 0:+ n(t, 'violins', M(tones[3]) + 12, 1.9, .42, -.35, .4, attack=.15, raw=True); n(t, 'cellos', ROOT[ch], 1.9, .45, .35, .45, attack=.1, raw=True)+ n(t, 'horn', M(tones[1]), 1.8, .4, .2, .3, attack=.1, raw=True)+ for k in range(3): n(t + k * .5 + .25, 'violins_spic', M(tones[k + 1]) + 12, .15, .45, -.2, .3, raw=True)+ if i % 2 == 1: n(t, 'xylophone', M(tones[(i // 2) % 4]) + 24, .2, .35, .5, .25, raw=True)+ t += .25; i += 1+groove2(G1, 34.6)+for k, p in enumerate(['D5', 'F#5', 'A5', 'D6']): n(G1 + k * .06, 'harp', p, 1.6, .55, -.3 + k * .2, .45)+n(G1, 'crash', None, None, .45, -.2, .35); n(G1, 'timpani', 'D3', 1.5, .7, 0, .6)+RL = cue['rideland']; chime(RL, .6, -.2, .5)+# 34.6–36: the ensemble lifts away+n(34.6, 'violins', 'F#5', 2.2, .4, -.3, .42, attack=.1, release=1.0); n(34.6, 'cellos', 'D3', 2.2, .42, .3, .45, release=1.0)+n(34.6, 'horn', 'A3', 2.0, .38, 0, .32, release=1.0)++# ---------------------------------------------------------------- 36–45.5 back to the start, end card+n(36.0, 'vibraphone_bowed', 'D5', 6.0, .35, 0, .38, attack=1.0, release=1.5); n(36.0, 'cellos', 'D3', 6.2, .3, .2, .3, attack=1.5, release=1.5)+chime(cue['here'], .7, -.2, .65)+for k, p in enumerate(['A4', 'D5', 'F#5', 'A5']): n(cue['caption'] + k * .09, 'harp', p, 2.5, .45, .2, .4)+E = cue['end']+n(E, 'harp', 'D4', 3.0, .5, -.2, .45); n(E + .08, 'harp', 'A4', 3.0, .48, 0, .42); n(E + .16, 'harp', 'D5', 3.0, .46, .2, .42)+for p, pan in (('D3', -.25), ('A3', .25), ('F#4', 0)): n(E + .5, 'horn', p, 2.4, .42, pan, .35, attack=.2, release=1.2)+n(E + .5, 'violins', 'A5', 2.4, .32, -.3, .35, attack=.3, release=1.2); n(E + .5, 'contrabass', 'D2', 2.4, .35, 0, .35, attack=.3, release=1.2)+chime(cue['endring'] + .02, .5, .1, .45)++music = S.render(mus, dur=DUR + 3, master=False)[:N]+# under the river: low-pass the music between 9.15 and 10.32 (block-wise, smooth cutoff)+def sweep_lp(x, a, b, lo=520):+ out = x.copy(); i0, i1 = int((a - .25) * SR), int((b + .25) * SR); blk = 1200+ for i in range(i0, i1, blk):+ tt = i / SR; d = min(1, max(0, (tt - (a - .25)) / .35)) * min(1, max(0, ((b + .25) - tt) / .35))+ fc = np.exp(np.log(12000) * (1 - d) + np.log(lo) * d)+ seg_ = x[max(0, i - 4000):i + blk]+ y = np.stack([lp(seg_[:, c], fc, 2) for c in range(2)], 1)[-(min(blk, len(x) - i)):]+ out[i:i + len(y)] = y+ return out+music = sweep_lp(music, T(cue['dive']), T(cue['surface']))+# the beat of silence before the verdict+g = np.ones(N, np.float32); a, b = int(T(25.45) * SR), int(T(V) * SR); g[a:b] = np.linspace(1, .04, b - a) ** 2+g[:int(1.4 * SR)] = 0+music *= g[:, None]+music = S.room(music, size=.4, mix=.15)++# ---------------------------------------------------------------- sound effects+fx = np.zeros((N, 2), np.float32)+def riser(d, f0=400, f1=6000):+ x = noise(d); out = np.zeros_like(x)+ for i in range(0, len(x), 480):+ hi = min(len(x), i + 480); f = f0 + (f1 - f0) * (i / len(x)) ** 2+ out[i:hi] = bp(x[max(0, i - 2000):hi], f * .8, f * 1.25)[-(hi - i):]+ return norm(out * (t_(d) / d) ** 2)+def pen(d):+ x = lp(hp(noise(d), 1100), 3800) * (1 + .25 * np.sin(2 * np.pi * 7 * t_(d)))+ e = np.minimum(1, t_(d) / .12) * np.minimum(1, (d - t_(d)) / .15); return norm(x * e)+def falling(d): # the ring falling: a descending whistle + air+ tt = t_(d); f = 1800 * np.exp(-tt * 3.2) + 180; ph = 2 * np.pi * np.cumsum(f) / SR+ return norm(np.sin(ph) * .25 * (tt / d) + lp(noise(d), 900) * (tt / d) ** 2)+# tunnel: rumble rising, wheel clacks accelerating, the train's horn, the flare riser+d0 = 1.42+rum = hp(lp(brown(d0), 160), 45, 2); rum = norm(rum) * np.linspace(.35, 1, len(rum)) ** 2+add(fx, rum, 0, .55); add(fx, -rum[::-1] * .0, 0, 0)+tt = 0.05+while tt < 1.3:+ for dt in (0, .055): add(fx, clack(.8 + .3 * tt, .8), tt + dt, .12 + .2 * tt, -.3 + .6 * (tt / 1.3))+ tt += max(.09, .28 - .16 * tt)+horn = np.zeros(int(.7 * SR)); th = t_(.7)+for f in (311, 415): horn += np.sign(np.sin(2 * np.pi * f * th)) * .5+horn = lp(horn, 2400) * np.minimum(1, th / .05) * np.minimum(1, (.7 - th) / .2)+add(fx, norm(horn), .55, .16, 0)+add(fx, riser(.45, 300, 7000), 0.98, .3, 0)+# events from the picture+last_click = -1+for e in ev:+ t, ty, pan = e['tau'], e['type'], e.get('pan', 0)+ if ty == 'depart' and e.get('t1', t) > t:+ dd = e['t1'] - e['t'] + .1+ if dd > .15: add(fx, pen(dd), t, .05 if t > 12.5 else .07, pan)+ if 12.5 < t < 19 or 28 < t < 30: add(fx, whoosh(.22), t - .03, .05, pan)+ elif ty == 'stop' and e.get('vis') and t > 1.5:+ if t - last_click > .045: add(fx, click(1.1 + .4 * ((sum(map(ord, e['id'])) % 7) / 7), 1), t, .1 if t < 12.6 else .05, pan); last_click = t+ elif ty == 'x' and e.get('vis'):+ add(fx, pop(1), t, .08, pan); add(fx, thump(1, 95), t, .12, pan)+ elif ty == 'drop':+ add(fx, thump(1, 58), t, .6, 0); add(fx, pop(1), t, .25, 0); add(fx, crash(.6), t, .12, .1)+add(fx, falling(.42), cue['fall'], .3, .1)+add(fx, whoosh(.5), cue['dive'] - .1, .22, -.2)+wat = lp(noise(1.2), 380) * np.sin(np.linspace(0, np.pi, int(1.2 * SR))); add(fx, norm(wat), cue['dive'] + .05, .1, 0)+add(fx, pop(1), cue['surface'], .18, .3)+add(fx, click(.7, 1), cue['plaque'], .14, .3)+for k, t in enumerate(np.arange(4.3, 12.6, .55)): add(fx, clack(1.3, .5), float(t), .05, -.2 + .4 * (k % 2)) # the shuttle+for t in (6.3, 7.62, 11.45): # the year drums roll+ for k in range(6): add(fx, click(2.2, .6), t + k * .04, .05, -.7)+add(fx, whoosh(1.1), cue['glide'] - .05, .28, 0)+add(fx, whoosh(.8), cue['shanghai'] - .05, .12, .4)+add(fx, thump(1, 60), V + .65, .35, 0); add(fx, clack(.7, 1), V + .65, .2, .1)+add(fx, whoosh(1.4), cue['rise'] - .05, .32, 0)+for k in range(30): add(fx, click(2.2, .5), 28.05 + k * .06, .04, -.7)+# the sign passing close to the lens: a doppler-ish swish+sw = whoosh(1.6); add(fx, sw, cue['sign'] + .3, .3, .5); add(fx, sw * .6, cue['sign'] + .5, .2, -.5)+for k in range(24): add(fx, click(2.4, .5), 31.4 + k * .06, .035, -.7)+# trains everywhere: ta-tak pairs in eighths across the stereo field+for k, t in enumerate(np.arange(29.6, 36.2, .25)):+ v = .05 * min(1, (t - 29.6) / .6) * min(1, (36.2 - t) / 1.0)+ add(fx, clack(1.0 + .1 * (k % 3), .7), float(t), v, [-.7, .5, -.2, .8, -.5, .2][k % 6])+add(fx, whoosh(1.2), cue['lift'], .2, 0); add(fx, whoosh(1.0), cue['push'], .15, 0)+add(fx, pen(.6), E, .06, -.2); add(fx, pop(1), cue['endring'], .14, 0)++# ---------------------------------------------------------------- mix+mix = music * .9 + fx+mix = np.stack([hp(mix[:, c], 38, 4) for c in range(2)], 1)+mix = mix - .45 * np.stack([lp(mix[:, c], 75, 2) for c in range(2)], 1) # about -5 dB shelf under 75 Hz+fade = np.ones(N, np.float32); f0 = N - int(.7 * SR); fade[f0:] = np.linspace(1, 0, N - f0) ** 1.5; mix *= fade[:, None]+mix = np.stack([limit(mix[:, 0], .9), limit(mix[:, 1], .9)], 1)+# loudness to about -16 LUFS (measured with ffmpeg ebur128), true-peak ceiling -3.2 dBTP (4x oversampled)+import soxr, subprocess, tempfile, re+def lufs_tp(x):+ with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as f: tmp = f.name+ sf.write(tmp, x.astype(np.float32), SR, subtype='FLOAT')+ out = subprocess.run(['ffmpeg', '-hide_banner', '-nostats', '-i', tmp, '-af', 'ebur128=peak=true', '-f', 'null', '-'], capture_output=True, text=True).stderr+ os.remove(tmp)+ I = float(re.findall(r'I:\s+(-?[\d.]+) LUFS', out)[-1]); P = float(re.findall(r'Peak:\s+(-?[\d.]+) dBFS', out)[-1]); return I, P+mix = np.stack([compress(mix[:, c], thr=.16, ratio=2.8, att=.008, rel=.18) for c in range(2)], 1)+ceil = 10 ** (-3.4 / 20)+for _ in range(9):+ I, P = lufs_tp(mix); mix *= 10 ** ((-16.0 - I) / 20)+ for c in range(2): mix[:, c] = limit(mix[:, c], ceil * .78)+ up = soxr.resample(mix, SR, SR * 4); tp = np.abs(up).max()+ if tp > ceil: mix *= ceil / tp+I, P = lufs_tp(mix); tp = 10 ** (P / 20)+print('measured', I, 'LUFS', P, 'dBTP')+assert mix.shape[0] == N+sf.write(os.path.join(HERE, 'mix.wav'), mix.astype(np.float32), SR, subtype='PCM_24')+# the sampled instruments this mix used (demo/CREDITS lists them with their libraries and licences)+print('instruments:', ', '.join(sorted(used)))+for l in S.credits(sorted(used)): print(' ' + l)+print('mix.wav', mix.shape[0] / SR, 's', 'true peak', round(20 * np.log10(tp), 2), 'dBTP; instruments:', len(used))diff --git a/styles/transit-map/demo/build.sh b/styles/transit-map/demo/build.shnew file mode 100644index 0000000..938037f--- /dev/null+++ b/styles/transit-map/demo/build.sh@@ -0,0 +1,42 @@+#!/bin/sh+# One command: 《6 公里》 6 Kilometres (Transit Map demo)+# sh styles/transit-map/demo/build.sh fonts, events, score + mix, picture, master, reading-time check, poster+# No narration, so no voice and no subtitles: every word is printed on the sheet or on the counter.+# In a fresh clone (fonts and samples are not in git) Inter and Noto Sans SC are downloaded from github.com/google/fonts (OFL)+# and the sample packs with tools/fetch.sh.+set -e+HERE=$(cd "$(dirname "$0")" && pwd) # .../<slug>/demo+FILM=$(cd "$HERE/.." && pwd) # .../<slug>+LIB=${LIB:-$(cd "$HERE/../../.." && pwd)} # styles/<slug>/demo -> library root+export LIB+[ -f "$LIB/core/render/video.mjs" ] || { echo "set LIB to the library folder"; exit 1; }+PY="$LIB/.venv/bin/python"+NAME=transit-map+FPS=30+FRAME=36.2 # the low sweep over today's network: poster and gallery still+cd "$LIB"++# fonts (gitignored): Inter variable, and Noto Sans SC variable as the source of the subset the page loads+GF=https://github.com/google/fonts/raw/main/ofl+[ -f "$HERE/fonts/Inter.ttf" ] || curl -sfL -o "$HERE/fonts/Inter.ttf" "$GF/inter/Inter%5Bopsz,wght%5D.ttf"+[ -f "$HERE/tools/NotoSansSC-VF.ttf" ] || curl -sfL -o "$HERE/tools/NotoSansSC-VF.ttf" "$GF/notosanssc/NotoSansSC%5Bwght%5D.ttf"+"$PY" "$HERE/tools/subset.py" # fonts/NotoSansSC-sub.ttf from every CJK character in the JS+# sampled instruments (library packs, CC0), fetched once per clone+for l in vcsl freepats vsco2ce; do [ -d "core/audio/instruments/$l" ] || sh tools/fetch.sh instruments $l; done++# events from the picture, then the score and effects placed on them (mix.wav, about -16 LUFS before the master)+node core/render/events.mjs "$HERE"+"$PY" "$HERE/audio.py"++# picture and master (mux.sh brings the mix to -14 LUFS and adds a light grain)+node core/render/video.mjs "$HERE" --fps $FPS --workers 3 --out "$HERE/out/video.mp4"+sh core/render/mux.sh "$HERE/out/video.mp4" "$HERE/mix.wav" "$FILM/$NAME.mp4" $FPS 1++# reading time of every printed word (window.TEXTS)+node core/render/readcheck.mjs "$HERE" > "$HERE/out/readcheck.txt" && echo "readcheck ok" || { tail -20 "$HERE/out/readcheck.txt"; exit 1; }++# poster and the gallery style frame+ffmpeg -v error -y -ss $FRAME -i "$FILM/$NAME.mp4" -frames:v 1 -q:v 2 "$FILM/poster.jpg"+mkdir -p "$HERE/stills"+ffmpeg -v error -y -ss $FRAME -i "$FILM/$NAME.mp4" -frames:v 1 -q:v 2 "$HERE/stills/styleframe.jpg"+echo "done: $FILM/$NAME.mp4"diff --git a/styles/transit-map/demo/events.json b/styles/transit-map/demo/events.jsonnew file mode 100644index 0000000..dc2d579--- /dev/null+++ b/styles/transit-map/demo/events.json@@ -0,0 +1 @@+{"dur":47,"ev":[{"t":0,"type":"tunnel","tau":0},{"t":1.12,"type":"flare","tau":1.12},{"t":1.4,"type":"cut","tau":1.4},{"t":1.42,"type":"stop","id":"JJLY","tier":3,"line":"1","pan":0,"vis":1,"tau":1.42},{"t":1.42,"type":"depart","line":"1","year":1993,"t1":4.35,"pan":0,"vis":1,"tau":1.42},{"t":1.55,"type":"chime","tau":1.55},{"t":2.547,"type":"stop","id":"SHNZ","tier":1,"line":"1","pan":-0.07,"vis":1,"tau":2.547},{"t":3.197,"type":"stop","id":"CBL","tier":2,"line":"1","pan":-0.06,"vis":1,"tau":3.197},{"t":3.817,"type":"stop","id":"TYG","tier":2,"line":"1","pan":-0.05,"vis":1,"tau":3.817},{"t":3.95,"type":"plaque","tau":3.95},{"t":4.2,"type":"shuttle","tau":4.2},{"t":4.348,"type":"stop","id":"XJH","tier":1,"line":"1","pan":-0.05,"vis":1,"tau":4.348},{"t":6.404,"type":"depart","line":"1","year":1995,"t1":7.345,"pan":-0.13,"vis":1,"tau":6.28},{"t":6.455,"type":"year","tau":6.3},{"t":6.602,"type":"stop","id":"CSL","tier":3,"line":"1","pan":-0.02,"vis":1,"tau":6.358},{"t":6.704,"type":"stop","id":"SXNL","tier":2,"line":"1","pan":0.06,"vis":1,"tau":6.398},{"t":6.839,"type":"stop","id":"HPNL","tier":4,"line":"1","pan":0.17,"vis":1,"tau":6.451},{"t":6.959,"type":"stop","id":"RMGC","tier":1,"line":"1","pan":0.28,"vis":0,"tau":6.498},{"t":7.081,"type":"stop","id":"HZL","tier":2,"line":"1","pan":0.27,"vis":0,"tau":6.546},{"t":7.198,"type":"minor","line":"1","pan":0.26,"vis":0,"tau":6.592},{"t":7.345,"type":"stop","id":"SHZ","tier":1,"line":"1","pan":0.24,"vis":0,"tau":6.65},{"t":9.32,"type":"stop","id":"ZSGY","tier":1,"line":"2","pan":-0.24,"vis":1,"tau":7.62},{"t":9.32,"type":"depart","line":"2","year":1999,"t1":13,"pan":-0.24,"vis":1,"tau":7.62},{"t":9.32,"type":"year","tau":7.62},{"t":9.648,"type":"stop","id":"JSL","tier":2,"line":"2","pan":-0.22,"vis":1,"tau":7.948},{"t":9.949,"type":"stop","id":"JAS","tier":1,"line":"2","pan":-0.23,"vis":1,"tau":8.249},{"t":10.06,"type":"fall","tau":8.36},{"t":10.199,"type":"stop","id":"NJXL","tier":2,"line":"2","pan":-0.19,"vis":1,"tau":8.499},{"t":10.478,"type":"drop","id":"RMGC","pan":-0.18,"vis":1,"tau":8.778},{"t":10.898,"type":"stop","id":"NJDL","tier":2,"line":"2","pan":-0.2,"vis":1,"tau":9.198},{"t":10.9,"type":"dive","tau":9.2},{"t":12.018,"type":"stop","id":"LJZ","tier":1,"line":"2","pan":0.14,"vis":1,"tau":10.318},{"t":12.02,"type":"surface","tau":10.32},{"t":12.298,"type":"stop","id":"DCL","tier":4,"line":"2","pan":0.07,"vis":1,"tau":10.598},{"t":12.579,"type":"stop","id":"SJDD","tier":1,"line":"2","pan":-0.21,"vis":1,"tau":10.879},{"t":12.787,"type":"stop","id":"KJG","tier":4,"line":"2","pan":-0.19,"vis":1,"tau":11.087},{"t":12.891,"type":"minor","line":"2","pan":-0.15,"vis":1,"tau":11.191},{"t":12.999,"type":"stop","id":"LYL","tier":1,"line":"2","pan":-0.11,"vis":1,"tau":11.299},{"t":13.15,"type":"x","id":"SHNZ","pan":-1,"vis":0,"tau":11.45},{"t":13.15,"type":"depart","line":"3","year":2000,"t1":14.25,"pan":-1,"vis":0,"tau":11.45},{"t":13.15,"type":"year","tau":11.45},{"t":13.213,"type":"stop","id":"SLL","tier":4,"line":"3","pan":-1,"vis":0,"tau":11.513},{"t":13.248,"type":"stop","id":"LCL","tier":2,"line":"3","pan":-1,"vis":0,"tau":11.548},{"t":13.308,"type":"minor","line":"3","pan":-1,"vis":0,"tau":11.608},{"t":13.362,"type":"minor","line":"3","pan":-1,"vis":0,"tau":11.662},{"t":13.413,"type":"stop","id":"YSL","tier":2,"line":"3","pan":-1,"vis":0,"tau":11.713},{"t":13.485,"type":"stop","id":"HQL","tier":2,"line":"3","pan":-1,"vis":0,"tau":11.785},{"t":13.547,"type":"stop","id":"YAXL","tier":3,"line":"3","pan":-1,"vis":0,"tau":11.847},{"t":13.604,"type":"x","id":"ZSGY","pan":-0.84,"vis":1,"tau":11.904},{"t":13.654,"type":"stop","id":"JSJL","tier":2,"line":"3","pan":-0.67,"vis":1,"tau":11.954},{"t":13.698,"type":"stop","id":"CYL","tier":2,"line":"3","pan":-0.55,"vis":1,"tau":11.998},{"t":13.742,"type":"minor","line":"3","pan":-0.43,"vis":1,"tau":12.042},{"t":13.789,"type":"stop","id":"ZPL","tier":2,"line":"3","pan":-0.28,"vis":1,"tau":12.089},{"t":13.861,"type":"stop","id":"ZTL","tier":3,"line":"3","pan":-0.08,"vis":1,"tau":12.161},{"t":13.94,"type":"x","id":"SHZ","pan":0.08,"vis":1,"tau":12.24},{"t":13.996,"type":"stop","id":"BSL","tier":3,"line":"3","pan":0.18,"vis":1,"tau":12.296},{"t":14.083,"type":"stop","id":"HKZQ","tier":2,"line":"3","pan":0.26,"vis":1,"tau":12.383},{"t":14.161,"type":"minor","line":"3","pan":0.26,"vis":1,"tau":12.461},{"t":14.25,"type":"stop","id":"JWZ","tier":4,"line":"3","pan":0.26,"vis":0,"tau":12.55},{"t":14.3,"type":"burst","tau":12.6},{"t":15.1,"type":"depart","line":"1","year":1996,"t1":15.6,"pan":-0.17,"vis":1,"tau":13.4},{"t":15.2,"type":"x","id":"LYL","pan":0.59,"vis":1,"tau":13.5},{"t":15.2,"type":"depart","line":"M","year":2002,"t1":15.8,"pan":0.59,"vis":1,"tau":13.5},{"t":15.268,"type":"minor","line":"M","pan":0.62,"vis":1,"tau":13.568},{"t":15.315,"type":"stop","id":"LHL","tier":4,"line":"1","pan":-0.22,"vis":1,"tau":13.615},{"t":15.325,"type":"minor","line":"M","pan":0.67,"vis":1,"tau":13.625},{"t":15.375,"type":"minor","line":"M","pan":0.72,"vis":1,"tau":13.675},{"t":15.42,"type":"minor","line":"M","pan":0.78,"vis":1,"tau":13.72},{"t":15.461,"type":"minor","line":"M","pan":0.83,"vis":1,"tau":13.761},{"t":15.5,"type":"minor","line":"M","pan":0.88,"vis":1,"tau":13.8},{"t":15.538,"type":"minor","line":"M","pan":0.94,"vis":1,"tau":13.838},{"t":15.579,"type":"minor","line":"M","pan":0.99,"vis":1,"tau":13.879},{"t":15.598,"type":"stop","id":"XZ","tier":1,"line":"1","pan":-0.29,"vis":1,"tau":13.898},{"t":15.624,"type":"minor","line":"M","pan":1,"vis":1,"tau":13.924},{"t":15.674,"type":"minor","line":"M","pan":1,"vis":0,"tau":13.974},{"t":15.731,"type":"minor","line":"M","pan":1,"vis":0,"tau":14.031},{"t":15.8,"type":"stop","id":"PDJC","tier":1,"line":"M","pan":1,"vis":0,"tau":14.1},{"t":15.9,"type":"x","id":"XZ","pan":-0.28,"vis":1,"tau":14.2},{"t":15.9,"type":"depart","line":"5","year":2003,"t1":16.7,"pan":-0.28,"vis":1,"tau":14.2},{"t":16.116,"type":"minor","line":"5","pan":-0.27,"vis":1,"tau":14.416},{"t":16.272,"type":"minor","line":"5","pan":-0.27,"vis":1,"tau":14.572},{"t":16.416,"type":"stop","id":"DCL5","tier":3,"line":"5","pan":-0.27,"vis":0,"tau":14.716},{"t":16.6,"type":"depart","line":"1","year":2004,"t1":17.2,"pan":0.09,"vis":1,"tau":14.9},{"t":16.699,"type":"stop","id":"MHKF","tier":3,"line":"5","pan":-0.26,"vis":0,"tau":14.999},{"t":16.714,"type":"minor","line":"1","pan":0.09,"vis":1,"tau":15.014},{"t":16.802,"type":"stop","id":"YCL","tier":4,"line":"1","pan":0.09,"vis":1,"tau":15.102},{"t":16.888,"type":"minor","line":"1","pan":0.09,"vis":1,"tau":15.188},{"t":16.97,"type":"stop","id":"PPXC","tier":4,"line":"1","pan":0.09,"vis":1,"tau":15.27},{"t":17,"type":"x","id":"BSL","pan":0.15,"vis":1,"tau":15.3},{"t":17,"type":"depart","line":"4","year":2005,"t1":17.8,"pan":0.15,"vis":1,"tau":15.3},{"t":17.068,"type":"minor","line":"1","pan":0.09,"vis":1,"tau":15.368},{"t":17.118,"type":"stop","id":"HLL","tier":2,"line":"4","pan":0.21,"vis":1,"tau":15.418},{"t":17.199,"type":"stop","id":"GFXC","tier":4,"line":"1","pan":0.09,"vis":0,"tau":15.499},{"t":17.213,"type":"stop","id":"DLL","tier":2,"line":"4","pan":0.27,"vis":1,"tau":15.513},{"t":17.289,"type":"minor","line":"4","pan":0.32,"vis":1,"tau":15.589},{"t":17.419,"type":"stop","id":"PDDD","tier":2,"line":"4","pan":0.34,"vis":1,"tau":15.719},{"t":17.498,"type":"x","id":"SJDD","pan":0.35,"vis":1,"tau":15.798},{"t":17.5,"type":"depart","line":"2","year":2006,"t1":18.1,"pan":-0.17,"vis":1,"tau":15.8},{"t":17.5,"type":"depart","line":"3","year":2006,"t1":18,"pan":0.2,"vis":1,"tau":15.8},{"t":17.581,"type":"minor","line":"4","pan":0.34,"vis":1,"tau":15.881},{"t":17.624,"type":"minor","line":"3","pan":0.2,"vis":1,"tau":15.924},{"t":17.66,"type":"minor","line":"2","pan":-0.22,"vis":1,"tau":15.96},{"t":17.678,"type":"minor","line":"4","pan":0.34,"vis":1,"tau":15.978},{"t":17.715,"type":"stop","id":"CJNL","tier":2,"line":"3","pan":0.2,"vis":1,"tau":16.015},{"t":17.777,"type":"stop","id":"LSGL","tier":2,"line":"2","pan":-0.27,"vis":1,"tau":16.077},{"t":17.791,"type":"minor","line":"3","pan":0.2,"vis":0,"tau":16.091},{"t":17.799,"type":"stop","id":"LCL2","tier":2,"line":"4","pan":0.34,"vis":1,"tau":16.099},{"t":17.879,"type":"minor","line":"3","pan":0.2,"vis":0,"tau":16.179},{"t":17.9,"type":"x","id":"YSL","pan":-0.16,"vis":1,"tau":16.2},{"t":17.9,"type":"depart","line":"4","year":2007,"t1":18.8,"pan":0.33,"vis":1,"tau":16.2},{"t":17.9,"type":"depart","line":"4","year":2007,"t1":18.6,"pan":-0.16,"vis":1,"tau":16.2},{"t":17.91,"type":"minor","line":"2","pan":-0.33,"vis":1,"tau":16.21},{"t":17.999,"type":"stop","id":"JYBL","tier":3,"line":"3","pan":0.2,"vis":0,"tau":16.299},{"t":18.004,"type":"x","id":"HQL","pan":-0.16,"vis":1,"tau":16.304},{"t":18.081,"type":"x","id":"YAXL","pan":-0.16,"vis":1,"tau":16.381},{"t":18.099,"type":"stop","id":"SHL","tier":4,"line":"2","pan":-0.39,"vis":1,"tau":16.399},{"t":18.2,"type":"stop","id":"GCL","tier":3,"line":"6","pan":0.59,"vis":0,"tau":16.5},{"t":18.2,"type":"stop","id":"JPL","tier":2,"line":"8","pan":0.31,"vis":1,"tau":16.5},{"t":18.2,"type":"stop","id":"SJNZ","tier":3,"line":"9","pan":-0.76,"vis":1,"tau":16.5},{"t":18.2,"type":"depart","line":"6","year":2007,"t1":19.2,"pan":0.59,"vis":0,"tau":16.5},{"t":18.2,"type":"depart","line":"8","year":2007,"t1":19.1,"pan":0.31,"vis":1,"tau":16.5},{"t":18.2,"type":"depart","line":"9","year":2007,"t1":19,"pan":-0.76,"vis":1,"tau":16.5},{"t":18.204,"type":"x","id":"JSJL","pan":-0.16,"vis":1,"tau":16.504},{"t":18.25,"type":"x","id":"CYL","pan":-0.16,"vis":1,"tau":16.55},{"t":18.255,"type":"minor","line":"6","pan":0.59,"vis":0,"tau":16.555},{"t":18.28,"type":"minor","line":"9","pan":-0.74,"vis":1,"tau":16.58},{"t":18.291,"type":"stop","id":"SPL","tier":2,"line":"8","pan":0.26,"vis":1,"tau":16.591},{"t":18.291,"type":"minor","line":"4","pan":-0.13,"vis":1,"tau":16.591},{"t":18.3,"type":"depart","line":"1","year":2007,"t1":18.8,"pan":0.08,"vis":1,"tau":16.6},{"t":18.305,"type":"minor","line":"6","pan":0.59,"vis":1,"tau":16.605},{"t":18.336,"type":"x","id":"ZPL","pan":-0.08,"vis":1,"tau":16.636},{"t":18.348,"type":"minor","line":"9","pan":-0.7,"vis":1,"tau":16.648},{"t":18.352,"type":"minor","line":"6","pan":0.59,"vis":1,"tau":16.652},{"t":18.373,"type":"x","id":"HKZQ","pan":0.2,"vis":1,"tau":16.673},{"t":18.389,"type":"x","id":"ZTL","pan":0,"vis":1,"tau":16.689},{"t":18.394,"type":"minor","line":"6","pan":0.59,"vis":1,"tau":16.694},{"t":18.408,"type":"minor","line":"9","pan":-0.66,"vis":1,"tau":16.708},{"t":18.421,"type":"minor","line":"8","pan":0.15,"vis":1,"tau":16.721},{"t":18.435,"type":"minor","line":"6","pan":0.59,"vis":1,"tau":16.735},{"t":18.463,"type":"minor","line":"9","pan":-0.63,"vis":1,"tau":16.763},{"t":18.465,"type":"minor","line":"8","pan":0.12,"vis":1,"tau":16.765},{"t":18.473,"type":"minor","line":"6","pan":0.59,"vis":1,"tau":16.773},{"t":18.483,"type":"minor","line":"1","pan":0.08,"vis":0,"tau":16.783},{"t":18.507,"type":"minor","line":"8","pan":0.12,"vis":1,"tau":16.807},{"t":18.509,"type":"minor","line":"6","pan":0.58,"vis":1,"tau":16.809},{"t":18.513,"type":"minor","line":"9","pan":-0.59,"vis":1,"tau":16.813},{"t":18.544,"type":"minor","line":"6","pan":0.56,"vis":1,"tau":16.844},{"t":18.547,"type":"minor","line":"8","pan":0.12,"vis":1,"tau":16.847},{"t":18.56,"type":"minor","line":"9","pan":-0.56,"vis":1,"tau":16.86},{"t":18.577,"type":"stop","id":"JFL","tier":2,"line":"6","pan":0.52,"vis":1,"tau":16.877},{"t":18.585,"type":"stop","id":"QFL","tier":2,"line":"8","pan":0.12,"vis":1,"tau":16.885},{"t":18.604,"type":"minor","line":"9","pan":-0.53,"vis":1,"tau":16.904},{"t":18.609,"type":"minor","line":"6","pan":0.49,"vis":1,"tau":16.909},{"t":18.615,"type":"minor","line":"1","pan":0.08,"vis":0,"tau":16.915},{"t":18.639,"type":"minor","line":"6","pan":0.46,"vis":1,"tau":16.939},{"t":18.648,"type":"minor","line":"9","pan":-0.49,"vis":1,"tau":16.948},{"t":18.669,"type":"stop","id":"MSL","tier":2,"line":"6","pan":0.42,"vis":1,"tau":16.969},{"t":18.689,"type":"stop","id":"DSJ","tier":2,"line":"8","pan":0.12,"vis":1,"tau":16.989},{"t":18.695,"type":"minor","line":"9","pan":-0.46,"vis":1,"tau":16.995},{"t":18.696,"type":"minor","line":"6","pan":0.39,"vis":1,"tau":16.996},{"t":18.722,"type":"minor","line":"6","pan":0.36,"vis":1,"tau":17.022},{"t":18.731,"type":"stop","id":"LXM","tier":2,"line":"8","pan":0.12,"vis":1,"tau":17.031},{"t":18.746,"type":"minor","line":"9","pan":-0.43,"vis":1,"tau":17.046},{"t":18.786,"type":"minor","line":"6","pan":0.33,"vis":1,"tau":17.086},{"t":18.798,"type":"stop","id":"FJL","tier":3,"line":"1","pan":0.08,"vis":0,"tau":17.098},{"t":18.801,"type":"stop","id":"QB","tier":3,"line":"9","pan":-0.39,"vis":1,"tau":17.101},{"t":18.806,"type":"stop","id":"LJBL","tier":2,"line":"8","pan":0.12,"vis":1,"tau":17.106},{"t":18.825,"type":"minor","line":"6","pan":0.33,"vis":1,"tau":17.125},{"t":18.839,"type":"stop","id":"XZNL","tier":2,"line":"8","pan":0.12,"vis":1,"tau":17.139},{"t":18.859,"type":"minor","line":"9","pan":-0.35,"vis":1,"tau":17.159},{"t":18.866,"type":"x","id":"LCL2","pan":0.33,"vis":1,"tau":17.166},{"t":18.899,"type":"minor","line":"8","pan":0.12,"vis":1,"tau":17.199},{"t":18.9,"type":"stop","id":"GLL9","tier":2,"line":"9","pan":-0.26,"vis":1,"tau":17.2},{"t":18.9,"type":"depart","line":"9","year":2008,"t1":19.3,"pan":-0.26,"vis":1,"tau":17.2},{"t":18.902,"type":"minor","line":"6","pan":0.33,"vis":1,"tau":17.202},{"t":18.924,"type":"minor","line":"9","pan":-0.3,"vis":1,"tau":17.224},{"t":18.939,"type":"minor","line":"6","pan":0.33,"vis":1,"tau":17.239},{"t":18.978,"type":"stop","id":"GKXL","tier":2,"line":"6","pan":0.33,"vis":1,"tau":17.278},{"t":19.017,"type":"minor","line":"6","pan":0.3,"vis":1,"tau":17.317},{"t":19.041,"type":"stop","id":"ZHYSG","tier":3,"line":"8","pan":0.12,"vis":1,"tau":17.341},{"t":19.057,"type":"minor","line":"6","pan":0.27,"vis":1,"tau":17.357},{"t":19.099,"type":"minor","line":"9","pan":-0.21,"vis":1,"tau":17.399},{"t":19.1,"type":"stop","id":"YHL","tier":2,"line":"8","pan":0.12,"vis":1,"tau":17.4},{"t":19.101,"type":"minor","line":"6","pan":0.24,"vis":1,"tau":17.401},{"t":19.148,"type":"minor","line":"6","pan":0.21,"vis":1,"tau":17.448},{"t":19.2,"type":"stop","id":"DMLU","tier":2,"line":"6","pan":0.18,"vis":1,"tau":17.5},{"t":19.3,"type":"stop","id":"MLH","tier":3,"line":"7","pan":-0.27,"vis":0,"tau":17.6},{"t":19.3,"type":"depart","line":"8","year":2009,"t1":19.8,"pan":0.12,"vis":1,"tau":17.6},{"t":19.3,"type":"depart","line":"7","year":2009,"t1":20.4,"pan":-0.27,"vis":0,"tau":17.6},{"t":19.339,"type":"minor","line":"7","pan":-0.27,"vis":0,"tau":17.639},{"t":19.376,"type":"minor","line":"7","pan":-0.27,"vis":0,"tau":17.676},{"t":19.4,"type":"stop","id":"JDB","tier":3,"line":"11","pan":-0.61,"vis":0,"tau":17.7},{"t":19.4,"type":"depart","line":"11","year":2009,"t1":20.2,"pan":-0.61,"vis":0,"tau":17.7},{"t":19.4,"type":"depart","line":"9","year":2009,"t1":20.1,"pan":-0.16,"vis":1,"tau":17.7},{"t":19.41,"type":"minor","line":"7","pan":-0.27,"vis":1,"tau":17.71},{"t":19.413,"type":"stop","id":"CSL8","tier":2,"line":"8","pan":0.12,"vis":1,"tau":17.713},{"t":19.443,"type":"minor","line":"7","pan":-0.24,"vis":1,"tau":17.743},{"t":19.463,"type":"minor","line":"11","pan":-0.6,"vis":0,"tau":17.763},{"t":19.474,"type":"minor","line":"7","pan":-0.21,"vis":1,"tau":17.774},{"t":19.498,"type":"x","id":"XJH","pan":-0.1,"vis":1,"tau":17.798},{"t":19.498,"type":"stop","id":"DFTY","tier":1,"line":"8","pan":0.11,"vis":1,"tau":17.798},{"t":19.504,"type":"minor","line":"7","pan":-0.18,"vis":1,"tau":17.804},{"t":19.518,"type":"minor","line":"11","pan":-0.57,"vis":1,"tau":17.818},{"t":19.532,"type":"minor","line":"7","pan":-0.15,"vis":1,"tau":17.832},{"t":19.556,"type":"stop","id":"ZJBL","tier":2,"line":"9","pan":-0.05,"vis":1,"tau":17.856},{"t":19.56,"type":"minor","line":"7","pan":-0.11,"vis":1,"tau":17.86},{"t":19.568,"type":"minor","line":"11","pan":-0.54,"vis":1,"tau":17.868},{"t":19.579,"type":"minor","line":"8","pan":0.11,"vis":1,"tau":17.879},{"t":19.586,"type":"minor","line":"7","pan":-0.08,"vis":1,"tau":17.886},{"t":19.592,"type":"stop","id":"JSL9","tier":2,"line":"9","pan":-0.02,"vis":1,"tau":17.892},{"t":19.612,"type":"minor","line":"7","pan":-0.07,"vis":1,"tau":17.912},{"t":19.613,"type":"minor","line":"11","pan":-0.5,"vis":1,"tau":17.913},{"t":19.637,"type":"minor","line":"7","pan":-0.06,"vis":1,"tau":17.937},{"t":19.655,"type":"minor","line":"11","pan":-0.47,"vis":1,"tau":17.955},{"t":19.671,"type":"stop","id":"MDL","tier":2,"line":"9","pan":0.07,"vis":1,"tau":17.971},{"t":19.672,"type":"minor","line":"8","pan":0.11,"vis":1,"tau":17.972},{"t":19.688,"type":"minor","line":"7","pan":-0.05,"vis":1,"tau":17.988},{"t":19.694,"type":"minor","line":"11","pan":-0.44,"vis":1,"tau":17.994},{"t":19.714,"type":"x","id":"LJBL","pan":0.11,"vis":1,"tau":18.014},{"t":19.715,"type":"stop","id":"CSL7","tier":2,"line":"7","pan":-0.05,"vis":1,"tau":18.015},{"t":19.732,"type":"minor","line":"11","pan":-0.41,"vis":1,"tau":18.032},{"t":19.744,"type":"x","id":"JAS","pan":-0.05,"vis":1,"tau":18.044},{"t":19.753,"type":"minor","line":"9","pan":0.16,"vis":1,"tau":18.053},{"t":19.765,"type":"minor","line":"7","pan":-0.05,"vis":1,"tau":18.065},{"t":19.767,"type":"minor","line":"11","pan":-0.38,"vis":1,"tau":18.067},{"t":19.786,"type":"minor","line":"7","pan":-0.05,"vis":1,"tau":18.086},{"t":19.799,"type":"stop","id":"SDGL","tier":3,"line":"8","pan":0.11,"vis":1,"tau":18.099},{"t":19.8,"type":"stop","id":"XJWC","tier":3,"line":"10","pan":0.26,"vis":1,"tau":18.1},{"t":19.8,"type":"depart","line":"2","year":2010,"t1":20.3,"pan":-0.37,"vis":1,"tau":18.1},{"t":19.8,"type":"depart","line":"2","year":2010,"t1":20.4,"pan":0.44,"vis":1,"tau":18.1},{"t":19.8,"type":"depart","line":"10","year":2010,"t1":20.6,"pan":0.26,"vis":1,"tau":18.1},{"t":19.801,"type":"minor","line":"11","pan":-0.35,"vis":1,"tau":18.101},{"t":19.806,"type":"x","id":"CSL","pan":-0.05,"vis":1,"tau":18.106},{"t":19.828,"type":"x","id":"ZJBL","pan":-0.05,"vis":1,"tau":18.128},{"t":19.833,"type":"stop","id":"SCL","tier":4,"line":"9","pan":0.22,"vis":1,"tau":18.133},{"t":19.834,"type":"minor","line":"11","pan":-0.32,"vis":1,"tau":18.134},{"t":19.843,"type":"stop","id":"DAL","tier":2,"line":"7","pan":-0.05,"vis":1,"tau":18.143},{"t":19.845,"type":"minor","line":"10","pan":0.26,"vis":1,"tau":18.145},{"t":19.862,"type":"stop","id":"LHZL","tier":2,"line":"7","pan":-0.05,"vis":1,"tau":18.162},{"t":19.87,"type":"minor","line":"11","pan":-0.29,"vis":1,"tau":18.17},{"t":19.875,"type":"minor","line":"9","pan":0.25,"vis":1,"tau":18.175},{"t":19.882,"type":"minor","line":"7","pan":-0.02,"vis":1,"tau":18.182},{"t":19.885,"type":"minor","line":"10","pan":0.25,"vis":1,"tau":18.185},{"t":19.9,"type":"x","id":"MDL","pan":0.07,"vis":1,"tau":18.2},{"t":19.9,"type":"depart","line":"13","year":2010,"t1":20.4,"pan":0.05,"vis":1,"tau":18.2},{"t":19.9,"type":"landing","tau":18.2},{"t":19.903,"type":"minor","line":"7","pan":0.02,"vis":1,"tau":18.203},{"t":19.907,"type":"stop","id":"SHXZ","tier":2,"line":"11","pan":-0.25,"vis":1,"tau":18.207},{"t":19.912,"type":"minor","line":"2","pan":-0.42,"vis":1,"tau":18.212},{"t":19.918,"type":"stop","id":"ZJGK","tier":3,"line":"2","pan":0.52,"vis":1,"tau":18.218},{"t":19.92,"type":"minor","line":"9","pan":0.29,"vis":1,"tau":18.22},{"t":19.922,"type":"stop","id":"WJC","tier":3,"line":"10","pan":0.25,"vis":1,"tau":18.222},{"t":19.925,"type":"minor","line":"7","pan":0.05,"vis":1,"tau":18.225},{"t":19.957,"type":"minor","line":"10","pan":0.25,"vis":1,"tau":18.257},{"t":19.966,"type":"stop","id":"ZR","tier":2,"line":"11","pan":-0.2,"vis":1,"tau":18.266},{"t":19.969,"type":"x","id":"YHL","pan":0.11,"vis":1,"tau":18.269},{"t":19.989,"type":"x","id":"SPL","pan":0.25,"vis":1,"tau":18.289},{"t":19.99,"type":"minor","line":"13","pan":0.07,"vis":1,"tau":18.29},{"t":19.994,"type":"stop","id":"CQL","tier":2,"line":"7","pan":0.16,"vis":1,"tau":18.294},{"t":19.995,"type":"stop","id":"HQ2","tier":2,"line":"2","pan":-0.47,"vis":1,"tau":18.295},{"t":20,"type":"x","id":"JSL","pan":-0.1,"vis":1,"tau":18.3},{"t":20,"type":"depart","line":"11","year":2010,"t1":20.5,"pan":-0.1,"vis":1,"tau":18.3},{"t":20.009,"type":"stop","id":"GLL","tier":3,"line":"2","pan":0.6,"vis":1,"tau":18.309},{"t":20.015,"type":"minor","line":"10","pan":0.22,"vis":1,"tau":18.315},{"t":20.021,"type":"minor","line":"7","pan":0.21,"vis":1,"tau":18.321},{"t":20.03,"type":"minor","line":"9","pan":0.37,"vis":1,"tau":18.33},{"t":20.04,"type":"x","id":"HLL","pan":0.19,"vis":1,"tau":18.34},{"t":20.048,"type":"minor","line":"7","pan":0.25,"vis":1,"tau":18.348},{"t":20.05,"type":"expo","tau":18.35},{"t":20.051,"type":"minor","line":"2","pan":0.64,"vis":1,"tau":18.351},{"t":20.06,"type":"minor","line":"13","pan":0.1,"vis":1,"tau":18.36},{"t":20.07,"type":"minor","line":"10","pan":0.15,"vis":1,"tau":18.37},{"t":20.077,"type":"minor","line":"7","pan":0.29,"vis":1,"tau":18.377},{"t":20.089,"type":"minor","line":"2","pan":0.69,"vis":1,"tau":18.389},{"t":20.094,"type":"minor","line":"11","pan":-0.1,"vis":1,"tau":18.394},{"t":20.098,"type":"stop","id":"TTL","tier":2,"line":"10","pan":0.14,"vis":1,"tau":18.398},{"t":20.1,"type":"stop","id":"YGZL","tier":2,"line":"9","pan":0.41,"vis":1,"tau":18.4},{"t":20.1,"type":"depart","line":"10","year":2010,"t1":20.5,"pan":-0.42,"vis":1,"tau":18.4},{"t":20.104,"type":"stop","id":"HQZ","tier":1,"line":"2","pan":-0.55,"vis":1,"tau":18.404},{"t":20.106,"type":"x","id":"GKXL","pan":0.33,"vis":1,"tau":18.406},{"t":20.116,"type":"stop","id":"LDL","tier":2,"line":"11","pan":-0.1,"vis":1,"tau":18.416},{"t":20.127,"type":"x","id":"NJDL","pan":0.14,"vis":1,"tau":18.427},{"t":20.127,"type":"stop","id":"CS","tier":4,"line":"2","pan":0.73,"vis":1,"tau":18.427},{"t":20.134,"type":"minor","line":"7","pan":0.36,"vis":1,"tau":18.434},{"t":20.149,"type":"stop","id":"YY","tier":2,"line":"10","pan":0.14,"vis":1,"tau":18.449},{"t":20.162,"type":"minor","line":"7","pan":0.39,"vis":1,"tau":18.462},{"t":20.166,"type":"stop","id":"JTDX","tier":2,"line":"11","pan":-0.1,"vis":1,"tau":18.466},{"t":20.17,"type":"minor","line":"2","pan":0.76,"vis":1,"tau":18.47},{"t":20.173,"type":"stop","id":"SBDD","tier":3,"line":"13","pan":0.16,"vis":1,"tau":18.473},{"t":20.174,"type":"x","id":"LXM","pan":0.11,"vis":1,"tau":18.474},{"t":20.187,"type":"minor","line":"2","pan":-0.6,"vis":1,"tau":18.487},{"t":20.192,"type":"minor","line":"7","pan":0.42,"vis":1,"tau":18.492},{"t":20.195,"type":"stop","id":"XTD","tier":2,"line":"10","pan":0.07,"vis":1,"tau":18.495},{"t":20.216,"type":"minor","line":"2","pan":0.8,"vis":1,"tau":18.516},{"t":20.223,"type":"minor","line":"7","pan":0.46,"vis":1,"tau":18.523},{"t":20.23,"type":"x","id":"SXNL","pan":-0.02,"vis":1,"tau":18.53},{"t":20.231,"type":"minor","line":"13","pan":0.16,"vis":1,"tau":18.531},{"t":20.246,"type":"minor","line":"10","pan":-0.37,"vis":1,"tau":18.546},{"t":20.249,"type":"minor","line":"10","pan":-0.06,"vis":1,"tau":18.549},{"t":20.268,"type":"minor","line":"2","pan":0.83,"vis":1,"tau":18.568},{"t":20.269,"type":"x","id":"JTDX","pan":-0.1,"vis":1,"tau":18.569},{"t":20.288,"type":"minor","line":"7","pan":0.49,"vis":1,"tau":18.588},{"t":20.298,"type":"x","id":"CQL","pan":0.16,"vis":1,"tau":18.598},{"t":20.299,"type":"stop","id":"XJD","tier":3,"line":"2","pan":-0.64,"vis":1,"tau":18.599},{"t":20.323,"type":"minor","line":"7","pan":0.52,"vis":1,"tau":18.623},{"t":20.325,"type":"minor","line":"10","pan":-0.2,"vis":1,"tau":18.625},{"t":20.327,"type":"minor","line":"11","pan":-0.07,"vis":1,"tau":18.627},{"t":20.328,"type":"minor","line":"2","pan":0.86,"vis":1,"tau":18.628},{"t":20.347,"type":"minor","line":"10","pan":-0.24,"vis":1,"tau":18.647},{"t":20.352,"type":"minor","line":"10","pan":-0.33,"vis":1,"tau":18.652},{"t":20.36,"type":"minor","line":"7","pan":0.56,"vis":1,"tau":18.66},{"t":20.37,"type":"minor","line":"10","pan":-0.29,"vis":1,"tau":18.67},{"t":20.394,"type":"minor","line":"10","pan":-0.33,"vis":1,"tau":18.694},{"t":20.399,"type":"x","id":"CSL8","pan":0.11,"vis":1,"tau":18.699},{"t":20.4,"type":"x","id":"PDJC","pan":0.89,"vis":1,"tau":18.7},{"t":20.4,"type":"stop","id":"HXL","tier":3,"line":"7","pan":0.56,"vis":1,"tau":18.7},{"t":20.402,"type":"minor","line":"11","pan":-0.05,"vis":1,"tau":18.702},{"t":20.419,"type":"minor","line":"10","pan":-0.37,"vis":1,"tau":18.719},{"t":20.445,"type":"stop","id":"HQ1","tier":3,"line":"10","pan":-0.42,"vis":1,"tau":18.745},{"t":20.475,"type":"minor","line":"10","pan":-0.45,"vis":1,"tau":18.775},{"t":20.499,"type":"stop","id":"LH","tier":2,"line":"11","pan":-0.02,"vis":1,"tau":18.799},{"t":20.499,"type":"stop","id":"JTL","tier":3,"line":"10","pan":-0.33,"vis":1,"tau":18.799},{"t":20.507,"type":"minor","line":"10","pan":-0.47,"vis":1,"tau":18.807},{"t":20.541,"type":"x","id":"HQ2","pan":-0.47,"vis":1,"tau":18.841},{"t":20.6,"type":"x","id":"HQZ","pan":-0.55,"vis":1,"tau":18.9},{"t":21.7,"type":"glide","tau":20},{"t":22.7,"type":"london","tau":21},{"t":24.4,"type":"shanghai","tau":22.7},{"t":25,"type":"hold","tau":23.3},{"t":27.5,"type":"verdict","tau":25.8},{"t":28.15,"type":"stamp","tau":26.45},{"t":30.5,"type":"rise","tau":28},{"t":30.6,"type":"depart","line":"6","year":2011,"t1":31,"pan":0.73,"vis":0,"tau":28.1},{"t":30.6,"type":"depart","line":"8","year":2011,"t1":31,"pan":0.88,"vis":0,"tau":28.1},{"t":30.716,"type":"minor","line":"8","pan":0.86,"vis":0,"tau":28.216},{"t":30.75,"type":"depart","line":"11","year":2013,"t1":31.5,"pan":0.42,"vis":0,"tau":28.25},{"t":30.8,"type":"stop","id":"QXL","tier":3,"line":"12","pan":-0.12,"vis":0,"tau":28.3},{"t":30.8,"type":"stop","id":"HQ11","tier":3,"line":"11","pan":-0.43,"vis":0,"tau":28.3},{"t":30.8,"type":"depart","line":"11","year":2013,"t1":31.3,"pan":-0.43,"vis":0,"tau":28.3},{"t":30.8,"type":"depart","line":"12","year":2013,"t1":31.7,"pan":-0.12,"vis":0,"tau":28.3},{"t":30.8,"type":"minor","line":"8","pan":0.78,"vis":0,"tau":28.3},{"t":30.827,"type":"minor","line":"11","pan":0.38,"vis":0,"tau":28.327},{"t":30.835,"type":"minor","line":"12","pan":-0.09,"vis":0,"tau":28.335},{"t":30.85,"type":"depart","line":"16","year":2013,"t1":31.5,"pan":0.8,"vis":0,"tau":28.35},{"t":30.857,"type":"minor","line":"11","pan":-0.42,"vis":0,"tau":28.357},{"t":30.867,"type":"minor","line":"12","pan":-0.06,"vis":0,"tau":28.367},{"t":30.882,"type":"minor","line":"8","pan":0.65,"vis":0,"tau":28.382},{"t":30.893,"type":"minor","line":"11","pan":0.34,"vis":0,"tau":28.393},{"t":30.898,"type":"minor","line":"12","pan":-0.04,"vis":0,"tau":28.398},{"t":30.904,"type":"minor","line":"11","pan":-0.41,"vis":0,"tau":28.404},{"t":30.907,"type":"minor","line":"16","pan":0.73,"vis":0,"tau":28.407},{"t":30.927,"type":"minor","line":"12","pan":-0.02,"vis":0,"tau":28.427},{"t":30.946,"type":"minor","line":"11","pan":-0.4,"vis":0,"tau":28.446},{"t":30.95,"type":"stop","id":"JYL","tier":3,"line":"13","pan":-0.31,"vis":0,"tau":28.45},{"t":30.95,"type":"depart","line":"13","year":2012,"t1":31.6,"pan":-0.31,"vis":0,"tau":28.45},{"t":30.954,"type":"minor","line":"12","pan":0,"vis":1,"tau":28.454},{"t":30.956,"type":"minor","line":"16","pan":0.66,"vis":0,"tau":28.456},{"t":30.98,"type":"minor","line":"12","pan":0.02,"vis":1,"tau":28.48},{"t":30.983,"type":"minor","line":"11","pan":-0.39,"vis":0,"tau":28.483},{"t":30.996,"type":"minor","line":"13","pan":-0.29,"vis":0,"tau":28.496},{"t":30.998,"type":"x","id":"DFTY","pan":0.31,"vis":1,"tau":28.498},{"t":30.999,"type":"stop","id":"SGL","tier":3,"line":"8","pan":0.43,"vis":0,"tau":28.499},{"t":31,"type":"depart","line":"9","year":2017,"t1":31.5,"pan":0.48,"vis":0,"tau":28.5},{"t":31,"type":"minor","line":"16","pan":0.59,"vis":1,"tau":28.5},{"t":31.003,"type":"minor","line":"11","pan":0.28,"vis":1,"tau":28.503},{"t":31.005,"type":"minor","line":"12","pan":0.04,"vis":1,"tau":28.505},{"t":31.018,"type":"minor","line":"11","pan":-0.37,"vis":0,"tau":28.518},{"t":31.029,"type":"x","id":"CBL","pan":0.06,"vis":1,"tau":28.529},{"t":31.037,"type":"minor","line":"13","pan":-0.27,"vis":1,"tau":28.537},{"t":31.04,"type":"minor","line":"16","pan":0.56,"vis":1,"tau":28.54},{"t":31.047,"type":"x","id":"LCL","pan":0.08,"vis":1,"tau":28.547},{"t":31.05,"type":"minor","line":"11","pan":-0.34,"vis":1,"tau":28.55},{"t":31.051,"type":"minor","line":"11","pan":0.26,"vis":1,"tau":28.551},{"t":31.071,"type":"x","id":"LH","pan":0.11,"vis":1,"tau":28.571},{"t":31.074,"type":"minor","line":"13","pan":-0.24,"vis":1,"tau":28.574},{"t":31.076,"type":"minor","line":"9","pan":0.44,"vis":1,"tau":28.576},{"t":31.077,"type":"minor","line":"16","pan":0.56,"vis":1,"tau":28.577},{"t":31.082,"type":"minor","line":"11","pan":-0.31,"vis":1,"tau":28.582},{"t":31.1,"type":"depart","line":"13","year":2018,"t1":31.7,"pan":0.26,"vis":1,"tau":28.6},{"t":31.109,"type":"minor","line":"13","pan":-0.21,"vis":1,"tau":28.609},{"t":31.111,"type":"minor","line":"16","pan":0.58,"vis":1,"tau":28.611},{"t":31.113,"type":"stop","id":"DMQL","tier":2,"line":"12","pan":0.09,"vis":1,"tau":28.613},{"t":31.116,"type":"minor","line":"11","pan":-0.28,"vis":1,"tau":28.616},{"t":31.128,"type":"x","id":"JSL9","pan":0.08,"vis":1,"tau":28.628},{"t":31.136,"type":"minor","line":"9","pan":0.44,"vis":1,"tau":28.636},{"t":31.14,"type":"minor","line":"11","pan":0.29,"vis":1,"tau":28.64},{"t":31.14,"type":"minor","line":"13","pan":-0.18,"vis":1,"tau":28.64},{"t":31.144,"type":"minor","line":"16","pan":0.59,"vis":1,"tau":28.644},{"t":31.154,"type":"minor","line":"11","pan":-0.25,"vis":1,"tau":28.654},{"t":31.17,"type":"stop","id":"DDHL","tier":2,"line":"13","pan":-0.15,"vis":1,"tau":28.67},{"t":31.175,"type":"minor","line":"16","pan":0.62,"vis":1,"tau":28.675},{"t":31.186,"type":"minor","line":"11","pan":0.32,"vis":1,"tau":28.686},{"t":31.188,"type":"minor","line":"9","pan":0.45,"vis":1,"tau":28.688},{"t":31.192,"type":"minor","line":"12","pan":0.04,"vis":1,"tau":28.692},{"t":31.195,"type":"minor","line":"11","pan":-0.22,"vis":1,"tau":28.695},{"t":31.2,"type":"depart","line":"17","year":2017,"t1":31.8,"pan":-0.37,"vis":1,"tau":28.7},{"t":31.202,"type":"minor","line":"13","pan":-0.12,"vis":1,"tau":28.702},{"t":31.205,"type":"x","id":"DMLU","pan":0.27,"vis":1,"tau":28.705},{"t":31.206,"type":"minor","line":"16","pan":0.64,"vis":1,"tau":28.706},{"t":31.216,"type":"x","id":"NJXL","pan":0.06,"vis":1,"tau":28.716},{"t":31.235,"type":"minor","line":"9","pan":0.47,"vis":1,"tau":28.735},{"t":31.236,"type":"minor","line":"11","pan":0.35,"vis":1,"tau":28.736},{"t":31.238,"type":"minor","line":"16","pan":0.67,"vis":1,"tau":28.738},{"t":31.243,"type":"minor","line":"11","pan":-0.19,"vis":1,"tau":28.743},{"t":31.251,"type":"x","id":"HZL","pan":0.09,"vis":1,"tau":28.751},{"t":31.263,"type":"x","id":"LDL","pan":-0.05,"vis":1,"tau":28.763},{"t":31.265,"type":"x","id":"QFL","pan":0.11,"vis":1,"tau":28.765},{"t":31.273,"type":"minor","line":"16","pan":0.7,"vis":1,"tau":28.773},{"t":31.274,"type":"x","id":"TTL","pan":0.13,"vis":1,"tau":28.774},{"t":31.278,"type":"stop","id":"JHL","tier":2,"line":"9","pan":0.5,"vis":1,"tau":28.778},{"t":31.29,"type":"minor","line":"11","pan":0.38,"vis":1,"tau":28.79},{"t":31.292,"type":"minor","line":"13","pan":0.31,"vis":1,"tau":28.792},{"t":31.294,"type":"x","id":"CSL7","pan":-0.01,"vis":1,"tau":28.794},{"t":31.298,"type":"minor","line":"17","pan":-0.4,"vis":1,"tau":28.798},{"t":31.3,"type":"depart","line":"P","year":2018,"t1":31.7,"pan":0.23,"vis":1,"tau":28.8},{"t":31.3,"type":"depart","line":"5","year":2018,"t1":31.8,"pan":-0.02,"vis":1,"tau":28.8},{"t":31.31,"type":"minor","line":"16","pan":0.73,"vis":1,"tau":28.81},{"t":31.316,"type":"minor","line":"12","pan":0.16,"vis":1,"tau":28.816},{"t":31.319,"type":"minor","line":"13","pan":0.02,"vis":1,"tau":28.819},{"t":31.322,"type":"minor","line":"9","pan":0.51,"vis":1,"tau":28.822},{"t":31.338,"type":"x","id":"DLL","pan":0.18,"vis":1,"tau":28.838},{"t":31.346,"type":"minor","line":"13","pan":0.05,"vis":1,"tau":28.846},{"t":31.35,"type":"minor","line":"11","pan":0.42,"vis":1,"tau":28.85},{"t":31.35,"type":"minor","line":"16","pan":0.76,"vis":1,"tau":28.85},{"t":31.359,"type":"minor","line":"12","pan":0.2,"vis":1,"tau":28.859},{"t":31.365,"type":"minor","line":"13","pan":0.34,"vis":1,"tau":28.865},{"t":31.365,"type":"minor","line":"P","pan":0.25,"vis":1,"tau":28.865},{"t":31.372,"type":"minor","line":"9","pan":0.52,"vis":1,"tau":28.872},{"t":31.375,"type":"minor","line":"17","pan":-0.43,"vis":1,"tau":28.875},{"t":31.381,"type":"minor","line":"12","pan":0.23,"vis":1,"tau":28.881},{"t":31.381,"type":"minor","line":"5","pan":0.01,"vis":1,"tau":28.881},{"t":31.393,"type":"minor","line":"16","pan":0.79,"vis":1,"tau":28.893},{"t":31.4,"type":"x","id":"CJNL","pan":0.09,"vis":1,"tau":28.9},{"t":31.4,"type":"depart","line":"18","year":2020,"t1":32.2,"pan":0.09,"vis":1,"tau":28.9},{"t":31.404,"type":"minor","line":"12","pan":0.26,"vis":1,"tau":28.904},{"t":31.405,"type":"minor","line":"13","pan":0.07,"vis":1,"tau":28.905},{"t":31.417,"type":"minor","line":"P","pan":0.28,"vis":1,"tau":28.917},{"t":31.418,"type":"minor","line":"11","pan":0.45,"vis":1,"tau":28.918},{"t":31.429,"type":"minor","line":"9","pan":0.53,"vis":1,"tau":28.929},{"t":31.431,"type":"minor","line":"13","pan":0.37,"vis":1,"tau":28.931},{"t":31.441,"type":"minor","line":"17","pan":-0.45,"vis":1,"tau":28.941},{"t":31.443,"type":"minor","line":"16","pan":0.82,"vis":1,"tau":28.943},{"t":31.443,"type":"minor","line":"18","pan":0.12,"vis":1,"tau":28.943},{"t":31.461,"type":"minor","line":"P","pan":0.32,"vis":1,"tau":28.961},{"t":31.476,"type":"minor","line":"13","pan":0.07,"vis":1,"tau":28.976},{"t":31.478,"type":"x","id":"JFL","pan":0.35,"vis":1,"tau":28.978},{"t":31.482,"type":"minor","line":"18","pan":0.15,"vis":1,"tau":28.982},{"t":31.499,"type":"stop","id":"CL","tier":3,"line":"9","pan":0.54,"vis":1,"tau":28.999},{"t":31.499,"type":"stop","id":"DSN","tier":3,"line":"11","pan":0.49,"vis":1,"tau":28.999},{"t":31.5,"type":"stop","id":"GCGY","tier":3,"line":"15","pan":-0.24,"vis":1,"tau":29},{"t":31.5,"type":"stop","id":"DSH","tier":3,"line":"16","pan":0.84,"vis":1,"tau":29},{"t":31.5,"type":"depart","line":"15","year":2021,"t1":32.2,"pan":-0.24,"vis":1,"tau":29},{"t":31.5,"type":"minor","line":"17","pan":-0.47,"vis":1,"tau":29},{"t":31.5,"type":"minor","line":"P","pan":0.33,"vis":1,"tau":29},{"t":31.501,"type":"minor","line":"5","pan":0.07,"vis":1,"tau":29.001},{"t":31.503,"type":"minor","line":"13","pan":0.41,"vis":1,"tau":29.003},{"t":31.505,"type":"minor","line":"12","pan":0.38,"vis":1,"tau":29.005},{"t":31.518,"type":"minor","line":"18","pan":0.17,"vis":1,"tau":29.018},{"t":31.519,"type":"x","id":"XTD","pan":0.1,"vis":1,"tau":29.019},{"t":31.533,"type":"minor","line":"12","pan":0.42,"vis":1,"tau":29.033},{"t":31.536,"type":"minor","line":"15","pan":-0.23,"vis":1,"tau":29.036},{"t":31.539,"type":"minor","line":"P","pan":0.35,"vis":1,"tau":29.039},{"t":31.55,"type":"stop","id":"FL","tier":3,"line":"14","pan":-0.35,"vis":1,"tau":29.05},{"t":31.55,"type":"depart","line":"14","year":2021,"t1":32.25,"pan":-0.35,"vis":1,"tau":29.05},{"t":31.55,"type":"minor","line":"5","pan":0.1,"vis":1,"tau":29.05},{"t":31.552,"type":"minor","line":"18","pan":0.18,"vis":1,"tau":29.052},{"t":31.558,"type":"minor","line":"17","pan":-0.5,"vis":1,"tau":29.058},{"t":31.562,"type":"minor","line":"12","pan":0.45,"vis":1,"tau":29.062},{"t":31.569,"type":"minor","line":"15","pan":-0.23,"vis":1,"tau":29.069},{"t":31.583,"type":"x","id":"JPL","pan":0.2,"vis":1,"tau":29.083},{"t":31.583,"type":"minor","line":"P","pan":0.36,"vis":1,"tau":29.083},{"t":31.588,"type":"minor","line":"14","pan":-0.31,"vis":1,"tau":29.088},{"t":31.589,"type":"minor","line":"13","pan":0.45,"vis":1,"tau":29.089},{"t":31.593,"type":"minor","line":"12","pan":0.46,"vis":1,"tau":29.093},{"t":31.598,"type":"minor","line":"5","pan":0.14,"vis":1,"tau":29.098},{"t":31.6,"type":"minor","line":"15","pan":-0.22,"vis":1,"tau":29.1},{"t":31.609,"type":"minor","line":"18","pan":0.22,"vis":1,"tau":29.109},{"t":31.623,"type":"minor","line":"14","pan":-0.28,"vis":1,"tau":29.123},{"t":31.624,"type":"minor","line":"17","pan":-0.54,"vis":1,"tau":29.124},{"t":31.626,"type":"minor","line":"12","pan":0.48,"vis":1,"tau":29.126},{"t":31.628,"type":"minor","line":"15","pan":-0.22,"vis":1,"tau":29.128},{"t":31.634,"type":"minor","line":"P","pan":0.39,"vis":1,"tau":29.134},{"t":31.635,"type":"minor","line":"18","pan":0.25,"vis":1,"tau":29.135},{"t":31.653,"type":"minor","line":"5","pan":0.19,"vis":1,"tau":29.153},{"t":31.655,"type":"minor","line":"14","pan":-0.25,"vis":1,"tau":29.155},{"t":31.655,"type":"minor","line":"15","pan":-0.21,"vis":1,"tau":29.155},{"t":31.661,"type":"minor","line":"12","pan":0.5,"vis":1,"tau":29.161},{"t":31.68,"type":"minor","line":"15","pan":-0.21,"vis":1,"tau":29.18},{"t":31.684,"type":"minor","line":"14","pan":-0.21,"vis":1,"tau":29.184},{"t":31.699,"type":"stop","id":"ZKL","tier":3,"line":"13","pan":0.52,"vis":1,"tau":29.199},{"t":31.7,"type":"x","id":"JHL","pan":0.52,"vis":1,"tau":29.2},{"t":31.7,"type":"stop","id":"SHGZ","tier":3,"line":"P","pan":0.43,"vis":1,"tau":29.2},{"t":31.7,"type":"depart","line":"A","year":2024,"t1":32.35,"pan":-0.39,"vis":1,"tau":29.2},{"t":31.701,"type":"minor","line":"17","pan":-0.6,"vis":1,"tau":29.201},{"t":31.705,"type":"x","id":"MSL","pan":0.33,"vis":1,"tau":29.205},{"t":31.705,"type":"minor","line":"15","pan":-0.2,"vis":1,"tau":29.205},{"t":31.712,"type":"minor","line":"14","pan":-0.18,"vis":1,"tau":29.212},{"t":31.718,"type":"minor","line":"5","pan":0.24,"vis":1,"tau":29.218},{"t":31.723,"type":"minor","line":"A","pan":-0.38,"vis":1,"tau":29.223},{"t":31.728,"type":"minor","line":"15","pan":-0.19,"vis":1,"tau":29.228},{"t":31.731,"type":"minor","line":"18","pan":0.35,"vis":1,"tau":29.231},{"t":31.738,"type":"x","id":"ZR","pan":-0.15,"vis":1,"tau":29.238},{"t":31.744,"type":"minor","line":"A","pan":-0.36,"vis":1,"tau":29.244},{"t":31.75,"type":"minor","line":"15","pan":-0.18,"vis":1,"tau":29.25},{"t":31.755,"type":"x","id":"YGZL","pan":0.37,"vis":1,"tau":29.255},{"t":31.762,"type":"minor","line":"14","pan":-0.12,"vis":1,"tau":29.262},{"t":31.765,"type":"minor","line":"A","pan":-0.33,"vis":1,"tau":29.265},{"t":31.771,"type":"x","id":"DDHL","pan":-0.18,"vis":1,"tau":29.271},{"t":31.781,"type":"minor","line":"18","pan":0.4,"vis":1,"tau":29.281},{"t":31.784,"type":"minor","line":"14","pan":-0.09,"vis":1,"tau":29.284},{"t":31.784,"type":"minor","line":"A","pan":-0.31,"vis":1,"tau":29.284},{"t":31.798,"type":"x","id":"LSGL","pan":-0.17,"vis":1,"tau":29.298},{"t":31.799,"type":"stop","id":"DFL","tier":3,"line":"17","pan":-0.71,"vis":1,"tau":29.299},{"t":31.799,"type":"stop","id":"FXXC","tier":3,"line":"5","pan":0.35,"vis":1,"tau":29.299},{"t":31.802,"type":"minor","line":"A","pan":-0.28,"vis":1,"tau":29.302},{"t":31.805,"type":"minor","line":"14","pan":-0.05,"vis":1,"tau":29.305},{"t":31.82,"type":"x","id":"QB","pan":-0.25,"vis":1,"tau":29.32},{"t":31.82,"type":"minor","line":"15","pan":-0.16,"vis":1,"tau":29.32},{"t":31.826,"type":"minor","line":"14","pan":-0.02,"vis":1,"tau":29.326},{"t":31.826,"type":"minor","line":"18","pan":0.48,"vis":1,"tau":29.326},{"t":31.837,"type":"minor","line":"A","pan":-0.22,"vis":1,"tau":29.337},{"t":31.841,"type":"minor","line":"15","pan":-0.15,"vis":1,"tau":29.341},{"t":31.846,"type":"minor","line":"14","pan":0.02,"vis":1,"tau":29.346},{"t":31.847,"type":"minor","line":"18","pan":0.52,"vis":1,"tau":29.347},{"t":31.853,"type":"minor","line":"A","pan":-0.18,"vis":1,"tau":29.353},{"t":31.861,"type":"minor","line":"15","pan":-0.14,"vis":1,"tau":29.361},{"t":31.866,"type":"minor","line":"14","pan":0.06,"vis":1,"tau":29.366},{"t":31.867,"type":"minor","line":"18","pan":0.57,"vis":1,"tau":29.367},{"t":31.869,"type":"minor","line":"A","pan":-0.14,"vis":1,"tau":29.369},{"t":31.882,"type":"x","id":"GLL9","pan":-0.13,"vis":1,"tau":29.382},{"t":31.884,"type":"x","id":"HPNL","pan":0.11,"vis":1,"tau":29.384},{"t":31.884,"type":"minor","line":"A","pan":-0.09,"vis":1,"tau":29.384},{"t":31.889,"type":"minor","line":"18","pan":0.62,"vis":1,"tau":29.389},{"t":31.899,"type":"minor","line":"A","pan":-0.04,"vis":1,"tau":29.399},{"t":31.901,"type":"minor","line":"15","pan":-0.09,"vis":1,"tau":29.401},{"t":31.911,"type":"minor","line":"18","pan":0.69,"vis":1,"tau":29.411},{"t":31.913,"type":"minor","line":"A","pan":0.02,"vis":1,"tau":29.413},{"t":31.917,"type":"x","id":"DSJ","pan":0.21,"vis":1,"tau":29.417},{"t":31.922,"type":"minor","line":"15","pan":-0.03,"vis":1,"tau":29.422},{"t":31.926,"type":"x","id":"YY","pan":0.24,"vis":1,"tau":29.426},{"t":31.927,"type":"minor","line":"A","pan":0.08,"vis":1,"tau":29.427},{"t":31.934,"type":"minor","line":"18","pan":0.78,"vis":1,"tau":29.434},{"t":31.941,"type":"minor","line":"A","pan":0.15,"vis":1,"tau":29.441},{"t":31.942,"type":"minor","line":"15","pan":0.03,"vis":1,"tau":29.442},{"t":31.954,"type":"minor","line":"A","pan":0.24,"vis":1,"tau":29.454},{"t":31.958,"type":"minor","line":"18","pan":0.88,"vis":1,"tau":29.458},{"t":31.964,"type":"minor","line":"15","pan":0.11,"vis":1,"tau":29.464},{"t":31.967,"type":"minor","line":"A","pan":0.32,"vis":1,"tau":29.467},{"t":31.979,"type":"x","id":"LJZ","pan":0.38,"vis":1,"tau":29.479},{"t":31.98,"type":"stop","id":"HJ","tier":3,"line":"A","pan":0.41,"vis":1,"tau":29.48},{"t":31.983,"type":"minor","line":"18","pan":0.99,"vis":1,"tau":29.483},{"t":32.002,"type":"minor","line":"14","pan":0.41,"vis":1,"tau":29.502},{"t":32.006,"type":"minor","line":"A","pan":0.61,"vis":1,"tau":29.506},{"t":32.009,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.509},{"t":32.012,"type":"minor","line":"15","pan":0.27,"vis":1,"tau":29.512},{"t":32.019,"type":"minor","line":"A","pan":0.71,"vis":1,"tau":29.519},{"t":32.025,"type":"x","id":"PDDD","pan":0.46,"vis":1,"tau":29.525},{"t":32.031,"type":"minor","line":"A","pan":0.83,"vis":1,"tau":29.531},{"t":32.036,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.536},{"t":32.038,"type":"minor","line":"15","pan":0.34,"vis":1,"tau":29.538},{"t":32.044,"type":"minor","line":"A","pan":0.96,"vis":1,"tau":29.544},{"t":32.048,"type":"minor","line":"14","pan":0.53,"vis":1,"tau":29.548},{"t":32.057,"type":"stop","id":"SLN","tier":3,"line":"A","pan":1,"vis":0,"tau":29.557},{"t":32.064,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.564},{"t":32.066,"type":"minor","line":"15","pan":0.36,"vis":1,"tau":29.566},{"t":32.069,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.569},{"t":32.072,"type":"minor","line":"14","pan":0.6,"vis":1,"tau":29.572},{"t":32.083,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.583},{"t":32.094,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.594},{"t":32.095,"type":"minor","line":"15","pan":0.38,"vis":1,"tau":29.595},{"t":32.096,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.596},{"t":32.097,"type":"minor","line":"14","pan":0.67,"vis":1,"tau":29.597},{"t":32.11,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.61},{"t":32.123,"type":"minor","line":"14","pan":0.73,"vis":1,"tau":29.623},{"t":32.124,"type":"stop","id":"ZJZ","tier":3,"line":"A","pan":1,"vis":0,"tau":29.624},{"t":32.127,"type":"minor","line":"15","pan":0.4,"vis":0,"tau":29.627},{"t":32.127,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.627},{"t":32.14,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.64},{"t":32.152,"type":"minor","line":"14","pan":0.8,"vis":1,"tau":29.652},{"t":32.157,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.657},{"t":32.162,"type":"minor","line":"15","pan":0.42,"vis":0,"tau":29.662},{"t":32.162,"type":"minor","line":"18","pan":1,"vis":0,"tau":29.662},{"t":32.174,"type":"stop","id":"DJQ","tier":3,"line":"A","pan":1,"vis":0,"tau":29.674},{"t":32.182,"type":"minor","line":"14","pan":0.86,"vis":1,"tau":29.682},{"t":32.191,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.691},{"t":32.2,"type":"stop","id":"ZZGX","tier":3,"line":"15","pan":0.44,"vis":0,"tau":29.7},{"t":32.2,"type":"stop","id":"YSH","tier":3,"line":"18","pan":1,"vis":0,"tau":29.7},{"t":32.207,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.707},{"t":32.214,"type":"minor","line":"14","pan":0.92,"vis":1,"tau":29.714},{"t":32.225,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.725},{"t":32.243,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.743},{"t":32.25,"type":"stop","id":"GQL","tier":3,"line":"14","pan":0.97,"vis":1,"tau":29.75},{"t":32.262,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.762},{"t":32.282,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.782},{"t":32.303,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.803},{"t":32.326,"type":"minor","line":"A","pan":1,"vis":0,"tau":29.826},{"t":32.4,"type":"sweep","tau":29.9},{"t":33.9,"type":"ride","tau":31.4},{"t":35.1,"type":"sign","tau":32.6},{"t":35.4,"type":"rideland","tau":32.9},{"t":37.1,"type":"lift","tau":34.6},{"t":38.5,"type":"push","tau":36},{"t":39.9,"type":"here","tau":37.4},{"t":40.25,"type":"caption","tau":37.75},{"t":44,"type":"end","tau":41.5},{"t":44.5,"type":"endring","tau":42}]}\ No newline at end of filediff --git a/styles/transit-map/demo/film.js b/styles/transit-map/demo/film.jsnew file mode 100644index 0000000..ab5b68c--- /dev/null+++ b/styles/transit-map/demo/film.js@@ -0,0 +1,450 @@+// 《6 公里》 6 Kilometres — Transit Map style demo.+// A printed schematic of the Shanghai Metro grows year by year from the 6 km first section of Line 1 (1993).+// Unofficial fan film: line colours and station names are public facts; no operator logo, our own schematic.+// render(t) depends only on t: line growth, stations, trains, camera and counters are closed-form functions of t,+// precomputed at load where needed (station light-up times, label placement).+import { clamp, lerp, seg, ss, eio, eo, ei, back, monotone, track, mulberry, hash } from '/core/lib.js';+import { DATA, WARP } from './timeline.js';++const { G, ST, LINES, RIVER, SUZHOU, expand, pt: gpt } = window.NET;+const DUR = DATA.DUR; // story time (tau)+const DUR_T = WARP[WARP.length - 1][0]; window.DUR = DUR_T; // film time+// film time t -> story time tau (piecewise linear: a slow 1995 beat, a longer verdict hold)+function tauOf(t) { for (let i = 1; i < WARP.length; i++) { const [ta, ua] = WARP[i - 1], [tb, ub] = WARP[i]; if (t <= tb) return ua + (ub - ua) * clamp((t - ta) / (tb - ta || 1)); } return WARP[WARP.length - 1][1]; }+function tOf(u) { for (let i = 1; i < WARP.length; i++) { const [ta, ua] = WARP[i - 1], [tb, ub] = WARP[i]; if (ub > ua && u >= ua && u < ub) return ta + (tb - ta) * (u - ua) / (ub - ua); } return u >= WARP[WARP.length - 1][1] ? WARP[WARP.length - 1][0] : u; }+// readable-text registry for window.TEXTS (readcheck): filled while a frame is drawn+let REG = [];+function regBox(id, text, X0, Y0, X1, Y1, a, minH) {+ if (a < .5 || !text) return;+ if (!(X0 >= 0 && Y0 >= 0 && X1 <= innerWidth && Y1 <= innerHeight)) return; // counted from the moment it is fully in frame+ if (Y1 - Y0 < minH) return; // too small to be read+ REG.push({ id: String(id), text, x0: X0, y0: Y0, x1: X1, y1: Y1 });+}+function regW(id, text, x0, y0, x1, y1, a = 1, minH = 14) { // a box on the sheet (world units)+ const b = window.__cam, SX = innerWidth / 1920; if (!b) return;+ const q = [[x0, y0], [x1, y0], [x0, y1], [x1, y1]].map(([x, y]) => toScreen(b, x, y)); if (q.some(p => !p)) return;+ const xs = q.map(p => p[0] * SX), ys = q.map(p => p[1] * SX);+ regBox(id, text, Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys), a, minH);+}+function regS(id, text, x0, y0, x1, y1, a = 1) { const SX = innerWidth / 1920; regBox(id, text, x0 * SX, y0 * SX, x1 * SX, y1 * SX, a, 8); }+const RG = { regW, regS };+const DEG = Math.PI / 180, FOV = 32 * DEG, FOCAL = 540 / Math.tan(FOV / 2);+const INK = '#1b1c1e', PAPER = '#f2eee5', MUTED = '#77736b', RIVERC = '#bcd6ea', RIVERE = '#8fb5d6';+const F = (w, px) => `${w} ${px}px Inter, NotoSC`;+const LW = 15;++// ---------------------------------------------------------------- geometry+function rounded(pts, r) { // dense polyline with circular fillets at corners (world units)+ const P = pts.filter((q, i) => { if (i === 0 || i === pts.length - 1) return true; const a = pts[i - 1], b = pts[i + 1];+ return Math.abs((q[0] - a[0]) * (b[1] - q[1]) - (q[1] - a[1]) * (b[0] - q[0])) > 1e-6; });+ const out = [P[0]];+ for (let i = 1; i < P.length - 1; i++) {+ const [ax, ay] = P[i - 1], [bx, by] = P[i], [cx, cy] = P[i + 1];+ let ux = ax - bx, uy = ay - by, vx = cx - bx, vy = cy - by;+ const lu = Math.hypot(ux, uy), lv = Math.hypot(vx, vy); ux /= lu; uy /= lu; vx /= lv; vy /= lv;+ const ang = Math.acos(clamp(ux * vx + uy * vy, -1, 1));+ const tlen = Math.min(r / Math.tan(ang / 2), lu * .45, lv * .45), rr = tlen * Math.tan(ang / 2);+ const p1 = [bx + ux * tlen, by + uy * tlen], p2 = [bx + vx * tlen, by + vy * tlen];+ const bis = [ux + vx, uy + vy], bl = Math.hypot(...bis), d = rr / Math.sin(ang / 2);+ const ox = bx + bis[0] / bl * d, oy = by + bis[1] / bl * d;+ let a1 = Math.atan2(p1[1] - oy, p1[0] - ox), a2 = Math.atan2(p2[1] - oy, p2[0] - ox);+ let da = a2 - a1; while (da > Math.PI) da -= 2 * Math.PI; while (da < -Math.PI) da += 2 * Math.PI;+ out.push(p1); for (let k = 1; k < 12; k++) { const a = a1 + da * k / 12; out.push([ox + Math.cos(a) * rr, oy + Math.sin(a) * rr]); } out.push(p2);+ }+ out.push(P[P.length - 1]);+ const L = [0]; for (let i = 1; i < out.length; i++) L.push(L[i - 1] + Math.hypot(out[i][0] - out[i - 1][0], out[i][1] - out[i - 1][1]));+ return { p: out, L, total: L[L.length - 1] };+}+function project(path, x, y) {+ let best = 1e18, bl = 0; const { p, L } = path;+ for (let i = 1; i < p.length; i++) {+ const [ax, ay] = p[i - 1], [bx, by] = p[i], dx = bx - ax, dy = by - ay, l2 = dx * dx + dy * dy || 1;+ const f = clamp(((x - ax) * dx + (y - ay) * dy) / l2), qx = ax + dx * f, qy = ay + dy * f, d = (x - qx) ** 2 + (y - qy) ** 2;+ if (d < best) { best = d; bl = L[i - 1] + f * (L[i] - L[i - 1]); }+ }+ return bl;+}+function pointAt(path, len) {+ const { p, L } = path; if (len <= 0) return p[0]; if (len >= path.total) return p[p.length - 1];+ let lo = 0, hi = L.length - 1; while (hi - lo > 1) { const m = (lo + hi) >> 1; if (L[m] < len) lo = m; else hi = m; }+ const f = (len - L[lo]) / (L[hi] - L[lo] || 1); return [lerp(p[lo][0], p[hi][0], f), lerp(p[lo][1], p[hi][1], f)];+}+function dirAt(path, len) { const a = pointAt(path, len - 2), b = pointAt(path, len + 2); return Math.atan2(b[1] - a[1], b[0] - a[0]); }+function subPath(c, path, a, b) { // trace the part [a, b] of a path into the current context path+ if (b < a) [a, b] = [b, a]; if (b - a < .01) return false;+ const { p, L } = path; const s = pointAt(path, a); c.moveTo(s[0], s[1]);+ for (let i = 1; i < p.length; i++) { if (L[i] <= a) continue; if (L[i] >= b) break; c.lineTo(p[i][0], p[i][1]); }+ const e = pointAt(path, b); c.lineTo(e[0], e[1]); return true;+}+const W = v => v * G;++// river polyline (world) and distance to it+const RIV = RIVER.map(q => [W(q[0]), W(q[1])]), SUZ = SUZHOU.map(q => [W(q[0]), W(q[1])]);+const RIVER_W = 76;+function distPoly(poly, x, y) { let best = 1e18; for (let i = 1; i < poly.length; i++) { const [ax, ay] = poly[i - 1], [bx, by] = poly[i], dx = bx - ax, dy = by - ay, l2 = dx * dx + dy * dy || 1; const f = clamp(((x - ax) * dx + (y - ay) * dy) / l2); best = Math.min(best, Math.hypot(x - ax - dx * f, y - ay - dy * f)); } return best; }++// ---------------------------------------------------------------- network build+const PATHS = {}; // key: lineId or lineId+'b'+const LINE = {};+for (const L of LINES) {+ LINE[L.id] = L;+ for (const key of ['route', 'branch']) {+ if (!L[key]) continue;+ const ex = expand(L[key]);+ const path = rounded(ex.pts.map(q => [W(q[0]), W(q[1])]), L.thin ? 30 : 34);+ path.line = L.id; path.color = L.color; path.key = L.id + (key === 'branch' ? 'b' : '');+ path.st = []; // stations on the path: {id, s, x, y}+ L[key].forEach(it => { if (it === '/') return; const id = NET.sid(it); if (!id) return; const q = gpt(it); path.st.push({ id, x: W(q[0]), y: W(q[1]), s: project(path, W(q[0]), W(q[1])) }); });+ // tunnel intervals: where the path is inside the river band+ path.tun = []; let inT = false, s0 = 0;+ for (let s = 0; s <= path.total; s += 4) { const q = pointAt(path, s), d = distPoly(RIV, q[0], q[1]); const now = d < RIVER_W / 2 + 10;+ if (now && !inT) { inT = true; s0 = s; } if (!now && inT) { inT = false; path.tun.push([s0, s]); } }+ if (inT) path.tun.push([s0, path.total]);+ // minor stops between named stations+ path.minor = [];+ const st = [...path.st].sort((a, b) => a.s - b.s);+ for (let i = 1; i < st.length; i++) {+ const gap = st[i].s - st[i - 1].s, n = Math.floor(gap / 78) - 0;+ for (let k = 1; k < n; k++) { const s = st[i - 1].s + gap * k / n; if (path.tun.some(([a, b]) => s > a - 20 && s < b + 20)) continue; path.minor.push(s); }+ }+ PATHS[path.key] = path;+ }+}+// station → the line points that meet there+const SNODE = {};+for (const path of Object.values(PATHS)) for (const q of path.st) {+ const n = SNODE[q.id] || (SNODE[q.id] = { id: q.id, pts: [], lines: new Set() });+ if (!n.pts.some(p => p.line === path.line)) n.pts.push({ line: path.line, x: q.x, y: q.y, path: path.key, s: q.s });+ n.lines.add(path.line);+}+for (const n of Object.values(SNODE)) {+ const s = ST[n.id]; n.zh = s[2]; n.en = s[3]; n.tier = s[4]; n.x = W(s[0]); n.y = W(s[1]);+ const xs = n.pts.map(p => p.x), ys = n.pts.map(p => p.y);+ n.box = [Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys)];+ n.cx = (n.box[0] + n.box[2]) / 2; n.cy = (n.box[1] + n.box[3]) / 2;+}++// ---------------------------------------------------------------- growth phases+// a phase draws part of a path from station a toward station b between film times t0 and t1+const PH = DATA.PHASES.map(ph => {+ const path = PATHS[ph.path]; if (!path) throw new Error('no path ' + ph.path);+ const fa = path.st.find(q => q.id === ph.a), fb = ph.bLast ? path.st.filter(q => q.id === ph.b).pop() : path.st.find(q => q.id === ph.b);+ if (!fa || !fb) throw new Error('phase station missing ' + ph.path + ' ' + ph.a + ' ' + ph.b);+ const o = { ...ph, path, s0: fa.s, s1: fb.s };+ // progress function: custom keys (t, station) or eased between t0 and t1+ if (ph.keys) { const ks = ph.keys.map(([t, id]) => [t, Math.abs(path.st.find(q => q.id === id).s - o.s0) / Math.abs(o.s1 - o.s0)]); o.f = monotone(ks); o.t0 = ks[0][0]; o.t1 = ks[ks.length - 1][0]; }+ else o.f = t => { const u = seg(t, o.t0, o.t1); return ph.lin ? u : (u < .5 ? 2 * u * u : 1 - 2 * (1 - u) * (1 - u)) * .35 + u * .65; };+ return o;+});+const phaseHead = (o, t) => t <= o.t0 ? o.s0 : t >= o.t1 ? o.s1 : lerp(o.s0, o.s1, clamp(o.f(t)));+function arrival(o, s) { // when the tip of phase o reaches arc length s+ const lo0 = Math.min(o.s0, o.s1) - 1, hi0 = Math.max(o.s0, o.s1) + 1; if (s < lo0 || s > hi0) return Infinity;+ let a = o.t0, b = o.t1; const want = Math.abs(s - o.s0);+ for (let k = 0; k < 40; k++) { const m = (a + b) / 2; if (Math.abs(phaseHead(o, m) - o.s0) >= want - .5) b = m; else a = m; }+ return b;+}+// light time of each (station, line) point, and of each station+for (const n of Object.values(SNODE)) {+ for (const p of n.pts) { p.tl = Infinity; for (const o of PH) if (o.path.key === p.path) p.tl = Math.min(p.tl, arrival(o, p.s)); }+ const ts = n.pts.map(p => p.tl).sort((a, b) => a - b);+ n.t1 = ts[0]; n.t2 = ts.length > 1 ? ts[1] : Infinity; // first line arrives, second line arrives (becomes an interchange)+}+for (const path of Object.values(PATHS)) path.minorT = path.minor.map(s => { let tl = Infinity; for (const o of PH) if (o.path === path) tl = Math.min(tl, arrival(o, s)); return tl; });+const lineStart = {}; for (const o of PH) { const k = o.path.line; if (!(k in lineStart) || o.t0 < lineStart[k].t0) lineStart[k] = o; }++// ---------------------------------------------------------------- paper texture (tileable)+function paperTexture() {+ const N = 1024, c = document.createElement('canvas'); c.width = c.height = N; const g = c.getContext('2d');+ const img = g.createImageData(N, N), d = img.data, R = mulberry(7);+ const lat = (p, seed) => { const a = new Float32Array(p * p); const r = mulberry(seed); for (let i = 0; i < a.length; i++) a[i] = r(); return a; };+ const L1 = lat(16, 3), L2 = lat(64, 5), L3 = lat(256, 9);+ const vn = (a, p, x, y) => { const xi = Math.floor(x), yi = Math.floor(y), fx = x - xi, fy = y - yi, ux = fx * fx * (3 - 2 * fx), uy = fy * fy * (3 - 2 * fy);+ const at = (i, j) => a[((j % p + p) % p) * p + ((i % p + p) % p)];+ return lerp(lerp(at(xi, yi), at(xi + 1, yi), ux), lerp(at(xi, yi + 1), at(xi + 1, yi + 1), ux), uy); };+ for (let y = 0; y < N; y++) for (let x = 0; x < N; x++) {+ const i = (y * N + x) * 4, u = x / N, v = y / N;+ const cloud = .55 * vn(L1, 16, u * 16, v * 16) + .3 * vn(L2, 64, u * 64, v * 64) + .15 * vn(L3, 256, u * 256, v * 256);+ d[i] = cloud * 255; d[i + 1] = (R() * .6 + vn(L3, 256, u * 256, v * 256) * .4) * 255; d[i + 2] = 0; d[i + 3] = 255;+ }+ g.putImageData(img, 0, 0);+ // fibres into the blue channel+ const f = document.createElement('canvas'); f.width = f.height = N; const fg = f.getContext('2d'); fg.fillStyle = '#000'; fg.fillRect(0, 0, N, N);+ fg.strokeStyle = '#fff'; fg.lineCap = 'round';+ for (let k = 0; k < 2600; k++) { const x = R() * N, y = R() * N, a = R() * 6.283, l = 8 + R() * 34; fg.globalAlpha = .25 + R() * .6; fg.lineWidth = .6 + R() * 1.1;+ for (const ox of [-N, 0, N]) for (const oy of [-N, 0, N]) { fg.beginPath(); fg.moveTo(x + ox, y + oy); fg.quadraticCurveTo(x + ox + Math.cos(a + .8) * l * .5, y + oy + Math.sin(a + .8) * l * .5, x + ox + Math.cos(a) * l, y + oy + Math.sin(a) * l); fg.stroke(); } }+ const fd = fg.getImageData(0, 0, N, N).data; const id2 = g.getImageData(0, 0, N, N); for (let i = 0; i < fd.length; i += 4) id2.data[i + 2] = fd[i]; g.putImageData(id2, 0, 0);+ return c;+}++// ---------------------------------------------------------------- label placement (static, on the full network)+const meas = document.createElement('canvas').getContext('2d');+const LBL = {}; // id -> {dx, dy, align, zs, es}+function placeLabels() {+ const pts = []; for (const p of Object.values(PATHS)) for (let s = 0; s < p.total; s += 12) pts.push(pointAt(p, s));+ const grid = new Map(); const key = (x, y) => (Math.floor(x / 60)) + ',' + (Math.floor(y / 60));+ for (const q of pts) { const k = key(q[0], q[1]); (grid.get(k) || grid.set(k, []).get(k)).push(q); }+ const boxes = [];+ const nodes = Object.values(SNODE).filter(n => n.tier <= 3).sort((a, b) => a.tier - b.tier || b.lines.size - a.lines.size);+ for (const n of nodes) {+ const zs = n.tier === 1 ? 30 : n.tier === 2 ? 23 : 20, es = n.tier === 1 ? 17 : 14, K = n.tier === 1 ? 1.35 : 1;+ meas.font = F(n.tier === 1 ? 700 : 600, zs * K); const zw = meas.measureText(n.zh).width; meas.font = F(500, es * K); const ew = meas.measureText(n.en).width;+ const w = Math.max(zw, ew), h = (zs + es + 4) * K;+ const hw = (n.box[2] - n.box[0]) / 2 + 16, hh = (n.box[3] - n.box[1]) / 2 + 16;+ const cands = [['e', hw + 6, -h / 2, 0], ['w', -hw - 6 - w, -h / 2, 1], ['ne', hw - 2, -hh - h + 6, 2], ['se', hw - 2, hh - 6, 2], ['nw', -hw + 2 - w, -hh - h + 6, 3], ['sw', -hw + 2 - w, hh - 6, 3], ['n', -w / 2, -hh - h - 2, 2.5], ['s', -w / 2, hh + 2, 2.5]];+ const pref = DATA.LABEL_PREF[n.id];+ let best = null;+ for (const [nm, ox, oy, pen] of cands) {+ const x0 = n.cx + ox, y0 = n.cy + oy, x1 = x0 + w, y1 = y0 + h;+ let sc = pen * 4 + (pref ? (pref === nm ? -1000 : 0) : 0);+ for (let gx = Math.floor(x0 / 60); gx <= Math.floor(x1 / 60); gx++) for (let gy = Math.floor(y0 / 60); gy <= Math.floor(y1 / 60); gy++) {+ for (const q of grid.get(gx + ',' + gy) || []) if (q[0] > x0 - 9 && q[0] < x1 + 9 && q[1] > y0 - 9 && q[1] < y1 + 9) sc += 3; }+ for (const b of boxes) if (x0 < b[2] && x1 > b[0] && y0 < b[3] && y1 > b[1]) sc += 60;+ if (!best || sc < best.sc) best = { sc, nm, x0, y0, w, h };+ }+ boxes.push([best.x0 - 4, best.y0 - 4, best.x0 + best.w + 4, best.y0 + best.h + 4]);+ const right = best.nm === 'w' || best.nm === 'nw' || best.nm === 'sw';+ const centre = best.nm === 'n' || best.nm === 's';+ LBL[n.id] = { nm: best.nm, hw, hh, zs, es, align: right ? 'right' : centre ? 'center' : 'left' };+ }+}++// ---------------------------------------------------------------- camera+function basis(c) {+ const th = c.head * DEG, ti = c.tilt * DEG;+ const F = [Math.sin(th) * Math.sin(ti), -Math.cos(th) * Math.sin(ti), -Math.cos(ti)];+ const R = [Math.cos(th), Math.sin(th), 0];+ const U = [F[1] * R[2] - F[2] * R[1], F[2] * R[0] - F[0] * R[2], F[0] * R[1] - F[1] * R[0]];+ const D = FOCAL / c.z;+ const pos = [c.x - F[0] * D, c.y - F[1] * D, -F[2] * D];+ return { pos, F, R, Up: U, focal: FOCAL, D, c };+}+function toScreen(b, x, y, z = 0) {+ const v = [x - b.pos[0], y - b.pos[1], z - b.pos[2]];+ const zc = v[0] * b.F[0] + v[1] * b.F[1] + v[2] * b.F[2]; if (zc <= 1) return null;+ const xc = v[0] * b.R[0] + v[1] * b.R[1] + v[2] * b.R[2], yc = v[0] * b.Up[0] + v[1] * b.Up[1] + v[2] * b.Up[2];+ return [960 + FOCAL * xc / zc, 540 - FOCAL * yc / zc, zc];+}+function toPlane(b, sx, sy, maxT) {+ const px = sx - 960, py = 540 - sy;+ const d = [b.F[0] * FOCAL + b.R[0] * px + b.Up[0] * py, b.F[1] * FOCAL + b.R[1] * px + b.Up[1] * py, b.F[2] * FOCAL + b.R[2] * px + b.Up[2] * py];+ const l = Math.hypot(...d); d[0] /= l; d[1] /= l; d[2] /= l;+ let t = d[2] < -1e-4 ? -b.pos[2] / d[2] : maxT; t = Math.min(t, maxT);+ return [b.pos[0] + d[0] * t, b.pos[1] + d[1] * t, t];+}+const CAM = DATA.camera; // (t, helpers) -> {x, y, z, tilt, head, ap}++// ---------------------------------------------------------------- drawing helpers (world space)+function stopDot(c, x, y, color, r = 8.5, ring = 4.6) { c.beginPath(); c.arc(x, y, r, 0, 7); c.fillStyle = '#fff'; c.fill(); c.lineWidth = ring; c.strokeStyle = color; c.stroke(); }+function capsule(c, n, sc = 1, lw = 5.5) {+ const pad = 13, [x0, y0, x1, y1] = n.box, w = (x1 - x0) / 2 + pad, h = (y1 - y0) / 2 + pad;+ c.save(); c.translate(n.cx, n.cy); c.scale(sc, sc);+ c.beginPath(); c.roundRect(-w, -h, 2 * w, 2 * h, Math.min(w, h)); c.fillStyle = '#fff'; c.fill(); c.lineWidth = lw; c.strokeStyle = INK; c.stroke();+ c.restore();+}+function labelText(c, n, a, scaleK = 1) {+ const L = LBL[n.id]; if (!L || a <= .01) return;+ const k = scaleK, zs = L.zs * k, es = L.es * k, h = zs + es + 4 * k, { hw, hh } = L;+ // anchor from the station edge (fixed) and the label box (scaled)+ const P = { e: [hw + 6, -h / 2], w: [-hw - 6, -h / 2], ne: [hw - 2, -hh - h + 6], se: [hw - 2, hh - 6], nw: [-hw + 2, -hh - h + 6], sw: [-hw + 2, hh - 6], n: [0, -hh - h - 2], s: [0, hh + 2] }[L.nm];+ c.save(); c.globalAlpha *= a; c.textAlign = L.align; c.textBaseline = 'top';+ c.translate(n.cx, n.cy);+ const ox = P[0], oy = P[1];+ c.lineJoin = 'round'; c.strokeStyle = 'rgba(242,238,229,.92)';+ const nm = DATA.nameAt ? DATA.nameAt(n, c.__t) : [n.zh, n.en];+ c.font = F(n.tier === 1 ? 700 : 600, zs); const wz = c.measureText(nm[0]).width; c.lineWidth = 5 * k; c.strokeText(nm[0], ox, oy); c.fillStyle = INK; c.fillText(nm[0], ox, oy);+ c.font = F(500, es); const we = c.measureText(nm[1]).width; c.fillStyle = '#4a4740'; c.strokeText(nm[1], ox, oy + zs + 3 * k); c.fillText(nm[1], ox, oy + zs + 3 * k);+ c.restore();+ const w = Math.max(wz, we), lx = L.align === 'left' ? ox : L.align === 'right' ? ox - w : ox - w / 2;+ regW('st-' + n.id, nm[0] + ' ' + nm[1], n.cx + lx, n.cy + oy, n.cx + lx + w, n.cy + oy + zs + 3 * k + es, a, 26);+}+function roundel(c, x, y, line, sc, r = 25) {+ const L = LINE[line]; c.save(); c.translate(x, y); c.scale(sc, sc);+ c.beginPath(); c.arc(0, 0, r, 0, 7); c.fillStyle = L.color; c.fill();+ const txt = L.id === 'P' ? '浦江' : L.id === 'M' ? '磁浮' : L.id === 'A' ? '机场' : L.id;+ c.fillStyle = ['3', '9', '10', '13', '16', '2', '15'].includes(L.id) ? INK : '#fff';+ c.font = F(800, L.id.length > 1 || txt.length > 1 ? (txt.length > 2 || /[^\x00-\x7f]/.test(txt) ? 15 : 22) : 27); c.textAlign = 'center'; c.textBaseline = 'middle';+ c.fillText(txt, 0, 1.5); c.restore();+}+function tipGlow(c, x, y, color, a) {+ const rgb = [1, 3, 5].map(i => parseInt(color.slice(i, i + 2), 16)).join(',');+ const g = c.createRadialGradient(x, y, 0, x, y, 80); g.addColorStop(0, `rgba(${rgb},${.45 * a})`); g.addColorStop(.4, `rgba(${rgb},${.14 * a})`); g.addColorStop(1, `rgba(${rgb},0)`);+ c.fillStyle = g; c.beginPath(); c.arc(x, y, 80, 0, 7); c.fill();+ c.save(); c.globalAlpha = a; c.beginPath(); c.arc(x, y, 11, 0, 7); c.fillStyle = '#fff'; c.shadowColor = `rgba(${rgb},1)`; c.shadowBlur = 22; c.fill(); c.shadowBlur = 0; c.lineWidth = 5; c.strokeStyle = color; c.stroke(); c.restore();+}+function train(c, path, s, color, a, scale = 1) {+ const q = pointAt(path, s), ang = dirAt(path, s);+ c.save(); c.globalAlpha *= a; c.translate(q[0], q[1]); c.rotate(ang); c.scale(scale, scale);+ c.beginPath(); c.roundRect(-20, -7, 40, 14, 7); c.fillStyle = '#fff'; c.fill(); c.lineWidth = 2.6; c.strokeStyle = INK; c.stroke();+ c.fillStyle = color; for (const wx of [-10, 0, 10]) c.fillRect(wx - 3.2, -2.8, 6.4, 5.6);+ c.restore();+}++// ---------------------------------------------------------------- the printed sheet: static furniture+const SHEET = DATA.SHEET;+function sheetFurniture(c, t, view) {+ DATA.furniture(c, t, view, { F, INK, MUTED, roundel, stopDot, W, ...RG });+}++// ---------------------------------------------------------------- map+function drawMap(c, t, view) {+ const z = view.z; c.__t = t;+ const lodMinor = ss(seg(z, .55, .85)), lod2 = ss(seg(z, .62, .9)), lod3 = ss(seg(z, 1.0, 1.3));+ const veil = DATA.veil(t); // 0..1: everything but the highlighted first section fades back+ // river and creek+ c.lineJoin = 'round'; c.lineCap = 'round';+ c.save(); c.strokeStyle = RIVERE; c.lineWidth = RIVER_W + 5; c.beginPath(); RIV.forEach((q, i) => c[i ? 'lineTo' : 'moveTo'](q[0], q[1])); c.stroke();+ c.strokeStyle = RIVERC; c.lineWidth = RIVER_W - 1; c.stroke();+ c.lineWidth = 15; c.strokeStyle = RIVERE; c.beginPath(); SUZ.forEach((q, i) => c[i ? 'lineTo' : 'moveTo'](q[0], q[1])); c.stroke(); c.lineWidth = 11; c.strokeStyle = RIVERC; c.stroke();+ c.restore();+ DATA.riverLabels(c, t, view, { F });+ sheetFurniture(c, t, view);+ // lines+ const active = [];+ for (const o of PH) {+ if (t <= o.t0) continue;+ const head = phaseHead(o, t), path = o.path, L = LINE[path.line];+ const a = Math.min(o.s0, head), b = Math.max(o.s0, head);+ if (b - a < .5) continue;+ const lw = L.thin ? 7 : LW;+ c.save(); c.strokeStyle = path.color; c.lineWidth = lw; c.lineCap = 'round';+ // split by tunnel intervals: dashed inside the river+ let cur = a; const cuts = path.tun.filter(([x, y]) => y > a && x < b).sort((p, q) => p[0] - q[0]);+ for (const [x, y] of cuts) {+ if (x > cur) { c.beginPath(); subPath(c, path, cur, x); c.stroke(); }+ const ta = Math.max(x, a), tb = Math.min(y, b);+ c.save(); c.lineCap = 'butt'; c.setLineDash([16, 11]); c.lineDashOffset = -ta; c.globalAlpha = .9; c.beginPath(); subPath(c, path, ta, tb); c.stroke();+ c.setLineDash([]); c.globalAlpha = .55; c.lineWidth = 2; c.strokeStyle = INK; // tunnel casing+ for (const side of [-1, 1]) { c.beginPath(); const n = 24; for (let k = 0; k <= n; k++) { const s = lerp(ta, tb, k / n), q = pointAt(path, s), an = dirAt(path, s); const px = q[0] - Math.sin(an) * side * (lw / 2 + 5), py = q[1] + Math.cos(an) * side * (lw / 2 + 5); k ? c.lineTo(px, py) : c.moveTo(px, py); } c.stroke(); }+ c.restore(); cur = tb;+ }+ if (b > cur) { c.beginPath(); subPath(c, path, cur, b); c.stroke(); }+ c.restore();+ if (t < o.t1 + .15) active.push({ o, head, fade: 1 - seg(t, o.t1, o.t1 + .15) });+ }+ // first section highlight (end of film): glow along the 1993 segment+ DATA.highlight(c, t, { PATHS, pointAt, subPath });+ // veil: paper wash over the network except the highlight+ if (veil > 0) { c.save(); c.fillStyle = `rgba(242,238,229,${.62 * veil})`; c.fillRect(SHEET[0], SHEET[1], SHEET[2] - SHEET[0], SHEET[3] - SHEET[1]); c.restore(); DATA.highlight(c, t, { PATHS, pointAt, subPath }, true); }+ // trains+ DATA.trains(c, t, { PATHS, PH, phaseHead, train, pointAt });+ // minor stops+ if (lodMinor > 0) for (const path of Object.values(PATHS)) {+ if (LINE[path.line].thin) continue;+ path.minor.forEach((s, i) => { const tl = path.minorT[i]; if (t < tl) return; const q = pointAt(path, s), k = t - tl;+ c.save(); c.globalAlpha = lodMinor * (1 - .6 * veil); stopDot(c, q[0], q[1], path.color, 6.5 * (.6 + .4 * back(seg(k, 0, .25), 3)), 3.6); c.restore(); });+ }+ // stations+ for (const n of Object.values(SNODE)) {+ if (t < n.t1) continue;+ const k1 = t - n.t1, multi = n.pts.length > 1, inter = t >= n.t2 && multi;+ const dim = DATA.stationDim(n, t, veil);+ c.save(); c.globalAlpha = dim;+ if (!inter) {+ if (n.tier <= 3 || lodMinor > 0) { const p = n.pts.reduce((a, b) => a.tl <= b.tl ? a : b); const col = LINE[p.line].color;+ const sc = .6 + .4 * back(seg(k1, 0, .28), 3);+ if (k1 < .6) { c.save(); c.globalAlpha *= (1 - k1 / .6) * .6; c.lineWidth = 3; c.strokeStyle = col; c.beginPath(); c.arc(p.x, p.y, 10 + 32 * eo(k1 / .6), 0, 7); c.stroke(); c.restore(); }+ c.globalAlpha *= n.tier <= 3 ? 1 : lodMinor; stopDot(c, p.x, p.y, col, 8.5 * sc, 4.6); }+ } else {+ const k2 = t - n.t2, drop = DATA.drops[n.id];+ if (drop) DATA.dropRing(c, n, k2, { capsule, INK });+ else { const u = seg(k2, 0, .22), sc = lerp(2.0, 1, eo(u));+ if (k2 < .55) { c.save(); c.globalAlpha *= (1 - k2 / .55) * .5; c.lineWidth = 3.5; c.strokeStyle = INK; c.beginPath(); c.arc(n.cx, n.cy, 18 + 46 * eo(k2 / .55), 0, 7); c.stroke(); c.restore(); }+ c.globalAlpha *= clamp(u * 3); capsule(c, n, sc); }+ }+ c.restore();+ }+ // glowing tips+ for (const { o, head, fade } of active) { const q = pointAt(o.path, head); tipGlow(c, q[0], q[1], o.path.color, fade * (o.glow ?? 1)); }+ // roundels at the start of each line, with the opening year+ for (const [id, o] of Object.entries(lineStart)) {+ if (DATA.noRoundel.includes(id)) continue;+ const u = seg(t, o.t0 - .05, o.t0 + .3); if (u <= 0) continue;+ const p = pointAt(o.path, o.s0), an = dirAt(o.path, o.s0 + (o.s1 > o.s0 ? 3 : -3)) + (o.s1 > o.s0 ? Math.PI : 0);+ const rp = DATA.roundelPos[id]; const rx = rp ? W(rp[0]) : p[0] + Math.cos(an) * 44, ry = rp ? W(rp[1]) : p[1] + Math.sin(an) * 44;+ c.save(); c.globalAlpha = (1 - .6 * veil) * DATA.roundelAlpha(t, id, z);+ roundel(c, rx, ry, id, back(u, 2.2) * DATA.roundelScale(z));+ const yr = o.yearLabel; if (yr) { const ys = DATA.roundelScale(z); c.font = F(700, 17 * ys); c.fillStyle = INK; c.textAlign = 'center'; c.textBaseline = 'top'; c.globalAlpha *= seg(t, o.t0 + .1, o.t0 + .4); c.fillText(yr, rx, ry + 30 * ys); }+ c.restore();+ }+ // labels+ for (const n of Object.values(SNODE)) {+ if (n.tier > 3 || t < n.t1) continue;+ const only = DATA.labelOnly && DATA.labelOnly(t); if (only && !only.includes(n.id)) continue;+ const vis = n.tier === 1 ? 1 : n.tier === 2 ? lod2 : lod3;+ const forced = DATA.forceLabel(n, t);+ const a = Math.max(vis, forced) * seg(t, n.t1 + .02, n.t1 + .3) * DATA.stationDim(n, t, veil);+ if (a <= 0) continue;+ labelText(c, n, a, n.tier === 1 ? DATA.hubLabelScale(z) : 1);+ }+ DATA.annotations(c, t, view, { F, INK, MUTED, pointAt, PATHS, SNODE, W, stopDot, roundel, capsule, LINE, ...RG });+}++// ---------------------------------------------------------------- frame+const glC = document.getElementById('gl'), ov = document.getElementById('ov'), oc = ov.getContext('2d');+const mapC = document.createElement('canvas'), mc = mapC.getContext('2d');+let plane = null;+function fit() { for (const k of [glC, ov]) { k.width = innerWidth; k.height = innerHeight; } }+fit();++function regionFor(b, view) {+ const maxT = b.D * (view.far || 5);+ const xs = [], ys = [];+ for (let i = 0; i <= 12; i++) for (const [sx, sy] of [[i * 160, 0], [i * 160, 1080], [0, i * 90], [1920, i * 90]]) { const q = toPlane(b, sx, sy, maxT); xs.push(q[0]); ys.push(q[1]); }+ let x0 = Math.min(...xs) - 30, x1 = Math.max(...xs) + 30, y0 = Math.min(...ys) - 30, y1 = Math.max(...ys) + 30;+ x0 = Math.max(x0, SHEET[0] - 40); y0 = Math.max(y0, SHEET[1] - 40); x1 = Math.min(x1, SHEET[2] + 40); y1 = Math.min(y1, SHEET[3] + 40);+ if (x1 <= x0) x1 = x0 + 10; if (y1 <= y0) y1 = y0 + 10;+ const near = toPlane(b, 960, 1080, maxT), zn = FOCAL / Math.max(1, near[2]);+ const want = 1.35 * Math.max(b.c.z, Math.min(zn, b.c.z * 2.2)) * (innerHeight / 1080);+ const s = Math.min(want, 4096 / (x1 - x0), 4096 / (y1 - y0));+ return { x0, y0, x1, y1, s };+}++function render(tFilm) {+ REG = [];+ const t = tauOf(tFilm);+ if (glC.width !== innerWidth) fit();+ const SX = innerWidth / 1920;+ const view = CAM(t);+ const b = basis(view);+ window.__cam = b;+ oc.setTransform(1, 0, 0, 1, 0, 0); oc.clearRect(0, 0, ov.width, ov.height);+ if (!DATA.tunnelOnly(t)) {+ const R = regionFor(b, view);+ const w = Math.max(2, Math.ceil((R.x1 - R.x0) * R.s)), h = Math.max(2, Math.ceil((R.y1 - R.y0) * R.s));+ // clear in pixel space: the previous frame's transform is still set, and clearing under it leaves old ink behind (ghosting, every other frame)+ if (mapC.width !== w || mapC.height !== h) { mapC.width = w; mapC.height = h; } else { mc.setTransform(1, 0, 0, 1, 0, 0); mc.clearRect(0, 0, w, h); }+ mc.setTransform(R.s, 0, 0, R.s, -R.x0 * R.s, -R.y0 * R.s);+ drawMap(mc, t, { ...view, region: R, b });+ plane.draw(b, [R.x0, R.y0, R.x0 + w / R.s, R.y0 + h / R.s], mapC, { sheet: SHEET, focusD: b.D * (view.focus || 1), aperture: view.ap || 0, vig: view.vig ?? .24, dim: view.dim || 0 });+ }+ oc.setTransform(SX, 0, 0, SX, 0, 0);+ DATA.overlay(oc, t, { b, toScreen, F, INK, view, ...RG });+}+window.render = render;+window.TEXTS = () => REG.slice();++// ---------------------------------------------------------------- events for the score+function events() {+ const ev = [];+ const pan = (t, x, y) => { const b = basis(CAM(t)), q = toScreen(b, x, y); if (!q) return { pan: 0, vis: 0 }; return { pan: +clamp((q[0] - 960) / 960, -1, 1).toFixed(2), vis: q[0] > -40 && q[0] < 1960 && q[1] > -40 && q[1] < 1120 ? 1 : 0 }; };+ for (const n of Object.values(SNODE)) {+ if (n.t1 < DUR) ev.push({ t: +n.t1.toFixed(3), type: 'stop', id: n.id, tier: n.tier, line: [...n.pts].sort((a, b) => a.tl - b.tl)[0].line, ...pan(n.t1, n.x, n.y) });+ if (n.t2 < DUR && n.pts.length > 1) ev.push({ t: +n.t2.toFixed(3), type: DATA.drops[n.id] ? 'drop' : 'x', id: n.id, ...pan(n.t2, n.cx, n.cy) });+ }+ for (const o of PH) ev.push({ t: +o.t0.toFixed(3), type: 'depart', line: o.path.line, year: o.year, t1: +o.t1.toFixed(3), ...pan(o.t0, ...pointAt(o.path, o.s0)) });+ for (const path of Object.values(PATHS)) path.minorT.forEach((tl, i) => { if (tl < DUR) ev.push({ t: +tl.toFixed(3), type: 'minor', line: path.line, ...pan(tl, ...pointAt(path, path.minor[i])) }); });+ for (const e of DATA.cues) ev.push(e);+ for (const e of ev) { e.tau = e.t; e.t = +tOf(e.t).toFixed(3); if (e.t1 != null) e.t1 = +tOf(e.t1).toFixed(3); }+ return ev.filter(e => e.t <= DUR_T).sort((a, b) => a.t - b.t);+}++// ---------------------------------------------------------------- boot+const fontList = ['400 20px Inter', '500 20px Inter', '600 20px Inter', '700 20px Inter', '800 20px Inter', '500 20px NotoSC', '600 20px NotoSC', '700 20px NotoSC', '800 20px NotoSC'];+Promise.all(fontList.map(f => document.fonts.load(f, f.includes('Noto') ? '上海地铁' : 'A1'))).then(() => document.fonts.ready).then(() => {+ plane = window.makePlane(glC, paperTexture());+ placeLabels();+ DATA.init({ PATHS, SNODE, PH, LINE, pointAt, project, W, F, meas, basis, toScreen });+ window.EV = events();+ render(0);+ window.READY = true;+});diff --git a/styles/transit-map/demo/fonts/OFL-Inter.txt b/styles/transit-map/demo/fonts/OFL-Inter.txtnew file mode 100644index 0000000..21f6aff--- /dev/null+++ b/styles/transit-map/demo/fonts/OFL-Inter.txt@@ -0,0 +1,93 @@+Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)++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/transit-map/demo/fonts/OFL-NotoSansSC.txt b/styles/transit-map/demo/fonts/OFL-NotoSansSC.txtnew file mode 100644index 0000000..1c9f432--- /dev/null+++ b/styles/transit-map/demo/fonts/OFL-NotoSansSC.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/transit-map/demo/gl.js b/styles/transit-map/demo/gl.jsnew file mode 100644index 0000000..54316c0--- /dev/null+++ b/styles/transit-map/demo/gl.js@@ -0,0 +1,146 @@+// The map lives on a physical sheet of paper lying on a dark table. Each frame the 2D map (ink only, transparent+// background) is drawn into a texture for the region the camera sees; this WebGL2 pass lays it on a plane seen by a+// perspective camera, prints it onto procedural paper (fibres, tooth, a raking light, a faint sheen at low angles)+// and finishes with a depth-of-field pass computed analytically from the plane depth.+(function () {+const VS = `#version 300 es+in vec2 p; out vec2 v; void main(){ v = p*.5+.5; gl_Position = vec4(p,0.,1.); }`;++// pass 1: ray -> plane -> paper + ink+const FS1 = `#version 300 es+precision highp float;+in vec2 v; out vec4 o;+uniform vec2 uRes; // output size in pixels+uniform vec3 uCam, uF, uR, uU; // camera position (world units, z up), forward, right, up+uniform float uFocal; // focal length in pixels (at 1080 high)+uniform vec4 uRegion; // texture region: x0, y0, x1, y1 (world)+uniform sampler2D uMap, uPaper;+uniform vec4 uSheet; // sheet bounds x0,y0,x1,y1+uniform float uInk; // overall ink opacity (1)+uniform float uDim; // darkening of the whole frame (end / tunnel cut)+float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }+void main(){+ vec2 px = (v*uRes - .5*uRes) * (1080./uRes.y);+ vec3 d = normalize(uF*uFocal + uR*px.x + uU*px.y);+ float t = -uCam.z / min(d.z, -1e-4);+ vec3 w = uCam + d*t; // hit on the plane z = 0; x east, y south (map coords)+ vec2 m = w.xy;+ // paper+ vec2 pu = m / 900.;+ float f1 = texture(uPaper, pu).r, f2 = texture(uPaper, pu*3.7+.31).g, f3 = texture(uPaper, m/260.).b;+ vec3 paper = vec3(.952,.936,.900);+ paper *= .955 + .05*f1 + .03*(f2-.5) ;+ paper -= .03*smoothstep(.62,.95,f3); // darker fibres+ // raking light from the top left across the sheet + faint sheen when seen at a low angle+ vec2 sc = (m - uSheet.xy) / (uSheet.zw - uSheet.xy);+ float light = .965 + .05*(1.-sc.x*.6-sc.y*.8);+ vec3 L = normalize(vec3(-.5,-.7,.55)), V = normalize(uCam - w), H = normalize(L+V);+ float sheen = pow(max(H.z,0.), 60.) * .10 * smoothstep(.15,.6, 1.-V.z);+ // ink+ vec2 uv = (m - uRegion.xy) / (uRegion.zw - uRegion.xy);+ vec4 ink = texture(uMap, vec2(uv.x, uv.y));+ float inside = step(0.,uv.x)*step(uv.x,1.)*step(0.,uv.y)*step(uv.y,1.);+ ink *= inside * uInk;+ // ink soaks into the tooth: slightly uneven density, never fully flat+ float tooth = .93 + .07*f2 + .03*(hash(floor(m*1.7))-.5);+ vec3 col = paper*(1.-ink.a) + ink.rgb*tooth;+ col *= light;+ col += sheen;+ // the sheet edge: outside it is the table, with a soft shadow under the paper+ vec2 e = min(m - uSheet.xy, uSheet.zw - m);+ float ins = min(e.x, e.y);+ float edge = smoothstep(-1.5, 1.5, ins);+ vec3 table = vec3(.105,.098,.094) * (.9 + .2*f1);+ float shadow = 1. - .55*exp(-max(-ins,0.)/22.);+ table *= shadow;+ col = mix(table, col, edge);+ // far haze so the horizon never aliases+ float far = smoothstep(9000., 22000., t);+ col = mix(col, vec3(.09,.085,.08), far);+ o = vec4(col*(1.-uDim), t);+}`;++// pass 2: depth of field (circle of confusion from the analytic plane depth), vignette, light grade+const FS2 = `#version 300 es+precision highp float;+in vec2 v; out vec4 o;+uniform sampler2D uImg; uniform vec2 uRes;+uniform float uFocusD, uAperture, uVig, uMaxR;+const int N = 28;+void main(){+ vec4 c0 = texture(uImg, v);+ float d0 = c0.a;+ float r = clamp(uAperture * abs(d0 - uFocusD) / d0, 0., uMaxR);+ vec3 acc = c0.rgb; float wsum = 1.;+ if (r > .6) {+ for (int i = 1; i < N; i++) {+ float a = float(i) * 2.39996, rr = sqrt(float(i)/float(N)) * r;+ vec2 o2 = vec2(cos(a), sin(a)) * rr / uRes;+ vec4 s = texture(uImg, v + o2);+ float rs = clamp(uAperture * abs(s.a - uFocusD) / s.a, 0., uMaxR);+ float w = smoothstep(rr - 1., rr + 1., rs) + .02; // a sample only spreads as far as its own blur+ acc += s.rgb * w; wsum += w;+ }+ }+ vec3 col = acc / wsum;+ vec2 q = v - .5; q.x *= uRes.x/uRes.y;+ col *= 1. - uVig * smoothstep(.35, 1.05, length(q));+ col = pow(col, vec3(1.02));+ o = vec4(col, 1.);+}`;++function sh(gl, type, src) { const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s)); return s; }+function prog(gl, fs) { const p = gl.createProgram(); gl.attachShader(p, sh(gl, gl.VERTEX_SHADER, VS)); gl.attachShader(p, sh(gl, gl.FRAGMENT_SHADER, fs)); gl.bindAttribLocation(p, 0, 'p'); gl.linkProgram(p); if (!gl.getProgramParameter(p, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(p)); return p; }++window.makePlane = function (canvas, paperCanvas) {+ const gl = canvas.getContext('webgl2', { preserveDrawingBuffer: true, antialias: false, premultipliedAlpha: false });+ if (!gl) throw new Error('WebGL2 is required');+ gl.getExtension('EXT_color_buffer_float');+ const aniso = gl.getExtension('EXT_texture_filter_anisotropic');+ const p1 = prog(gl, FS1), p2 = prog(gl, FS2);+ const buf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buf);+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);+ gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);+ const tex = (wrap) => { const t = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, t);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);+ if (aniso) gl.texParameterf(gl.TEXTURE_2D, aniso.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(16, gl.getParameter(aniso.MAX_TEXTURE_MAX_ANISOTROPY_EXT)));+ return t; };+ const mapT = tex(gl.CLAMP_TO_EDGE), paperT = tex(gl.REPEAT);+ gl.bindTexture(gl.TEXTURE_2D, paperT); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, paperCanvas); gl.generateMipmap(gl.TEXTURE_2D);+ let fbo = null, fboT = null, fw = 0, fh = 0;+ function ensureFBO(w, h) {+ if (fbo && fw === w && fh === h) return;+ fw = w; fh = h; fboT = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, fboT);+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16F, w, h, 0, gl.RGBA, gl.HALF_FLOAT, null);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);+ fbo = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fboT, 0);+ }+ const U = (p, n) => gl.getUniformLocation(p, n);+ return {+ // cam: {pos, F, R, Up, focal}; region [x0,y0,x1,y1]; mapCanvas: the inked region; opt: {sheet, focusD, aperture, vig, dim}+ draw(cam, region, mapCanvas, opt) {+ const W = canvas.width, H = canvas.height; ensureFBO(W, H);+ gl.bindTexture(gl.TEXTURE_2D, mapT); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, mapCanvas); gl.generateMipmap(gl.TEXTURE_2D);+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.viewport(0, 0, W, H); gl.useProgram(p1);+ gl.uniform2f(U(p1, 'uRes'), W, H); gl.uniform3fv(U(p1, 'uCam'), cam.pos); gl.uniform3fv(U(p1, 'uF'), cam.F);+ gl.uniform3fv(U(p1, 'uR'), cam.R); gl.uniform3fv(U(p1, 'uU'), cam.Up); gl.uniform1f(U(p1, 'uFocal'), cam.focal);+ gl.uniform4fv(U(p1, 'uRegion'), region); gl.uniform4fv(U(p1, 'uSheet'), opt.sheet);+ gl.uniform1f(U(p1, 'uInk'), 1); gl.uniform1f(U(p1, 'uDim'), opt.dim || 0);+ gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, mapT); gl.uniform1i(U(p1, 'uMap'), 0);+ gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, paperT); gl.uniform1i(U(p1, 'uPaper'), 1);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ gl.bindFramebuffer(gl.FRAMEBUFFER, null); gl.viewport(0, 0, W, H); gl.useProgram(p2);+ gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, fboT); gl.uniform1i(U(p2, 'uImg'), 0);+ gl.uniform2f(U(p2, 'uRes'), W, H); gl.uniform1f(U(p2, 'uFocusD'), opt.focusD); gl.uniform1f(U(p2, 'uAperture'), opt.aperture * H / 1080);+ gl.uniform1f(U(p2, 'uVig'), opt.vig ?? .22); gl.uniform1f(U(p2, 'uMaxR'), 26 * H / 1080);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ },+ };+};+})();diff --git a/styles/transit-map/demo/index.html b/styles/transit-map/demo/index.htmlnew file mode 100644index 0000000..34f3046--- /dev/null+++ b/styles/transit-map/demo/index.html@@ -0,0 +1,14 @@+<!doctype html>+<html><head><meta charset="utf-8">+<style>+@font-face{font-family:Inter;src:url(fonts/Inter.ttf) format('truetype');font-weight:100 900}+@font-face{font-family:NotoSC;src:url(fonts/NotoSansSC-sub.ttf) format('truetype');font-weight:100 900}+html,body{margin:0;background:#0f0f10;overflow:hidden}+canvas{display:block;position:absolute;left:0;top:0}+</style>+</head><body>+<canvas id="gl"></canvas><canvas id="ov"></canvas>+<script src="net.js"></script>+<script src="gl.js"></script>+<script type="module" src="film.js"></script>+</body></html>diff --git a/styles/transit-map/demo/net.js b/styles/transit-map/demo/net.jsnew file mode 100644index 0000000..f49f9a0--- /dev/null+++ b/styles/transit-map/demo/net.js@@ -0,0 +1,211 @@+// Schematic of the Shanghai Metro network, drawn by hand on an octilinear grid (0/45/90 degrees).+// Unofficial: geometry is our own schematic, not the operator's map. Units: G = 1 grid step = 100 world units.+// x grows east, y grows south. People's Square is the origin.+// Route items: 'ID' = the station's point; ['ID', dx, dy] = that station, offset for this line (parallel pairs);+// [x, y] = a bend. Stations carry {zh, en, tier}: tier 1 = big hub (label at every zoom), 2 = interchange, 3 = named stop.+(function () {+const G = 100;+const ST = {+ // ---- Line 1+ FJL: [0, -11, '富锦路', 'Fujin Road', 3],+ GFXC: [0, -8.6, '共富新村', 'Gongfu Xincun', 4],+ PPXC: [0, -6.6, '彭浦新村', 'Pengpu Xincun', 4],+ YCL: [0, -4.6, '延长路', 'Yanchang Road', 4],+ SHZ: [0, -2.9, '上海火车站', 'Shanghai Railway Station', 1],+ HZL: [0, -1.1, '汉中路', 'Hanzhong Road', 2],+ RMGC: [0, 0, '人民广场', "People's Square", 1],+ HPNL: [-0.9, 0.9, '黄陂南路', 'South Huangpi Road', 4],+ SXNL: [-1.8, 1.8, '陕西南路', 'South Shaanxi Road', 2],+ CSL: [-2.4, 2.4, '常熟路', 'Changshu Road', 3],+ XJH: [-3.3, 3.3, '徐家汇', 'Xujiahui', 1],+ TYG: [-3.3, 4.5, '上海体育馆', 'Shanghai Indoor Stadium', 2],+ CBL: [-3.3, 5.5, '漕宝路', 'Caobao Road', 2],+ SHNZ: [-3.3, 6.5, '上海南站', 'Shanghai South Railway Station', 1],+ JJLY: [-4.1, 7.3, '锦江乐园', 'Jinjiang Park', 3],+ LHL: [-4.8, 8.0, '莲花路', 'Lianhua Road', 4],+ XZ: [-5.8, 9.0, '莘庄', 'Xinzhuang', 1],+ // ---- Line 2+ XJD: [-13.4, 0, '徐泾东', 'East Xujing', 3],+ HQZ: [-11.6, 0, '虹桥火车站', 'Hongqiao Railway Station', 1],+ HQ2: [-10.2, 0, '虹桥2号航站楼', 'Hongqiao Airport Terminal 2', 2],+ SHL: [-8.4, 0, '淞虹路', 'Songhong Road', 4],+ LSGL: [-6.2, 0, '娄山关路', 'Loushanguan Road', 2],+ ZSGY: [-4.4, 0, '中山公园', 'Zhongshan Park', 1],+ JSL: [-3.4, 0, '江苏路', 'Jiangsu Road', 2],+ JAS: [-2.4, 0, '静安寺', "Jing'an Temple", 1],+ NJXL: [-1.1, 0, '南京西路', 'West Nanjing Road', 2],+ NJDL: [1.0, 0, '南京东路', 'East Nanjing Road', 2],+ LJZ: [2.9, 0, '陆家嘴', 'Lujiazui', 1],+ DCL: [3.6, 0, '东昌路', 'Dongchang Road', 4],+ SJDD: [4.4, 0.1, '世纪大道', 'Century Avenue', 1],+ KJG: [5.4, 1.0, '上海科技馆', 'Science and Technology Museum', 4],+ LYL: [6.6, 2.2, '龙阳路', 'Longyang Road', 1],+ ZJGK: [8.1, 2.2, '张江高科', 'Zhangjiang Hi-Tech Park', 3],+ GLL: [9.6, 2.2, '广兰路', 'Guanglan Road', 3],+ CS: [12.0, 2.2, '川沙', 'Chuansha', 4],+ PDJC: [15.0, 5.2, '浦东国际机场', 'Pudong International Airport', 1],+ // ---- Line 3 / 4 corridor+ LCL: [-2.7, 5.5, '龙漕路', 'Longcao Road', 2],+ SLL: [-2.7, 6.0, '石龙路', 'Shilong Road', 4],+ YSL: [-4.4, 3.7, '宜山路', 'Yishan Road', 2],+ HQL: [-4.4, 2.4, '虹桥路', 'Hongqiao Road', 2],+ YAXL: [-4.4, 1.2, '延安西路', 'West Yan\'an Road', 3],+ JSJL: [-4.4, -1.1, '金沙江路', 'Jinshajiang Road', 2],+ CYL: [-4.4, -2.1, '曹杨路', 'Caoyang Road', 2],+ ZPL: [-3.0, -2.9, '镇坪路', 'Zhenping Road', 2],+ ZTL: [-1.5, -2.9, '中潭路', 'Zhongtan Road', 3],+ BSL: [1.0, -2.9, '宝山路', 'Baoshan Road', 3],+ HKZQ: [2.0, -4.0, '虹口足球场', 'Hongkou Football Stadium', 2],+ JWZ: [2.0, -6.2, '江湾镇', 'Jiangwan Town', 4],+ CJNL: [2.0, -8.0, '长江南路', 'South Changjiang Road', 2],+ JYBL: [2.0, -10.6, '江杨北路', 'North Jiangyang Road', 3],+ HLL: [2.0, -2.8, '海伦路', 'Hailun Road', 2],+ DLL: [3.0, -2.8, '大连路', 'Dalian Road', 2],+ PDDD: [4.3, -1.0, '浦东大道', 'Pudong Avenue', 2],+ LCL2: [4.4, 3.2, '蓝村路', 'Lancun Road', 2],+ XZNL: [0.6, 3.9, '西藏南路', 'South Xizang Road', 2],+ DMQL: [-1.8, 3.9, '大木桥路', 'Damuqiao Road', 2],+ DAL: [-2.4, 3.9, '东安路', "Dong'an Road", 2],+ // ---- Line 5+ DCL5: [-5.8, 12.0, '东川路', 'Dongchuan Road', 3],+ MHKF: [-5.8, 13.4, '闵行开发区', 'Minhang Development Zone', 3],+ FXXC: [-1.4, 16.4, '奉贤新城', 'Fengxian Xincheng', 3],+ // ---- Line 6+ GCL: [9.0, -10.6, '港城路', 'Gangcheng Road', 3],+ JFL: [7.9, -3.4, '巨峰路', 'Jufeng Road', 2],+ MSL: [6.1, -1.6, '民生路', 'Minsheng Road', 2],+ GKXL: [4.5, 5.8, '高科西路', 'West Gaoke Road', 2],+ DMLU: [1.7, 8.6, '东明路', 'Dongming Road', 2],+ DFTY: [0.6, 9.5, '东方体育中心', 'Oriental Sports Center', 1],+ // ---- Line 7+ MLH: [-6.4, -11.4, '美兰湖', 'Meilan Lake', 3],+ CSL7: [-2.4, -1.1, '长寿路', 'Changshou Road', 2],+ LHZL: [-2.4, 4.7, '龙华中路', 'Middle Longhua Road', 2],+ YHL: [0.6, 7.7, '耀华路', 'Yaohua Road', 2],+ CQL: [1.5, 7.7, '长清路', 'Changqing Road', 2],+ HXL: [8.8, 5.2, '花木路', 'Huamu Road', 3],+ // ---- Line 8+ SGL: [6.6, -7.4, '市光路', 'Shiguang Road', 3],+ JPL: [4.0, -4.8, '江浦路', 'Jiangpu Road', 2],+ SPL: [3.2, -4.0, '四平路', 'Siping Road', 2],+ QFL: [0.6, -1.1, '曲阜路', 'Qufu Road', 2],+ LXM: [0.6, 1.8, '老西门', 'Laoximen', 2],+ LJBL: [0.6, 3.3, '陆家浜路', 'Lujiabang Road', 2],+ ZHYSG: [0.6, 7.0, '中华艺术宫', 'China Art Museum', 3],+ CSL8: [0.6, 8.6, '成山路', 'Chengshan Road', 2],+ SDGL: [0.6, 12.6, '沈杜公路', 'Shendu Highway', 3],+ // ---- Line 9+ SJNZ: [-15.0, 10.4, '松江南站', 'Songjiang South Railway Station', 3],+ QB: [-8.6, 3.7, '七宝', 'Qibao', 3],+ ZJBL: [-2.4, 3.3, '肇嘉浜路', 'Zhaojiabang Road', 2],+ JSL9: [-1.8, 3.3, '嘉善路', 'Jiashan Road', 2],+ MDL: [-0.3, 3.3, '马当路', 'Madang Road', 2],+ SCL: [2.6, 1.9, '商城路', 'Shangcheng Road', 4],+ YGZL: [6.1, 0.3, '杨高中路', 'Middle Yanggao Road', 2],+ JHL: [10.4, 0.3, '金海路', 'Jinhai Road', 2],+ CL: [12.6, -1.9, '曹路', 'Caolu', 3],+ // ---- Line 10+ XJWC: [3.2, -9.0, '新江湾城', 'Xinjiangwan City', 3],+ WJC: [3.2, -6.0, '五角场', 'Wujiaochang', 3],+ TTL: [1.0, -1.1, '天潼路', 'Tiantong Road', 2],+ YY: [1.0, 0.9, '豫园', 'Yuyuan Garden', 2],+ XTD: [-0.3, 1.8, '新天地', 'Xintiandi', 2],+ JTDX: [-3.4, 1.8, '交通大学', 'Jiaotong University', 2],+ HQ1: [-9.2, 2.4, '虹桥1号航站楼', 'Hongqiao Airport Terminal 1', 3],+ JTL: [-7.6, 3.6, '航中路', 'Hangzhong Road', 3],+ // ---- Line 11+ JDB: [-12.6, -10.4, '嘉定北', 'North Jiading', 3],+ HQ11: [-14.4, -5.6, '花桥', 'Huaqiao', 3],+ SHXZ: [-6.2, -3.4, '上海西站', 'Shanghai West Railway Station', 2],+ LDL: [-3.4, -1.1, '隆德路', 'Longde Road', 2],+ LH: [-1.8, 5.5, '龙华', 'Longhua', 2],+ DSN: [6.6, 9.8, '迪士尼', 'Disney Resort', 3],+ GLL9: [-6.2, 3.7, '桂林路', 'Guilin Road', 2],+ DDHL: [-6.2, -1.1, '大渡河路', 'Daduhe Road', 2],+ // ---- Line 12+ QXL: [-9.6, 5.5, '七莘路', 'Qixin Road', 3],+ // ---- Line 13+ JYL: [-11.0, -1.1, '金运路', 'Jinyun Road', 3],+ ZRBWG: [-1.8, -1.5, '自然博物馆', 'Natural History Museum', 4],+ SBDD: [1.5, 6.0, '世博大道', 'Expo Avenue', 3],+ ZKL: [6.8, 8.6, '张江路', 'Zhangjiang Road', 3],+ // ---- Line 14+ FL: [-10.6, -2.9, '封浜', 'Fengbang', 3],+ ZR: [-5.2, -2.9, '真如', 'Zhenru', 2],+ DSJ: [0.6, 0.9, '大世界', 'Great World', 2],+ GQL: [11.0, -1.0, '桂桥路', 'Guiqiao Road', 3],+ // ---- Line 15+ GCGY: [-6.6, -9.4, '顾村公园', 'Gucun Park', 3],+ ZZGX: [-6.6, 11.4, '紫竹高新区', 'Zizhu Hi-tech Park', 3],+ // ---- Line 16+ DSH: [14.6, 11.4, '滴水湖', 'Dishui Lake', 3],+ // ---- Line 17+ DFL: [-17.4, 2.4, '东方绿舟', 'Oriental Land', 3],+ // ---- Line 18+ YSH: [9.2, 13.2, '航头', 'Hangtou', 3],+ // ---- Airport link+ HJ: [-2.0, 9.3, '华泾', 'Huajing', 3],+ SLN: [2.6, 10.6, '三林南', 'South Sanlin', 3],+ ZJZ: [6.8, 10.6, '张江', 'Zhangjiang', 3],+ DJQ: [9.6, 10.6, '度假区', 'Resort', 3],+ // ---- Pujiang line+ SHGZ: [2.0, 15.6, '汇臻路', 'Huizhen Road', 3],+};++// colours: official line colours of the network (as published on the operator's maps, approximated for print)+const LINES = [+ { id: '1', color: '#E3002B', route: ['XZ', 'LHL', 'JJLY', 'SHNZ', 'CBL', 'TYG', 'XJH', 'CSL', 'SXNL', 'HPNL', 'RMGC', 'HZL', 'SHZ', 'YCL', 'PPXC', 'GFXC', 'FJL'] },+ { id: '2', color: '#82BF25', route: ['XJD', ['HQZ', 0, -0.08], ['HQ2', 0, -0.08], 'SHL', 'LSGL', 'ZSGY', 'JSL', 'JAS', 'NJXL', 'RMGC', 'NJDL', 'LJZ', 'DCL', ['SJDD', 0, -0.1], 'KJG', 'LYL', 'ZJGK', 'GLL', 'CS', 'PDJC'] },+ { id: '3', color: '#FCD600', route: ['SHNZ', [-2.7, 5.9], 'SLL', 'LCL', ['YSL', -0.1, 0], ['HQL', -0.1, 0], ['YAXL', -0.1, 0], ['ZSGY', -0.1, 0], ['JSJL', -0.1, 0], ['CYL', -0.1, 0], [-4.5, -2.5], [-4.1, -2.9], ['ZPL', 0, -0.1], ['ZTL', 0, -0.1], ['SHZ', 0, -0.1], ['BSL', 0, -0.1], 'HKZQ', 'JWZ', 'CJNL', 'JYBL'] },+ { id: '4', color: '#461D84', loop: true, route: [['YSL', 0.1, 0], ['HQL', 0.1, 0], ['YAXL', 0.1, 0], ['ZSGY', 0.1, 0], ['JSJL', 0.1, 0], ['CYL', 0.1, 0], [-4.3, -2.5], [-4.0, -2.8], ['ZPL', 0, 0.1], ['ZTL', 0, 0.1], ['SHZ', 0, 0.1], ['BSL', 0, 0.1], 'HLL', 'DLL', [3.8, -2.8], [4.3, -2.3], 'PDDD', ['SJDD', -0.1, 0], [4.3, 2.0], ['LCL2', -0.1, 0], [3.6, 3.9], [2.9, 3.9], 'XZNL', 'DMQL', 'DAL', [-3.0, 4.5], 'TYG', [-3.5, 4.5], ['YSL', 0.1, 0]] },+ { id: '5', color: '#944D9A', route: ['XZ', 'DCL5', 'MHKF'], branch: ['DCL5', [-5.8, 12.4], [-2.2, 16.0], [-1.8, 16.4], 'FXXC'] },+ { id: '6', color: '#D40068', route: ['GCL', [9.0, -4.5], 'JFL', 'MSL', [4.5, 0.0], ['SJDD', 0.1, 0], [4.5, 2.0], ['LCL2', 0.1, 0], 'GKXL', 'DMLU', [0.8, 9.5], 'DFTY'] },+ { id: '7', color: '#ED6F00', route: ['MLH', [-6.4, -8.8], [-3.0, -5.4], [-3.0, -2.9], 'ZPL', [-2.4, -2.3], 'CSL7', 'JAS', 'CSL', 'ZJBL', 'DAL', 'LHZL', 'YHL', 'CQL', [2.4, 7.7], [4.4, 5.7], 'GKXL', [7.1, 3.2], [7.1, 2.6], 'LYL', [8.8, 4.4], 'HXL'] },+ { id: '8', color: '#0094D8', route: ['SGL', 'JPL', 'SPL', 'HKZQ', [1.2, -4.0], [0.6, -3.4], 'QFL', [0.6, -0.6], 'RMGC', [0.6, 0.6], 'DSJ', 'LXM', 'LJBL', 'XZNL', 'ZHYSG', 'YHL', 'CSL8', 'DFTY', 'SDGL'] },+ { id: '9', color: '#87CAED', route: ['SJNZ', [-9.6, 4.8], 'QB', 'GLL9', ['YSL', 0, 0], 'XJH', 'ZJBL', 'JSL9', 'MDL', 'LJBL', [1.2, 3.3], 'SCL', [4.2, 0.3], ['SJDD', 0, 0.2], 'YGZL', 'JHL', [10.6, 0.3], 'CL'] },+ { id: '10', color: '#C6AFD4', route: ['XJWC', 'WJC', 'SPL', 'HLL', [1.0, -1.8], 'TTL', 'NJDL', 'YY', [1.0, 1.4], 'LXM', 'XTD', 'SXNL', 'JTDX', [-3.8, 2.4], 'HQL', 'HQ1', [-10.2, 1.4], ['HQ2', 0, 0.12], ['HQZ', 0, 0.12]], branch: ['HQ1', [-7.6, 2.4], 'JTL'] },+ { id: '11', color: '#871C2B', route: ['JDB', [-12.6, -9.6], 'SHXZ', 'ZR', 'CYL', 'LDL', 'JSL', 'JTDX', ['XJH', -0.1, 0], [-2.6, 4.1], [-2.6, 4.7], 'LH', [-0.4, 6.9], '/', [0.6, 8.5], 'DFTY', [1.4, 9.6], [4.0, 9.6], 'DSN'], branch: ['HQ11', [-12.4, -3.6], [-11.6, -2.8], 'SHXZ'] },+ { id: '12', color: '#007A60', route: ['QXL', 'CBL', 'LCL', 'LH', [-1.8, 4.7], 'DMQL', 'JSL9', 'SXNL', [-1.8, 0.7], 'NJXL', 'HZL', 'QFL', 'TTL', [2.2, -2.3], [2.5, -2.3], 'DLL', [3.6, -3.4], 'JFL', [10.4, -3.4], 'JHL'] },+ { id: '13', color: '#E999C0', route: ['JYL', 'DDHL', 'JSJL', 'LDL', 'CSL7', ['HZL', 0, 0], [0.1, -1.0], ['NJXL', 0.1, 0.1], [-1.0, 1.1], [-0.3, 1.8], 'XTD', 'MDL', [-0.3, 4.2], 'SBDD', 'CQL', 'CSL8', 'DMLU', [6.0, 8.6], 'ZKL'] },+ { id: '14', color: '#626020', route: ['FL', [-5.8, -2.9], 'ZR', [-4.3, -2.1], [-2.4, -0.2], [-1.3, 0.9], 'HPNL', 'DSJ', 'YY', [2.0, 0.9], 'LJZ', [3.9, -1.0], 'PDDD', [10.0, -1.0], 'GQL'] },+ { id: '15', color: '#BCA886', route: ['GCGY', [-6.6, -3.6], [-6.2, -3.2], 'DDHL', 'LSGL', 'GLL9', [-6.2, 4.0], [-3.7, 6.5], 'SHNZ', [-3.3, 8.0], 'ZZGX'] },+ { id: '16', color: '#98D1C0', route: ['LYL', [7.6, 3.2], [7.6, 4.8], [14.6, 11.8], 'DSH'] },+ { id: '17', color: '#BC796F', route: ['HQZ', [-12.6, 0], [-15.0, 2.4], 'DFL'] },+ { id: '18', color: '#C4984F', route: ['CJNL', [3.0, -8.0], [4.0, -7.0], 'JPL', [6.1, -2.7], 'MSL', 'YGZL', [6.1, 1.7], 'LYL', [6.6, 6.6], 'YSH'] },+ { id: 'P', name: '浦江线', color: '#B5B5B6', route: ['DFTY', [0.6, 10.2], [2.0, 11.6], 'SHGZ'] },+ { id: 'M', name: '磁浮', color: '#008B9A', thin: true, route: ['LYL', [6.6, 2.8], [12.6, 2.8], 'PDJC'] },+ { id: 'A', name: '机场联络线', color: '#3D688A', route: [['HQZ', 0, 0.12], [-11.6, 0.7], 'QB', [-3.0, 9.3], 'HJ', [0.2, 9.3], [1.4, 10.6], 'SLN', 'ZJZ', 'DJQ', ['PDJC', 0, 0.1]] },+];++// the Huangpu: Bund stretch north, bend east round Lujiazui, out to the Yangtze (top right)+const RIVER = [[-19, 14.4], [-6.0, 14.4], [-1.0, 9.4], [-1.0, 8.2], [2.0, 5.2], [2.0, -1.6], [5.0, -1.6], [8.0, -4.6], [8.0, -14]];+const SUZHOU = [[2.0, -0.7], [-0.6, -0.7], [-1.2, -1.3], [-2.0, -1.3], [-2.6, -1.9], [-3.6, -1.9], [-4.4, -1.6], [-7.0, -1.6]]; // Suzhou Creek (thin)++// resolve a route item to a point (grid units)+function pt(it) {+ if (typeof it === 'string') { const s = ST[it]; if (!s) throw new Error('no station ' + it); return [s[0], s[1]]; }+ if (typeof it[0] === 'string') { const s = ST[it[0]]; if (!s) throw new Error('no station ' + it[0]); return [s[0] + it[1], s[1] + it[2]]; }+ return [it[0], it[1]];+}+const sid = it => typeof it === 'string' ? it : (typeof it[0] === 'string' ? it[0] : null);+// expand a route into an octilinear polyline: between two points that are not on one of the 8 directions,+// insert a bend: straight first then diagonal (default), or diagonal first when the item is preceded by '/'.+function expand(route) {+ const out = [], ids = []; let diagFirst = false;+ for (const it of route) {+ if (it === '/') { diagFirst = true; continue; }+ const p = pt(it);+ if (out.length) {+ const a = out[out.length - 1], dx = p[0] - a[0], dy = p[1] - a[1], ax = Math.abs(dx), ay = Math.abs(dy);+ if (ax > 1e-6 && ay > 1e-6 && Math.abs(ax - ay) > 1e-6) {+ const d = Math.min(ax, ay), sx = Math.sign(dx), sy = Math.sign(dy);+ const bend = diagFirst ? [a[0] + sx * d, a[1] + sy * d] : [p[0] - sx * d, p[1] - sy * d];+ out.push(bend); ids.push(null);+ }+ }+ out.push(p); ids.push(sid(it)); diagFirst = false;+ }+ return { pts: out, ids };+}+window.NET = { G, ST, LINES, RIVER, SUZHOU, pt, sid, expand };+})();diff --git a/styles/transit-map/demo/stills/styleframe.jpg b/styles/transit-map/demo/stills/styleframe.jpgnew file mode 100644index 0000000..2c20e33Binary files /dev/null and b/styles/transit-map/demo/stills/styleframe.jpg differdiff --git a/styles/transit-map/demo/timeline.js b/styles/transit-map/demo/timeline.jsnew file mode 100644index 0000000..db7b0ea--- /dev/null+++ b/styles/transit-map/demo/timeline.js@@ -0,0 +1,532 @@+// Direction of 《6 公里》: facts, growth phases, camera, printed annotations, overlays, sound cues.+// Every number shown on screen comes from FX below; FACTS.md holds the source of each.+import { clamp, lerp, seg, ss, eio, eo, ei, back, monotone, track, hash } from '/core/lib.js';++const DUR = 44.5; // story time (tau); film time runs 47.0 s through WARP below+const W = v => v * 100;++// ------------------------------------------------------------------ facts (see FACTS.md)+export const FX = {+ firstDate: '1993.5.28', firstKm: 6, firstStations: 5,+ km: [[1993, 6.0], [1995, 16.1], [2010, 420], [2026, 906]], // landing values only (network length, km)+ nowYear: 2026, nowLines: 21, nowStations: 523,+ ride: { value: 1339.7, date: '2024.3.8' }, // daily ridership record, 10k trips+ london: { open: 1863, openKm: 6, nowKm: 402 },+};++// film time (t) -> story time (tau): everything below is written in tau; film.js maps. The 1995 beat plays slower+// (so its counter values can be read) and the verdict holds 0.8 s longer.+export const WARP = [[0, 0], [6.2, 6.2], [9.0, 7.3], [29.7, 28.0], [30.5, 28.0], [47.0, 44.5]];+const FIRST5 = ['JJLY', 'SHNZ', 'CBL', 'TYG', 'XJH'];+// register a line of text for window.TEXTS (readcheck): box from the current font and alignment, alphabetic baseline+function rt(c, R, id, s, x, y, size, a = 1, screen = false) {+ if (!R || !R.regW) return;+ const w = c.measureText(s).width, al = c.textAlign, x0 = al === 'center' ? x - w / 2 : al === 'right' ? x - w : x, y0 = y - size * .9, y1 = y + size * .25;+ if (screen) R.regS(id, s, x0, y0, x0 + w, y1, a); else R.regW(id, s, x0, y0, x0 + w, y1, a, 12);+}+// ------------------------------------------------------------------ shots (seconds)+const S = { tunnel: [0, 1.4], first: [1.4, 6.2], early: [6.2, 12.6], burst: [12.6, 20.0], verdict: [20.0, 28.0], now: [28.0, 36.0], back: [36.0, 42.5], end: [41.5, 44.5] };++// ------------------------------------------------------------------ growth phases: path, from, to, t0, t1, year+// line 2 follows hand keys so the camera can ride its tip: ring slam at People's Square, dive under the river+const L2KEYS = [[7.62, 'ZSGY'], [7.95, 'JSL'], [8.25, 'JAS'], [8.5, 'NJXL'], [8.78, 'RMGC'], [9.2, 'NJDL'], [10.32, 'LJZ'], [10.6, 'DCL'], [10.88, 'SJDD'], [11.3, 'LYL']];+const P = (path, a, b, t0, t1, year, extra = {}) => ({ path, a, b, t0, t1, year, ...extra });+const PHASES = [+ P('1', 'JJLY', 'XJH', 0, 0, 1993, { yearLabel: '1993', keys: [[1.42, 'JJLY'], [1.75, 'JJLY'], [2.55, 'SHNZ'], [3.2, 'CBL'], [3.82, 'TYG'], [4.35, 'XJH']] }),+ P('1', 'XJH', 'SHZ', 6.28, 6.65, 1995),+ P('2', 'ZSGY', 'LYL', 0, 0, 1999, { keys: L2KEYS, yearLabel: '1999' }),+ P('3', 'SHNZ', 'JWZ', 11.45, 12.55, 2000, { yearLabel: '2000' }),+ // 2001–2010 burst (12.6–18.6, one film second per 1.67 years)+ P('M', 'LYL', 'PDJC', 13.5, 14.1, 2002, { yearLabel: '2002' }),+ P('5', 'XZ', 'MHKF', 14.2, 15.0, 2003, { yearLabel: '2003' }),+ P('1', 'JJLY', 'XZ', 13.4, 13.9, 1996),+ P('1', 'SHZ', 'GFXC', 14.9, 15.5, 2004),+ P('4', 'BSL', 'LCL2', 15.3, 16.1, 2005, { yearLabel: '2005', loopFrom: true }),+ P('2', 'ZSGY', 'SHL', 15.8, 16.4, 2006),+ P('3', 'JWZ', 'JYBL', 15.8, 16.3, 2006),+ P('4', 'LCL2', 'YSL', 16.2, 17.1, 2007, { bLast: true }),+ P('4', 'YSL', 'BSL', 16.2, 16.9, 2007),+ P('6', 'GCL', 'DMLU', 16.5, 17.5, 2007, { yearLabel: '2007' }),+ P('8', 'JPL', 'YHL', 16.5, 17.4, 2007, { yearLabel: '2007' }),+ P('9', 'SJNZ', 'GLL9', 16.5, 17.3, 2007, { yearLabel: '2007' }),+ P('1', 'GFXC', 'FJL', 16.6, 17.1, 2007),+ P('9', 'GLL9', 'YSL', 17.2, 17.6, 2008),+ P('8', 'YHL', 'SDGL', 17.6, 18.1, 2009),+ P('7', 'MLH', 'HXL', 17.6, 18.7, 2009, { yearLabel: '2009' }),+ P('11', 'JDB', 'JSL', 17.7, 18.5, 2009, { yearLabel: '2009' }),+ P('9', 'YSL', 'YGZL', 17.7, 18.4, 2009),+ P('2', 'SHL', 'XJD', 18.1, 18.6, 2010),+ P('2', 'LYL', 'PDJC', 18.1, 18.7, 2010),+ P('10', 'XJWC', 'HQZ', 18.1, 18.9, 2010, { yearLabel: '2010' }),+ P('10b', 'HQ1', 'JTL', 18.4, 18.8, 2010),+ P('13', 'MDL', 'CSL8', 18.2, 18.7, 2010, { yearLabel: '2010' }),+ P('11', 'JSL', 'LH', 18.3, 18.8, 2010),+ // 2011–2026 (28.1–29.9)+ P('6', 'DMLU', 'DFTY', 28.1, 28.5, 2011),+ P('8', 'JPL', 'SGL', 28.1, 28.5, 2011),+ P('11', 'LH', 'DSN', 28.25, 29.0, 2013),+ P('11b', 'HQ11', 'SHXZ', 28.3, 28.8, 2013),+ P('12', 'QXL', 'JHL', 28.3, 29.2, 2013, { yearLabel: '2013' }),+ P('16', 'LYL', 'DSH', 28.35, 29.0, 2013, { yearLabel: '2013' }),+ P('13', 'JYL', 'MDL', 28.45, 29.1, 2012, { yearLabel: '2012' }),+ P('13', 'CSL8', 'ZKL', 28.6, 29.2, 2018),+ P('9', 'YGZL', 'CL', 28.5, 29.0, 2017),+ P('17', 'HQZ', 'DFL', 28.7, 29.3, 2017, { yearLabel: '2017' }),+ P('P', 'DFTY', 'SHGZ', 28.8, 29.2, 2018, { yearLabel: '2018' }),+ P('5b', 'DCL5', 'FXXC', 28.8, 29.3, 2018),+ P('18', 'CJNL', 'YSH', 28.9, 29.7, 2020, { yearLabel: '2020' }),+ P('15', 'GCGY', 'ZZGX', 29.0, 29.7, 2021, { yearLabel: '2021' }),+ P('14', 'FL', 'GQL', 29.05, 29.75, 2021, { yearLabel: '2021' }),+ P('A', 'HQZ', 'PDJC', 29.2, 29.85, 2024, { yearLabel: '2024' }),+ P('7', 'LYL', 'HXL', 0, 0, 2009, { skip: true }),+];++// ------------------------------------------------------------------ helpers filled at init+let H = null;+const tipOf = (key, t) => { const o = H.PH.find(o => o.path.key === key && o.t0 <= t + 1e-6 && (o === H.PH.find(p => p.path.key === key && p.t1 >= t) || true)); return null; };+function phaseTip(idx, t) { const o = H.PH[idx]; const s = o.t0 >= t ? o.s0 : o.t1 <= t ? o.s1 : lerp(o.s0, o.s1, clamp(o.f(t))); return H.pointAt(o.path, s); }+function smoothTip(idx, t, span = .35) { let x = 0, y = 0; for (let k = -4; k <= 4; k++) { const q = phaseTip(idx, t + k * span / 4); x += q[0]; y += q[1]; } return [x / 9, y / 9]; }+const st = id => { const n = H.SNODE[id]; return [n.cx, n.cy]; };++// ------------------------------------------------------------------ camera+const lz = (a, b, u) => Math.exp(lerp(Math.log(a), Math.log(b), u));+function mixCam(a, b, u) { return { x: lerp(a.x, b.x, u), y: lerp(a.y, b.y, u), z: lz(a.z, b.z, u), tilt: lerp(a.tilt, b.tilt, u), head: lerp(a.head, b.head, u), ap: lerp(a.ap || 0, b.ap || 0, u), focus: 1 }; }+const STRIP = { x: -885, y: 2465, z: .665 };+const ENDC = { x: 1260, y: 2120, z: 1.5 };+function camera(t) {+ if (t < S.first[0]) return { x: -410, y: 730, z: 2.6, tilt: 30, head: -14, ap: 0 };+ if (t < S.first[1]) {+ const tp = smoothTip(0, t, .5), u = ss(seg(t, 1.4, 4.4)), j = st('JJLY'), w = ss(seg(t, 1.55, 2.4));+ const span = Math.hypot(tp[0] - j[0], tp[1] - j[1]);+ const a = { x: lerp(j[0], (j[0] + tp[0]) / 2 + 90, w), y: lerp(j[1], (j[1] + tp[1]) / 2, w), z: Math.min(lz(2.6, 1.55, u), 1080 / (span * 1.15 + 420)), tilt: lerp(30, 16, u), head: lerp(-14, -4, u), ap: 16 };+ const hold = { x: -228, y: 520, z: 1.3, tilt: 7, head: 0, ap: 6 };+ return mixCam(a, hold, eio(seg(t, 4.25, 5.6)));+ }+ if (t < 7.38) {+ const a = camera(6.199), b = { x: -190, y: 300, z: .86, tilt: 9, head: 0, ap: 4 };+ return mixCam(a, b, eio(seg(t, 6.2, 7.25)));+ }+ if (t < 11.3) {+ const iL2 = H.PH.findIndex(o => o.path.key === '2' && o.keys), tp = smoothTip(iL2, Math.max(t, 7.7), .45);+ const ride = { x: tp[0] + 140, y: tp[1] + 70, z: 1.5, tilt: 24, head: -5, ap: 16 };+ // under the river: the camera drops low and turns so the line dives across the frame+ const dive = ss(seg(t, 9.05, 9.6)) * (1 - ss(seg(t, 10.35, 10.95)));+ if (dive > 0) { const d = { x: 215, y: -10, z: 1.85, tilt: 61, head: -10, ap: 26 }; Object.assign(ride, mixCam(ride, d, dive)); }+ // the slam at People's Square: a short push+ const k = t - 8.78; if (k > -.3 && k < .7) ride.z *= 1 + .07 * Math.exp(-Math.abs(k) * 5);+ if (t < 7.9) { const a = camera(7.379); return mixCam(a, ride, eio(seg(t, 7.38, 7.9))); }+ return ride;+ }+ if (t < S.burst[0]) {+ const a = camera(11.299), b = { x: -170, y: 230, z: .78, tilt: 12, head: 2, ap: 6 };+ return mixCam(a, b, eio(seg(t, 11.3, 12.55)));+ }+ if (t < S.verdict[0]) {+ const u = seg(t, 12.6, 18.7);+ const a = { x: -170, y: 230, z: .78, tilt: 12, head: 2, ap: 6 }, b = { x: -150, y: 170, z: .52, tilt: 0, head: 0, ap: 0 };+ const c = mixCam(a, b, 1 - Math.pow(1 - u, 2.2)); return c;+ }+ if (t < S.now[0]) { // glide down the sheet to the time-line panel, then hold still+ const a = { x: -150, y: 170, z: .52, tilt: 0, head: 0, ap: 0 }, b = { x: STRIP.x, y: STRIP.y, z: STRIP.z, tilt: 0, head: 0, ap: 0 };+ const near = { x: STRIP.x - 40, y: STRIP.y - 10, z: STRIP.z * .965, tilt: 0, head: 0, ap: 0 };+ if (t < 21.2) { const u = eio(seg(t, 20.0, 21.2)); const c = mixCam(a, near, u); c.tilt = 26 * Math.sin(Math.PI * u); c.ap = 8 * Math.sin(Math.PI * u); return c; }+ return mixCam(near, b, ss(seg(t, 21.2, 23.25)));+ }+ if (t < 29.9) {+ const a = { x: STRIP.x, y: STRIP.y, z: STRIP.z, tilt: 0, head: 0, ap: 0 }, m = { x: -420, y: 700, z: .42, tilt: 30, head: 14, ap: 6 }, b = sweep(29.9);+ const u = seg(t, 28.0, 29.9);+ if (u < .5) return mixCam(a, m, eio(u * 2));+ return mixCam(m, b, eio(u * 2 - 1));+ }+ if (t < 34.6) return sweep(t);+ if (t < S.back[0] + .01) {+ const a = sweep(34.6), b = { x: -330, y: 470, z: .62, tilt: 4, head: 0, ap: 3 };+ return mixCam(a, b, eio(seg(t, 34.6, 36.0)));+ }+ if (t < S.end[0]) {+ const a = { x: -330, y: 470, z: .62, tilt: 4, head: 0, ap: 3 }, b = { x: -225, y: 510, z: 1.42, tilt: 0, head: 0, ap: 0 };+ return mixCam(a, b, eio(seg(t, 36.0, 39.6)));+ }+ return { x: ENDC.x, y: ENDC.y, z: lz(ENDC.z * .97, ENDC.z, eo(seg(t, 41.5, 44.0))), tilt: 0, head: 0, ap: 0 };+}+function sweep(t) {+ const u = seg(t, 29.9, 34.6);+ return { x: lerp(-470, 470, u), y: lerp(140, -10, u), z: 1.02, tilt: lerp(57, 62, u), head: lerp(26, -14, ss(u)), ap: 24, far: 9 };+}++// ------------------------------------------------------------------ sheet furniture (printed)+const SHEET = [-2520, -1320, 2000, 3420];+const YX = y => -2200 + (y - 1860) * 15; // time-line panel: year -> x+const ROWL = 2240, ROWS = 2510, AXY = 2730;+const NAVY = '#24346e';+function furniture(c, t, view, k) {+ const { F, INK, MUTED } = k;+ // north-west title block of the printed map+ c.save(); c.textBaseline = 'alphabetic'; c.textAlign = 'left';+ c.fillStyle = INK; c.fillRect(-2240, -1215, 90, 10);+ c.font = F(800, 64); c.fillText('上海地铁', -2240, -1120);+ c.font = F(600, 30); c.fillText('Shanghai Metro', -2240, -1076);+ c.font = F(500, 24); c.fillStyle = MUTED; c.fillText('线网示意图 · 非官方致敬', -2240, -1030); c.fillText('Network schematic · unofficial tribute', -2240, -998);+ // scale-less note and compass+ c.restore();+ // time-line panel+ c.save(); c.strokeStyle = 'rgba(27,28,30,.55)'; c.lineWidth = 3; c.strokeRect(-2290, 2050, 2810, 830);+ // axis+ c.strokeStyle = INK; c.lineWidth = 3; c.beginPath(); c.moveTo(YX(1858), AXY); c.lineTo(YX(2030), AXY); c.stroke();+ c.font = F(600, 34); c.textAlign = 'center'; c.fillStyle = INK;+ for (let y = 1860; y <= 2030; y += 10) { const x = YX(y), big = y % 20 === 0; c.beginPath(); c.moveTo(x, AXY); c.lineTo(x, AXY + (big ? 18 : 10)); c.stroke(); if (big) { c.fillText(String(y), x, AXY + 50); rt(c, k, 'axis-' + y, String(y), x, AXY + 50, 34); } }+ c.font = F(700, 28); c.fillStyle = MUTED; c.textAlign = 'right'; c.fillText('年份', YX(2030), AXY + 90); rt(c, k, 'axis-unit', '年份', YX(2030), AXY + 90, 28); c.font = F(600, 24); c.fillText('Year', YX(2030), AXY + 120); rt(c, k, 'axis-unit-en', 'Year', YX(2030), AXY + 120, 24);+ c.restore();+ // end-card title block (bottom right of the sheet)+ DATAend(c, t, k);+}+function DATAend(c, t, K) { const { F, INK, MUTED } = K;+ if (t < 41.4) return;+ const x = 970, y = 1880, k = t - 41.5;+ c.save();+ c.strokeStyle = INK; c.lineWidth = 3; c.strokeRect(x - 60, y - 70, 700, 620);+ // a short red line runs out to a terminus+ const u = eo(clamp(k / .55)), xe = x + 200 * u;+ c.lineCap = 'round'; c.strokeStyle = '#E3002B'; c.lineWidth = 15; c.beginPath(); c.moveTo(x, y + 40); c.lineTo(xe, y + 40); c.stroke();+ const r = back(seg(k, .5, .75), 3); if (r > 0) { c.save(); c.translate(x + 200, y + 40); c.scale(r, r); c.beginPath(); c.arc(0, 0, 15, 0, 7); c.fillStyle = '#fff'; c.fill(); c.lineWidth = 6; c.strokeStyle = INK; c.stroke(); c.restore(); }+ c.textAlign = 'left'; c.textBaseline = 'alphabetic'; c.fillStyle = INK; c.globalAlpha = 1;+ const A = c.globalAlpha;+ c.font = F(800, 92); c.fillText('6 公里', x, y + 190); rt(c, K, 'end-title', '6 公里', x, y + 190, 92, A);+ c.font = F(600, 44); c.fillText('6 Kilometres', x, y + 248); rt(c, K, 'end-title-en', '6 Kilometres', x, y + 248, 44, A);+ c.fillStyle = INK; c.fillRect(x, y + 290, 120, 5);+ c.font = F(700, 30); c.fillText('地铁线路图', x, y + 344); rt(c, K, 'end-style', '地铁线路图', x, y + 344, 30, A); c.font = F(600, 26); c.fillText('Transit Map', x, y + 380); rt(c, K, 'end-style-en', 'Transit Map', x, y + 380, 26, A);+ c.font = F(500, 30); c.fillText('LemoLab × Claude Opus 5.5', x, y + 436); rt(c, K, 'end-credit', 'LemoLab × Claude Opus 5.5', x, y + 436, 30, A);+ c.font = F(500, 21); c.fillStyle = MUTED; c.fillText('非官方致敬片,与运营方无关', x, y + 484); rt(c, K, 'end-note', '非官方致敬片,与运营方无关', x, y + 484, 21, A); c.fillText('Unofficial fan film, not affiliated with the operator', x, y + 512); rt(c, K, 'end-note-en', 'Unofficial fan film, not affiliated with the operator', x, y + 512, 21, A);+ c.restore();+}+function riverLabels(c, t, view, { F }) {+ c.save(); c.fillStyle = '#5f88ad'; c.textBaseline = 'middle';+ c.translate(W(2.0), W(3.6)); c.rotate(-Math.PI / 2); c.textAlign = 'center'; c.font = F(700, 22); c.fillText('黄浦江', 0, -12); c.font = F(600, 17); c.fillText('Huangpu River', 0, 12);+ c.restore();+ c.save(); c.fillStyle = '#5f88ad'; c.textBaseline = 'middle'; c.translate(W(8.0), W(-8.0)); c.rotate(-Math.PI / 2); c.textAlign = 'center'; c.font = F(700, 22); c.fillText('黄浦江', 0, -12); c.font = F(600, 17); c.fillText('Huangpu River', 0, 12); c.restore();+}++// ------------------------------------------------------------------ annotations (printed / pen)+function plaque(c, t, K) { const { F, INK, MUTED } = K;+ const a = seg(t, 3.95, 4.45) * (1 - seg(t, 10.9, 11.4)); if (a <= 0) return;+ const x = W(-2.7), y = W(4.3);+ c.save(); c.globalAlpha = a;+ // leader from the segment+ const u = eo(seg(t, 3.95, 4.5));+ c.beginPath(); c.rect(x - 20, y - 90, 640 * u + 20, 330); c.clip();+ c.fillStyle = '#E3002B'; c.fillRect(x, y - 52, 10, 160);+ c.fillStyle = INK; c.textAlign = 'left'; c.textBaseline = 'alphabetic';+ const ra = a * (u > .99 ? 1 : 0), s1 = `1 号线首段 · ${FX.firstKm} 公里 · ${FX.firstStations} 站`, s2 = `Line 1, first section · ${FX.firstKm} km · ${FX.firstStations} stations`;+ c.font = F(800, 58); c.fillText(FX.firstDate, x + 30, y + 4); rt(c, K, 'plaque-date', FX.firstDate, x + 30, y + 4, 58, ra);+ c.font = F(700, 34); c.fillText(s1, x + 30, y + 58); rt(c, K, 'plaque-zh', s1, x + 30, y + 58, 34, ra);+ c.font = F(500, 24); c.fillStyle = '#3d3a34'; c.fillText(s2, x + 30, y + 96); rt(c, K, 'plaque-en', s2, x + 30, y + 96, 24, ra);+ c.restore();+}+function expo(c, t, { F, INK }) {+ const a = seg(t, 18.35, 18.65); if (a <= 0) return;+ const x = W(1.0), y = W(6.35);+ c.save(); c.globalAlpha = a * (1 - seg(t, 19.7, 20.2));+ if (c.globalAlpha <= 0.001) { c.restore(); return; }+ const sc = back(seg(t, 18.35, 18.7), 2.4);+ c.translate(x, y); c.scale(sc, sc);+ c.fillStyle = '#E3002B'; c.beginPath(); for (let i = 0; i < 10; i++) { const r = i % 2 ? 11 : 26, an = -Math.PI / 2 + i * Math.PI / 5; c.lineTo(Math.cos(an) * r, Math.sin(an) * r); } c.closePath(); c.fill();+ c.fillStyle = INK; c.textAlign = 'left'; c.textBaseline = 'alphabetic'; c.font = F(800, 40); c.fillText('2010 世博会', 40, 4); c.font = F(600, 26); c.fillText('Expo 2010', 40, 38);+ c.restore();+}+// the People's Square ring falls onto the paper before it lands at t2+const drops = { RMGC: true };+function dropRing(c, n, k2, { capsule, INK }) {+ if (k2 < 0) return;+ const u = seg(k2, 0, .18);+ // shockwaves+ if (k2 < .9) { const v = k2 / .9; c.save(); c.globalAlpha *= (1 - v) * .75; c.lineWidth = 7; c.strokeStyle = INK; c.beginPath(); c.arc(n.cx, n.cy, 30 + 230 * eo(v), 0, 7); c.stroke();+ c.lineWidth = 5; c.strokeStyle = '#8CC220'; c.beginPath(); c.arc(n.cx, n.cy, 26 + 170 * eo(clamp(v * 1.15)), 0, 7); c.stroke();+ c.strokeStyle = '#E3002B'; c.beginPath(); c.arc(n.cx, n.cy, 22 + 120 * eo(clamp(v * 1.3)), 0, 7); c.stroke(); c.restore(); }+ capsule(c, n, 1 + .18 * Math.exp(-k2 * 14) * Math.cos(k2 * 40), 7);+}+function fallingRing(c, t) {+ const n = H.SNODE.RMGC; const k = t - n.t2; if (!(k > -.42 && k < 0)) return;+ const u = 1 + k / .42; // 0 -> 1 as it falls+ const h = (1 - ei(u)); // height 1 -> 0+ c.save();+ // shadow on the paper grows sharper as the ring comes down+ c.globalAlpha = .35 * u; c.fillStyle = '#000'; c.filter = `blur(${(14 * h).toFixed(1)}px)`;+ c.beginPath(); c.ellipse(n.cx + 60 * h, n.cy + 70 * h, 34 + 40 * h, 34 + 40 * h, 0, 0, 7); c.fill(); c.filter = 'none';+ c.globalAlpha = clamp(u * 2.5);+ const sc = 1 + 2.4 * h; c.translate(n.cx - 10 * h, n.cy - 30 * h); c.scale(sc, sc);+ c.beginPath(); c.roundRect(-28, -28, 56, 56, 28); c.fillStyle = '#fff'; c.fill(); c.lineWidth = 7; c.strokeStyle = '#1b1c1e'; c.stroke();+ c.restore();+}+// time-line panel content: London and Shanghai drawn as two lines over one axis+function timeLines(c, t, K) { const { F, INK, MUTED } = K; let nid = 0;+ if (t < 20.5) return;+ const L = FX.london, KM10 = FX.km.find(k => k[0] === 2010)[1], NOW = FX.km[FX.km.length - 1][1];+ const draw = (y, color, years, t0, t1, lw = 15) => { const u = clamp((t - t0) / (t1 - t0)); if (u <= 0) return; const x0 = YX(years[0]), x1 = YX(years[1]), x = lerp(x0, x1, u);+ c.save(); c.strokeStyle = color; c.lineWidth = lw; c.lineCap = 'round'; c.beginPath(); c.moveTo(x0, y); c.lineTo(x, y); c.stroke(); c.restore();+ if (u < 1) { c.save(); const g = c.createRadialGradient(x, y, 0, x, y, 70); g.addColorStop(0, 'rgba(255,255,255,.9)'); g.addColorStop(.25, color + '66'); g.addColorStop(1, color + '00'); c.fillStyle = g; c.beginPath(); c.arc(x, y, 70, 0, 7); c.fill(); c.restore(); } };+ const ring = (x, y, color, a, big) => { if (a <= 0) return; c.save(); c.globalAlpha = a; c.beginPath(); c.arc(x, y, big ? 19 : 13, 0, 7); c.fillStyle = '#fff'; c.fill(); c.lineWidth = big ? 7.5 : 6; c.strokeStyle = big ? INK : color; c.stroke(); c.restore(); };+ const lab = (x, y, zh, en, a, align = 'center', dy = -40) => { if (a <= 0) return; c.save(); c.globalAlpha = a; c.textAlign = align; c.textBaseline = 'alphabetic'; c.fillStyle = INK; c.font = F(800, 60); c.fillText(zh, x, y + dy - 44); rt(c, K, 'tl-' + zh, zh, x, y + dy - 44, 60, a); c.font = F(600, 38); c.fillStyle = '#3d3a34'; c.fillText(en, x, y + dy); rt(c, K, 'tl-' + zh + '-en', en, x, y + dy, 38, a); c.restore(); };+ const rn = (x, y, zh, en, a, align) => { if (a <= 0) return; c.save(); c.globalAlpha = a; c.textAlign = align; c.textBaseline = 'alphabetic'; c.fillStyle = INK; c.font = F(800, 58); c.fillText(zh, x, y - 84); rt(c, K, 'row-' + y, zh, x, y - 84, 58, a); c.font = F(600, 38); c.fillStyle = '#3d3a34'; c.fillText(en, x, y - 36); rt(c, K, 'row-' + y + '-en', en, x, y - 36, 38, a); c.restore(); };+ // London: 1863 (6 km) -> today (402 km)+ rn(YX(L.open) - 14, ROWL, `伦敦地铁 ${L.open} 年 · ${L.openKm} 公里`, `London Underground · ${L.open} · ${L.openKm} km`, seg(t, 20.95, 21.3), 'left');+ draw(ROWL, NAVY, [L.open, FX.nowYear], 21.0, 22.4);+ ring(YX(L.open), ROWL, NAVY, seg(t, 21.0, 21.12));+ ring(YX(FX.nowYear), ROWL, NAVY, seg(t, 22.35, 22.45), true);+ lab(YX(FX.nowYear) + 34, ROWL + 52, `${L.nowKm}`, 'km', seg(t, 22.4, 22.65), 'left', 0);+ // Shanghai: 1993 (6 km) -> 2010 (420 km) -> today (906 km)+ rn(YX(1993) - 34, ROWS, `上海地铁 1993 年 · ${FX.firstKm} 公里`, `Shanghai Metro · 1993 · ${FX.firstKm} km`, seg(t, 22.45, 22.8), 'right');+ draw(ROWS, '#E3002B', [1993, 2010], 22.55, 22.85);+ draw(ROWS, '#E3002B', [2010, FX.nowYear], 22.85, 23.1);+ ring(YX(1993), ROWS, '#E3002B', seg(t, 22.55, 22.65));+ ring(YX(2010), ROWS, '#E3002B', seg(t, 22.82, 22.92), true);+ lab(YX(2010), ROWS - 6, '2010', `${KM10} km`, seg(t, 22.85, 23.1), 'center');+ ring(YX(FX.nowYear), ROWS, '#E3002B', seg(t, 23.05, 23.15), true);+ lab(YX(FX.nowYear) + 34, ROWS + 52, `${NOW}`, 'km', seg(t, 23.1, 23.35), 'left', 0);+ // verdict at 26.0: brackets with the spans; the Shanghai one is stamped+ const V = 25.8;+ const br = (y, xa, xb, color, zh, en, a, stamp, lx) => { if (a <= 0) return; c.save(); c.globalAlpha = Math.min(1, a * 1.6); c.strokeStyle = color; c.lineWidth = 6; const yy = y + 40 + 14 * (1 - eo(a));+ c.beginPath(); c.moveTo(xa, yy - 14); c.lineTo(xa, yy); c.lineTo(xb, yy); c.lineTo(xb, yy - 14); c.stroke();+ c.textAlign = 'center'; c.textBaseline = 'alphabetic'; c.fillStyle = color; const xm = lx ?? (xa + xb) / 2; const ra = Math.min(1, a * 1.6); c.font = F(800, 58); c.fillText(zh, xm, yy + 64); rt(c, K, 'br-' + zh, zh, xm, yy + 64, 58, ra); c.font = F(600, 36); c.fillText(en, xm, yy + 106); rt(c, K, 'br-' + en, en, xm, yy + 106, 36, ra);+ if (stamp > 0) { c.globalAlpha = Math.min(1, stamp * 1.5); c.lineWidth = 8; const s = 1 + .5 * (1 - eo(stamp)); c.beginPath(); c.ellipse(xm, yy + 50, 290 * s, 100 * s, -.04, 0, 7); c.stroke(); }+ c.restore(); };+ br(ROWL, YX(L.open), YX(FX.nowYear), NAVY, `${FX.nowYear - L.open} 年 → ${L.nowKm} 公里`, `${FX.nowYear - L.open} years to ${L.nowKm} km`, seg(t, V, V + .3), 0, YX(1910));+ br(ROWS, YX(1993), YX(2010), '#E3002B', `17 年 → ${KM10} 公里`, `17 years to ${KM10} km`, seg(t, V + .4, V + .7), seg(t, V + .65, V + .95));+}+// the end: first section glows, "you are here", the line that started it all+function highlight(c, t, { PATHS, pointAt, subPath }, top = false) {+ const g = seg(t, 36.4, 37.6); if (g <= 0) return;+ const p = PATHS['1'], a = p.st.find(q => q.id === 'JJLY').s, b = p.st.find(q => q.id === 'XJH').s;+ c.save(); c.lineCap = 'round';+ if (!top) { c.strokeStyle = `rgba(227,0,43,${.22 * g})`; c.lineWidth = 60; c.beginPath(); subPath(c, p, a, b); c.stroke(); }+ else { c.strokeStyle = '#E3002B'; c.lineWidth = 15; c.beginPath(); subPath(c, p, a, b); c.stroke(); for (const id of ['JJLY', 'SHNZ', 'CBL', 'TYG', 'XJH']) { const q = p.st.find(s => s.id === id); const pp = pointAt(p, q.s); c.beginPath(); c.arc(pp[0], pp[1], 8.5, 0, 7); c.fillStyle = '#fff'; c.fill(); c.lineWidth = 4.6; c.strokeStyle = '#E3002B'; c.stroke(); } }+ c.restore();+}+function veil(t) { return ss(seg(t, 36.3, 37.5)) * (t < S.end[0] ? 1 : 0); }+function stationDim(n, t, v) { if (v <= 0) return 1; return ['JJLY', 'SHNZ', 'CBL', 'TYG', 'XJH'].includes(n.id) ? 1 : 1 - .78 * v; }+function hereMarker(c, t, K) { const { F, INK } = K;+ const a = seg(t, 37.4, 37.7); if (a <= 0 || t >= S.end[0]) return;+ const n = H.SNODE.JJLY, x = n.cx, y = n.cy;+ c.save();+ const pulse = (t - 37.4) % 1.2 / 1.2;+ c.globalAlpha = a * (1 - pulse) * .6; c.strokeStyle = '#E3002B'; c.lineWidth = 4; c.beginPath(); c.arc(x, y, 22 + 40 * pulse, 0, 7); c.stroke();+ c.globalAlpha = a; c.fillStyle = '#E3002B'; c.beginPath(); c.arc(x, y, 17 * back(seg(t, 37.4, 37.7), 3), 0, 7); c.fill(); c.lineWidth = 4; c.strokeStyle = '#fff'; c.stroke();+ c.textAlign = 'right'; c.textBaseline = 'alphabetic'; c.font = F(800, 36); const hw = Math.max(c.measureText('你在这里').width, 150);+ c.fillStyle = 'rgba(244,240,231,.94)'; c.beginPath(); c.roundRect(x - 44 - hw - 14, y - 34, hw + 28, 86, 8); c.fill();+ c.fillStyle = INK; c.fillText('你在这里', x - 44, y + 6); rt(c, K, 'here', '你在这里', x - 44, y + 6, 36, a); c.font = F(600, 24); c.fillText('You are here', x - 44, y + 38); rt(c, K, 'here-en', 'You are here', x - 44, y + 38, 24, a);+ c.restore();+ // caption where the 1993 plaque was+ const b = seg(t, 37.75, 38.15); if (b <= 0) return;+ const cx = W(-2.7), cy = W(3.9);+ c.save(); c.globalAlpha = b; c.beginPath(); c.rect(cx - 20, cy - 100, 900 * eo(b) + 20, 280); c.clip();+ c.fillStyle = 'rgba(244,240,231,.96)'; c.shadowColor = 'rgba(0,0,0,.18)'; c.shadowBlur = 18; c.shadowOffsetY = 6; c.beginPath(); c.roundRect(cx - 18, cy - 82, 640, 172, 10); c.fill(); c.shadowColor = 'transparent';+ c.fillStyle = '#E3002B'; c.fillRect(cx, cy - 58, 10, 132);+ const cb = b * (eo(b) > .99 ? 1 : 0);+ c.fillStyle = INK; c.textAlign = 'left'; c.font = F(800, 52); c.fillText(`一切从 ${FX.firstKm} 公里开始`, cx + 30, cy); rt(c, K, 'caption', `一切从 ${FX.firstKm} 公里开始`, cx + 30, cy, 52, cb);+ c.font = F(600, 30); c.fillStyle = '#3d3a34'; c.fillText(`It all started with ${FX.firstKm} km`, cx + 30, cy + 48); rt(c, K, 'caption-en', `It all started with ${FX.firstKm} km`, cx + 30, cy + 48, 30, cb);+ c.restore();+ // the unofficial note, printed small under the caption; the end card carries the same lines+ const d = seg(t, 38.6, 38.9); if (d <= 0) return;+ c.save(); c.globalAlpha = d; c.textAlign = 'left'; c.textBaseline = 'alphabetic'; c.fillStyle = 'rgba(244,240,231,.96)'; c.beginPath(); c.roundRect(cx - 18, cy + 100, 640, 92, 10); c.fill();+ c.fillStyle = '#5a5650'; c.font = F(600, 24); c.fillText('非官方致敬片,与运营方无关', cx + 30, cy + 136); rt(c, K, 'end-note', '非官方致敬片,与运营方无关', cx + 30, cy + 136, 24, d);+ c.font = F(500, 21); c.fillText('Unofficial fan film, not affiliated with the operator', cx + 30, cy + 170); rt(c, K, 'end-note-en', 'Unofficial fan film, not affiliated with the operator', cx + 30, cy + 170, 21, d);+ c.restore();+}+function annotations(c, t, view, k) {+ plaque(c, t, k); expo(c, t, k); fallingRing(c, t); timeLines(c, t, k); hereMarker(c, t, k);+}++// ------------------------------------------------------------------ trains+function trains(c, t, { PATHS, PH, phaseHead, train, pointAt }) {+ // 1993: one train shuttles on the first section+ const sh = seg(t, 4.2, 4.5) * (1 - seg(t, 12.4, 12.8));+ if (sh > 0) { const p = PATHS['1'], a = p.st.find(q => q.id === 'JJLY').s, b = p.st.find(q => q.id === 'XJH').s;+ const ph = (t - 4.2) / 2.6, u = .5 - .5 * Math.cos(Math.PI * ph); train(c, p, lerp(a + 26, b - 26, u), '#E3002B', sh, 1.15); }+ // now: every line runs+ const run = seg(t, 29.0, 29.6) * (1 - seg(t, 36.0, 36.6)); if (run <= 0) return;+ for (const path of Object.values(PATHS)) {+ const n = Math.max(1, Math.floor(path.total / 420)), gap = path.total / n, v = 210;+ for (let k = 0; k < n; k++) for (const dir of [1, -1]) {+ let s = (k * gap + (hash(path.total + k) * gap) + dir * (t - 28) * v) % path.total; if (s < 0) s += path.total;+ if (s < 30 || s > path.total - 30) continue;+ train(c, path, s, path.color, run, path.line === 'M' ? .8 : 1);+ }+ }+}++// ------------------------------------------------------------------ overlay (screen space, 1920x1080)+function tunnel(c, t, { F }) {+ // the camera rushes down a running tunnel; an oncoming train's headlights grow, light the walls, and flare+ const vx = 960, vy = 548, K = 760, speed = 30, zc = t * speed;+ const zt = lerp(42, 1.2, Math.pow(clamp(t / 1.3), 1.5)); // distance to the oncoming train (m)+ const lit = z => clamp(1.4 / (1 + Math.pow(Math.max(0, zt - z) / 9, 2))); // headlight spill on the tunnel at depth z+ const bg = c.createRadialGradient(vx, vy, 0, vx, vy, 900); bg.addColorStop(0, '#1a1c1f'); bg.addColorStop(1, '#030405'); c.fillStyle = bg; c.fillRect(0, 0, 1920, 1080);+ const P = (x, y, z) => [vx + K * x / z, vy - K * y / z];+ // tunnel lining rings every 1.5 m (radius 2.75 m, centre 1.6 m above the rail)+ for (let i = 90; i >= 0; i--) {+ const z = (Math.floor(zc / 1.5) + i + 1) * 1.5 - zc; if (z < .5 || z > zt + .5) continue;+ const r = K * 2.75 / z, cy = vy - K * 1.6 / z, l = .1 + .9 * lit(z) + .25 * clamp(3 / z);+ c.strokeStyle = `rgba(${150 * l | 0},${146 * l | 0},${138 * l | 0},${clamp(.25 + l)})`; c.lineWidth = Math.max(.8, K * .12 / z);+ c.beginPath(); c.arc(vx, cy, r, Math.PI * .16, Math.PI * .84, true); c.stroke();+ }+ // track bed, sleepers, rails+ for (let i = 60; i >= 0; i--) { const z = (Math.floor(zc / .65) + i + 1) * .65 - zc; if (z < .5 || z > zt) continue; const a = P(-1.0, -1.45, z), b = P(1.0, -1.45, z), l = .15 + .8 * lit(z);+ c.strokeStyle = `rgba(${90 * l | 0},${84 * l | 0},${76 * l | 0},.9)`; c.lineWidth = Math.max(1, K * .18 / z); c.beginPath(); c.moveTo(a[0], a[1]); c.lineTo(b[0], b[1]); c.stroke(); }+ for (const x of [-.72, .72]) { const a = P(x, -1.4, .55), b = P(x, -1.4, zt); const g = c.createLinearGradient(a[0], a[1], b[0], b[1]); g.addColorStop(0, 'rgba(200,205,210,.5)'); g.addColorStop(1, 'rgba(255,245,225,.95)');+ c.strokeStyle = g; c.lineWidth = 4; c.beginPath(); c.moveTo(a[0], a[1]); c.lineTo(b[0], b[1]); c.stroke(); }+ // cable trays along the left wall+ for (const [x, y] of [[-2.55, .2], [-2.62, .55], [-2.66, .9]]) { const a = P(x, y, .6), b = P(x, y, zt); c.strokeStyle = 'rgba(70,72,74,.9)'; c.lineWidth = 3; c.beginPath(); c.moveTo(a[0], a[1]); c.lineTo(b[0], b[1]); c.stroke(); }+ // wall lamps streaking past, every 8 m+ for (let i = 0; i < 26; i++) { const z = (Math.floor(zc / 8) + i + 1) * 8 - zc - 4; if (z < .4 || z > zt) continue;+ for (const sd of [-1, 1]) { const a = P(sd * 2.45, 1.0, z), b = P(sd * 2.45, 1.0, z + 1.1), w = Math.max(1.5, K * .1 / z);+ c.strokeStyle = `rgba(255,214,150,${clamp(4 / z)})`; c.lineWidth = w; c.lineCap = 'round'; c.beginPath(); c.moveTo(a[0], a[1]); c.lineTo(b[0], b[1]); c.stroke();+ c.fillStyle = `rgba(255,200,120,${clamp(1.2 / z) * .25})`; c.beginPath(); c.arc(a[0], a[1], w * 5, 0, 7); c.fill(); } }+ // the train face and its headlights+ const s = K / zt, tw = 2.9 * s, th = 3.4 * s, tx = vx - tw / 2, ty = vy - K * 1.9 / zt - th / 2 + 0.2 * s;+ c.fillStyle = `rgba(30,32,36,${clamp(.6 + 1 / zt)})`; c.beginPath(); c.roundRect(tx, ty, tw, th, .35 * s); c.fill();+ for (const ox of [-1.0, 1.0]) {+ const [x, y] = P(ox, -.6, zt), r = Math.max(2.5, .2 * s);+ const g = c.createRadialGradient(x, y, 0, x, y, r * 9); g.addColorStop(0, 'rgba(255,255,252,1)'); g.addColorStop(.1, 'rgba(255,250,236,.95)'); g.addColorStop(.35, 'rgba(255,232,196,.28)'); g.addColorStop(1, 'rgba(255,220,180,0)');+ c.fillStyle = g; c.beginPath(); c.arc(x, y, r * 9, 0, 7); c.fill();+ c.fillStyle = `rgba(255,244,226,${clamp(.2 + t * .5)})`; c.fillRect(x - r * 18 - 60, y - Math.max(1, r * .1), r * 36 + 120, Math.max(2, r * .2));+ const g2 = c.createRadialGradient(x, y, 0, x, y, 40 + r * 3); g2.addColorStop(0, 'rgba(255,248,230,.55)'); g2.addColorStop(1, 'rgba(255,240,210,0)'); c.fillStyle = g2; c.beginPath(); c.arc(x, y, 40 + r * 3, 0, 7); c.fill();+ }+ const fl = seg(t, 1.1, 1.4); if (fl > 0) { c.fillStyle = `rgba(255,252,245,${ei(fl)})`; c.fillRect(0, 0, 1920, 1080); }+}+function matchFlash(c, t, b, toScreen) {+ // after the cut the white flare collapses into the red dot of the first station+ const k = t - 1.4; if (k < 0 || k > .55) return;+ const n = H.SNODE.JJLY, q = toScreen(b, n.cx, n.cy); if (!q) return;+ const u = eo(clamp(k / .5)), R = lerp(1500, 18, u);+ const g = c.createRadialGradient(q[0], q[1], 0, q[0], q[1], R);+ g.addColorStop(0, `rgba(255,255,255,${1 - u * .6})`); g.addColorStop(.25, `rgba(255,${lerp(250, 80, u)},${lerp(245, 90, u)},${.9 * (1 - u)})`); g.addColorStop(1, 'rgba(255,255,255,0)');+ c.fillStyle = g; c.fillRect(0, 0, 1920, 1080);+ if (k < .12) { c.fillStyle = `rgba(255,252,245,${1 - k / .12})`; c.fillRect(0, 0, 1920, 1080); }+}+// odometer: a small enamel counter with rolling drums+function digitsAt(v, n) { const out = []; for (let i = n - 1; i >= 0; i--) { const p = Math.pow(10, i); let d = Math.floor(v / p) % 10; const rest = v % p; const roll = p === 1 ? v % 1 : (rest > p - 1 ? rest - (p - 1) : 0); out.push(d + (p === 1 ? v % 1 : roll)); } return out; }+function drum(c, x, y, w, h, pos, F, dim, blur = 0) {+ c.save(); c.beginPath(); c.roundRect(x, y, w, h, 5); c.clip();+ const g = c.createLinearGradient(0, y, 0, y + h); g.addColorStop(0, '#9c968a'); g.addColorStop(.18, '#efe9dc'); g.addColorStop(.5, '#faf6ee'); g.addColorStop(.82, '#efe9dc'); g.addColorStop(1, '#9c968a');+ c.fillStyle = g; c.fillRect(x, y, w, h);+ const d = Math.floor(pos) % 10, f = pos - Math.floor(pos);+ c.font = F(800, h * .7); c.textAlign = 'center'; c.textBaseline = 'middle'; c.fillStyle = dim ? 'rgba(27,28,30,.28)' : '#1b1c1e';+ const n = blur > 0 ? 7 : 1;+ for (let k = 0; k < n; k++) { const off = n > 1 ? (k / (n - 1) - .5) * blur * h * .9 : 0; c.globalAlpha = n > 1 ? .26 : 1;+ for (const dd of [-1, 0, 1, 2]) c.fillText(String((d + dd + 10) % 10), x + w / 2, y + h / 2 + (dd - f) * h + 2 + off); }+ c.globalAlpha = 1;+ const sh = c.createLinearGradient(0, y, 0, y + h); sh.addColorStop(0, 'rgba(0,0,0,.35)'); sh.addColorStop(.25, 'rgba(0,0,0,0)'); sh.addColorStop(.75, 'rgba(0,0,0,0)'); sh.addColorStop(1, 'rgba(0,0,0,.35)'); c.fillStyle = sh; c.fillRect(x, y, w, h);+ c.restore();+}+const yearTrack = monotone([[0, 1993], [6.22, 1993], [6.45, 1995], [7.36, 1995], [7.68, 1999], [11.38, 1999], [11.6, 2000], [13.42, 2000], [18.2, 2010], [28.05, 2010], [29.85, FX.nowYear]]);+export const YEAR_HOLDS = [[1.95, 6.22], [6.45, 7.36], [7.68, 11.38], [11.6, 13.42], [18.2, 28.05], [29.85, 99]];+const kmKeys = () => [[0, 0], [1.75, 0], [4.35, FX.firstKm], [6.28, FX.firstKm], [6.65, FX.km[1][1]], [7.62, FX.km[1][1]], [18.2, FX.km[2][1]], [28.05, FX.km[2][1]], [29.85, FX.km[3][1]]];+const KM_HOLDS = [[4.35, 6.28], [6.65, 7.62], [18.2, 28.05], [29.85, 99]];+// between two sourced landings the drums spin (unreadable) and settle on the next value+const SPINS = [[7.62, 18.2], [28.05, 29.85]];+function kmCells(t) {+ const sp = SPINS.find(([a, b]) => t > a && t < b);+ const val = kmTrack(t), d = digitsAt(Math.round(Math.max(0, val) * 10 * 1000) / 1000, 4);+ if (!sp) return d.map(p => ({ pos: p, blur: 0 }));+ const [a, b] = sp, target = digitsAt(Math.round(kmTrack(b) * 10), 4), rem = b - t, wake = seg(t, a, a + .5);+ return target.map((p, i) => { const rate = [3, 9, 17, 26][i] * wake; const g = rem < 1.2 ? Math.pow(rem / 1.2, 2) * 1.2 : rem;+ return { pos: ((p - rate * g) % 10 + 10) % 10, blur: clamp(rate * (rem < 1.2 ? 2 * rem / 1.2 : 1) / 6) }; });+}+let kmTrack = null;+function odometer(c, t, F, R) {+ const vis = seg(t, 1.95, 2.35) * (1 - seg(t, 20.0, 20.35)) + seg(t, 28.2, 28.6) * (1 - seg(t, 35.6, 36.0));+ if (vis <= 0) return;+ const rideOn = seg(t, 31.2, 31.6) * (1 - seg(t, 35.6, 36.0));+ const x = 46 - 30 * (1 - eo(vis)), y = 40, w = 660, rows = 2 + (t > 31.2 && t < 36 ? 1 : 0), rh = 86, h = 26 + rows * rh - (rows === 3 ? (1 - eo(rideOn)) * rh : 0);+ c.save(); c.globalAlpha = vis;+ // plate+ c.shadowColor = 'rgba(0,0,0,.35)'; c.shadowBlur = 18; c.shadowOffsetY = 6;+ c.beginPath(); c.roundRect(x, y, w, h, 14); const pg = c.createLinearGradient(0, y, 0, y + h); pg.addColorStop(0, '#2a2d31'); pg.addColorStop(1, '#17191c'); c.fillStyle = pg; c.fill();+ c.shadowColor = 'transparent'; c.lineWidth = 1.5; c.strokeStyle = 'rgba(255,255,255,.12)'; c.stroke();+ for (const [sx, sy] of [[x + 12, y + 12], [x + w - 12, y + 12], [x + 12, y + h - 12], [x + w - 12, y + h - 12]]) { c.beginPath(); c.arc(sx, sy, 3.2, 0, 7); c.fillStyle = '#8b8577'; c.fill(); }+ c.beginPath(); c.rect(x, y, w, h); c.clip();+ const row = (i, zh, en, cells, unitZh, unitEn, val, ra = vis) => {+ const ry = y + 18 + i * rh;+ c.fillStyle = '#efe8d8'; c.textAlign = 'left'; c.textBaseline = 'alphabetic'; c.font = F(700, 24); c.fillText(zh, x + 26, ry + 34); rt(c, R, 'odo-' + i, zh, x + 26, ry + 34, 24, ra, true); c.font = F(500, 17); c.fillStyle = '#aaa395'; c.fillText(en, x + 26, ry + 60); rt(c, R, 'odo-' + i + '-en', en, x + 26, ry + 60, 17, ra, true);+ const vx0 = x + w - 26 - cells.reduce((a, q) => a + (q === '.' ? 12 : 42), 0) - (unitZh ? 110 : 0);+ if (val != null && R && R.regS) R.regS('odo-' + i + '-value', val, vx0, ry + 6, vx0 + cells.reduce((a, q) => a + (q === '.' ? 12 : 42), 0), ry + 66, ra);+ let cx = x + w - 26 - cells.reduce((a, q) => a + (q === '.' ? 12 : 42), 0) - (unitZh ? 110 : 0);+ for (const q of cells) { if (q === '.') { c.fillStyle = '#efe8d8'; c.beginPath(); c.arc(cx + 6, ry + 58, 3.5, 0, 7); c.fill(); cx += 12; continue; } drum(c, cx, ry + 6, 38, 60, q.pos, F, q.dim, q.blur || 0); cx += 42; }+ if (unitZh) { c.fillStyle = '#efe8d8'; c.font = F(700, 20); c.textAlign = 'left'; c.fillText(unitZh, cx + 8, ry + 34); rt(c, R, 'odo-' + i + '-unit', unitZh, cx + 8, ry + 34, 20, ra, true); c.font = F(500, 16); c.fillStyle = '#aaa395'; c.fillText(unitEn, cx + 8, ry + 58); rt(c, R, 'odo-' + i + '-unit-en', unitEn, cx + 8, ry + 58, 16, ra, true); }+ };+ const held = (H2, tt) => H2.some(([a, b]) => tt >= a && tt <= b);+ const yr = yearTrack(t); row(0, '年份', 'Year', digitsAt(yr, 4).map(p => ({ pos: p })), null, null, held(YEAR_HOLDS, t) ? String(Math.round(yr)) : null);+ const km = Math.max(0, kmTrack(t)), kc = kmCells(t), spin = kc[0].blur > 0;+ row(1, '运营里程', 'Route length', [{ ...kc[0], dim: km < 100 && !spin }, { ...kc[1], dim: km < 10 && !spin }, kc[2], '.', kc[3]], '公里', 'km', held(KM_HOLDS, t) ? km.toFixed(1) : null);+ if (rows === 3) { const rv = lerp(0, FX.ride.value, eo(seg(t, 31.4, 32.9))); const rd = digitsAt(Math.round(rv * 10), 5);+ c.globalAlpha = vis * rideOn; row(2, '日客流纪录', `Daily record · ${FX.ride.date}`, [{ pos: rd[0], dim: rv < 1000 }, { pos: rd[1] }, { pos: rd[2] }, { pos: rd[3] }, '.', { pos: rd[4] }], '万人次', `${(FX.ride.value / 100).toFixed(1)} million`, t >= 32.9 ? FX.ride.value.toFixed(1) : null, rideOn >= .99 ? vis : 0); }+ c.restore();+}+// a station name plate passes close to the lens during the low sweep+// a station name plate stands on the sheet near the lens during the low sweep: a billboard in the world, out of focus+let signImg = null;+function makeSign(F) {+ // a cream enamel station plate in a dark frame on a grey post (drawn once, used as a billboard)+ const W0 = 1000, H0 = 900, c = document.createElement('canvas'); c.width = W0; c.height = H0; const g = c.getContext('2d');+ // post+ const pg = g.createLinearGradient(470, 0, 530, 0); pg.addColorStop(0, '#5d5f62'); pg.addColorStop(.5, '#9a9c9f'); pg.addColorStop(1, '#4a4c4f');+ g.fillStyle = pg; g.fillRect(476, 330, 48, 570);+ // frame and enamel face+ g.fillStyle = '#2b2d31'; g.beginPath(); g.roundRect(0, 0, W0, 360, 26); g.fill();+ const fg = g.createLinearGradient(0, 18, 0, 342); fg.addColorStop(0, '#fbf9f3'); fg.addColorStop(1, '#e9e4d8');+ g.fillStyle = fg; g.beginPath(); g.roundRect(18, 18, W0 - 36, 324, 16); g.fill();+ g.fillStyle = '#E3002B'; g.fillRect(18, 268, W0 - 36, 16);+ [['1', '#E3002B', '#fff'], ['2', '#82BF25', '#1b1c1e'], ['8', '#0094D8', '#fff']].forEach(([n, col, f], i) => {+ g.beginPath(); g.arc(90, 70 + i * 74, 30, 0, 7); g.fillStyle = col; g.fill(); g.fillStyle = f; g.font = F(800, 38); g.textAlign = 'center'; g.textBaseline = 'middle'; g.fillText(n, 90, 72 + i * 74); });+ g.fillStyle = '#1b1c1e'; g.textAlign = 'left'; g.textBaseline = 'alphabetic'; g.font = F(800, 120); g.fillText('人民广场', 160, 166);+ g.font = F(600, 52); g.fillStyle = '#3d3a34'; g.fillText("People's Square", 166, 236);+ return c;+}+function foregroundSign(c, t, F, b, toScreen) {+ if (t < 29.95 || t > 35.6) return;+ if (!signImg) signImg = makeSign(F);+ // stands on the paper south-east of the centre, near the lens; passes through the lower right corner+ const X = 800, Y = 820, h = 400;+ const base = toScreen(b, X, Y, 0), top = toScreen(b, X, Y, h); if (!base || !top) return;+ const ph = base[1] - top[1]; if (ph < 4) return;+ const pw = ph * 1000 / 900, cx = (base[0] + top[0]) / 2;+ const blur = Math.min(5, 6 * Math.abs(base[2] - b.D) / base[2]);+ c.save(); c.globalAlpha = seg(t, 29.95, 30.3) * (1 - seg(t, 35.3, 35.6));+ // contact shadow on the paper+ c.filter = `blur(${(blur + 6).toFixed(1)}px)`; c.fillStyle = 'rgba(0,0,0,.25)'; c.beginPath(); c.ellipse(base[0] + pw * .05, base[1], pw * .12, ph * .02 + 3, 0, 0, 7); c.fill();+ c.filter = `blur(${blur.toFixed(1)}px)`;+ c.drawImage(signImg, cx - pw / 2, top[1], pw, ph); c.restore();+}+function overlay(c, t, O) { const { b, toScreen, F, INK, view } = O;+ if (t < S.tunnel[1]) { tunnel(c, t, { F }); return; }+ matchFlash(c, t, b, toScreen);+ foregroundSign(c, t, F, b, toScreen);+ odometer(c, t, F, O);+ // the end card fades from paper white in, and the film ends on the held card++}++// ------------------------------------------------------------------ cues for the score+const CUES = [+ { t: 0.0, type: 'tunnel' }, { t: 1.12, type: 'flare' }, { t: 1.4, type: 'cut' }, { t: 1.55, type: 'chime' },+ { t: 3.95, type: 'plaque' }, { t: 4.2, type: 'shuttle' }, { t: 6.3, type: 'year' }, { t: 7.62, type: 'year' },+ { t: 8.36, type: 'fall' }, { t: 9.2, type: 'dive' }, { t: 10.32, type: 'surface' }, { t: 11.45, type: 'year' },+ { t: 12.6, type: 'burst' }, { t: 18.35, type: 'expo' }, { t: 18.2, type: 'landing' },+ { t: 20.0, type: 'glide' }, { t: 21.0, type: 'london' }, { t: 22.7, type: 'shanghai' }, { t: 23.3, type: 'hold' },+ { t: 25.8, type: 'verdict' }, { t: 26.45, type: 'stamp' },+ { t: 28.0, type: 'rise' }, { t: 29.9, type: 'sweep' }, { t: 32.6, type: 'sign' }, { t: 31.4, type: 'ride' }, { t: 32.9, type: 'rideland' },+ { t: 34.6, type: 'lift' }, { t: 36.0, type: 'push' }, { t: 37.4, type: 'here' }, { t: 37.75, type: 'caption' },+ { t: 41.5, type: 'end' }, { t: 42.0, type: 'endring' },+];++const lineYear = {}; for (const p of PHASES) { const k = p.path.replace('b', ''); lineYear[k] = Math.min(lineYear[k] ?? 9999, p.year); }+const SWEEP_LABELS = ['RMGC', 'SJDD', 'XJH', 'JAS', 'ZSGY', 'LJZ', 'SHZ', 'LYL', 'YSL', 'LXM'];+export const DATA = {+ labelOnly: t => t < 7.4 ? FIRST5 : t < 11.3 ? [...FIRST5, 'RMGC', 'LJZ', 'SJDD', 'LYL'] : t < 20 ? (H.__hubs ??= Object.values(H.SNODE).filter(n => n.tier === 1 && n.t1 < 16.6).map(n => n.id)) : t < 28 ? [] : t < 35.6 ? SWEEP_LABELS : FIRST5,+ DUR, SHEET, PHASES: PHASES.filter(p => !p.skip), camera, furniture, riverLabels, annotations, overlay, trains, highlight, veil, stationDim,+ drops, dropRing, noRoundel: [], roundelPos: { '1': [-4.9, 6.9], '2': [-4.95, 0.55], '3': [-2.75, 7.15], '4': [-0.6, -2.35], '5': [-6.5, 10.3], 'M': [9.4, 3.35] },+ roundelAlpha: (t, id, z) => clamp(1 - seg(t, 19.6, 20.2) * (t < 28 ? 1 : 0) - (t >= 28 ? seg(t, 30.4, 31.0) : 0) - (t >= 28 && lineYear[id] < 2011 ? 1 : 0)), roundelScale: z => clamp(Math.pow(.9 / z, .55), 1, 1.8),+ forceLabel: (n, t) => 0, hubLabelScale: z => clamp(Math.pow(.85 / z, .6), 1, 1.75),+ tunnelOnly: t => t < S.tunnel[1], cues: CUES, LABEL_PREF: { JJLY: 'e', SHNZ: 'e', CBL: 'w', TYG: 'w', XJH: 'w', LJZ: 'sw', SJDD: 'ne', RMGC: 'ne' },+ nameAt: (n, t) => n.id === 'SHNZ' && t < 7.62 ? ['新龙华', 'Xinlonghua'] : [n.zh, n.en],+ init(h) { H = h; kmTrack = monotone(kmKeys()); },+};diff --git a/styles/transit-map/demo/tools/chars.txt b/styles/transit-map/demo/tools/chars.txtnew file mode 100644index 0000000..5df77fa--- /dev/null+++ b/styles/transit-map/demo/tools/chars.txt@@ -0,0 +1 @@+0123456789·×–—→≈《》一七万三上与世东中乐五交京人从份会伦体你假光公兰共关切北区华南博发口号商善嘉嘴四园国图在地场坪城士大天头奉如始娄学安官定宜宝客宫家富寺寿封尼山峰川巨市常平年广庄度延开张当录彭徐德心意成技敦敬新方无日昌明曲曹木术机村杜杨松林桂桥楼次段民水汇汉江沈沙河泾流浜浦浮海淞清渡港湖湾滴漕潭潼火然熟片物球生界真石磁示科程站竹紫纪线络绿网美耀老联肇育自致臻舟航艺花苏莘莲营蓝藏虹行西角豫贤足路车运这连迪通道里金铁锦镇长门闵阜阳陂际陆陕隆静非顾馆首马高黄龙,\ No newline at end of filediff --git a/styles/transit-map/demo/tools/sheet.sh b/styles/transit-map/demo/tools/sheet.shnew file mode 100644index 0000000..6879ec8--- /dev/null+++ b/styles/transit-map/demo/tools/sheet.sh@@ -0,0 +1,6 @@+#!/bin/sh+# Contact sheet every 0.5 s at 960x540, for review. Run from the library root: sh styles/transit-map/demo/tools/sheet.sh+D=styles/transit-map/demo+rm -rf $D/out/sheet+node core/render/still.mjs $D --range 0:47:0.5 --size 960x540 --out $D/out/sheet --prefix s_ | tail -1+.venv/bin/python core/render/sheet.py $D/out/sheet.jpg $(ls $D/out/sheet/s_*.jpg | awk -F/ '{print $NF" "$0}' | sort -t_ -k2 -g | cut -d' ' -f2) --cols 8 --w 240diff --git a/styles/transit-map/demo/tools/subset.py b/styles/transit-map/demo/tools/subset.pynew file mode 100644index 0000000..05175f0--- /dev/null+++ b/styles/transit-map/demo/tools/subset.py@@ -0,0 +1,11 @@+"""Subset Noto Sans SC (OFL) to the characters the film prints. Run from the library root:+ .venv/bin/python styles/transit-map/demo/tools/subset.py"""+import os, re, subprocess, sys+HERE = os.path.dirname(os.path.abspath(__file__)); D = os.path.dirname(HERE)+txt = ''.join(open(os.path.join(D, f), encoding='utf-8').read() for f in ['net.js', 'film.js', 'timeline.js'])+chars = sorted(set(ch for ch in txt if ord(ch) > 0x2E7F) | set('0123456789·→×—–≈年'))+open(os.path.join(HERE, 'chars.txt'), 'w', encoding='utf-8').write(''.join(chars))+from fontTools import subset+args = [os.path.join(HERE, 'NotoSansSC-VF.ttf'), '--text-file=' + os.path.join(HERE, 'chars.txt'), '--output-file=' + os.path.join(D, 'fonts', 'NotoSansSC-sub.ttf'), '--layout-features=*', '--no-hinting']+subset.main(args)+print(len(chars), 'chars')diff --git a/styles/transit-map/poster.jpg b/styles/transit-map/poster.jpgnew file mode 100644index 0000000..2c20e33Binary files /dev/null and b/styles/transit-map/poster.jpg differdiff --git a/styles/transit-map/style.json b/styles/transit-map/style.jsonnew file mode 100644index 0000000..6f96777--- /dev/null+++ b/styles/transit-map/style.json@@ -0,0 +1,19 @@+{+ "slug": "transit-map",+ "num": "72",+ "en": "Transit Map",+ "cn": "地铁线路图",+ "category_en": "Information & Keynote",+ "category_cn": "信息与发布",+ "film": "6 Kilometres",+ "line": "A printed metro map grows from one 6 km line in 1993 to 21 lines and 906 km, as a camera rides the pen, dives under the river and sweeps the paper.",+ "line_cn": "一张印在纸上的线路图,从 1993 年的 6 公里一路长到 21 条线、906 公里;镜头跟着笔尖走,压低过江,再贴着纸面扫过去。",+ "uses": [+ "City and transport stories",+ "Growth over the years",+ "Roadmaps and routes",+ "Network explainers"+ ],+ "frame_sec": 36.2,+ "dur": 47.0+}