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
Memphis Diorama: bilingual bottom type, night-to-day wave, cutaway and fonts.py input
lemomo-aibeada3ef896a
diff --git a/styles/memphis-diorama/DEMO.md b/styles/memphis-diorama/DEMO.mdindex 5335c4e..954ff6c 100644--- a/styles/memphis-diorama/DEMO.md+++ b/styles/memphis-diorama/DEMO.md@@ -76,7 +76,11 @@ Fonts (if missing) → picture at 60 fps with `core/render/video.mjs` (≈ 2.5 m| `demo/main.js` | the place, its four seasons, the timeline and the page contract (`render(t)`, `DUR`, `TEXTS(t)`) || `demo/people.js` | distant figures and the walk cycle || `demo/music.py` | the score and foley, written to `demo/out/mix.wav` |-| `demo/tools/fonts.py` | subsets Noto Sans SC, Inter Tight, IBM Plex Mono to the on-screen characters |+| `demo/tools/fonts.py` | subsets Noto Sans SC, Inter Tight, IBM Plex Mono to the on-screen characters (needs the network; input below) |++**Fonts.** `python -I demo/tools/fonts.py <dir>` reads `<dir>/main.js` and takes the Chinese characters only from the text that starts at `const TEXT = [` and runs to the end of the `const TITLE` line; Latin always gets all of printable ASCII. A `main.js` without both markers stops with `ValueError: substring not found`, and a Chinese character written anywhere else (a callout, a sign texture) is not in the subset and falls back to a system font. So in your own film either keep every on-screen string inside `const TEXT = [ … ]` followed by a one-line `const TITLE = '…'` (it may be `''`), or change the `src = …` line of your copy to collect your strings. It downloads the subsets from the Google Fonts CSS2 API (`fonts.googleapis.com`, `&text=`) and the OFL texts from `raw.githubusercontent.com/google/fonts`, so it needs the network; it writes `fonts/*.woff2`, `fonts/fonts.css` and `fonts/OFL-*.txt`. `build.sh` runs it only when a `.woff2` is missing; run it again after any change to the words.++**Bottom type in the demo.** The demo passes `text: [TITLE, …]` to `dio.render`, and when lines 2 and 3 change it covers them with a paper-coloured band (`fillRect(0, 948, 1920, 60)` in `main.js`) that fades. That band fits only this layout (lines 2 and 3 change, line 1 stays); for a film of your own, use `''` for unused lines and draw the cross-fade yourself (STYLE.md §10, "The bottom type").**Seasonal materials.** `S([spring, summer, autumn, winter], { patCols: […] })` in `main.js` makes a `flat()` material that remembers four colours. Each frame, `place(t)` sets `uCol` to the current season and `uCol2` to the next one, and `setSeason(x, z, r)` gives the wave's centre and radius: pixels inside the ring draw `uCol2`. For actions, `at(n, p)` returns how far season *n* has reached position *p* (0 → 1), so anything can grow, fold or fall as the ring passes it.@@ -98,4 +102,38 @@ window.render = (t) => {};```+**Night to day by area (the demo never does it).** The demo's dusk is global (`setNight(0.62 …)`, `setDusk`, `setLamps` in `place(t)`). For a dawn that spreads from one landmark, keep `setNight(0)` and give every changing material its night and day colours through the season wave (STYLE.md §3, §10). The night colour follows the shader's own rule (luminance toward violet, `FLAT_FS` in `memphis.js`); `n` is how far into the night (the demo's dusk stops at 0.62; go up to about 0.8 for deep night, never 1, which reads grey all over):++```js+const nightOf = (hex, n = 0.62) => { // the shader's night colour, in JS+ const c = new THREE.Color(hex), l = 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;+ const d = (v, a, b, add) => 0.4 * v * a + 0.6 * l * b + add;+ return '#' + c.clone().lerp(new THREE.Color().setRGB(d(c.r, 0.25, 0.24, 0.008), d(c.g, 0.26, 0.22, 0.007), d(c.b, 0.44, 0.46, 0.024)), n).getHexString();+};+const ND = (day, o = {}) => flat(nightOf(day), { ...o, col2: day, // night now, day once the ring has passed+ patCol: o.patCol && nightOf(o.patCol), patCol2: o.patCol });+const lit = flat('#FFD36E', { emit: true, col2: '#BFE4FF' }); // a lit window or lamp head: warm, then day glass+const pool = (x, z, r, groundDay) => { // a lamp's pool: warm disc, then the ground's colour+ const m = mesh(new THREE.CircleGeometry(r, 36).rotateX(-Math.PI / 2),+ flat('#' + new THREE.Color(nightOf(groundDay)).lerp(new THREE.Color('#FFD36E'), 0.35).getHexString(), { col2: groundDay, shadow: false }),+ x, 0.015, z, dio.scene); // 1.5 cm up: no z-fighting with the ground+ m.userData.noOutline = true; m.castShadow = false; return m;+};+// per frame: setNight(0); setSeason(x0, z0, radius(t)); for night falling, swap each pair (flat(day, { col2: nightOf(day) }))+```++Anything that should act as the ring reaches it (a shutter rolling up, a bird taking off) times itself from the ring: the time the radius passes its distance from the centre, as `at(n, p)` does for the seasons in `main.js`.++**Cutaway (the demo never does it; the engine has no section tool).** Make the near part its own group and move it in two steps; cut faces carry `pat: 5`:++```js+const near = new THREE.Group(); dio.scene.add(near); // front wall, roof lid, a slab of ground…+mesh(box(12, 6, 0.4), flat('#FF9C6B', { pat: 4, patCol: '#FFB98F', patScale: 0.5 }), 0, 0, 4, near);+const cut = flat('#E07A55', { pat: 5, patCol: '#25214A', patScale: 0.35 }); // section faces: one step darker, hatched+mesh(box(12, 0.02, 0.4), cut, 0, 0, 4.21, near); // e.g. the wall's cut top, seen once the lid is gone+// in render(t): a = ease(…) 0→1 to open, back to 0 to close+// lid: y up first, then z back (lid.position.set(0, 3 * ease(a * 2), -12 * ease(a * 2 - 1)))+// wall: straight down below the ground (near.position.y = -6.5 * a); near.visible = a < 0.99;+```+Pitfalls tied to this demo's props: reeds first read as ink scribbles (fixed with thicker stems and no outline); a constant-speed orbit lost the pond after 25 s (fixed by easing the camera down after 18 s); door-lamp light pools on the ground also lit the roofs above them (fixed by moving each pool 2.3 m out onto the lane).diff --git a/styles/memphis-diorama/STYLE.md b/styles/memphis-diorama/STYLE.mdindex 085df8d..6f4fa52 100644--- a/styles/memphis-diorama/STYLE.md+++ b/styles/memphis-diorama/STYLE.md@@ -9,7 +9,7 @@- **Memphis flat colour.** Saturated primaries plus pastels, flat fills, no gradients; a deep-indigo ink outline; small patterns tiled on surfaces (dots, stripes, zigzags, terrazzo flecks, halftone).- **The eye of a model-maker.** High three-quarter, top-down or cutaway views. The film always looks at a *place*, never at a person.- **Small motions everywhere.** Water, wind in trees, cloud shadows, birds, boats, walkers, lights coming on one by one. The place is alive because of them, not because of a protagonist.-- **Three lines of type under the frame**: title / one sentence / small data, under three Memphis marks (a yellow dot, a pink triangle, a blue zigzag).+- **Three lines of type under the frame**: title / one sentence / small data, under three Memphis marks (a yellow dot, a pink triangle, a blue zigzag). Bilingual words take two of them, one Chinese line and one English line (§4).Not character animation: nobody acts. Code-made faces, gestures, getting in and out of cars always look stiff, so this style never shows them. Not an isometric infographic (that one is cool and diagrammatic; this one has weather, seasons and sound). Not tilt-shift (no photograph, no depth of field: everything is flat and sharp). Not low-poly (no faceted shading or plastic highlights: flat fills, outlines and patterns do the work).@@ -33,13 +33,15 @@ Not character animation: nobody acts. Code-made faces, gestures, getting in and- **Day is bright and warm.** When it gets dark, darken by the scene: a night scene may be dark, but never grey all over.- **Night is a luminance shift toward violet**, not a general darkening, so yellows don't go olive; every light is the same warm yellow (about `#FFD36E`). **Dusk** adds an orange-pink layer (about `#FF9E7A`) on the way to night.- **Time and season change the large areas only** (ground, crowns, roofs, water), never the whole palette. Each changing material carries one colour per state; a wave (§8) swaps them.+- **Night and day by area is also a wave.** When the dark falls or lifts street by street (dawn spreading from one landmark, a district losing power), night and day are two states like two seasons: each changing material carries its night colour (the violet shift above) and its day colour, and the ring swaps them. Lights belong to the night state: a lit window or lamp head is warm yellow on the night side and plain glass or metal on the day side; a lamp's pool is a flat disc on the ground, warm on the night side and the ground's own colour on the day side, so it goes out exactly as the ring passes. Keep the rest of the picture's light unchanged during such a wave: a global darkening on top of it turns the day side grey.- Winter does not mean all white: crowns go to pastel lilac, ice blue and mint with white dots, paths stay swept, houses keep their colours.- Example palette (an example only): yellow `#FFD234`, pink `#FF7EB3`, sky `#5CC8FF`, mint `#5EDFB0`, lilac `#B9A0FF`, peach `#FF9C6B`, cobalt `#2F5BFF`, coral `#FF5A5F`, green `#2FCB7A`.## 4. Type & subtitles- **Three centred lines under the frame**: line 1, the title, Chinese and English, weight 600, about 25 px, dark; line 2, one sentence, weight 400, about 18 px, grey; line 3, small data (time, solar term, place, coordinates) in a monospace, about 15 px, light grey. Line 3 may change with the picture.-- The lines fade in and out with the frame and never move. When a line changes, the old one fades away and the new one fades in; line 1 stays.+- **Line 3 is optional, and so is line 2.** An empty line leaves its place empty; the others never move up to fill it. With a voice, or when the film's words are bilingual, the type is **one Chinese line and one English line**: line 1 in Chinese (weight 600, about 25 px, dark) and line 2 in English (weight 400, about 18 px, grey), each on one line, never wrapped; line 3 stays empty unless there is small data to show. In this layout both lines change together, as one pair.+- The lines fade in and out with the frame and never move. When a line changes, the old one fades away and the new one fades in; line 1 stays (in the bilingual layout, both lines cross-fade, about 0.4 s out and 0.4 s in). The three marks stay at full strength through every change: only the words fade.- Typefaces: Inter Tight for Latin, Noto Sans SC for Chinese, IBM Plex Mono for data (all OFL).- Usually no voice: the type is the narration. With a voice, use plain bottom subtitles, one Chinese and one English line, no styled caption boxes.- Hold every line ≥ max(1.8 s, reading time + 0.6 s).@@ -69,7 +71,7 @@ A vocabulary, not a route. Opening and ending come from the topic.- **Prefer one continuous take**, slow enough that the viewer can stop and look at any corner. When a long take must hold a composition, ease the camera speed down instead of letting the place drift out of frame.- The frame is about 1520 × 744 px, a little above centre; the type sits under it and never covers the subject.-- **Transitions**: only three — the frame draws in and grows out again; a wave sweeps across (colour, light, season); the ground is cut open. No white flash, spin or fast hard cut.+- **Transitions**: only three — the frame draws in and grows out again; a wave sweeps across (colour, light, season); the ground is cut open (the Cutaway of §8: the same move, whether the cut goes into the ground, a building or water). No white flash, spin or fast hard cut.- The camera never passes through geometry; to get around something, move in two steps (rise, then travel).## 7. Sound palette@@ -85,9 +87,9 @@ A vocabulary, not a route. Opening and ending come from the topic.A menu: use the ones your story needs.-- **Wave.** A ring spreads from one point; everything it passes takes its next state (colours swap per pixel inside the radius; objects grow, open, fall or light up as the ring reaches them). *Fits content like:* night falling street by street; a change of season; a delivery or signal coverage map; power coming back after an outage.+- **Wave.** A ring spreads from one point; everything it passes takes its next state (colours swap per pixel inside the radius; objects grow, open, fall or light up as the ring reaches them). *Fits content like:* night falling street by street; a change of season; a delivery or signal coverage map; power coming back after an outage. Night falling or day breaking by area follows §3 (night and day as two states); how to build it is in §10.- **Squash and spring.** One landmark squats, springs back, and the change starts from it. Use it to say "this causes that" without a person. *Fits content like:* a fountain that starts the morning; a factory chimney that starts a shift; a station clock that starts the rush hour.-- **Cutaway.** Cut along a line; the near part sinks and slides away to show the section underground, inside a wall or under water. *Fits content like:* how a metro and its pipes work; a tree's roots; what each floor of a building is doing; fish under a pond.+- **Cutaway.** Cut along a line; the near part sinks and slides away to show the section underground, inside a wall or under water. *Fits content like:* how a metro and its pipes work; a tree's roots; what each floor of a building is doing; fish under a pond. What is revealed is built, not implied: floors with their rooms and furniture, soil in layers, pipes and tunnels, water with what lives in it; every cut face is drawn as a section (flat colour with section hatching), never left hollow. The near part leaves in two steps (a lid rises, then slides back; a wall or a slab of ground sinks straight down), so nothing passes through anything, and it comes back the same way in reverse. The engine has no cutaway built in: §10 says how to make one.- **Grow the frame.** The organic frame grows from the centre to open, draws back in to close, and can close and reopen as a chapter break. *Fits content like:* an opening; a change of chapter; an ending.- **Living loop.** Every small motion is periodic, so a passage loops seamlessly. *Fits content like:* a website hero; a screensaver; a livestream background; a live wallpaper.- **Callout.** A pill label with a leader line pops out of the model. *Fits content like:* explaining a mechanism; labelling data; naming places.@@ -113,6 +115,12 @@ A menu: use the ones your story needs.`demo/memphis.js` (three.js r170): `Diorama(glCanvas, ctx2d)` renders at 2× with a normal-and-depth outline pass, composites the grainy organic frame (`grow` opens it) and draws the bottom type (`drawText`). `flat(hex, o)` is the flat material: `pat` (1 dots, 2 diagonal stripes, 3 zigzag, 4 vertical stripes, 5 hatch, 6 horizontal stripes), `patCol`, `patScale`, `lit` (no face tones), `emit`, `win` (facade windows), `nightCol`, `col2` / `patCol2` (the next state for a wave). Globals: `setSeason(x, z, r)` (wave), `setHalftone(1)`, `setNight`, `setDusk`, `setLamps([[x, y, z, r]…])`, `setWave` / `setZone` (lights coming on). Helpers: `mesh`, `box`, `rng`. `demo/people.js` has the distant walker. A minimal example that the demo never draws, and how the demo's seasonal materials work: [DEMO.md](DEMO.md) "Build notes".+- **Engine, not story.** `memphis.js` and `people.js` hold no place, season or timeline: copy them into your project folder whenever you like, before your treatment too. `main.js` is the demo's film (its place, seasons and timing): open it only after your treatment exists, like the rest of the demo.+- **Night is global.** `setNight`, `setDusk`, `nightCol`, `win` and `setLamps` act on the whole picture at once, and `win`, `setLamps`, `setWave` and `setZone` only show anything while `setNight` is above 0. `setWave(r, x, z)` (with `win` facades and `zoneAware` materials) lights windows ring by ring in a picture that is already at night; it does not darken or brighten by area.+- **Night to day (or day to night) by area** uses the season wave instead, with `setNight(0)` throughout: each changing material is `flat(nightColour, { col2: dayColour, patCol: nightPat, patCol2: dayPat })` (reverse the pair for night falling), and `setSeason(x, z, r)` moves the ring. Windows and lamp heads are their own meshes with `emit: true` (warm yellow, `col2` the day glass or metal); lamp pools are flat discs about 1.5 cm above the ground, `shadow: false` and `userData.noOutline`, warm on the night side and the ground's colour on the day side. The night colour is computed in JS from the shader's own night rule; the helper and the details are in [DEMO.md](DEMO.md) "Build notes".+- **The bottom type.** `drawText(g, [l1, l2, l3], alpha, strong2)` draws all three lines and the marks at one alpha; pass `''` for a line you leave out (`[zh, en, '']` for the bilingual layout). It has no alpha per line, so for a cross-fade (§4) draw the type yourself in the same layout: baseline `y0 = FRAME.cy + FRAME.hh + 64`, the lines at `y0 + 34`, `y0 + 64` and `y0 + 91` in the fonts of §4, the marks once at `y0` at the text's base alpha, each line at its own alpha; then leave `text` out of `dio.render`.+- **Cutaway: build it yourself.** The engine has no section, clipping or boolean. Model the subject so its near part is its own group (a front wall; a roof lid with its gable; a slab of ground in front of the cut, as a thick box instead of the ground plane, which cannot be cut), and model what is behind it (floors, rooms, soil layers, pipes, a pond's depth). Cut faces get `pat: 5` (section hatching) in a colour a step darker than the part. Animate the near group in two steps (lift then slide back; or sink straight down below the ground, where the ground plane hides it), and set it `visible = false` once it is fully away, so it casts no shadow and draws no outline. Close in reverse order. A code sketch is in [DEMO.md](DEMO.md) "Build notes".+## 11. Variation spaceYou decide the place, the season and time, the camera route, the pace, which native moves, and the palette within §3.