Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
Versions follow `plugins/beanfx/.claude-plugin/plugin.json`. A release is a tag `v<version>` on `main`; see
`CONTRIBUTING.md`.

## 2.5.0

Shorter runs for long, caster to target effects (2026-11-24).

- `Layer::Behind`: the part of the effect behind the character (a ring at the back, a halo). The sheet is `Behind`
then `Effect` on one canvas, the same bytes as drawing both in `Effect`; the previews draw it under the caster.
- `Spec.parts` (`dr::Part`) and `Effect::part`: the runner writes, checks and lists cast, travel and impact sheets
beside the aura parts. The default `part` crops the sheet, so only a part on its own clock needs code. A
`parts` object in `Spec.extra` now joins the runner's parts instead of replacing the aura parts.
- `cargo run --release -q -- quick`: the sheet's checks and light measure only, no previews, gif, parts, page or
reseeds, for the fix loop.
- The gate without Jev lists each knob's `stated` and `applies` questions (`questions`), so the model decides from
one output and opens only the files of the knobs it asks, instead of reading all 18.
- `SKILL.md`: look at the risky frames (hits, the widest, the last) before the first full run, and use `quick` while
fixing. New snapshot case `halo`; every earlier case is unchanged.

## 2.4.0

The phases knob: how a cast's time splits, with timing recommendations (2026-11-24).
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ node plugins/beanfx/skills/beanfx/tools/layers.mjs <id> --out <draft>/src --pixe
- Each brief knob is a file in the skill's `knobs/` (role, view, size, timing, phases, loop, shape, style, palette, glow,
clarity, density, states, caster, combo, placement, aura, sound). The gate, `<project>/.beanfx/bin/beanfx gate
"<prompt>"`, says which knobs the prompt leaves open. It asks Jev (an optional prompt classifier, run through
`python3` only when its client is installed) in one call; without it the model decides from the files. Each open
`python3` only when its client is installed) in one call; without it the gate lists each knob's two frontmatter questions and the model decides from them, opening only the files of the knobs it asks. Each open
knob is one AskUserQuestion question, and no draft file is written before the brief is in the reply.
- Tests: `cd S/kit && cargo test --locked` (unit and integration tests of the crate, including the gate, the
export, the facing fields and the preview page check), and `node S/tests/test_runtime.mjs` (the browser
Expand Down
2 changes: 1 addition & 1 deletion plugins/beanfx/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beanfx",
"version": "2.4.0",
"version": "2.5.0",
"description": "Pixel-art effects drawn as code: /beanfx designs an effect from words or a reference image and exports a sprite sheet, JSON and gifs.",
"author": {
"name": "bien"
Expand Down
19 changes: 14 additions & 5 deletions plugins/beanfx/skills/beanfx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ PROMPT
lists the knobs to ask, in order; `skip` the ones the prompt fixes or that do not apply. Follow it. Override
one only when the owner's words plainly contradict it (the prompt gives "64x48" and `size` is in `ask`), and
say so in one line.
- `"source": "model"`: the default without Jev (or with `BEANFX_GATE=model`). Read each knob file's "Fixed when"
and "Applies" and decide yourself. A knob counts as fixed only when the prompt states it or an image shows it;
- `"source": "model"`: the default without Jev (or with `BEANFX_GATE=model`). Decide from the `questions` list in
the output, each knob's `stated` and `applies` question, without opening the knob files: skip a knob whose
`applies` is no or whose `stated` is yes; open the files only of the knobs you ask. A knob counts as fixed only when the prompt states it or an image shows it;
the subject's colour or name alone fixes neither palette nor shape.

**Ask, one question per knob.** For each knob in `ask`, read its file and build the question from its "Ask" part:
Expand Down Expand Up @@ -134,7 +135,8 @@ upgrades.
main element, a look, then the other elements with Edit.

```
cd drafts/<name> && cargo run --release -q # every output and check; exit 1 a check, 2 an error
cd drafts/<name> && cargo run --release -q -- quick # the sheet's checks only, seconds: use it while fixing
cargo run --release -q # every output and check; exit 1 a check, 2 an error
cargo run --release -q -- look <frames> # just those frames at 3x, in a second
```

Expand Down Expand Up @@ -170,11 +172,18 @@ first pass, so the cover lands in its row.
character (`rig`) and the target dummy go into the previews only, and the binding goes into the JSON. Read
`caster.md` when the brief has a caster; time blows on the character's contact frames and take slash arcs from
the rig, never from a guess. Hits, poses, the target, directions and caster to target parts are fields of the
`Spec` (`export.md`).
`Spec` (`export.md`): the cast, travel and impact sheets are `Spec.parts`, and what sits behind the character (a
ring at the back, a halo) is drawn in `Layer::Behind`, so the preview shows it behind the body.

## 3. Run, and fix only what fails

Run the draft. Each run prints its checks and the light measure and exits 1 when a check fails.
Run the draft. Each run prints its checks and the light measure and exits 1 when a check fails. A full run
renders every frame many times (previews, aura and parts, three reseeds, the gif), so its cost grows with frames:

- Before the first full run, `look` the risky frames once (each hit and its sparks, the widest frame, the last
frame): an edge cut or an empty end shows there in a second.
- While fixing, rerun with `quick` (the sheet's checks and light measure only); go back to the full run for the
parts, the reseeds and the outputs. Run each command once per fix, never twice to filter its output.

- Fix every check line (edge, empty frame, pop-off, loop seam, seed, framing, budget, act) and every error, then
rerun. `kit/DRAFTS.md` says what each check means.
Expand Down
4 changes: 3 additions & 1 deletion plugins/beanfx/skills/beanfx/caster.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Casters: the mockup caster and a game character

Read only when the brief has a caster (`knobs/caster.md`). Signatures are in `kit/API.md`. On the runner, set
`Spec.caster_foot` (size the cell so the caster and the foe both fit) and draw the caster in `Layer::Caster` with `cv.caster(..)`; the raw `cs` calls below are what it
`Spec.caster_foot` (size the cell so the caster and the foe both fit) and draw the caster in `Layer::Caster` with `cv.caster(..)`; what sits behind the character (a ring of
suns at the back, a halo) goes in `Layer::Behind`, which ships in the sheet and draws under the caster in the
previews (mark the part `layer: behind`); the raw `cs` calls below are what it
runs, and a draft writes them only in its own `run()`.

**Mockup caster** (only when the brief says yes): `cs` (`kit/src/cs.rs`) draws a golden robed silhouette with no face,
Expand Down
4 changes: 3 additions & 1 deletion plugins/beanfx/skills/beanfx/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ the fields with `fc` (`kit/src/fc.rs`) and pass the whole meta through `fc::chec
pass the rows to `ex::write`, which lays heading k after heading k - 1 and tags each: row k faces `tau * k / n`, y down (0 east, n/4 south); the JSON tells the engine
`row = round(atan2(dy, dx) / tau * n) mod n`.
- **Caster to target** (a projectile that lands, a beam, a strike on a foe): the distance between them changes in
play, so never only bake it into one sheet. Export three parts in `parts`, each from `fc::part(sheet, w, h, frames, fps, pivot, looped, anchor, extra)`: `cast`
play, so never only bake it into one sheet. Export three parts in `parts` (on the runner: `Spec.parts` entries, drawn by `Effect::part`; the default
crops the sheet, so only a travel loop or an impact on its own clock overrides it; in a draft's own `run()`:
`fc::part(sheet, w, h, frames, fps, pivot, looped, anchor, extra)`): `cast`
(anchor caster, one-shot, the charge and release), `travel` (anchor travel, a loop the engine moves at `speed`
px/s from the caster to the target, with its own direction rows for top-down or `facing` for side) and
`impact` (anchor target, one-shot, the hit and dissolve). Keep the joined preview sheet and gif too, for review. When the owner wants one fixed-range sheet, record `target` and its mirror and say the range is
Expand Down
19 changes: 14 additions & 5 deletions plugins/beanfx/skills/beanfx/kit/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,33 @@ Read these before opening the kit source. `P = [f64; 2]` world px (y down), `Rgb

### dr

- `dr::main(fx: &(dyn Effect + Sync), env!("CARGO_MANIFEST_DIR")) -> ExitCode`. Args: none (full run), `look [frames]`
- `dr::main(fx: &(dyn Effect + Sync), env!("CARGO_MANIFEST_DIR")) -> ExitCode`. Args: none (full run), `quick` (the sheet's
own checks and light measure only: no previews, gif, parts, page or reseeds; seconds on a long sheet), `look [frames]`
(out/look.png at 3x on dark, look_1x.png), `glow` (out/glow_takes.png at gains 0.6, 1.0, 1.3), `bench <id>`
(out/bench.png against out/ref from tools/layers.mjs).
- `trait Effect { fn spec(&self) -> Spec; fn draw(&self, cv: &mut Canvas, f: usize, seed: u64, layer: Layer) -> Result<(), String>; }`.
- `trait Effect { fn spec(&self) -> Spec; fn draw(&self, cv: &mut Canvas, f: usize, seed: u64, layer: Layer) -> Result<(), String>;
fn part(&self, cv: &mut Canvas, key: &str, f: usize, seed: u64) -> Result<(), String> { /* Behind, then Effect */ } }`.
`part` draws frame f of a `Spec.parts` entry on a canvas placed at its origin (world px); the default crops the
sheet's layers, so override it only for a part with its own clock (a travel loop, an impact from contact).
`draw` is pure in (f, seed, layer); return `Ok(())` untouched for a layer the effect lacks. Pass kit errors on with
`?` (an `Err` stops the run with exit 2), never `let _ =`, which hides a missing caster.
- The runner draws frames on every core (`dr::par`), so `Fx` must be `Sync`: a plain struct is; keep a cache in a
`LazyLock` or `thread_local!`, never a `RefCell` field. The output is the same at any thread count;
`BEANFX_THREADS=1` runs in order on one thread (for a debugger or a print trace).
- `Layer::{Effect, Caster, AuraBack, AuraFront}`. The sheet is `Effect`. Previews stack AuraBack, Caster, AuraFront,
Effect over the dummy. Aura parts are cut round `caster_foot` with `Canvas::at`, so draw in world px.
- `Layer::{Effect, Caster, AuraBack, AuraFront, Behind}`. The sheet is `Behind` then `Effect` on one canvas. Previews
stack AuraBack, Behind, Caster, AuraFront, Effect over the dummy: draw what sits behind the character (a ring at the
back, a halo, the far side of a swirl) in `Behind`, so the preview matches the game, and mark that part's `layer`
behind. A `match` on `layer` needs a `Behind` arm or `_ => {}`. Aura parts are cut round `caster_foot` with `Canvas::at`, so draw in world px.
- `Spec::new(name, w, h, n, fps)`; fields and defaults: `pivot` [w/2, h/2], `seed` 7, `looped` false, `hold` false,
`view` "side", `dirs: fc::Meta` (`facing` "east" or "west" for one row), `glow` "medium", `clarity` "clear", `light_ramp: Vec<String>` (dark to white),
`steps: Option<lt::Steps>` (hard retro light, `Some(lt::Steps::default())`; also caps colours at 48 a frame, so take
every colour from a ramp tone at a few fixed alphas, never a per-pixel blend), `edge_fade` 0.0 px, `hits: Vec<Value>`
(`ex::hit`), `states: Vec<(String, [i64; 2])>`, `poses: Vec<Value>` (`ex::pose`), `windup` 0.0,
`target: Option<Value>`, `dummy: Option<P>` (preview dummy foot), `caster_foot: Option<P>`,
`aura: Option<dr::Aura { frames, w, h, pivot }>`, `extra: Map` (more meta.beanfx), `trim: Option<f64>` (`ex::TRIM`;
`aura: Option<dr::Aura { frames, w, h, pivot }>`, `parts: Vec<dr::Part>` (cast, travel, impact sheets:
`dr::Part::new(key, frames, w, h, origin, pivot, anchor)` with `looped` and `more` fields; the runner draws each with
`Effect::part`, writes `<name>_<key>`, checks it and lists it in `meta.beanfx.parts` beside the aura parts),
`extra: Map` (more meta.beanfx; a `parts` object in it joins the runner's parts), `trim: Option<f64>` (`ex::TRIM`;
None when the cell keeps room on purpose, such as the caster's side of a cast), `pick`, `takes` (frame lists).
- Aura parts and the sheet pass the same checks: every frame needs colour (light alone is an empty frame) and a
one-shot's last frame keeps at most 5 % of the peak pixels. `hold` does not exempt an aura: it starts with colour
Expand Down
2 changes: 1 addition & 1 deletion plugins/beanfx/skills/beanfx/kit/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/beanfx/skills/beanfx/kit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beanfx"
version = "2.4.0"
version = "2.5.0"
edition = "2021"
description = "The /beanfx kit: numpy-exact arrays and random draws, PNG, sheet export and checks, sound, preview writers"
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions plugins/beanfx/skills/beanfx/kit/DRAFTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fades in a 32x32 cell over 10 frames) that already writes the sheet and runs the

```
cd drafts/<name> && cargo run --release -q # writes out/, exits 1 when a check fails, 2 on an error
cargo run --release -q -- quick # the sheet's checks and light measure only, seconds on a long sheet
cargo run --release -q -- look 20 30 44 # just those frames, 3x, in a second
cargo run --release -q -- glow # the three glow takes round the first hit
```
Expand Down
Loading
Loading