mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-23 19:12:08 +01:00
feat(app): hide the Tilt options until a pen reports tilt (M7)
This commit is contained in:
1 parent
72bf68965c
commit
c8e2faf47c
10 files changed
+110
-27
No files matched your search
+5
-4
@@ -4,10 +4,11 @@
|
||||
|
||||
* **Brushes and erasing, second slice: tilt, textured brushes, erasing inside symbols, profiles
|
||||
in the merge** (ADR 0093, M7).
|
||||
* **Pen tilt** shapes the Brush: Properties › Tilt › **Angle** turns the tip with the way the
|
||||
pen leans, **Width** paints up to twice as wide as it lies down (the Paint Brush too). A
|
||||
mouse is never affected. Desktop systems don't pass tilt on to AniCraft yet, so tilt comes
|
||||
in through `draw.brush` points as `[x, y, pressure, altitude, azimuth]`.
|
||||
* **Pen tilt** shapes the Brush: it turns the tip with the way the pen leans and paints up
|
||||
to twice as wide as it lies down (the Paint Brush too). A mouse is never affected. Desktop
|
||||
systems don't pass tilt on to AniCraft yet, so the Tilt options stay hidden in Properties
|
||||
until a pen reports it; scripts and MCP send it in `draw.brush` points as
|
||||
`[x, y, pressure, altitude, azimuth]`.
|
||||
* **Textured brushes**, still vector: **Texture** lets a fixed paper grain show through the
|
||||
paint, **Scatter** throws dabs either side of the stroke. New built-in brushes **Charcoal**
|
||||
and **Spatter**.
|
||||
|
||||
@@ -43,9 +43,14 @@ was copied: no code, presets, textures or brushes.
|
||||
|
||||
*The platform gap.* winit 0.30 reports tilt only on iOS (`Force::Calibrated`'s
|
||||
`altitude_angle`), and egui 0.36's touch events carry only `force`. No desktop system passes
|
||||
a pen's tilt to the shell yet. The brush settings, the command and the model are ready, and the
|
||||
shell reads tilt as soon as the toolkit gives it. Properties says so in the options' hover
|
||||
text. We didn't add a platform-specific tablet API (Wintab, Windows Ink, NSEvent tilt,
|
||||
a pen's tilt to the shell yet. The model, the point format and the command params are ready,
|
||||
so scripts, the CLI and MCP can paint with tilt today.
|
||||
|
||||
*Hidden until a pen reports it.* A control that does nothing confuses artists, so
|
||||
Properties shows no Tilt options until a pointer event has carried tilt this session
|
||||
(`App::pen_tilt_seen`, set from `brushtool::frame_tilt`, the one place tilt is read). Then
|
||||
they appear by themselves. Brushes keep their tilt settings either way (Charcoal follows
|
||||
tilt), so a brush set moves between computers unchanged. A UI test checks both states. We didn't add a platform-specific tablet API (Wintab, Windows Ink, NSEvent tilt,
|
||||
XInput2 valuators): that would mean `unsafe`, FFI and a code path per OS for one value. The
|
||||
right place for it is upstream in winit.
|
||||
|
||||
@@ -111,8 +116,8 @@ was copied: no code, presets, textures or brushes.
|
||||
So does `brush.preset_save`, and brush presets keep them (`#[serde(default)]`: older brush
|
||||
sets and preferences load as before).
|
||||
* There is no new namespace, so the plug-in policy is unchanged (`draw.*` may be called).
|
||||
* Shell: Properties › Tilt (Angle for the Brush, Width for both brushes), Texture and Scatter
|
||||
for the Brush.
|
||||
* Shell: Texture and Scatter for the Brush; Properties › Tilt (Angle for the Brush, Width for
|
||||
both brushes) once a pen has reported tilt.
|
||||
|
||||
## Consequences
|
||||
|
||||
@@ -135,7 +140,8 @@ was copied: no code, presets, textures or brushes.
|
||||
|
||||
## Not yet
|
||||
|
||||
* Reading tilt from a pen on Windows, macOS and Linux (waits for winit).
|
||||
* Reading tilt from a pen on Windows, macOS and Linux (waits for winit), and so the Tilt
|
||||
options in Properties there.
|
||||
* Bitmap, art and pattern brushes; custom tip shapes.
|
||||
* Eraser pressure, tilt and presets.
|
||||
* A live preview through texture, scatter and tilt.
|
||||
|
||||
@@ -159,12 +159,14 @@ stipple. Both are still ordinary vector shapes: they merge, erase, scale and exp
|
||||
other paint, and the same stroke always comes out the same. The **Charcoal** and **Spatter**
|
||||
brushes in the Brush menu use them.
|
||||
|
||||
**Tilt.** Under **Tilt**, **Angle** turns the tip with the pen (the way the pen leans adds to
|
||||
the brush's angle, so a flat nib follows your hand), and **Width** paints wider as the pen
|
||||
leans, up to twice as wide lying flat. The Paint Brush has **Width**. A mouse is never
|
||||
affected. Desktop systems don't pass a pen's tilt on to AniCraft yet, so for now these settings
|
||||
work for strokes sent with tilt from scripts and assistants (`draw.brush` points as
|
||||
`[x, y, pressure, altitude, azimuth]`), and are kept with your brushes for when they do.
|
||||
**Tilt.** Brushes can follow a pen's tilt: the tip turns with the way the pen leans (so a flat
|
||||
nib follows your hand), and paints wider as it leans, up to twice as wide lying flat. A mouse
|
||||
is never affected. Windows, macOS and Linux don't pass a pen's tilt on to AniCraft yet, so the
|
||||
**Tilt** options (**Angle** and **Width**; the Paint Brush has **Width**) stay hidden in
|
||||
Properties. They appear by themselves as soon as a pen reports its tilt. Meanwhile scripts and
|
||||
assistants can paint with tilt: `draw.brush` takes points as `[x, y, pressure, altitude,
|
||||
azimuth]` and `tilt_angle` and `tilt_width` (see [Working headless](working-headless.md)). The
|
||||
**Charcoal** brush follows tilt when there is any.
|
||||
|
||||
**Snapping while you draw**: with **Snap to Objects** on (the magnet under the tools, or **Ctrl+Shift+/**), the Line,
|
||||
Rectangle, Oval, PolyStar and Pen tools snap their points to nearby points, lines and fill
|
||||
|
||||
+1
-1
@@ -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 (with reflect/repeat, focal points, elliptical radials and linear RGB, ADR 0074), 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. **Soft masks** (ADR 0070): a mask layer's mask type is Shape (coverage), Alpha (its artwork's opacity as drawn: gradients, faded shapes, strokes, bitmaps) or Luminance (brightness × opacity, SVG's coefficients), in the CPU oracle (analytic tests), the GPU stage (parity: mean 0.00006, worst 1 step of 255), SVG export (`<mask>` with `mask-type`), Lottie (alpha and luma track mattes) and the HTML canvas; Layer Properties › Mask type. **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. Filters apply in list order and may be switched off (ADR 0091): `evaluate` leaves switched-off ones out, so every renderer and export draws them as absent. **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). **Fourth slice** (ADR 0048): **tile binning on the GPU** for heavy frames without masks or groups (count, prefix sum, scatter and tile-list passes, no atomics, no readback; the CPU binning stays the reference and does the rest; one tile format for boLine truncated
|
||||
| Timeline | **Frame selection**: click, Shift-click or drag across frames and layers; F5/Shift+F5, F6/F7 and Shift+F6 (keys, icon buttons and right-click menu) act on the whole selection; with no frame selection F5 extends every layer with frames at or after the playhead, and F5/F6/F7 move the playhead on as in Animate (F6/F7 on a keyframe key the next frame; `all_layers`/`advance` headless); 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; a motion tween's keys stretch in proportion, ADR 0083). Side dock tab strips never run under the panel menu (names shrink with an ellipsis, then the strip scrolls). Headless: `layers`/`count` on the frame commands, `timeline.move_keyframes`, `timeline.cut_frames/copy_frames/paste_frames`. Layers (show/lock/outline), **timeline polish** (ADR 0061): a per-layer **onion skin toggle** column (Alt-click solos; left-out layers aren't onion-skinned; Edit Multiple Frames unaffected), the colour square toggles **View as Outlines** in the layer colour **on the stage only** (exports, Test Movie and the player draw the artwork as it is), the **colour chip** opens the layer colour (swatches, hex, More…), **onion frames of the parent timeline** dimmed around a symbol edited in place, **Layer Height** 100/200/300 %, **Layer Properties** (double-click the layer icon; name, show/lock, type, outline colour, outlines, onion, height; one undo step), **Frame View** (Tiny/Small/Normal/Medium/Large, Short rows) with the frame zoom in the timeline's bottom bar (the header fits at the default window size, tested); headless `layer.set_onion/set_color/set_height/set_properties/properties`; XFL `heightMultiplier`. Not yet: folder onion toggles, onion of deeper parent timelines, multi-layer Layer Properties and layer transparency, frame thumbnails (Preview). Keyframes, blank keyframes, insert/remove frames, classic tweens with **ease presets and custom eases** (ADR 0081: Classic Ease with a strength and Quad, Cubic, Quart, Quint, Sine, Back, Circ, Bounce and Elastic In/Out/In Out; custom eases of up to 64 Bézier points in the Custom Ease window, x kept monotonic, overshoot allowed, keyboard operable, **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, looping playback. **Onion skin and Edit Multiple Frames** (ADR 0047): onion markers on the frame ruler (drag the start and end brackets; Always Show Markers, Anchor Markers, Onion 2 / Onion 5 / Onion All, also on a right-click on the ruler), frames before and after the playhead tinted in their own colours (theme blue and green, changeable in the onion menu, Reset) and fading with distance, Outlines, Keyframes Only, locked layers left out as in Animate, each layer's onion frames under its own artwork and over the layers below; options saved in the preferences; the stage's frame cache keys every look apart. **Edit Multiple Frames** shows every keyframe within the markers at full strength and selects (click, Shift-click, marquee, Select All) and moves (drag, arrow keys) artwork across them, one undo step, motion tween paths moving with their objects. Headless: `frames.artwork`, `frames.edit_multiple`. **Edit Multiple Frames, complete** (ADR 0051): Cut, Copy, Paste (current frame), Paste in Place (back keyframe by keyframe, or a onLine truncated
|
||||
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge; **across layers**, ADR 0044: a selection holds artwork on several visible, unlocked layers, the timeline marks them, Properties shows mixed values), **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, under or over the artwork, snap accuracy up to Always); Snap to Pixels; one snap engine for every drawing tool, the Selection tool's moves and Free Transform's handles (point › guide › line › grid › pixel, guides and grid per axis); stage only, never exported, on the CPU and GPU stage. Headless: `view.rulers`, `view.grid_show/grid_snap/grid_set`, `view.guides_show/guides_lock/guides_snap/guides_set`, `view.guide_add/guide_move/guide_delete/guides_clear`, `view.snap_pixels`, `view.aids`, `moving` on `draw.snap`. *Not yet:* units other than px, a movable ruler origin, a symbol's own guides, guides and grid from Animate files, Snap Align and Edit Snapping, snapping while rotating. 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. **Stroke styles** (ADR 0046): Properties › Style (Solid, Dashed with dash and gap, Dotted with spacing), Cap (None, Round, Square), Join (Miter, Round, Bevel) and Miter limit, also in the drawing tools' options for new strokes; drawn exactly by the oracle (butt and square caps, miters bevelled past the limit, dashes by arc length restarting per subpath, round dots, dashes keeping a width profile's widths; sub-pixel patterns solid and faded) and so by the GPU stage; the Ink Bottle carries the style and the Eyedropper picks it; merge drawing keeps it on cut pieces; shape tweens blend miter limits and dash lengths; SVG, HTML canvas and Lottie export write it. Headless: `stroke.set_style`, and `cap`, `join`, `miter`, `style`, `dash`, `dash_offset`, `dot_spacing` on `element.set_stroke`, the drawing Line truncated
|
||||
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge; **across layers**, ADR 0044: a selection holds artwork on several visible, unlocked layers, the timeline marks them, Properties shows mixed values), **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, under or over the artwork, snap accuracy up to Always); Snap to Pixels; one snap engine for every drawing tool, the Selection tool's moves and Free Transform's handles (point › guide › line › grid › pixel, guides and grid per axis); stage only, never exported, on the CPU and GPU stage. Headless: `view.rulers`, `view.grid_show/grid_snap/grid_set`, `view.guides_show/guides_lock/guides_snap/guides_set`, `view.guide_add/guide_move/guide_delete/guides_clear`, `view.snap_pixels`, `view.aids`, `moving` on `draw.snap`. *Not yet:* units other than px, a movable ruler origin, a symbol's own guides, guides and grid from Animate files, Snap Align and Edit Snapping, snapping while rotating. 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. **Stroke styles** (ADR 0046): Properties › Style (Solid, Dashed with dash and gap, Dotted with spacing), Cap (None, Round, Square), Join (Miter, Round, Bevel) and Miter limit, also in the drawing tools' options for new strokes; drawn exactly by the oracle (butt and square caps, miters bevelled past the limit, dashes by arc length restarting per subpath, round dots, dashes keeping a width profile's widths; sub-pixel patterns solid and faded) and so by the GPU stage; the Ink Bottle carries the style and the Eyedropper picks it; merge drawing keeps it on cut pieces; shape tweens blend miter limits and dash lengths; SVG, HTML canvas and Lottie export write it. Headless: `stroke.set_style`, and `cap`, `join`, `miter`, `style`, `dash`, `dash_offset`, `dot_spacing` on `element.set_stroke`, the drawing Line 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. **Exporter and ease plug-ins** (ADR 0088): `kind: "exporter"` declares a format (name, extension, options) and gets evaluated frames (`movie`, `frame`: the flattened display list, never the document), returning the file's bytes from `ac_export` (64 MiB cap, 5·10¹⁰ instructions, 10 min); File › Export lists it with an Export window (options, frames, file, progress bar and Cancel on a worker thread); `file.export_plugin`, `file.export_formats`, `anicraft-cli export --format <id>` and `formats`. `kind: "ease"` declares named eases, `ac_ease(i, t)` sampled into 257 values at load (NaN, unbounded or end-missing eases refused); `Easing::Sampled` keeps the table in the document, so it plays the same without the plug-in; the ease menus list them under Plug-in eases; `{plugin, ease}` easing params. Samples: Plain Text Frames and Stepped Eases, built and run in CI. Not yet: plug-in formats in Publish, bitmaps' pixels and sounds for exporters, ease plug-ins with parameters, background runs of command plug-ins, 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. **A window of its own on the desktop** (ADR 0062): sized to the stage at 100 % (smaller to fit the screen), titled with the document, back where it was last (not on Wayland, where the desktop places windows), with the keyboard when it opens; Esc or Ctrl+W (⌘W) closes it, Ctrl+Enter restarts it in place, and the editor's Ctrl/Alt shortcuts work from it; floating inside the editor in the web build, where the system can't open windows (it says so), or by choice in Preferences › Test Movie. Not yet: full screen, zoom in the movie window, remembering its size. 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; **filters and Subtract/Invert in the page** (ADR 0072: `filters.js`, a port of the renderer's filters run over the group's pixels on a layer that reaches past the canvas by the filters' reach, Subtract and Invert composited per pixel, results kept while the group is unchanged; equal to the oracle's pixels within 9.3e-4 in Boa; 3.4 ms a frame for the demo's filters at 1080p while they change); Web Audio for Event/Start/Stop/Stream sounds; bitmap tints, 9-slice scaling and plug-in frame scripts reported. Not yet: 9-slice in the page, keeping a moving filtered group's pixels, filters off the main thread. **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`; **ActionScript timeline subset runs** (ADR 0013 tier 2): a hand-written, bounded lexer and parser (`anicraft_actions::as3`) lower stop/play/go to/next and previous frame and scene on instance-name paths, mouse listeners (click, down, up, roll over and out; named or inline functions, `currentTarget`), `trace` and property settings to the action IR, compiled once per script; anything else is reported with line and column and the script doesn't run (never half-run), `navigateToURL` and the like are ignored and noted; the player keeps listeners per instance, Test Movie's Output says which scripts run and which don't and why, the Script view lists problems in place, the XFL report and `script.list/check` say what runs, and the HTML page runs the same steps (`player.js` checked against the Rust player). **ActionScript small logic** (ADR 0052): scripts compile to a small typed script IR evaluated by the player with fuel (100,000 per script or listener call, 1,000,000 per step; an endless loop or a run-time error stops its script with an Output line and the movie plays on): typed variables (Number, int, uint, Boolean, String, untyped) kept per timeline instance across its frame scripts, expressions as ECMA-262 has them, `if`/`else`, `for`/`while`/`do`, functions with parameters, results and recursion, called from any frame of the same timeline (a timeline-level link step; names that aren't there keep the script from running, said in place), property reads of instances and timelines (`x`, `y`, `alpha`, `visible`, `rotation`, `scaleX/Y`, `currentFrame`, `tLine truncated
|
||||
| Headless | CLI: info, render, render-seq, **gif**, **apng**, **webp**, 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. |
|
||||
|
||||
+8
-3
@@ -433,6 +433,9 @@ pub struct App {
|
||||
pub filter_naming: crate::panels::FilterNaming,
|
||||
pub brush_samples: Vec<(anicraft_engine::geom::Vec2, Option<f32>)>,
|
||||
pub pen_pressure: Option<f32>,
|
||||
/// Whether a pointer event has carried a pen's tilt this session (ADR 0093). Until one has,
|
||||
/// the brushes' Tilt options stay hidden: they would do nothing.
|
||||
pub pen_tilt_seen: bool,
|
||||
/// Eraser tool options (ADR 0034); its stroke's samples are `brush_samples`.
|
||||
pub eraser: crate::erasertool::EraserOptions,
|
||||
pub bucket_gap: GapSize,
|
||||
@@ -705,6 +708,7 @@ impl App {
|
||||
filter_naming: Default::default(),
|
||||
brush_samples: Vec::new(),
|
||||
pen_pressure: None,
|
||||
pen_tilt_seen: false,
|
||||
eraser: crate::erasertool::EraserOptions::default(),
|
||||
bucket_gap: GapSize::default(),
|
||||
align_to_stage: false,
|
||||
@@ -2046,9 +2050,10 @@ impl App {
|
||||
Some("tiltbrush") => {
|
||||
// Tilt and textured brushes (ADR 0093) on a new layer: a flat nib whose angle
|
||||
// follows the pen's azimuth as it turns along an S, a round brush widening as the
|
||||
// pen lies down, Charcoal (the paper grain) and Spatter. The Brush's options show
|
||||
// Tilt, Texture and Scatter. Tilt comes in through the command's points, as no
|
||||
// desktop system reports it to the toolkit yet.
|
||||
// pen lies down, Charcoal (the paper grain) and Spatter.
|
||||
// Tilt comes in through the command's points, as no
|
||||
// desktop system reports it to the toolkit yet; so Properties shows Texture and
|
||||
// Scatter, and keeps the Tilt options hidden (ADR 0093).
|
||||
self.run("layer.new", json!({"name": "Tilt"}));
|
||||
self.run("draw.object_drawing", json!({"on": false}));
|
||||
let s_curve: Vec<[f32; 5]> = (0..=90)
|
||||
|
||||
+11
-7
@@ -312,6 +312,7 @@ pub fn props(app: &mut App, ui: &mut egui::Ui, row: impl Fn(&mut egui::Ui, &str,
|
||||
ui.painter().image(t.id(), r, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), egui::Color32::WHITE);
|
||||
});
|
||||
}
|
||||
let tilt_seen = app.pen_tilt_seen;
|
||||
let o = crate::brushtool::options_mut(app);
|
||||
row_prose(ui, tr!("Pressure"), &mut |ui| {
|
||||
crate::theme::checkbox(ui, &mut o.pressure_size, tr!("Size")).on_hover_text(tr!("Pen pressure varies the size, from 10 % to the full size"));
|
||||
@@ -340,13 +341,16 @@ pub fn props(app: &mut App, ui: &mut egui::Ui, row: impl Fn(&mut egui::Ui, &str,
|
||||
row_prose(ui, tr!("Mouse"), &mut |ui| {
|
||||
crate::theme::checkbox(ui, &mut o.velocity, tr!("Speed as pressure")).on_hover_text(tr!("Without a pen: drawing faster makes the stroke thinner, as a pen pressed lightly would"));
|
||||
});
|
||||
// Tilt (ADR 0093): a setting of the brush, used where the system reports a pen's tilt.
|
||||
row_prose(ui, tr!("Tilt"), &mut |ui| {
|
||||
if !as_stroke {
|
||||
crate::theme::checkbox(ui, &mut o.tilt_angle, tr!("Angle")).on_hover_text(tr!("The pen's tilt turns the tip: the way it leans adds to the brush's angle. Tilt is read where the system reports it; desktop systems don't report it to AniCraft yet"));
|
||||
}
|
||||
crate::theme::checkbox(ui, &mut o.tilt_width, tr!("Width")).on_hover_text(tr!("A leaning pen paints wider, up to twice as wide lying flat. Tilt is read where the system reports it; desktop systems don't report it to AniCraft yet"));
|
||||
});
|
||||
// Tilt (ADR 0093): shown once a pen has reported its tilt this session. Until then the
|
||||
// options would do nothing, so they stay out of the way (brushes keep their tilt settings).
|
||||
if tilt_seen {
|
||||
row_prose(ui, tr!("Tilt"), &mut |ui| {
|
||||
if !as_stroke {
|
||||
crate::theme::checkbox(ui, &mut o.tilt_angle, tr!("Angle")).on_hover_text(tr!("The pen's tilt turns the tip: the way it leans adds to the brush's angle"));
|
||||
}
|
||||
crate::theme::checkbox(ui, &mut o.tilt_width, tr!("Width")).on_hover_text(tr!("A leaning pen paints wider, up to twice as wide lying flat"));
|
||||
});
|
||||
}
|
||||
row(ui, tr!("Taper"), &mut |ui| {
|
||||
ui.add(egui::DragValue::new(&mut o.taper_start).suffix(" %").speed(0.5).range(0.0..=50.0).max_decimals(0)).named(tr!("Taper at the start")).on_hover_text(tr!("How much of the stroke swells from a point at its start"));
|
||||
ui.add(egui::DragValue::new(&mut o.taper_end).suffix(" %").speed(0.5).range(0.0..=50.0).max_decimals(0)).named(tr!("Taper at the end")).on_hover_text(tr!("How much of the stroke thins to a point at its end"));
|
||||
|
||||
@@ -197,6 +197,23 @@ pub fn frame_pressure(ctx: &egui::Context) -> Option<f32> {
|
||||
})
|
||||
}
|
||||
|
||||
/// The pen's tilt this frame, when the toolkit reports it (ADR 0093). egui 0.36's pointer and
|
||||
/// touch events carry only pressure, and winit 0.30 reports tilt only on iOS, so on the desktop
|
||||
/// this is `None` until they carry it. When it isn't, the Tilt options appear (see
|
||||
/// [`App::pen_tilt_seen`]).
|
||||
pub fn frame_tilt(ctx: &egui::Context) -> Option<anicraft_engine::geom::brush::Tilt> {
|
||||
// No egui event carries a tilt yet; this is where it is read once one does.
|
||||
let _ = ctx;
|
||||
None
|
||||
}
|
||||
|
||||
/// Notes a tilt reported this frame, so the Tilt options show from then on.
|
||||
pub fn note_tilt(app: &mut App, tilt: Option<anicraft_engine::geom::brush::Tilt>) {
|
||||
if tilt.is_some() {
|
||||
app.pen_tilt_seen = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts a stroke at stage point `p` at time `now` (seconds). A mouse paints at full
|
||||
/// pressure, or from half pressure when its speed stands in for it.
|
||||
pub fn start(app: &mut App, p: Vec2, pressure: Option<f32>, now: f64) -> Drag {
|
||||
|
||||
@@ -395,3 +395,5 @@ mod packaging_tests;
|
||||
mod rulers_tests;
|
||||
#[cfg(test)]
|
||||
mod retime_ui_tests;
|
||||
#[cfg(test)]
|
||||
mod tilt_ui_tests;
|
||||
@@ -337,6 +337,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
let xf = crate::pathtools::Xf { origin, zoom };
|
||||
// Pen pressure, when a tablet reports it (the Brush tool's width follows it).
|
||||
let pressure = crate::brushtool::frame_pressure(ui.ctx());
|
||||
// Tilt, where the toolkit reports it: the brushes' Tilt options show once it has (ADR 0093).
|
||||
crate::brushtool::note_tilt(app, crate::brushtool::frame_tilt(ui.ctx()));
|
||||
let now = ui.input(|i| i.time);
|
||||
// The motion path takes the pointer with the selection tools (ADR 0030): its ends and
|
||||
// handles before the object under them, the path itself only where no object is.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//! The brushes' Tilt options (ADR 0093) show only once a pen has reported its tilt: until then
|
||||
//! they would do nothing.
|
||||
|
||||
use crate::app::{App, Tool};
|
||||
use egui::{Rect, vec2};
|
||||
|
||||
/// The labels drawn in a few frames of the app with the Brush (or the Paint Brush) in hand.
|
||||
fn labels(tool: Tool, tilt_seen: bool) -> Vec<String> {
|
||||
let ctx = egui::Context::default();
|
||||
ctx.enable_accesskit();
|
||||
let session = anicraft_engine::Session::new(anicraft_engine::doc::sample::demo());
|
||||
let mut app = App::with_context(&ctx, session, Some(std::path::PathBuf::from("unused.png")));
|
||||
app.tool = tool;
|
||||
crate::brushtool::note_tilt(&mut app, tilt_seen.then_some(anicraft_engine::geom::brush::Tilt { altitude: 40.0, azimuth: 10.0 }));
|
||||
let mut nodes = Vec::new();
|
||||
for _ in 0..4 {
|
||||
let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(1600.0, 1400.0))), ..Default::default() };
|
||||
let mut out = ctx.run_ui(input, |ui| app.frame(ui));
|
||||
out.textures_delta.clear();
|
||||
nodes = out.platform_output.accesskit_update.map(|u| u.nodes.into_iter().map(|(_, n)| n).collect()).unwrap_or_default();
|
||||
}
|
||||
nodes.iter().filter_map(|n| n.label().map(str::to_string)).collect()
|
||||
}
|
||||
|
||||
fn count(labels: &[String], l: &str) -> usize {
|
||||
labels.iter().filter(|x| *x == l).count()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tilt_options_hide_until_a_pen_reports_tilt() {
|
||||
// The rows around it show, so Properties is drawn.
|
||||
let before = labels(Tool::Brush, false);
|
||||
assert!(before.iter().any(|l| l == "Texture"), "the Brush options are drawn: {before:?}");
|
||||
// No tilt reported: no Tilt row. Once a pen has reported tilt: its Angle and Width.
|
||||
let after = labels(Tool::Brush, true);
|
||||
assert_eq!(count(&after, "Angle"), count(&before, "Angle") + 1);
|
||||
assert_eq!(count(&after, "Width"), count(&before, "Width") + 1);
|
||||
// The Paint Brush has Width only.
|
||||
let (pb0, pb1) = (labels(Tool::PaintBrush, false), labels(Tool::PaintBrush, true));
|
||||
assert_eq!(count(&pb1, "Angle"), count(&pb0, "Angle"));
|
||||
assert_eq!(count(&pb1, "Width"), count(&pb0, "Width") + 1);
|
||||
// On the desktop nothing reports tilt yet.
|
||||
assert!(crate::brushtool::frame_tilt(&egui::Context::default()).is_none());
|
||||
}
|
||||
Reference in new issue
Block a user