pixi-effects 0.28.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/dist/loader.css +1 -1
- package/llms-full.txt +178 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +11 -1
- package/skills/pixi-effects/reference/direction.md +136 -0
- package/skills/pixi-effects/reference/pitfalls.md +2 -0
- package/skills/pixi-effects/reference/recipes.md +25 -0
- package/skills/pixi-effects/template.html +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.28.
|
|
3
|
+
## 0.28.1
|
|
4
|
+
|
|
5
|
+
**Changed**
|
|
6
|
+
|
|
7
|
+
- **A guide for directing a film, `reference/direction.md`** (renderer-neutral; linked from `SKILL.md` "For a film", pitfalls 101–102, recipe `two-formats`). Write `brief.md` (real assets with paths; if a needed asset is missing, stop and ask instead of drawing a fake), `style-guide.md` (taken from the real source, a motion rule per class of object) and `shotlist.md` (a row per beat with entry and exit state) before any composition; keep the files in a studio folder; put every cut on a bar line; review the rendered frames cold (the three largest defects, each with a timestamp, evidence and a local fix); make the formats the human asked for (one if they did not say; a vertical cut is its own composition, `?f=9x16`, `--query f=9x16`). Came from making two 32–45 s company films (16:9 and 9:16) from real websites' photos and copy, and from a published breakdown of building a code-rendered video studio (@0xwhrrari, rewritten, credited in the file).
|
|
8
|
+
|
|
9
|
+
## 0.28.1
|
|
4
10
|
|
|
5
11
|
**Added**
|
|
6
12
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pixi-effects
|
|
2
2
|
|
|
3
|
-
> **Status**: experimental — current release `0.28.
|
|
3
|
+
> **Status**: experimental — current release `0.28.1`. The API may still change between minor versions; see the [CHANGELOG](./CHANGELOG.md) for what each release changed.
|
|
4
4
|
|
|
5
5
|
**[Guide →](https://yjmtmtk.github.io/pixi-effects/guide/)** · **[Gallery →](https://yjmtmtk.github.io/pixi-effects/examples/gallery/)** · 52 portfolio pieces written as plain data by AI models · **[Examples →](https://yjmtmtk.github.io/pixi-effects/examples/)** · 15 numbered examples, a music lab + an in-browser playground.
|
|
6
6
|
|
|
@@ -49,8 +49,8 @@ Drop the imports into an [importmap](https://developer.mozilla.org/docs/Web/HTML
|
|
|
49
49
|
"imports": {
|
|
50
50
|
"pixi.js": "https://esm.sh/pixi.js@8.22.0?bundle-deps",
|
|
51
51
|
"mediabunny": "https://esm.sh/mediabunny",
|
|
52
|
-
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
53
|
-
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
52
|
+
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/index.js",
|
|
53
|
+
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/Controller.js"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
</script>
|
|
@@ -61,7 +61,7 @@ Drop the imports into an [importmap](https://developer.mozilla.org/docs/Web/HTML
|
|
|
61
61
|
</script>
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Load the `dist/` files **as they are** (jsDelivr's `/npm/…/dist/…`, or unpkg's `https://unpkg.com/pixi-effects@0.28.
|
|
64
|
+
Load the `dist/` files **as they are** (jsDelivr's `/npm/…/dist/…`, or unpkg's `https://unpkg.com/pixi-effects@0.28.1/dist/index.js`) rather than a CDN-rebundled build such as `esm.sh/pixi-effects` or jsDelivr's `+esm`: the entries (`pixi-effects`, `…/controller`, `…/three`) share internal chunks, which only works when each file is served untouched.
|
|
65
65
|
|
|
66
66
|
> **Using three.js?** Add two more entries (`three` and `pixi-effects/three`) to this importmap — see [Adding three.js](#adding-threejs-optional) below.
|
|
67
67
|
>
|
|
@@ -77,7 +77,7 @@ Add two more entries to the importmap above: three.js itself, and the `pixi-effe
|
|
|
77
77
|
"imports": {
|
|
78
78
|
"...": "(everything from the importmap above)",
|
|
79
79
|
"three": "https://esm.sh/three@0.178.0",
|
|
80
|
-
"pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
80
|
+
"pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/three.js"
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
</script>
|
package/ai/chat-template.html
CHANGED
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"imports": {
|
|
60
60
|
"pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8.22.0/dist/pixi.min.mjs",
|
|
61
61
|
"mediabunny": "https://cdn.jsdelivr.net/npm/mediabunny@1.61.3/+esm",
|
|
62
|
-
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
63
|
-
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
64
|
-
"pixi-effects/presenter": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
62
|
+
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/index.js",
|
|
63
|
+
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/Controller.js",
|
|
64
|
+
"pixi-effects/presenter": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/Presenter.js"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
</script>
|
package/dist/loader.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* pixi-effects loader: one line of HTML on the page, a few lines of CSS, no JavaScript of your own.
|
|
3
3
|
*
|
|
4
|
-
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
4
|
+
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/loader.css">
|
|
5
5
|
* <div class="stage" style="position: relative"> <!-- any box the canvas sits in, with position: relative -->
|
|
6
6
|
* <canvas id="stage" width="1280" height="720"></canvas>
|
|
7
7
|
* <div class="pe-loader" data-label="LOADING"></div> <!-- or class="pe-loader pe-loader--bar" -->
|
package/llms-full.txt
CHANGED
|
@@ -6,7 +6,7 @@ Concatenation of the skill, cheatsheet, pitfalls, recipes and the DSL / API refe
|
|
|
6
6
|
|
|
7
7
|
<!-- ===== skills/pixi-effects/SKILL.md ===== -->
|
|
8
8
|
|
|
9
|
-
> Written for pixi-effects 0.28.
|
|
9
|
+
> Written for pixi-effects 0.28.1. Update this skill with `npx skills update`; the newest docs are at https://yjmtmtk.github.io/pixi-effects/
|
|
10
10
|
|
|
11
11
|
# pixi-effects — write a video as data
|
|
12
12
|
|
|
@@ -29,6 +29,15 @@ You describe a video as a tree of plain objects; the library plays it in a canva
|
|
|
29
29
|
From a browser tool the result is a `data:` URL string: `agent-browser eval "movie.contactSheet({ count: 6, as: 'dataURL' })" | python3 scripts/save-image.py /absolute/sheet.png`, then open the PNG. Sheet tiles are small (~480 px): use `snapshot` for detail. `inspect` output is long on busy scenes: pass `{ layers: 'none' }` and read `issues` first. Give layers a `name` so inspect paths are readable. A moving ticker is not flagged as cut off.
|
|
30
30
|
6. **Iterate** on what you saw (clipped text, collisions, wrong timing). Fast motion looks choppy: add `motionBlur: true` to `movie.init` (render, snapshot and contact sheet then show a film-style blur; renders take ~8× longer). Then export: `const blob = await movie.render({ format: 'mp4' })` (about real time; `movie.on('progress', …)` reports 0–100). **While you iterate, do not export the whole movie:** `check --no-export --at <the moment you changed>` takes seconds (3 to 10 s on the gallery pieces: most of it is loading the page and measuring the sound); to see motion, `render({ range: [from, to] })` / `pixi-effects-render --range 10:15` / `--scene name` exports only that part (picture and sound); `draft: true` / `--draft` is half size, low quality and no motion blur: a much smaller file (a piece that asks for motion blur renders much faster as a draft: 4 s of `hanabi-night` took 14.0 s, and 8.2 s as a draft, about 7 s of either being the browser's start-up), but the drawing itself is not faster. Export the whole movie once, at the end.
|
|
31
31
|
|
|
32
|
+
## For a film (more than a title card): direct it first
|
|
33
|
+
|
|
34
|
+
**Read `reference/direction.md` before writing a composition for a product film, a company introduction, a launch or a data story.** It is renderer-neutral: write `brief.md` (the one sentence to remember, the REAL assets with paths, what must never be invented; if a needed asset is missing, stop and ask), `style-guide.md` (palette and type taken from the real source, a motion rule per class of object) and `shotlist.md` (a row per beat with entry and exit state) next to the page; then build, then review the rendered frames cold. What is specific to this library:
|
|
35
|
+
|
|
36
|
+
- **Time and sound:** pick a tempo whose bar is a round number of seconds (96 bpm: 2.5 s; 120 bpm: 2 s), put every cut on a bar line and every sfx on its beat. `npx pixi-effects check` prints a `music` read-back (bars per track, what starts on which beat, the drum span): verify the sound with it.
|
|
37
|
+
- **Review:** `check --at 3.5,title@end,50%` writes the contact sheet and single frames; look at mid-transition frames of the exported file too. Frames are seekable and deterministic here: render the same range twice and compare the frames if you doubt it.
|
|
38
|
+
- **Formats:** make the formats the human asked for, one if they did not say. When a vertical cut is wanted it is its own composition: one source, a layout function, `?f=9x16` (recipe `two-formats`); `check` and `render` take `--query f=9x16`.
|
|
39
|
+
- Fit a picture into a rectangle with the `photo()` helper of that recipe (`scale: 'cover'` fits the PARENT only); designed pictures (posters, flyers, screenshots) are shown whole, never cropped.
|
|
40
|
+
|
|
32
41
|
## The rules that cause most failures
|
|
33
42
|
|
|
34
43
|
- **Keyframe `at` starts at 0 when the layer appears** (negative = back from the layer's end). A layer's own `at` and a transition's `at` are composition time.
|
|
@@ -56,6 +65,7 @@ Centred text must be positioned by `anchorX/anchorY: 0.5`; estimate text width a
|
|
|
56
65
|
- `reference/cheatsheet.md` — every layer type, prop, default and rule on one page.
|
|
57
66
|
- `reference/recipes.md` — tested building blocks: slam type, lower-third, marquee, count-up, bar chart, 2.5D title, camera orbit, slideshow with transitions + music, looping, particles, gradients/vignette, three.js metal.
|
|
58
67
|
- `reference/pitfalls.md` — the full list of real mistakes, with status.
|
|
68
|
+
- `reference/direction.md` — how to direct a film (any renderer): brief, style guide, shot list, assets rule, sound on the beat grid, review protocol, formats, gates.
|
|
59
69
|
- `npx pixi-effects check` — the one-command review (see Workflow step 5).
|
|
60
70
|
- `template.html` — the starting file. (It loads the released library from a CDN, so it works from any folder.)
|
|
61
71
|
- `scripts/save-image.py` — save a `dataURL` result (contact sheet / snapshot) to a PNG.
|
|
@@ -380,6 +390,8 @@ A good habit that catches most of these: after `init`, read `window.__logs` (see
|
|
|
380
390
|
98. **A matte layer needs a fill.** A named matte (`mask: 'glass'`) that is a shape with no `fillColor` / `fillGradient` (or a text with no fill) cuts everything away and nothing warns: the layers it should show simply vanish. Give the matte a fill (white for `alpha`, a gradient for `luma`).
|
|
381
391
|
99. **In a `music` score a capital letter is a chord and a lowercase one a note.** `G7` is G dominant seventh, `C5` a power chord, `C6` a sixth chord; `g7`, `c5`, `c6` are notes (octave 7 is a very high note: it used to be what `G7` meant, silently). A bare note in capitals (`Bb2`) is refused with the lowercase spelling (`bb2`); inside brackets (`[C4 E4 G4]`) any case is a note. An unknown chord kind suggests the nearest (`Cmin7` → `Cm7`, `Csus` → `Csus4`, `CM7` → `Cmaj7`).
|
|
382
392
|
100. **Read the score back before you trust it.** `check` prints a `music` block: every track's length in bars (a track that ends early or has a short bar is named), the names that start in each bar with their beat (`Am(2)` starts on beat 2; no mark = the downbeat; the first four names of a bar are shown, `musicEvents()` lists everything), and the drum span. Count bars by the read-back, not by hand: a bar of 3 beats in a score with no `meter` is shown as bars of 4, so set `meter: 3` for a waltz. Drums repeat by themselves and `from` / `to` are beats; `swing` only moves notes that start off the beat, so a comp on beats 2 and 4 stays straight.
|
|
393
|
+
101. **A film built from one adjective looks like every other one.** Read `reference/direction.md` and write `brief.md` / `style-guide.md` / `shotlist.md` first: real assets with paths, the one sentence to remember, a row per beat with entry and exit state. If a real asset is missing, ask: a drawn fake (a logo, a dashboard, a figure) is the failure that matters. Judge the contact sheet cold: three defects, each with a timestamp, evidence and a local fix.
|
|
394
|
+
102. **A vertical cut is a second composition, not a crop, and only when someone asked for it.** One source, a layout function, `?f=9x16`; `check` and `render` take `--query f=9x16` (recipe `two-formats`). Look at a contact sheet of each format: type that fits wide is tiny tall. Ask which formats are wanted; make one if the answer is open. In a 1080p film keep every line of text at 34 px or more; if you cannot read it in a sheet tile, a phone cannot.
|
|
383
395
|
|
|
384
396
|
|
|
385
397
|
<!-- ===== skills/pixi-effects/reference/recipes.md ===== -->
|
|
@@ -1489,6 +1501,31 @@ return [
|
|
|
1489
1501
|
];
|
|
1490
1502
|
```
|
|
1491
1503
|
|
|
1504
|
+
## One source, two formats (16:9 and 9:16), and a photo inside a region
|
|
1505
|
+
|
|
1506
|
+
Only when a vertical cut is wanted (ask first). It is not a crop of the wide one: write each scene as a function of a layout, switch with a query (`?f=9x16`), and render each format on its own: `npx pixi-effects check film.html --query f=9x16`, `npx pixi-effects render film.html --query f=9x16 -o film-9x16.mp4`. `photo()` fits a picture into any rectangle like CSS `cover` (scale from the image's own size, a mask for the rectangle); `scale: 'cover'` only fits the PARENT.
|
|
1507
|
+
|
|
1508
|
+
```js
|
|
1509
|
+
// @docs-only two-formats
|
|
1510
|
+
const PORTRAIT = new URLSearchParams(location.search).get('f') === '9x16';
|
|
1511
|
+
const W = PORTRAIT ? 1080 : 1920, H = PORTRAIT ? 1920 : 1080, MX = PORTRAIT ? 76 : 150; // margins: nothing important in the outer 5 %
|
|
1512
|
+
const IMG = { hero: [1920, 1280] }; // each photo's size (assets: [{ name: 'hero', src: '...' }])
|
|
1513
|
+
const photo = (key, x, y, w, h, duration) => {
|
|
1514
|
+
const cover = Math.max(w / IMG[key][0], h / IMG[key][1]);
|
|
1515
|
+
return { type: 'image', asset: key, duration,
|
|
1516
|
+
mask: { type: 'shape', shape: 'rect', width: w, height: h, initial: { x: x + w / 2, y: y + h / 2, fillColor: '#fff' } }, // the mask lives in the parent's coordinates
|
|
1517
|
+
initial: { x: x + w / 2, y: y + h / 2, anchorX: 0.5, anchorY: 0.5, scale: cover }, // image anchors go in `initial`
|
|
1518
|
+
keyframes: [{ at: 0, to: { scale: cover * 1.1 }, duration, ease: 'sine.inOut' }] }; // a slow push
|
|
1519
|
+
};
|
|
1520
|
+
const scene = { type: 'composition', name: 'hook', at: 0, duration: 5.5, width: W, height: H, sequences: [
|
|
1521
|
+
photo('hero', 0, 0, W, H, 5.5),
|
|
1522
|
+
{ type: 'text', text: 'Headline', initial: { x: MX, y: PORTRAIT ? 1150 : 620 }, style: { fontSize: PORTRAIT ? 100 : 112, fill: '#fff' } }, // wide: lower left; tall: lower third
|
|
1523
|
+
] };
|
|
1524
|
+
// movie.init({ width: W, height: H, composition: { sequences: [scene] } })
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
---
|
|
1528
|
+
|
|
1492
1529
|
## A batch of videos from a table (one video per row)
|
|
1493
1530
|
|
|
1494
1531
|
A batch of videos is a loop outside the video. The page reads what changes from its address (`new URLSearchParams(location.search)`), and `pixi-effects-render --query "name=Aiko&score=92"` opens it with those values. Names with spaces or non-Latin letters must be URL-encoded (`jq -sRr @uri` as below, or `encodeURIComponent` in Node). Each video starts its own browser, so N videos cost N start-ups: try one with `--draft` (half size, fast), then render the real ones. To make the pieces of one row differ in more than text, use the same values to pick colours or an image name.
|
|
@@ -1518,6 +1555,146 @@ done < table.csv
|
|
|
1518
1555
|
```
|
|
1519
1556
|
|
|
1520
1557
|
|
|
1558
|
+
<!-- ===== skills/pixi-effects/reference/direction.md ===== -->
|
|
1559
|
+
|
|
1560
|
+
# Directing a film (for any AI that makes video with code)
|
|
1561
|
+
|
|
1562
|
+
Read this before you write a composition for anything longer than a title card: a product film, a company introduction, a launch, a data story. It is about the decisions around the renderer, so it names no tool; `SKILL.md` has the pixi-effects commands.
|
|
1563
|
+
|
|
1564
|
+
A one-line prompt makes the model fill every missing decision with its safest default: large text in the middle, a gradient behind it, everything fading in, the logo last. The fix is not a cleverer prompt. It is to remove the missing decisions before anything is drawn, and to judge what was drawn with evidence.
|
|
1565
|
+
|
|
1566
|
+
## The five layers (do not collapse them into one step)
|
|
1567
|
+
|
|
1568
|
+
| Layer | The question | Where the answer lives |
|
|
1569
|
+
|---|---|---|
|
|
1570
|
+
| Director | What is the film trying to say, to whom? | `brief.md` |
|
|
1571
|
+
| Reference | What should it look and feel like? | `style-guide.md` |
|
|
1572
|
+
| Timeline | What changes at each beat, and why? | `shotlist.md` |
|
|
1573
|
+
| Renderer | How is every frame produced? | `src/` (seekable code) |
|
|
1574
|
+
| Critic | What failed, exactly where, and why? | `reviews/` |
|
|
1575
|
+
|
|
1576
|
+
## Keep the decisions in files, not in the chat
|
|
1577
|
+
|
|
1578
|
+
A film whose only record is a conversation is a lucky session. Put the decisions where the next run can read them:
|
|
1579
|
+
|
|
1580
|
+
```
|
|
1581
|
+
film/
|
|
1582
|
+
brief.md the one-sentence goal, the audience, the product facts, the real assets
|
|
1583
|
+
style-guide.md palette, type, motion rules, banned defaults
|
|
1584
|
+
shotlist.md beats, states, timestamps, purpose
|
|
1585
|
+
assets/ approved logos, photos, screens, footage, sound
|
|
1586
|
+
src/ the composition and its code
|
|
1587
|
+
reviews/ contact sheets and defect notes
|
|
1588
|
+
out/ exports
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
The next film swaps the brief and the assets and keeps the rest. A run that stops can resume from the last file it finished and say which one is missing; "the last command exited 0" is never the definition of done.
|
|
1592
|
+
|
|
1593
|
+
## brief.md: facts about the product, choices about the film
|
|
1594
|
+
|
|
1595
|
+
Separate what is true (it comes from the product) from what is chosen (it comes from you). The model may invent a camera move or a stronger opening. It may not invent a dashboard, a figure, a logo or a client.
|
|
1596
|
+
|
|
1597
|
+
```
|
|
1598
|
+
FILM
|
|
1599
|
+
One sentence: what the viewer should remember
|
|
1600
|
+
Audience: who it is for
|
|
1601
|
+
Duration: seconds
|
|
1602
|
+
Formats: ask the human; one format unless they name more (see "Formats" below)
|
|
1603
|
+
|
|
1604
|
+
ASSETS (paths; everything on screen comes from here)
|
|
1605
|
+
Logo · photos · screens · copy and numbers · brand type and colours · sound reference
|
|
1606
|
+
|
|
1607
|
+
VISUAL RULES
|
|
1608
|
+
Keep: traits taken from the reference
|
|
1609
|
+
Avoid: the clichés you will not use
|
|
1610
|
+
Never: invent a product screen, a metric, a claim or a logo
|
|
1611
|
+
|
|
1612
|
+
DELIVERABLES
|
|
1613
|
+
Final video, poster frame, contact sheets, source, an asset list, a note on what a human still has to check
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
**Collect the assets first, list them, and read the list before building.** If the brief needs an asset that is missing, stop and ask. A convincing fake (a drawn logo, an invented dashboard, a guessed number) is the one failure that cannot be repaired afterwards. Words and numbers on screen are the source's own; take colours and type from the source itself (a site's CSS, a brand sheet), never from an adjective such as "premium".
|
|
1617
|
+
|
|
1618
|
+
## style-guide.md: a visual grammar written down
|
|
1619
|
+
|
|
1620
|
+
Without one the model supplies its own, which is why unrelated one-prompt films look related. Give it a frame, a film or the real site, and make it write what it saw:
|
|
1621
|
+
|
|
1622
|
+
```
|
|
1623
|
+
REFERENCE ANALYSIS
|
|
1624
|
+
Palette: the actual colours (hex), not an adjective
|
|
1625
|
+
Typography: family, weight, scale
|
|
1626
|
+
Composition: where the eye goes first
|
|
1627
|
+
Pacing: average time between meaningful changes
|
|
1628
|
+
Motion: snap, glide, overshoot, cut or hold
|
|
1629
|
+
Texture: grain, paper, glass, flat
|
|
1630
|
+
DO NOT COPY: the reference's subjects, logos, copy or product imagery
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1633
|
+
The result is a style guide, not a collage of borrowed shots. Add a **motion rule per class of object**, because "motion with weight" is the difference between decoration and direction: small controls snap, large panels settle, the camera is almost invisible, headlines enter strongly and then hold long enough to read, one playful object is allowed to overshoot. If everything overshoots, nothing feels precise. After each move ask: does the viewer know where to look?
|
|
1634
|
+
|
|
1635
|
+
## shotlist.md: states and beats, not effects
|
|
1636
|
+
|
|
1637
|
+
"Zoom in, then morph, then add particles" lists activity. A plan says what the viewer knows at each moment:
|
|
1638
|
+
|
|
1639
|
+
```
|
|
1640
|
+
00-02 HOOK one image that earns attention
|
|
1641
|
+
02-05 PROBLEM the friction, shown, not described in a paragraph
|
|
1642
|
+
05-09 REVEAL the product enters through a real interaction
|
|
1643
|
+
09-13 PROOF one screen or number that demonstrates the claim
|
|
1644
|
+
13-16 CLOSE a clean final state and a readable call to action
|
|
1645
|
+
```
|
|
1646
|
+
|
|
1647
|
+
Each row has an entry state, an exit state and a reason to exist. For a UI film write the state list first (SEARCH → RESULT → DETAIL → ACTION → CONFIRMATION) so one component can change size, colour and content while staying recognisably the same object. The shot list is a contract: a shot nobody can justify is cut.
|
|
1648
|
+
|
|
1649
|
+
## Seekable and deterministic, or it cannot be reviewed
|
|
1650
|
+
|
|
1651
|
+
Frame 240 must render directly, without replaying frames 0 to 239: no hidden clock, no unseeded randomness, nothing that only works after eight seconds of running. Think of a frame as a query: `frame = render(time, shotlist, assets, style, seed)`. Then a revision is local (change one time value, one curve, one asset) and a reviewed frame stays reviewed. Two renders of the same moment must give the same pixels; check it.
|
|
1652
|
+
|
|
1653
|
+
## Sound is on the same timeline
|
|
1654
|
+
|
|
1655
|
+
Many AI films look finished with the sound off; then the click lands after the button, the cut misses the beat, the logo arrives before the music resolves. Write a beat grid and drive picture and sound from it: choose a tempo whose bar is a round number of seconds, put every cut on a bar line and every cue on the beat it belongs to. With a licensed or original track, measure its beats and cut against them. Test: close your eyes and listen; if the film has no shape without the picture, the sound is not finished.
|
|
1656
|
+
|
|
1657
|
+
## Review the rendered frames, not your intent
|
|
1658
|
+
|
|
1659
|
+
Do not start by watching a full export ten times, and do not describe what you meant to make. Ask the renderer for a contact sheet: one frame at every beat, a short strip around the fastest transitions, and a frame from the middle of each cut taken from the exported file. Look cold, then write the **three largest defects**, each with a **timestamp**, the **evidence** (what you see) and a **local fix**; patch only those, render those frames again. Ask for a second pair of eyes on the sheet whenever one is available: the author reads their own intent into it.
|
|
1660
|
+
|
|
1661
|
+
```
|
|
1662
|
+
[ ] text readable at phone size (about 34 px or more on a 1080p frame)
|
|
1663
|
+
[ ] nothing in the outer 5 % of the frame
|
|
1664
|
+
[ ] real assets only, none redrawn or invented
|
|
1665
|
+
[ ] one type and colour system across scenes
|
|
1666
|
+
[ ] no awkward half-transition frame
|
|
1667
|
+
[ ] cuts and sound cues land together
|
|
1668
|
+
[ ] the first two seconds are a real hook
|
|
1669
|
+
[ ] the last frame works as a poster
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
"The agent made a video" stops when the file exists. "The agent directed a video" stops when the evidence says the film works.
|
|
1673
|
+
|
|
1674
|
+
## Formats
|
|
1675
|
+
|
|
1676
|
+
A 16:9 film and a 9:16 cut are different compositions: the vertical one needs larger type, fewer things at once, another layout, sometimes a tighter story. Never crop the middle of the wide one. **Do not make a format nobody asked for:** ask which formats are wanted, make one if the answer is "whatever", and offer the others. When more than one is wanted, keep the same assets, timeline and states, define the layout per format, and look at a contact sheet of each: an export is correct because the composition survived the format, not because the encoder finished.
|
|
1677
|
+
|
|
1678
|
+
## Gates, and what to do when no human is there
|
|
1679
|
+
|
|
1680
|
+
Long runs need places to stop. With a human present:
|
|
1681
|
+
|
|
1682
|
+
1. approve the references and the asset list
|
|
1683
|
+
2. approve the style guide and the shot list
|
|
1684
|
+
3. look at representative stills
|
|
1685
|
+
4. look at a rough cut and its contact sheet
|
|
1686
|
+
5. repair the three highest-impact defects
|
|
1687
|
+
6. check sound, formats and deliverables
|
|
1688
|
+
|
|
1689
|
+
Between gates the agent may work for hours; it never makes an irreversible brand decision (logo, claim, number) for the human, and a missing real asset is a blocker, not an invitation to invent one. If the reference is unclear, the right output is a question or one small test frame, not nine hundred polished wrong ones. With nobody to ask, record each decision you took as a "ruling" in the review notes, with what it costs if wrong, and finish with a short note of what still needs a human.
|
|
1690
|
+
|
|
1691
|
+
## The loop
|
|
1692
|
+
|
|
1693
|
+
PROMPT → CLIP is a demo. BRIEF → SYSTEM → FILM → REVIEW → BETTER SYSTEM is a studio: every stage leaves evidence the next one can use, and the tenth film can be better than the first.
|
|
1694
|
+
|
|
1695
|
+
*The shape of this guide follows a published breakdown of building a code-rendered video studio around an AI model ("Motion Engineering", @0xwhrrari, September 2026); the wording and the checklist are rewritten for this library's users.*
|
|
1696
|
+
|
|
1697
|
+
|
|
1521
1698
|
<!-- ===== docs/dsl.md ===== -->
|
|
1522
1699
|
|
|
1523
1700
|
# DSL Reference
|
package/llms.txt
CHANGED
|
@@ -18,6 +18,7 @@ Rules that cause most failures (details in the skill and pitfalls):
|
|
|
18
18
|
- [Cheatsheet](https://raw.githubusercontent.com/yjmtmtk/pixi-effects/main/skills/pixi-effects/reference/cheatsheet.md): every layer type, prop, default and convention on one page
|
|
19
19
|
- [Recipes](https://raw.githubusercontent.com/yjmtmtk/pixi-effects/main/skills/pixi-effects/reference/recipes.md): tested building blocks (kinetic type, lower-third, count-up, bar chart, 2.5D title, camera orbit, slideshow with transitions, sound effects without files, music written as text, three.js, a presentation deck, visuals that follow music)
|
|
20
20
|
- [Pitfalls](https://raw.githubusercontent.com/yjmtmtk/pixi-effects/main/skills/pixi-effects/reference/pitfalls.md): real mistakes made by AI authors, with fixes
|
|
21
|
+
- [Directing a film](https://raw.githubusercontent.com/yjmtmtk/pixi-effects/main/skills/pixi-effects/reference/direction.md): for a product film or company intro, before building: brief, style guide, shot list, assets rule, review protocol (any renderer)
|
|
21
22
|
- [Starter template](https://raw.githubusercontent.com/yjmtmtk/pixi-effects/main/skills/pixi-effects/template.html): copy this file to begin
|
|
22
23
|
|
|
23
24
|
## Reference
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ name: pixi-effects
|
|
|
3
3
|
description: Use when asked to make, animate, preview or export a video, motion graphics, an animated title, a lower third, kinetic type, a promo, a slideshow with transitions, an animated chart or data story, a social clip, a 2.5D / depth scene, or music and sound for a video, written as code in JavaScript or HTML. pixi-effects is a JS library where a video is a plain-object composition (text, shape, image, video, audio and file-free sfx / music, camera, light and shader layers with keyframes) that plays in the browser, is checked by a tool the agent can run, and exports MP4 / WebM / MOV with no server. Not for a project that already uses another video tool (Remotion, Motion Canvas, ffmpeg); follow that tool instead.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
> Written for pixi-effects 0.28.
|
|
6
|
+
> Written for pixi-effects 0.28.1. Update this skill with `npx skills update`; the newest docs are at https://yjmtmtk.github.io/pixi-effects/
|
|
7
7
|
|
|
8
8
|
# pixi-effects — write a video as data
|
|
9
9
|
|
|
@@ -26,6 +26,15 @@ You describe a video as a tree of plain objects; the library plays it in a canva
|
|
|
26
26
|
From a browser tool the result is a `data:` URL string: `agent-browser eval "movie.contactSheet({ count: 6, as: 'dataURL' })" | python3 scripts/save-image.py /absolute/sheet.png`, then open the PNG. Sheet tiles are small (~480 px): use `snapshot` for detail. `inspect` output is long on busy scenes: pass `{ layers: 'none' }` and read `issues` first. Give layers a `name` so inspect paths are readable. A moving ticker is not flagged as cut off.
|
|
27
27
|
6. **Iterate** on what you saw (clipped text, collisions, wrong timing). Fast motion looks choppy: add `motionBlur: true` to `movie.init` (render, snapshot and contact sheet then show a film-style blur; renders take ~8× longer). Then export: `const blob = await movie.render({ format: 'mp4' })` (about real time; `movie.on('progress', …)` reports 0–100). **While you iterate, do not export the whole movie:** `check --no-export --at <the moment you changed>` takes seconds (3 to 10 s on the gallery pieces: most of it is loading the page and measuring the sound); to see motion, `render({ range: [from, to] })` / `pixi-effects-render --range 10:15` / `--scene name` exports only that part (picture and sound); `draft: true` / `--draft` is half size, low quality and no motion blur: a much smaller file (a piece that asks for motion blur renders much faster as a draft: 4 s of `hanabi-night` took 14.0 s, and 8.2 s as a draft, about 7 s of either being the browser's start-up), but the drawing itself is not faster. Export the whole movie once, at the end.
|
|
28
28
|
|
|
29
|
+
## For a film (more than a title card): direct it first
|
|
30
|
+
|
|
31
|
+
**Read `reference/direction.md` before writing a composition for a product film, a company introduction, a launch or a data story.** It is renderer-neutral: write `brief.md` (the one sentence to remember, the REAL assets with paths, what must never be invented; if a needed asset is missing, stop and ask), `style-guide.md` (palette and type taken from the real source, a motion rule per class of object) and `shotlist.md` (a row per beat with entry and exit state) next to the page; then build, then review the rendered frames cold. What is specific to this library:
|
|
32
|
+
|
|
33
|
+
- **Time and sound:** pick a tempo whose bar is a round number of seconds (96 bpm: 2.5 s; 120 bpm: 2 s), put every cut on a bar line and every sfx on its beat. `npx pixi-effects check` prints a `music` read-back (bars per track, what starts on which beat, the drum span): verify the sound with it.
|
|
34
|
+
- **Review:** `check --at 3.5,title@end,50%` writes the contact sheet and single frames; look at mid-transition frames of the exported file too. Frames are seekable and deterministic here: render the same range twice and compare the frames if you doubt it.
|
|
35
|
+
- **Formats:** make the formats the human asked for, one if they did not say. When a vertical cut is wanted it is its own composition: one source, a layout function, `?f=9x16` (recipe `two-formats`); `check` and `render` take `--query f=9x16`.
|
|
36
|
+
- Fit a picture into a rectangle with the `photo()` helper of that recipe (`scale: 'cover'` fits the PARENT only); designed pictures (posters, flyers, screenshots) are shown whole, never cropped.
|
|
37
|
+
|
|
29
38
|
## The rules that cause most failures
|
|
30
39
|
|
|
31
40
|
- **Keyframe `at` starts at 0 when the layer appears** (negative = back from the layer's end). A layer's own `at` and a transition's `at` are composition time.
|
|
@@ -53,6 +62,7 @@ Centred text must be positioned by `anchorX/anchorY: 0.5`; estimate text width a
|
|
|
53
62
|
- `reference/cheatsheet.md` — every layer type, prop, default and rule on one page.
|
|
54
63
|
- `reference/recipes.md` — tested building blocks: slam type, lower-third, marquee, count-up, bar chart, 2.5D title, camera orbit, slideshow with transitions + music, looping, particles, gradients/vignette, three.js metal.
|
|
55
64
|
- `reference/pitfalls.md` — the full list of real mistakes, with status.
|
|
65
|
+
- `reference/direction.md` — how to direct a film (any renderer): brief, style guide, shot list, assets rule, sound on the beat grid, review protocol, formats, gates.
|
|
56
66
|
- `npx pixi-effects check` — the one-command review (see Workflow step 5).
|
|
57
67
|
- `template.html` — the starting file. (It loads the released library from a CDN, so it works from any folder.)
|
|
58
68
|
- `scripts/save-image.py` — save a `dataURL` result (contact sheet / snapshot) to a PNG.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Directing a film (for any AI that makes video with code)
|
|
2
|
+
|
|
3
|
+
Read this before you write a composition for anything longer than a title card: a product film, a company introduction, a launch, a data story. It is about the decisions around the renderer, so it names no tool; `SKILL.md` has the pixi-effects commands.
|
|
4
|
+
|
|
5
|
+
A one-line prompt makes the model fill every missing decision with its safest default: large text in the middle, a gradient behind it, everything fading in, the logo last. The fix is not a cleverer prompt. It is to remove the missing decisions before anything is drawn, and to judge what was drawn with evidence.
|
|
6
|
+
|
|
7
|
+
## The five layers (do not collapse them into one step)
|
|
8
|
+
|
|
9
|
+
| Layer | The question | Where the answer lives |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Director | What is the film trying to say, to whom? | `brief.md` |
|
|
12
|
+
| Reference | What should it look and feel like? | `style-guide.md` |
|
|
13
|
+
| Timeline | What changes at each beat, and why? | `shotlist.md` |
|
|
14
|
+
| Renderer | How is every frame produced? | `src/` (seekable code) |
|
|
15
|
+
| Critic | What failed, exactly where, and why? | `reviews/` |
|
|
16
|
+
|
|
17
|
+
## Keep the decisions in files, not in the chat
|
|
18
|
+
|
|
19
|
+
A film whose only record is a conversation is a lucky session. Put the decisions where the next run can read them:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
film/
|
|
23
|
+
brief.md the one-sentence goal, the audience, the product facts, the real assets
|
|
24
|
+
style-guide.md palette, type, motion rules, banned defaults
|
|
25
|
+
shotlist.md beats, states, timestamps, purpose
|
|
26
|
+
assets/ approved logos, photos, screens, footage, sound
|
|
27
|
+
src/ the composition and its code
|
|
28
|
+
reviews/ contact sheets and defect notes
|
|
29
|
+
out/ exports
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The next film swaps the brief and the assets and keeps the rest. A run that stops can resume from the last file it finished and say which one is missing; "the last command exited 0" is never the definition of done.
|
|
33
|
+
|
|
34
|
+
## brief.md: facts about the product, choices about the film
|
|
35
|
+
|
|
36
|
+
Separate what is true (it comes from the product) from what is chosen (it comes from you). The model may invent a camera move or a stronger opening. It may not invent a dashboard, a figure, a logo or a client.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
FILM
|
|
40
|
+
One sentence: what the viewer should remember
|
|
41
|
+
Audience: who it is for
|
|
42
|
+
Duration: seconds
|
|
43
|
+
Formats: ask the human; one format unless they name more (see "Formats" below)
|
|
44
|
+
|
|
45
|
+
ASSETS (paths; everything on screen comes from here)
|
|
46
|
+
Logo · photos · screens · copy and numbers · brand type and colours · sound reference
|
|
47
|
+
|
|
48
|
+
VISUAL RULES
|
|
49
|
+
Keep: traits taken from the reference
|
|
50
|
+
Avoid: the clichés you will not use
|
|
51
|
+
Never: invent a product screen, a metric, a claim or a logo
|
|
52
|
+
|
|
53
|
+
DELIVERABLES
|
|
54
|
+
Final video, poster frame, contact sheets, source, an asset list, a note on what a human still has to check
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Collect the assets first, list them, and read the list before building.** If the brief needs an asset that is missing, stop and ask. A convincing fake (a drawn logo, an invented dashboard, a guessed number) is the one failure that cannot be repaired afterwards. Words and numbers on screen are the source's own; take colours and type from the source itself (a site's CSS, a brand sheet), never from an adjective such as "premium".
|
|
58
|
+
|
|
59
|
+
## style-guide.md: a visual grammar written down
|
|
60
|
+
|
|
61
|
+
Without one the model supplies its own, which is why unrelated one-prompt films look related. Give it a frame, a film or the real site, and make it write what it saw:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
REFERENCE ANALYSIS
|
|
65
|
+
Palette: the actual colours (hex), not an adjective
|
|
66
|
+
Typography: family, weight, scale
|
|
67
|
+
Composition: where the eye goes first
|
|
68
|
+
Pacing: average time between meaningful changes
|
|
69
|
+
Motion: snap, glide, overshoot, cut or hold
|
|
70
|
+
Texture: grain, paper, glass, flat
|
|
71
|
+
DO NOT COPY: the reference's subjects, logos, copy or product imagery
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The result is a style guide, not a collage of borrowed shots. Add a **motion rule per class of object**, because "motion with weight" is the difference between decoration and direction: small controls snap, large panels settle, the camera is almost invisible, headlines enter strongly and then hold long enough to read, one playful object is allowed to overshoot. If everything overshoots, nothing feels precise. After each move ask: does the viewer know where to look?
|
|
75
|
+
|
|
76
|
+
## shotlist.md: states and beats, not effects
|
|
77
|
+
|
|
78
|
+
"Zoom in, then morph, then add particles" lists activity. A plan says what the viewer knows at each moment:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
00-02 HOOK one image that earns attention
|
|
82
|
+
02-05 PROBLEM the friction, shown, not described in a paragraph
|
|
83
|
+
05-09 REVEAL the product enters through a real interaction
|
|
84
|
+
09-13 PROOF one screen or number that demonstrates the claim
|
|
85
|
+
13-16 CLOSE a clean final state and a readable call to action
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Each row has an entry state, an exit state and a reason to exist. For a UI film write the state list first (SEARCH → RESULT → DETAIL → ACTION → CONFIRMATION) so one component can change size, colour and content while staying recognisably the same object. The shot list is a contract: a shot nobody can justify is cut.
|
|
89
|
+
|
|
90
|
+
## Seekable and deterministic, or it cannot be reviewed
|
|
91
|
+
|
|
92
|
+
Frame 240 must render directly, without replaying frames 0 to 239: no hidden clock, no unseeded randomness, nothing that only works after eight seconds of running. Think of a frame as a query: `frame = render(time, shotlist, assets, style, seed)`. Then a revision is local (change one time value, one curve, one asset) and a reviewed frame stays reviewed. Two renders of the same moment must give the same pixels; check it.
|
|
93
|
+
|
|
94
|
+
## Sound is on the same timeline
|
|
95
|
+
|
|
96
|
+
Many AI films look finished with the sound off; then the click lands after the button, the cut misses the beat, the logo arrives before the music resolves. Write a beat grid and drive picture and sound from it: choose a tempo whose bar is a round number of seconds, put every cut on a bar line and every cue on the beat it belongs to. With a licensed or original track, measure its beats and cut against them. Test: close your eyes and listen; if the film has no shape without the picture, the sound is not finished.
|
|
97
|
+
|
|
98
|
+
## Review the rendered frames, not your intent
|
|
99
|
+
|
|
100
|
+
Do not start by watching a full export ten times, and do not describe what you meant to make. Ask the renderer for a contact sheet: one frame at every beat, a short strip around the fastest transitions, and a frame from the middle of each cut taken from the exported file. Look cold, then write the **three largest defects**, each with a **timestamp**, the **evidence** (what you see) and a **local fix**; patch only those, render those frames again. Ask for a second pair of eyes on the sheet whenever one is available: the author reads their own intent into it.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
[ ] text readable at phone size (about 34 px or more on a 1080p frame)
|
|
104
|
+
[ ] nothing in the outer 5 % of the frame
|
|
105
|
+
[ ] real assets only, none redrawn or invented
|
|
106
|
+
[ ] one type and colour system across scenes
|
|
107
|
+
[ ] no awkward half-transition frame
|
|
108
|
+
[ ] cuts and sound cues land together
|
|
109
|
+
[ ] the first two seconds are a real hook
|
|
110
|
+
[ ] the last frame works as a poster
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
"The agent made a video" stops when the file exists. "The agent directed a video" stops when the evidence says the film works.
|
|
114
|
+
|
|
115
|
+
## Formats
|
|
116
|
+
|
|
117
|
+
A 16:9 film and a 9:16 cut are different compositions: the vertical one needs larger type, fewer things at once, another layout, sometimes a tighter story. Never crop the middle of the wide one. **Do not make a format nobody asked for:** ask which formats are wanted, make one if the answer is "whatever", and offer the others. When more than one is wanted, keep the same assets, timeline and states, define the layout per format, and look at a contact sheet of each: an export is correct because the composition survived the format, not because the encoder finished.
|
|
118
|
+
|
|
119
|
+
## Gates, and what to do when no human is there
|
|
120
|
+
|
|
121
|
+
Long runs need places to stop. With a human present:
|
|
122
|
+
|
|
123
|
+
1. approve the references and the asset list
|
|
124
|
+
2. approve the style guide and the shot list
|
|
125
|
+
3. look at representative stills
|
|
126
|
+
4. look at a rough cut and its contact sheet
|
|
127
|
+
5. repair the three highest-impact defects
|
|
128
|
+
6. check sound, formats and deliverables
|
|
129
|
+
|
|
130
|
+
Between gates the agent may work for hours; it never makes an irreversible brand decision (logo, claim, number) for the human, and a missing real asset is a blocker, not an invitation to invent one. If the reference is unclear, the right output is a question or one small test frame, not nine hundred polished wrong ones. With nobody to ask, record each decision you took as a "ruling" in the review notes, with what it costs if wrong, and finish with a short note of what still needs a human.
|
|
131
|
+
|
|
132
|
+
## The loop
|
|
133
|
+
|
|
134
|
+
PROMPT → CLIP is a demo. BRIEF → SYSTEM → FILM → REVIEW → BETTER SYSTEM is a studio: every stage leaves evidence the next one can use, and the tenth film can be better than the first.
|
|
135
|
+
|
|
136
|
+
*The shape of this guide follows a published breakdown of building a code-rendered video studio around an AI model ("Motion Engineering", @0xwhrrari, September 2026); the wording and the checklist are rewritten for this library's users.*
|
|
@@ -128,3 +128,5 @@ A good habit that catches most of these: after `init`, read `window.__logs` (see
|
|
|
128
128
|
98. **A matte layer needs a fill.** A named matte (`mask: 'glass'`) that is a shape with no `fillColor` / `fillGradient` (or a text with no fill) cuts everything away and nothing warns: the layers it should show simply vanish. Give the matte a fill (white for `alpha`, a gradient for `luma`).
|
|
129
129
|
99. **In a `music` score a capital letter is a chord and a lowercase one a note.** `G7` is G dominant seventh, `C5` a power chord, `C6` a sixth chord; `g7`, `c5`, `c6` are notes (octave 7 is a very high note: it used to be what `G7` meant, silently). A bare note in capitals (`Bb2`) is refused with the lowercase spelling (`bb2`); inside brackets (`[C4 E4 G4]`) any case is a note. An unknown chord kind suggests the nearest (`Cmin7` → `Cm7`, `Csus` → `Csus4`, `CM7` → `Cmaj7`).
|
|
130
130
|
100. **Read the score back before you trust it.** `check` prints a `music` block: every track's length in bars (a track that ends early or has a short bar is named), the names that start in each bar with their beat (`Am(2)` starts on beat 2; no mark = the downbeat; the first four names of a bar are shown, `musicEvents()` lists everything), and the drum span. Count bars by the read-back, not by hand: a bar of 3 beats in a score with no `meter` is shown as bars of 4, so set `meter: 3` for a waltz. Drums repeat by themselves and `from` / `to` are beats; `swing` only moves notes that start off the beat, so a comp on beats 2 and 4 stays straight.
|
|
131
|
+
101. **A film built from one adjective looks like every other one.** Read `reference/direction.md` and write `brief.md` / `style-guide.md` / `shotlist.md` first: real assets with paths, the one sentence to remember, a row per beat with entry and exit state. If a real asset is missing, ask: a drawn fake (a logo, a dashboard, a figure) is the failure that matters. Judge the contact sheet cold: three defects, each with a timestamp, evidence and a local fix.
|
|
132
|
+
102. **A vertical cut is a second composition, not a crop, and only when someone asked for it.** One source, a layout function, `?f=9x16`; `check` and `render` take `--query f=9x16` (recipe `two-formats`). Look at a contact sheet of each format: type that fits wide is tiny tall. Ask which formats are wanted; make one if the answer is open. In a 1080p film keep every line of text at 34 px or more; if you cannot read it in a sheet tile, a phone cannot.
|
|
@@ -1103,6 +1103,31 @@ return [
|
|
|
1103
1103
|
];
|
|
1104
1104
|
```
|
|
1105
1105
|
|
|
1106
|
+
## One source, two formats (16:9 and 9:16), and a photo inside a region
|
|
1107
|
+
|
|
1108
|
+
Only when a vertical cut is wanted (ask first). It is not a crop of the wide one: write each scene as a function of a layout, switch with a query (`?f=9x16`), and render each format on its own: `npx pixi-effects check film.html --query f=9x16`, `npx pixi-effects render film.html --query f=9x16 -o film-9x16.mp4`. `photo()` fits a picture into any rectangle like CSS `cover` (scale from the image's own size, a mask for the rectangle); `scale: 'cover'` only fits the PARENT.
|
|
1109
|
+
|
|
1110
|
+
```js
|
|
1111
|
+
// @docs-only two-formats
|
|
1112
|
+
const PORTRAIT = new URLSearchParams(location.search).get('f') === '9x16';
|
|
1113
|
+
const W = PORTRAIT ? 1080 : 1920, H = PORTRAIT ? 1920 : 1080, MX = PORTRAIT ? 76 : 150; // margins: nothing important in the outer 5 %
|
|
1114
|
+
const IMG = { hero: [1920, 1280] }; // each photo's size (assets: [{ name: 'hero', src: '...' }])
|
|
1115
|
+
const photo = (key, x, y, w, h, duration) => {
|
|
1116
|
+
const cover = Math.max(w / IMG[key][0], h / IMG[key][1]);
|
|
1117
|
+
return { type: 'image', asset: key, duration,
|
|
1118
|
+
mask: { type: 'shape', shape: 'rect', width: w, height: h, initial: { x: x + w / 2, y: y + h / 2, fillColor: '#fff' } }, // the mask lives in the parent's coordinates
|
|
1119
|
+
initial: { x: x + w / 2, y: y + h / 2, anchorX: 0.5, anchorY: 0.5, scale: cover }, // image anchors go in `initial`
|
|
1120
|
+
keyframes: [{ at: 0, to: { scale: cover * 1.1 }, duration, ease: 'sine.inOut' }] }; // a slow push
|
|
1121
|
+
};
|
|
1122
|
+
const scene = { type: 'composition', name: 'hook', at: 0, duration: 5.5, width: W, height: H, sequences: [
|
|
1123
|
+
photo('hero', 0, 0, W, H, 5.5),
|
|
1124
|
+
{ type: 'text', text: 'Headline', initial: { x: MX, y: PORTRAIT ? 1150 : 620 }, style: { fontSize: PORTRAIT ? 100 : 112, fill: '#fff' } }, // wide: lower left; tall: lower third
|
|
1125
|
+
] };
|
|
1126
|
+
// movie.init({ width: W, height: H, composition: { sequences: [scene] } })
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
---
|
|
1130
|
+
|
|
1106
1131
|
## A batch of videos from a table (one video per row)
|
|
1107
1132
|
|
|
1108
1133
|
A batch of videos is a loop outside the video. The page reads what changes from its address (`new URLSearchParams(location.search)`), and `pixi-effects-render --query "name=Aiko&score=92"` opens it with those values. Names with spaces or non-Latin letters must be URL-encoded (`jq -sRr @uri` as below, or `encodeURIComponent` in Node). Each video starts its own browser, so N videos cost N start-ups: try one with `--draft` (half size, fast), then render the real ones. To make the pieces of one row differ in more than text, use the same values to pick colours or an image name.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>pixi-effects video</title>
|
|
7
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
7
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/loader.css" /> <!-- the loader: HTML + CSS only, so it is on screen at once and keeps moving while the page builds the video -->
|
|
8
8
|
<style>
|
|
9
9
|
body { background: #0d1220; margin: 0; padding: 16px; }
|
|
10
10
|
.stage { position: relative; width: min(960px, 100%); } /* the player and the loader both sit inside this box */
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"imports": {
|
|
38
38
|
"pixi.js": "https://esm.sh/pixi.js@8.22.0?bundle-deps",
|
|
39
39
|
"mediabunny": "https://esm.sh/mediabunny",
|
|
40
|
-
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
41
|
-
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
42
|
-
"pixi-effects/presenter": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
43
|
-
"pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
40
|
+
"pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/index.js",
|
|
41
|
+
"pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/Controller.js",
|
|
42
|
+
"pixi-effects/presenter": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/Presenter.js",
|
|
43
|
+
"pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/three.js",
|
|
44
44
|
"pixi-filters": "https://esm.sh/pixi-filters@6.1.5?external=pixi.js",
|
|
45
45
|
"three": "https://esm.sh/three@0.178.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
</script>
|
|
49
|
-
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.
|
|
49
|
+
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.28.1/dist/index.js" /> <!-- after the import map: the library downloads while the page is parsed -->
|
|
50
50
|
|
|
51
51
|
<script type="module">
|
|
52
52
|
import { Movie, kenBurns, withFade } from 'pixi-effects';
|