docs: ADR 0042 Subselection on raw drawings and merging everywhere; ADR 0031/0041 lists, roadmap, changelog (M1)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Tanish MankuandClaude committed 2026-11-10 14:32:14 -07:00
1 parent 17d766536d
commit e89b2bb61d
8 files changed
+216 -16

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ shaders or SDK code).
| Hack Regular (via `epaint_default_fonts`) | UI monospace font | Source Foundry Authors; Bitstream (Vera) | <https://github.com/source-foundry/Hack> | MIT + Bitstream Vera licence, [`licenses/fonts/LICENSE-Hack.txt`](licenses/fonts/LICENSE-Hack.txt) |
| Noto Emoji (via `epaint_default_fonts`) | Symbol fallback | Google | <https://github.com/googlefonts/noto-emoji> | SIL OFL 1.1, [`licenses/fonts/OFL-1.1-NotoEmoji.txt`](licenses/fonts/OFL-1.1-NotoEmoji.txt) |
| emoji-icon-font (via `epaint_default_fonts`) | Symbol fallback | John Slegers | <https://github.com/jslegers/emoji-icon-font> | MIT, [`licenses/fonts/LICENSE-emoji-icon-font.txt`](licenses/fonts/LICENSE-emoji-icon-font.txt) |
| `assets/icons/anicraft-*.svg` (16 files: align, distribute, mask and masked layer, width tool, camera, brush, eraser, eyedropper, muted sound) | Align panel, layer-type, Width tool, Camera, Brush, Eraser and Eyedropper tool icons, the timeline's mute toggle | AniCraft contributors | Original work, drawn on Lucide's 24-unit grid and stroke style (the muted sound keeps the speaker of Lucide's `volume-2`, ISC, crossed out) | MIT OR Apache-2.0 |
| `assets/icons/anicraft-*.svg` (17 files: align, distribute, mask and masked layer, width tool, camera, brush, eraser, eyedropper, muted sound, magnet) | Align panel, layer-type, Width tool, Camera, Brush, Eraser and Eyedropper tool icons, the timeline's mute toggle, Snap to Objects | AniCraft contributors | Original work, drawn on Lucide's 24-unit grid and stroke style (the muted sound keeps the speaker of Lucide's `volume-2`, ISC, crossed out) | MIT OR Apache-2.0 |
| `crates/svg/fixtures/clips-masks-text.svg` | SVG import test drawing (clip paths, a mask, text) | AniCraft contributors | Original work | MIT OR Apache-2.0 |
| `assets/icons/*.svg` except `anicraft-*` (33 files: tools, transport, layer toggles, folders, guide, image, text, sound, chevrons) | UI icons, stroked by `src/icons.rs` | Lucide Icons and Contributors (some derived from Feather by Cole Bemis) | <https://github.com/lucide-icons/lucide> (`icons/<name>.svg`), copied unchanged from the PhotoCraft sibling project's set (`volume-2.svg` from Lucide 0.512.0) | ISC (Lucide) and MIT (Feather), [`licenses/icons/LICENSE-lucide.txt`](licenses/icons/LICENSE-lucide.txt) |
| `assets/app-icon/` (`anicraft.svg`, `anicraft-small.svg` and every render: PNGs, `anicraft.ico`, `hicolor/`) | App icon (engraved rabbit): window, Dock, taskbar, `anicraft.exe`, Help › About | Project owner (ArtCraft team) | Original artwork drawn in ArtCraft for AniCraft, vectorised by `assets/app-icon/trace.py` and rendered by `scripts/icons.sh` | MIT OR Apache-2.0 ([`assets/app-icon/LICENSE.txt`](assets/app-icon/LICENSE.txt)) |
+27
View File
@@ -2,6 +2,33 @@
## Unreleased
* **Subselection on raw drawings, Snap to Objects, and merging everywhere** (ADR 0042, issue
#42). With Object Drawing off:
* Click a raw line or fill with the **Subselection tool** (A) to see the points of everything
connected to it: hollow squares, one per shared corner. Click a point to select it (Shift
adds or removes). The curve handles of the selected points, and of the edge you clicked,
show as lines ending in dots.
* Drag a point to move it together with the other selected points; every shape that shares
a point moves with it, and it snaps as with the Selection tool. Drag a handle to change the
curve; a fill and its outline change together.
* Drag a line or fill to move everything connected to it. A marquee shows the shapes it
touches on the active layer and selects the points inside it. Arrow keys move the selected
points 1 screen pixel (Shift: 10). Each drag or press is one undo step.
* **Snap to Objects**, in View › Snapping, as the magnet under the tools and in the
selection tools' options, turns snapping on and off. It is on by default.
* **The Paint Bucket** fills a raw drawing exactly up to its lines and fill edges, and the
fill joins any fill of its colour it touches. Recolouring a fill joins it to its new
colour's neighbours.
* **Pasted** raw shapes (Paste and Paste in Place) cut and join the drawing they land on.
* **Animate files**: raw shapes open as raw shapes, merged into one drawing per keyframe.
Drawing objects and groups stay objects.
* **Gradient and bitmap fills** now merge like solid ones, each piece keeping its part of the
gradient. Strokes with a width profile are still drawn as objects.
Headless: `raw.subselect`, `raw.subselect_rect`, `raw.points`, `raw.move_handle`, `with` on
`raw.move_point`, `draw.snap_to_objects`, and `object` on `paint.bucket`; plug-ins may call
them.
* **The Selection tool on raw drawings** (ADR 0041, issue #42). With Object Drawing off, the
Selection tool now edits raw strokes and fills the way Animate does:
* Drag an unselected line or the edge of a fill to **bend** it. The segment becomes a curve
+12
View File
@@ -378,3 +378,15 @@ fn subselection_timings() {
open.as_secs_f64() * 1e3
);
}
#[test]
fn the_eraser_takes_gradient_fills_too() {
let mut s = raw_session();
s.style.fill_paint = Some(linear());
run(&mut s, "draw.rect", json!({"x": 0, "y": 0, "w": 200, "h": 100, "stroke": null}));
let before: f32 = fills(&s).iter().map(|e| area(e)).sum();
run(&mut s, "draw.erase", json!({"points": [[100, -20], [100, 120]], "size": 20}));
let after: f32 = fills(&s).iter().map(|e| area(e)).sum();
assert_eq!(fills(&s).len(), 2, "cut in two");
assert!(before - after > 1500.0, "{before} → {after}");
}
+5 -5
View File
@@ -112,9 +112,9 @@ the program; nothing was copied.
to points and strokes within 10 screen pixels~~ (and keyboard moves within 0.2), ~~moving
a point to move every shape that shares it~~ (with the Selection tool) and ~~a marquee
that selects parts of fills and strokes~~: done in ADR 0041;
* moving shared points with the Subselection tool and its arrows;
* ~~moving shared points with the Subselection tool and its arrows~~ and ~~Subselection
anchors and handles of connected raw shapes~~: done in ADR 0042;
* a marquee that selects across layers (ADR 0041 keeps a selection on one layer);
* Subselection anchors and handles of connected raw shapes;
* merging the Paint Bucket's fills and pasted raw shapes;
* importing Animate's raw shapes (XFL) as raw shapes;
* gradients and width profiles in the merge.
* ~~merging the Paint Bucket's fills and pasted raw shapes~~ and ~~importing Animate's raw
shapes (XFL) as raw shapes~~: done in ADR 0042;
* ~~gradients~~ (ADR 0042) and width profiles in the merge (ADR 0042 says why profiles wait).
@@ -127,7 +127,7 @@ was copied.
* Not in this slice:
* selecting across layers;
* snapping while drawing with the shape tools;
* a Snap to Objects switch;
* Subselection anchors and handles of connected raw shapes (ADR 0042);
* ~~a Snap to Objects switch~~ (ADR 0042);
* ~~Subselection anchors and handles of connected raw shapes~~ (ADR 0042);
* bending or moving points of raw shapes inside symbols;
* the Free Transform tool's handles on raw parts.
@@ -0,0 +1,160 @@
# ADR 0042: Subselection on raw drawings, and merging everywhere
* Status: accepted (2026-11-10)
* Relates to: ADR 0031 (merge drawing), ADR 0041 (Selection tool on raw drawings), ADR 0004
(destructive actions), ADR 0009 and 0035 (XFL import and its corpus), issue #42 (section 3,
and the rest of section 1)
## Context
ADR 0031 made the shape tools draw raw strokes and fills: one element per fill region and per
stroke run, which cut and join where they meet. ADR 0041 taught the Selection tool to bend,
pull corners, snap and select parts. Three things still did not behave as issue #42 describes.
* **Subselection (A)** treated raw shapes as objects. Clicking a raw side of a rectangle showed
only that side's two points. In Animate, a click shows the anchors of **everything
connected**, and a point drag moves every shape that has the point.
* **Not everything merged.** These came in as objects that never cut or joined the drawing:
* the Paint Bucket's fills;
* pasted raw shapes;
* Animate's own raw shapes (XFL `DOMShape`);
* gradient and bitmap fills.
* **Snapping could not be switched off.** Animate has View > Snapping > Snap to Objects (the
magnet).
Behaviour was learned from the issue, Adobe's public help pages and watching the program;
nothing was copied.
## Decision
1. **Connected means sharing a point.** Two raw shapes are connected when a point of one (an
anchor) lies within `2 × SNAP` (0.4 units) of the other's outline:
* a corner both have;
* an edge two fills share;
* a line ending on an edge.
`cmds_rawsub::connected` takes that transitively over the active layer's raw shapes. A grid
over their bounds keeps it near linear, and it is bounded (20,000 shapes).
2. **Anchors are positions, listed once.** ADR 0041 stores a shared corner once in each shape
that has it, so the Subselection tool works in stage positions:
* `Session::raw_points` lists each anchor once, merging copies within `SNAP`;
* it lists each curve handle once, a fill's edge and its outline having the same one;
* a point drag is `raw.move_point` with `with: [[x, y], ..]` for the other selected anchors,
which finds every shape's copy of each.
Which anchors are selected is view state in the editor (`App::raw_anchors`), as it is for
drawing objects. Positions survive the re-merge a drag ends with: the merge renumbers
elements but moves a point by at most `SNAP`, so the editor keeps each selected anchor on
the nearest point within 0.5 units.
*Rejected:* addressing anchors as `(element, command)` pairs. Every merge renumbers elements,
so the selection would be lost after every edit.
3. **Commands for each gesture** (namespace `raw`, already allowed for plug-ins):
* `raw.subselect {x, y, add?}` is the click. It selects the connected raw shapes, and
returns their anchors, handles, and the clicked edge's ends (whose handles show). An
object is selected alone.
* `raw.subselect_rect {x0, y0, x1, y1, add?}` is the marquee, on the **active layer only**.
It selects whole the shapes it touches (raw ones with everything connected to them), and
returns the raw anchors inside it. It never cuts; cutting is the Selection tool's.
* `raw.points {ids?}` lists anchors and handles.
* `raw.move_handle {id, cmd, slot, dx, dy, merge?}` moves a control point. Every raw shape
with that edge follows (`edit_edge`, which `path.bend_segment` now shares; built on
`anicraft_geom::raw::follow`).
As in ADR 0041, a drag runs its command every frame with `merge: false` and `raw.merge` on
release. The whole drag is one gesture, so one undo step (ADR 0004: undoable, no
confirmation). Arrow keys move the selected anchors 1 screen px (Shift 10) as one step each,
merged where they land, so ends within 0.2 px meet as ADR 0041 describes.
4. **What a Subselection press takes**, in order:
* a shown handle: the drag bends that curve;
* a shown anchor: it moves, with the other selected anchors (Shift adds to them);
* a raw anchor not shown yet: its shapes show and the anchor moves;
* a raw line or fill: its connected shapes show and **all of them move**, merged on release;
* otherwise, the object behaviour as before.
Anchors are hollow squares (solid when selected). The handles of the selected anchors' curves,
and of the clicked edge, are lines ending in filled dots. On a drawing object, the
Subselection tool behaves as before.
5. **Snap to Objects is tool state**, like Object Drawing (ADR 0031):
* it is `ToolStyle.snap_objects`, on by default, toggled by `draw.snap_to_objects`;
* the switch is in View > Snapping, and also a magnet under the tools and a checkbox in the
Selection, Subselection and Free Transform options;
* off, every `snap` parameter does nothing (`ToolStyle::snap_radius`), so the Selection tool
and Subselection, and scripts, stop snapping alike;
* merging still joins points within 0.2 px: that is the drawing model, not snapping.
There is no default shortcut. Animate's is Ctrl+Shift+/, and the slash's shifted key depends
on the keyboard layout. Users can give it one in Keyboard Shortcuts.
6. **The Paint Bucket fills raw drawings exactly.** Unless `object` (default: Object Drawing),
the fill is raw and merges **behind** the drawing, so it takes only what is empty. It joins
the fills of its colour it touches, and the lines that bound it stay on top.
* **The area** comes from the planar merge itself. A *probe* fill under everything is
merged with the raw shapes. What is left of the probe is the empty area, divided by every
line and fill edge. The piece under the click is the area, unless it reaches the probe's
border (the area is open). The result is exact: up to the lines' centres, with holes.
* **It is local.** The probe starts as a 128-unit window around the click, with only the
shapes that reach into it. It grows fourfold while the area reaches its border. A shape
wholly outside a window cannot touch an area inside it.
* **Fallback.** When raw shapes do not close the area (drawing objects close it, or a gap
has to be bridged), the rasterized flood fill of before is used, and its result merges the
same way.
* **Recolouring** a raw fill merges it again, so it joins neighbours of its new colour.
7. **Pasted raw shapes merge where they land** (Paste, Paste in Place), cutting and joining
like a drop (ADR 0031). Objects on the clipboard go on top whole, as before.
8. **Animate's raw shapes import raw.** In `anicraft-xfl`, a `DOMShape` loose on a frame
(not `isDrawingObject`, not inside a `DOMGroup`) makes shapes with `merge: true`. The
importer is layer L2, below the engine. So when `file.open` imports, the engine merges each
keyframe's raw shapes into one drawing (`merge::merge_document`), across scenes and symbols.
* XFL arrives one shape per style; afterwards there is one element per fill region and per
stroke run, as AniCraft draws.
* Keyframes a tween joins keep their shapes as they came, because tweens pair shapes in
order.
* The corpus renders still match their goldens. A raw outline is one stroke per side, so at
a corner two round caps overlap where one round join was, and their antialiased edges add
up: 47 of the shapes frame's 14,400 pixels are slightly darker. The merged-corpus test
allows that and compares only, never rewriting goldens.
9. **Gradients and bitmap fills take part in the merge.** A fill's paint is carried into
keyframe space with the shape (`Paint::transformed`), and back into each piece. Each piece
shows its part of the gradient where it was. Fill styles are matched with a thousandth-unit
tolerance (`same_paint`), so a gradient cut in two joins again when the cut goes.
**Width profiles stay whole, as objects.** A profile runs along the whole stroke (width
points by arc length). Cutting it at crossings, and joining runs again, would need each
piece's length range carried through the planar map, which it does not track. That is a
later change to `planar`.
## Consequences
* Measured on 748 raw shapes (12 × 12 outlined, rounded squares and 12 lines; optimised debug
build, `subselection_timings`):
| Operation | Time |
|---|---|
| Subselection click (63 connected shapes, 122 anchors, 96 handles) | 0.9 ms |
| Listing anchors and handles (every frame) | 0.1 ms |
| Handle drag frame | 0.1 ms |
| Merge on release | 0.2 ms |
| Paint Bucket fill, exact | 0.3 ms (20 ms when the probe took the whole layer) |
| Paint Bucket on an open area (every window, then the raster) | 29–36 ms |
* Opening an Animate file now gives merge drawing as Animate had it. Its drawings cut and join
as soon as they are edited.
* A Paint Bucket fill in merge drawing lies exactly along its lines. Deleting a line later
joins fills of one colour, as in Animate.
* Not in this slice:
* deleting raw anchors (Delete says so), and adding them;
* Make Smooth and Make Corner on raw anchors;
* smooth handle pairs (a handle moves alone, as on drawing objects);
* width profiles in the merge;
* Subselection inside symbols;
* a default shortcut for Snap to Objects;
* snapping while drawing with the shape tools;
* a marquee across layers (ADR 0041).
-1
View File
@@ -24,5 +24,4 @@ has to renumber because another PR merged first.
|---|---|---|
| 0037 | #38 (outside contribution) | Interface languages |
| 0040 | branch `m8/localisation` (PR to come) | Localisation of the interface |
| 0042 | branch `m1/raw-subselection` (PR to come) | Subselection on raw drawings, merging everywhere (issue #42) |
| 0043 | branch `m7/bones` (PR to come) | Bone tool and inverse kinematics |
+9 -7
View File
@@ -11,7 +11,7 @@ milestone ends with a green tree: build, tests, clippy, a `--screenshot` check a
| Architecture | M0 skeleton in place: geom → doc → render → engine → cli → shell, layering enforced by `cargo test` (`src/architecture_tests.rs`: lower layers only, no UI crates below the shell, and the AGENTS.md map must match). |
| Rendering | CPU oracle with analytic AA, non-zero/even-odd, solid + linear/radial gradients, round-join strokes. **Mask clipping**: the display list carries nested clips; a clip is the anti-aliased union of its mask fills (strokes and opacity ignored), intersected with any enclosing clip, computed once per render band; an empty mask hides everything under it. **Group alpha**: a symbol instance below full opacity is a group in the display list; each render band composites the group's run of ops into its own buffer (nested groups stack) and blends it once at the group's alpha, so overlaps don't show through; SVG export writes `<g opacity>`. **Blend modes** (Animate's 14, on movie clip and button instances): an instance with one is an isolated group that blends at its close with the W3C separable formulas on premultiplied colour (Alpha and Erase keep or clear the backdrop); SVG gets CSS `mix-blend-mode`, Lottie the layer `bm`. **Bitmaps**: `Paint::Bitmap` fills (once or tiled) with bilinear sampling in premultiplied space, colour effects per sample; PNG/JPEG import to stage (a rectangle of the image's size); stored in the document as PNG (base64 in `.anicraft`), decoded once on first use; SVG export embeds each image once as a pattern. **Filters**: a filtered group is drawn on its own (by the same renderer, recursively, so nested filters work) into a buffer over its artwork grown by the filters' reach, filtered (box-blur passes; shadow and glow from the blurred, offset opacity; **bevel and gradient bevel** from the difference of the blurred opacity offset towards and away from the light, **gradient glow** from the glow's intensity, both through a colour ramp whose rest stop is pinned transparent, inner/outer/full and knockout, ADR 0025; colour matrix), and composited back as one image in its group, so alpha and blend apply; clips from inside the symbol apply before filtering and the instance's own clip after. **GPU stage, first slice** (M3, ADR 0019; `--features gpu-stage`, off by default): Preferences › Stage › Renderer *GPU (preview)* draws the stage with wgpu compute from the oracle's own prepared fills (tile binning with per-row backdrops on the CPU, exact area coverage and src-over per pixel on the GPU): solid and gradient fills and strokes, non-zero and even-odd; masks, group opacity, blend modes, filters and bitmaps fall back to the CPU per tile, and the status bar says so. Parity with the oracle: max 1/255, mean < 0.0001/255 on the sample, stress and analytic scenes (tests skip without an adapter). 4K with 1,000 shapes: 8.8–9.0 ms vs the CPU's 17.4–17.8 ms. **Second slice** (ADR 0029): on the window's wgpu device the stage tiles are drawn straight into textures egui shows (no readback; a headless device with readback when the window is on OpenGL); **masks** (nested, united artwork), **group opacity** and **all 14 blend modes** on the GPU, same parity (max 1/255, mean ≤ 0.0011/255); 4K: 1,000 shapes in 2.1–2.4 ms, 10k shapes in 10.2 ms as stage tiles, masked scenes 7× the CPU. **Third slice** (ADR 0032): **bitmap fills** (textures uploaded once per image and cached under a 256 MB budget, sampled with the oracle's own bilinear filter, colour effect and repeat rules: byte-identical) and **all seven filters** (each filtered symbol drawn into a layer of its own and filtered by compute passes that run the oracle's resolved steps: max 1/255, mean ≤ 0.007/255) on the GPU; the shaders now build with Direct3D's FXC, so DX12 windows get the GPU stage too (parity suite green on Vulkan and DX12); software adapters are refused (the CPU is faster), the start-up self-test compares with the oracle. **The GPU is the default stage renderer**: the shell's `gpu-stage` feature is on by default, Preferences › Stage › Renderer defaults to *Graphics card (GPU)*, and the CPU draws whenever there is no usable card, a tile is past the GPU's limits (more than 16 images, filters nested deeper than 4) or anything fails. 4K: the filtered sample in 3.9 ms (CPU 31.5), 200 bitmap fills in 4.4 ms (CPU 37.2). Not yet: sharing a filtered layer across a frame's tiles, more than 16 images per tile, GPU binning (ADR 0029), buffer reuse across tiles, GPU exports, a GPU runner in CI; the CPU stays the oracle and the export path. |
| Timeline | **Frame selection**: click, Shift-click or drag across frames and layers; F5/Shift+F5, F6/F7 and Shift+F6 (keys, buttons and right-click menu) act on the whole selection; drag selected keyframes left or right to move them, and up or down onto other layers (the source keeps empty frames, as in Animate) (with a drop outline; one undo step; keys they land on are replaced, and spans fill the frames left behind); removing or clearing selected frames that hold artwork asks first. **Cut/Copy/Paste Frames** (Ctrl+Alt+X/C/V, and plain Ctrl+X/C/V after clicking the timeline): own clipboard, copies cut exactly at the selection edges (mid-tween state kept), paste inserts like Animate, several layers paste onto the layers below (missing ones are created), fresh element ids, symbols travel with them. **Span length by dragging its end** (resize cursor, live outline with the length in frames and seconds; later frames move with it). Headless: `layers`/`count` on the frame commands, `timeline.move_keyframes`, `timeline.cut_frames/copy_frames/paste_frames`. Layers (show/lock/outline), keyframes, blank keyframes, insert/remove frames, classic tweens with 8 easing presets + curve preview, **shape tweens** (morph between any two shapes: segments made cubic, subpaths paired by size and grown from or shrunk to a point when counts differ, segment counts equalized by subdivision, windings matched and start points aligned; amber spans; classic ⇄ shape keeps the easing; **shape hints** (ADR 0023): Modify › Shape › Add Shape Hint (Ctrl+Shift+H) adds lettered markers `a`–`z` that the artist drags onto an edge on the first and last keyframe (rose until placed, amber placed on the first, mint on the last; right-click removes), the morph cuts both outlines at the hinted points and matches the pieces in order by length; `tween.add_hint/move_hint/remove_hint/clear_hints/hints`; not yet: View › Show Shape Hints, hints inside symbols edited in place), auto-key when editing inside a tween, frame labels, symbol nesting: graphics keep step with their timeline (loop, play once, single frame, first frame; set in Properties), movie clips loop their own timeline from when the instance appears (continuous across keyframes holding the same instance), buttons show their Up frame, onion skin (±2 frames), looping playback. **Mask layers**: right-click a layer › Mask turns it into a mask over the layer below (Masked adds more layers to it); masked layers are indented under a stencil icon; the mask applies on the stage and in every export alike, and while the mask layer is unlocked its edge shows in the layer colour so it can be picked and reshaped; masked-away parts cannot be picked; layers moved in under a mask join it, moved out leave it, and a mask moves with its whole group; masks inside symbols nest. Headless: `layer.toggle_mask`, `layer.set_type`. **Scenes** (ADR 0011): the movie is an ordered list of scenes, each its own timeline, edited one at a time (scene menu on the edit bar, Insert › Scene, Modify › Scene, Shift+PageUp/PageDown); add, duplicate (fresh ids), rename, reorder and remove (asks when the scene has artwork; undoable); PNG-sequence and GIF exports play every scene in order. **Layer folders**: nestable folders (depth ≤ 16) holding layers and masks through `Layer.parent`, one invariant (`Timeline::repair_masks`: a child sits below its parent inside the parent's unbroken run; broken links fall back to the nearest valid ancestor); hiding or locking a folder hides or locks its contents (rendering, picking, drawing); folders open and close on the timeline (view state); layers move in and out with Up/Down, a folder moves with its contents; deleting a folder deletes its contents (asks first). **Motion tweens** (ADR 0016): a span's object animated property by property (x, y, scale, rotation, skew, alpha, tint), each property its own curve of property keyframes with a per-segment ease (presets or a custom cubic Bézier, overshoot allowed); auto-key turns any edit of the object inside the span into property keys (every command, through the session), F6 keys every property, splits and copies keep the motion; sky-blue spans with property-key diamonds; **Motion Editor** tab beside the timeline: property list with values at the playhead, curve graph with draggable keys and Bézier handles, one undo step per drag. **Motion paths** (ADR 0030): a motion tween may carry a cubic path its object travels by arc length, timed by the X/Y curves (a straight path reproduces them exactly, overshoot included); shown on the stage in the motion colour with a dot per frame when the object or span is selected; Selection drags the path to bend it and its ends to move them, Subselection drags anchors and handles; moving the object reshapes the path; Orient to path and Straighten in Properties; splits cut the path. **Path points** (ADR 0038): with Subselection, double-click the path to add a point (shape and motion unchanged), Shift-clicLine truncated
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge), **Free Transform (Q)**: scale from corner/edge handles (Shift proportional, Alt from centre), rotate outside corners (Shift snaps 15°), move; one undo step per drag. Rectangle (corner radius), oval, PolyStar, line (45° snap), hand, zoom. **Pen (P)**: click for corners, drag for smooth handles (Alt breaks them), close on the first point, Enter/Esc/last-point click finishes, Backspace takes back a point; one undo step per path. **Pencil (Shift+Y)**: Smooth (Schneider curve fitting with corner detection), Straighten and Ink modes, smoothing relative to the screen. **Subselection (A)**: anchors and handles on selected shapes, drag points/handles (anchors bring their handles; one undo step per drag), point marquee, double-click an edge to add a point, Delete removes points, right-click Make Smooth/Corner; closed shapes' start point and closing edge edit like any other. **Cut/Copy/Paste in Center/Paste in Place** (the clipboard carries symbols across documents). **Rotate 90° CW/CCW, Flip H/V. Align** left/centre/right/top/middle/bottom (Ctrl+Alt+1…6; a single element aligns to the stage) and distribute. Convert to symbol / break apart; arrange; duplicate. Headless: `draw.path`, `draw.freehand`, `path.move_points/add_point/delete_points/convert_point`. **Paint Bucket (K)**: click a fill to recolour it, or inside an outline (one shape or several) to fill the enclosed area; gap size None/Small/Medium/Large closes openings; the fill is traced and curve-fitted into a new shape placed under its lines; open areas say so instead of flooding. **Ink Bottle (S)**: gives the clicked shape the current stroke. Headless: `paint.bucket`, `paint.ink`. Tool options show first in Properties while a drawing tool is active. **Text (T)** (ADR 0012): click to type on the stage, click or double-click text to edit it; font (installed families, plus the embedded Inter), size, colour, bold, italic, alignment, letter/line spacing, wrap width; the last style is kept for new text; laid out by `anicraft-text` (`fontdb` discovery, `harfrust` shaping, `skrifa` outlines) and stored as outlines with the source, so rendering never needs the font; Break Apart makes a shape. **Variable-width strokes** (ADR 0018): a stroke's width varies along it through width points (position by arc length, a width on each side as a factor of the stroke width, smooth monotone interpolation); built-in profiles (Uniform, Taper both ends, Taper start, Taper end, Bulge, Pinch) in Properties › Width with a picture of each, and in the drawing tools' options for new strokes; the **Width tool (U)**: hover a stroke to see its width points, drag a handle to widen or narrow (Alt: one side), drag the dot to slide a point, drag anywhere on the stroke to add one, Delete removes; one undo step per drag; rendered by the oracle as trapezoids with outer round joins and cross-section caps, written by SVG and Lottie export as the same filled outlines; shape tweens blend profiles; `.anicraft` keeps them (older files open as uniform). Headless: `stroke.set_profile`, `stroke.set_width_point`, `stroke.delete_width_point`, `stroke.width_at`, `profile` on `element.set_stroke`, the drawing commands and `paint.ink`. Not yet: width data from or to Animate files, saved custom profiles, pressure. **Merge drawing** (ADR 0031, first slice): with Object Drawing (J) off, the editor's default, the shape tools, Pen and Pencil draw raw strokes and fills that cut and join the raw shapes they touch (a fill on top replaces what it covers or joins the same colour, lines cut each other and the fills they cross, a fill hides the lines under it, points within 0.2 px are one; exact Bézier pieces, `anicraft_geom::planar`); one element per fill region and stroke run, selected with Animate's dot pattern; double-click selects connected strokes, or a fill with its outline; a dragged or nudged raw shape merges where it lands; arrows move 1 screen pixel (Shift 10). Headless: `object` on the drawing commands (scripts draw objects by default), `draw.object_drawing`, `draw.drop`, `element.select_connected`. **Selection tool on raw shapes** (ADR 0041): drag an unselected segment or fill edge to bend it through the pointer (every shape sharing the edge bends with it), an unselected corner or end to move it with every raw shape that shares it, a fill to move only that fill; points and selections snap to points, strokes and fill edges within 10 screen px (snap ring), and arrow nudges join ends within 0.2 px at their midpoint or onto a line that stays put; a corner or curve mark by the pointer shows what a drag does; the marquee selects the parts of raw fills and strokes under it, cut at its edges (taken back if nothing uses them, no undo step), and objects wholly inside; each drag one undo step, merged on release. Headless: `path.bend_segment`, `raw.move_point`, `raw.select_rect`, `raw.merge`, `raw.hit`, `snap` on `element.translate`. Not yet:Line truncated
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge), **Free Transform (Q)**: scale from corner/edge handles (Shift proportional, Alt from centre), rotate outside corners (Shift snaps 15°), move; one undo step per drag. Rectangle (corner radius), oval, PolyStar, line (45° snap), hand, zoom. **Pen (P)**: click for corners, drag for smooth handles (Alt breaks them), close on the first point, Enter/Esc/last-point click finishes, Backspace takes back a point; one undo step per path. **Pencil (Shift+Y)**: Smooth (Schneider curve fitting with corner detection), Straighten and Ink modes, smoothing relative to the screen. **Subselection (A)**: anchors and handles on selected shapes, drag points/handles (anchors bring their handles; one undo step per drag), point marquee, double-click an edge to add a point, Delete removes points, right-click Make Smooth/Corner; closed shapes' start point and closing edge edit like any other. **Cut/Copy/Paste in Center/Paste in Place** (the clipboard carries symbols across documents). **Rotate 90° CW/CCW, Flip H/V. Align** left/centre/right/top/middle/bottom (Ctrl+Alt+1…6; a single element aligns to the stage) and distribute. Convert to symbol / break apart; arrange; duplicate. Headless: `draw.path`, `draw.freehand`, `path.move_points/add_point/delete_points/convert_point`. **Paint Bucket (K)**: click a fill to recolour it, or inside an outline (one shape or several) to fill the enclosed area; gap size None/Small/Medium/Large closes openings; the fill is traced and curve-fitted into a new shape placed under its lines; open areas say so instead of flooding. **Ink Bottle (S)**: gives the clicked shape the current stroke. Headless: `paint.bucket`, `paint.ink`. Tool options show first in Properties while a drawing tool is active. **Text (T)** (ADR 0012): click to type on the stage, click or double-click text to edit it; font (installed families, plus the embedded Inter), size, colour, bold, italic, alignment, letter/line spacing, wrap width; the last style is kept for new text; laid out by `anicraft-text` (`fontdb` discovery, `harfrust` shaping, `skrifa` outlines) and stored as outlines with the source, so rendering never needs the font; Break Apart makes a shape. **Variable-width strokes** (ADR 0018): a stroke's width varies along it through width points (position by arc length, a width on each side as a factor of the stroke width, smooth monotone interpolation); built-in profiles (Uniform, Taper both ends, Taper start, Taper end, Bulge, Pinch) in Properties › Width with a picture of each, and in the drawing tools' options for new strokes; the **Width tool (U)**: hover a stroke to see its width points, drag a handle to widen or narrow (Alt: one side), drag the dot to slide a point, drag anywhere on the stroke to add one, Delete removes; one undo step per drag; rendered by the oracle as trapezoids with outer round joins and cross-section caps, written by SVG and Lottie export as the same filled outlines; shape tweens blend profiles; `.anicraft` keeps them (older files open as uniform). Headless: `stroke.set_profile`, `stroke.set_width_point`, `stroke.delete_width_point`, `stroke.width_at`, `profile` on `element.set_stroke`, the drawing commands and `paint.ink`. Not yet: width data from or to Animate files, saved custom profiles, pressure. **Merge drawing** (ADR 0031, first slice): with Object Drawing (J) off, the editor's default, the shape tools, Pen and Pencil draw raw strokes and fills that cut and join the raw shapes they touch (a fill on top replaces what it covers or joins the same colour, lines cut each other and the fills they cross, a fill hides the lines under it, points within 0.2 px are one; exact Bézier pieces, `anicraft_geom::planar`); one element per fill region and stroke run, selected with Animate's dot pattern; double-click selects connected strokes, or a fill with its outline; a dragged or nudged raw shape merges where it lands; arrows move 1 screen pixel (Shift 10). Headless: `object` on the drawing commands (scripts draw objects by default), `draw.object_drawing`, `draw.drop`, `element.select_connected`. **Selection tool on raw shapes** (ADR 0041): drag an unselected segment or fill edge to bend it through the pointer (every shape sharing the edge bends with it), an unselected corner or end to move it with every raw shape that shares it, a fill to move only that fill; points and selections snap to points, strokes and fill edges within 10 screen px (snap ring), and arrow nudges join ends within 0.2 px at their midpoint or onto a line that stays put; a corner or curve mark by the pointer shows what a drag does; the marquee selects the parts of raw fills and strokes under it, cut at its edges (taken back if nothing uses them, no undo step), and objects wholly inside; each drag one undo step, merged on release. Headless: `path.bend_segment`, `raw.move_point`, `raw.select_rect`, `raw.merge`, `raw.hit`, `snap` on `element.translate`. **SubselLine truncated
| Plug-ins | **WebAssembly plug-ins** (ADR 0017, `docs/plugins.md`): sandboxed modules run by `wasmi` with no imports but the AniCraft ABI (`anicraft.call`/`anicraft.response`: JSON requests that run registry commands, read a compact document view or the active layer's elements, and log); fuel (10⁹ instructions), memory (256 MiB), wall-clock (5 s), request, size and log limits, a fresh instance per run; file, plug-in, undo and clipboard commands refused. `plugin.install/list/run/remove/reload`; a run is atomic and one undo step named after the plug-in. App: **Commands** menu (Plug-ins, Install, Manage, Reload), palette entries, a dialog generated from the manifest's parameters with a live preview; plug-ins load from `<settings>/plugins` or `ANICRAFT_PLUGINS`; CLI `--plugins`. Samples in Rust (Star Field, Jitter Selection, guest SDK) in `examples/plugins`. Frame scripts: see Interactivity. Not yet: exporter and easing kinds, background runs with cancel, a binary document view. |
| Interactivity | **Frame actions, frame scripts and Test Movie, first slice** (ADR 0024): a typed timeline action IR (`anicraft-actions`: stop, play, go to a frame or label in a scene, next/previous frame and scene, trace, set x/y/alpha/visible/rotation/scale, instance-name target paths) on keyframes and on button and movie clip instances (click, press, release, over, out); a pure, deterministic, budgeted player in `anicraft-doc` (`step(doc, &state, &events)`; movie clip playheads, button Up/Over/Down states with Hit-frame hit tests, script-set properties) drawn by `evaluate_player`, while `evaluate` and exports stay script-free. **Actions panel** (F9: structured lists, targets/labels/scenes picked from the document; movie clip timelines too), instance name and events in Properties, an "a" on keyframes with actions. **Frame scripts** on the plug-in host (`kind: "frame-script"`, entry points, `player`/`action` ops, 20 M instructions per frame shared, no document access). **Test Movie** (Control › Test Movie, Ctrl+Enter): the player at the document frame rate in its own window with the pointer, restart/pause/step and an Output panel. Headless: `actions.set/clear/list`, `instance.set_name`, `control.test_movie` (timed pointer events, returns output and state). **HTML canvas export** (ADR 0028, `file.export_html`, File › Export › Export HTML Canvas…): one self-contained page (data, player and drawing code inline; images and sounds embedded) that plays in any browser with canvas 2D; every used timeline baked frame by frame (tweens of every kind exact, identical paths, paints and frames stored once), movie clips, buttons with Hit areas and every action run by `player.js`, a port of the Rust player checked against it step by step in Boa (state, output and display list); masks and fading/blending groups on offscreen layers; Web Audio for Event/Start/Stop/Stream sounds; filters, Subtract/Invert, bitmap tints and plug-in frame scripts reported. **Kept frame scripts** (ADR 0013 tier 1): scripts written in another language (an Animate document's ActionScript) kept verbatim on keyframes with their language, symbol linkage classes and the document class; the Actions panel's **Script** view (monospace editor with line numbers, language, live and undoable), the same "a" marker, Class rows in Properties; `script.set/clear/list/set_class`; nothing runs them (Test Movie says so once; the HTML export reports them). Not yet: running the ActionScript timeline subset (ADR 0013 tier 2), scripts on instances, filters and keyboard focus in the HTML page, sound actions, keyboard events, variables, persistent script state, masks in hit tests, a separate OS window. |
| Headless | CLI: info, render, render-seq, **gif**, commands, exec, run, serve (JSON-lines). **MCP server** (`anicraft-cli mcp`, `docs/mcp.md`): stdio JSON-RPC, protocol 2025-06-18 (and 2025-03-26, 2024-11-05); five tools over the command registry (list, run, run a script, describe the document, render a frame as a PNG picture); confirmation tiers and undo apply as in the app. |
@@ -86,12 +86,14 @@ Next, in order:
dragged points to points, strokes and fill edges within 10 screen px, and keyboard moves
within 0.2 document px; a marquee that selects the parts of fills and strokes under it
(cut at its edges); Shift adds. Not yet: a marquee across several layers at once (a
selection lives on one layer), snapping while drawing, a Snap to Objects switch.
* **Subselection on raw drawings, and merging everywhere** (ADR 0042): hollow anchors on
connected raw shapes, handles on curves, point marquee on the active layer, dragging a
segment or fill moves what is connected; the Paint Bucket's fills and pasted raw shapes
merge; raw shapes from Animate files come in raw; gradients and width profiles take part
in the merge.
selection lives on one layer), snapping while drawing.
* ~~**Subselection on raw drawings, and merging everywhere** (ADR 0042)~~ ✅: hollow anchors
on connected raw shapes, handles on curves, point marquee on the active layer, dragging a
segment or fill moves what is connected, arrow keys; Snap to Objects (View › Snapping, the
magnet); the Paint Bucket's fills (exact, up to the lines) and pasted raw shapes merge;
raw shapes from Animate files come in raw; gradients take part in the merge. Not yet:
width profiles in the merge, deleting or adding raw anchors, smooth handle pairs, a
default Snap to Objects shortcut.
1. M4 **XFL import, next slices**: ~~masks (with M2 mask layers)~~ ✅, ~~shape tweens~~ ✅,
~~every scene~~ ✅, ~~bitmaps~~ ✅ (PNG/JPEG data), ~~text~~ ✅ (one style per line; per-character styles with
the text model), motion tweens, and ~~a larger self-authored