motion.add_point splits the nearest segment (shape and timing
unchanged), motion.delete_points refits through the rest and keeps the
ends, motion.convert_point makes an anchor smooth or a corner, and
motion.move_path moves the path, its X/Y keys and the object together.
Point edits on a straight motion make its path the tween's own.
motion.info and the path commands list the anchors.
src/web.rs starts the editor on a page canvas with eframe's WebRunner (WebGL2 via glow) and
provides the browser's services; platform.rs decides when: picked files go to the engine's
in-memory store and the command runs, saves and exports leave as downloads, preferences and
recovery copies live in localStorage, Web Locks tell open tabs from crashed ones, and leaving
with unsaved work asks first. The GPU stage and sound output become build cfgs that are off
on wasm. Video export and plug-in installs are dimmed in the browser with the reason.
scripts/build-web.sh and .ps1 build web/ with the wasm-bindgen CLI pinned to Cargo.lock's
version, from packaging/web/index.html. The web profile (opt-level s, stripped, renderer and
geometry at opt-level 3) gives an 8973 KB module, 3278 KB gzipped, in 41 s.
crates/engine/tests/wasm.rs runs the engine inside WebAssembly in Node (3 tests, 0.6 s).
20 frames of the corpus rendered by the CPU oracle at 160x90 and compared
with committed PNGs (a pixel differs past 3 per channel; at most 0.2 %
may), plus hand-worked colour probes, and every package opened with
file.open and round-tripped through .anicraft. UPDATE_GOLDENS=1 rewrites
the goldens; a mismatch writes the render and a diff image and names
them. Rendering and comparing all 20 frames takes about 20 ms.
The eraser sweeps the brush tip (ADR 0033) and goes into the planar merge as a fill whose regions come out empty, placed by the mode: on top (Erase Normal), between fills and lines (Erase Fills), over the lines only (Erase Lines), right above the selected fills or the fill the stroke starts on. Only raw shapes are erased; a stroke that erases nothing leaves no step (exact area and length compare). The Eyedropper picks a fill's paint (solid, gradient or bitmap, in stage space) or a line's colour, width and profile into the tool style; the Paint Bucket and the shape tools use a picked gradient where it is on the stage.
Commands read and write files through engine::vfs: std::fs on the desktop, an in-memory
store in the browser that the web shell fills from the file picker and empties into
downloads (ADR 0036). file.open opens .fla bytes through it and gains unsaved?: true for
restored copies. Instant/SystemTime come from web-time; rayon's deferred drops run inline
on wasm; the GPU crate plans layers in turn where wgpu handles aren't Sync; video export
says why it can't run in a browser; system font discovery is native-only.
Part of #42. ADR 0031: raw shapes cut and join on the layer (exact Bezier planar merge), Object Drawing (J), dot-pattern selection, double-click connected, drop on move, screen-pixel nudge.
Auto-key on a path tween: moving the object at the first position key
moves the path's start, at the last its end, in between the path bends
until the object lands where it was put; X/Y keys keep the timing.
motion.info reports the path, orient and where the object is. The
every-command fuzz also runs on an oriented motion path.
A motion tween may carry a cubic motion path in the layer's space. The
registration point travels it by arc length (geom::walk::CurveWalk, exact
points and tangents); the X/Y curves give the timing, leg by leg between
position keys, signed so overshooting eases overshoot along the path. A
straight path reproduces the X/Y curves exactly. Splitting a span cuts the
path where the object is. Files without a path open unchanged.
The GPU stage shares eframe's wgpu device (egui_wgpu::RenderState) and
draws each stage tile into a storage texture the shell registers with
egui as it is. Fallbacks: a headless device with readback (window on
OpenGL), then the CPU oracle. Every call runs in thread-local error
scopes; nothing is installed on the window's device; a work bound per
dispatch guards the driver watchdog.
The engine stays GPU-free: Raster::Native carries an opaque image, cached
under its own 384 MB budget; only the shell downcasts it.
perf, gpu_bench on RTX 5090 (Vulkan), 32 threads:
4K, 1,000 shapes: CPU 16.2-19.6 ms, read-back 8.4, direct 2.1-2.4 ms
4K, 10k shapes: CPU 25.8-28.1 ms, read-back 23.2, stage tiles 10.2 ms
4K, masked 10k: CPU 74.8-80.0 ms, stage tiles 10.9 ms
Binning stays on the CPU (ADR 0029: not the bottleneck as stage tiles).
The stage draws the camera frame in the camera layer's colour; the Camera tool
(C) pans, turns (round handle) and zooms (wheel), one undo step per drag;
View > Preview Through Camera renders stage tiles through the camera; the
timeline header toggles the camera; Properties gets a Camera section and a
layer Depth row. GPU parity and the accessibility audit cover camera scenes.
A camera layer kind (at most one per scene, always on top) whose keyframes hold
the camera as an element, so it tweens with classic and motion tweens. The
movie (evaluate, the player, every export) is the stage seen through it; the
editing view stays in stage space. Layer depth gives parallax. Commands:
camera.add/remove/set/info and layer.set_depth (ADR 0027).
Commands: actions.set/clear/list, instance.set_name, control.test_movie
(Ctrl+Enter; headless it plays the movie and reports its output), and
file.new_sample {which: interactive}. Frame-script plug-ins (kind
frame-script, entry points) run on enter-frame with Limits::frame_script:
20 M instructions shared per frame, 100 ms, ops player/action/actions/log,
no commands; plugin.run refuses them.
App: Test Movie window (player at the document frame rate, pointer to
buttons, Output panel, restart/pause/step, snapshot of the document),
Actions panel (F9) with structured action lists for keyframes, movie clip
timelines and button/movie clip events, instance name and events in
Properties, an 'a' mark on keyframes with actions.
anicraft-actions (L0): typed actions (stop, play, go to a frame or label in
a scene, next/previous frame and scene, trace, set property), instance-name
target paths, button events, plug-in frame-script references.
anicraft-doc: keyframes carry a FrameScript, symbol instances carry event
handlers (serde defaults, sanitized on load). player::{start, step} steps a
PlayerState (scene, playheads, script-set properties, pointer) with budgets;
evaluate_player draws it; evaluate stays pure and unchanged.
* Box blurs of an even width were half a pixel off centre: now centred (one more
pixel each side at half weight), so bevels stay symmetric.
* Inner effects blur the transparency around the artwork, so every side gets the
full margin (inner Glow and Drop Shadow came out weak near the buffer edge).
* The reach past the surface is capped by area, keeping the padding around the
artwork on wide surfaces (a 4096 px surface clipped shadows to the artwork).
* SVG: filter regions are the stage grown by the reach in user space; ramp tables
have the CPU's 257 samples.
* Ramps: one pinned stop, others step aside (sanitize is idempotent); XFL ramps
use one ratio scale; the panel edits sanitized filters, keeps moved stops between
their neighbours and clear of the pin, and adds a stop from the keyboard.
Model (FilterSide inner/outer/full, ramps with a pinned transparent rest stop),
CPU oracle (signed offset-difference field of the blurred opacity; ramp table),
SVG export with standard primitives, element.set_filters with hex colours and
ramp stops, XFL import of BevelFilter, GradientGlowFilter and
GradientBevelFilter, and Properties > Filters rows with a compact ramp editor.
Per 400x300 buffer, blur 16, quality Medium (release): Glow 0.87 ms, Bevel
1.33 ms, Gradient Glow 1.66 ms, Gradient Bevel 2.42 ms.
Preferences > Stage > Renderer (and View > Stage Rendering) choose CPU
(reference) or GPU (preview) in builds with --features gpu-stage. The
renderer starts off the UI thread; the status bar says who drew the
visible tiles and why the CPU stepped in. ANICRAFT_STAGE_RENDERER
overrides the preference (also for --screenshot).
New L0 crate anicraft-audio: WAV reader/writer, Ogg Vorbis (lewton) and MP3
(nanomp3) decoding with hard size caps and a panic guard, a pure stereo
mixer (sample-exact at equal rates, Catmull-Rom resampling otherwise),
waveform peaks and a device-independent Player.
Document: Sound library items (the imported bytes, decoded once), a
FrameSound on keyframes (Event/Start/Stop/Stream, repeat, loop), and
sound::voices(), the pure layout of the movie's sounds in time.
Commands: file.import_to_library, Import to Stage for sounds, sound.place/
set/remove/delete/rename, file.export_audio, and the soundtrack in
file.export_video (Opus in WebM, AAC in MP4, by the user's ffmpeg).
Keyframe.motion holds a motion tween: one target object, a track of property
keys per property (x, y, scale, rotation, skew, alpha, tint) with a per-segment
ease (any Easing, including a custom cubic Bezier). evaluate stays pure.
Commands: timeline.create_motion_tween, motion.set_key/remove_key/set_ease/info.
Edits made inside a motion span become property keys (auto-key) for every
command, via the session; F6 keys every property; splits keep the motion.
The shell schedules recovery copies (every minute or 25 changes, set in
Preferences > Files > Autosave, with an off switch) on the engine's
Autosaver, waking itself when the interval runs out; the recovery folder
comes from platform::recovery_dir. A non-blocking window offers work left
by crashed sessions; File > Recover Autosaved Documents brings it back.
Clean exits and saves remove the copy. Preferences scroll when taller
than the window. bench measures one autosave.
recovery.rs: atomic recovery copies (temp + fsync + rename) under validated
session ids, an OS file lock per running session so only copies left by
sessions that ended without a clean exit are offered, and an Autosaver
thread that serializes Arc snapshots off the caller's thread, coalescing to
the newest job. Commands: file.recovery_list, file.recover (unsaved, with the
original path unless that file is newer), file.discard_recovery (always
confirms), file.autosave.
Strokes carry an optional width profile (width points: position by arc
length, left/right factors of the nominal width; monotone cubic between
points). The CPU oracle outlines them as positive trapezoids, outer-side
round joins and cross-section caps; SVG and Lottie write the same polygons
as filled outlines. stroke.* commands, a profile picker in Properties and
the tools' options, the Width tool (U) on stage, shape tweens blend
profiles. Also fixes Rect::transformed leaving flat rects untransformed
(horizontal lines missed bounds checks).