docs: ActionScript small logic as ADR 0052 (M6)

This commit is contained in:
Tanish Manku committed 2026-11-11 04:33:51 -07:00
1 parent b71abc4b5e
commit 9d9377bbf7
16 files changed
+150 -128

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
## Unreleased
* **Frame scripts in ActionScript 3.0 run small logic** (ADR 0013 tier 2.5, M6).
* **Frame scripts in ActionScript 3.0 run small logic** (ADR 0052, M6).
* Typed variables (`var score:int = 0;` as Number, int, uint, Boolean, String or untyped),
kept per timeline instance across its frame scripts as Animate timelines keep them;
expressions (arithmetic, comparison, logic, joining text, `Math.min/max/abs/floor/ceil/
+1 -1
View File
@@ -1,4 +1,4 @@
//! The script IR (ADR 0013 tier 2.5): a small, typed form of statements and expressions that a
//! The script IR (ADR 0052): a small, typed form of statements and expressions that a
//! compiled script runs as, evaluated by [`super::run`]. It is data, not code: the player (and
//! the HTML canvas player, which reads the same IR as JSON) walks it with a fuel budget.
//!
+1 -1
View File
@@ -1,4 +1,4 @@
//! Running the script IR (ADR 0013 tier 2.5): a small tree-walking evaluator over a
//! Running the script IR (ADR 0052): a small tree-walking evaluator over a
//! [`World`] (the player, which knows the movie). It is deterministic (the only random numbers
//! come from the world's seeded generator) and bounded: every statement and expression costs
//! fuel, text has a length limit, calls a depth limit. When fuel runs out or something can't
+4 -4
View File
@@ -181,7 +181,7 @@ pub struct PlayerState {
pub listeners: BTreeMap<InstancePath, Vec<Listening>>,
/// Listeners on the stage (keyboard and enter-frame), in the order added.
pub stage: Vec<Listening>,
/// Each timeline instance's variables (ADR 0013 tier 2.5), by name.
/// Each timeline instance's variables (ADR 0052), by name.
pub vars: BTreeMap<InstancePath, BTreeMap<String, Value>>,
/// The random generator.
pub rng: Rng,
@@ -500,7 +500,7 @@ struct Run<'a, 'h> {
/// The frame each graphic showed when the step began: one that shows another frame at
/// its end has entered it (and starts its sounds).
graphics: BTreeMap<InstancePath, u32>,
/// Each timeline's declarations (ADR 0013 tier 2.5), made the first time a script there
/// Each timeline's declarations (ADR 0052), made the first time a script there
/// needs them.
decls: BTreeMap<TimelineRef, Arc<Decls>>,
/// Script fuel left this step.
@@ -725,7 +725,7 @@ impl<'a, 'h> Run<'a, 'h> {
self.decls.entry(key).or_insert_with(|| Arc::new(decls(doc, key))).clone()
}
/// Runs a compiled frame script on timeline `owner` (ADR 0013 tier 2.5): when every name
/// Runs a compiled frame script on timeline `owner` (ADR 0052): when every name
/// it takes from other frames is there, its statements run with the fuel the step has left.
fn run_script(&mut self, owner: &[ElementId], frame: u32, c: &'a Compiled) {
let Some(i) = self.index_of(owner) else { return };
@@ -1297,7 +1297,7 @@ fn decompose64(m: &Affine) -> [f64; 5] {
[e, f, sx, sy, r]
}
/// A running script's view of the movie (ADR 0013 tier 2.5).
/// A running script's view of the movie (ADR 0052).
struct Script<'r, 'a, 'h> {
r: &'r mut Run<'a, 'h>,
/// The timeline the script belongs to.
+1 -1
View File
@@ -449,7 +449,7 @@ fn next_scene_in_a_movie_clip_script_stays_in_its_clip() {
assert_eq!(s.output, ["Next scene: a movie clip's timeline has one scene; call it in the main timeline's script"]);
}
// ----- ActionScript small logic (ADR 0013 tier 2.5) ---------------------------------------------
// ----- ActionScript small logic (ADR 0052) ---------------------------------------------
/// A one-layer main timeline of `frames` frames with scripts on some of them, and `extra` layers.
fn scripted(frames: u32, scripts: &[(u32, &str)], extra: Vec<Arc<Layer>>, library: Vec<Arc<Symbol>>) -> Document {
+1 -1
View File
@@ -50,7 +50,7 @@ fn what(script: &Option<FrameScript>) -> Value {
/// Whether a script runs, its problems and notes (each `{line, column, message}`; line 0 is
/// the whole script). `links`: why it doesn't run on its timeline although it compiles (a
/// name from another frame that isn't there, ADR 0013 tier 2.5).
/// name from another frame that isn't there, ADR 0052).
fn status(c: &CompileResult, links: &[Problem]) -> Value {
match c {
Ok(c) if links.is_empty() => json!({"runs": true, "problems": [], "notes": c.notes}),
+1 -1
View File
@@ -292,7 +292,7 @@ pub struct KeptScript<'a> {
pub plays: bool,
pub compiled: &'a CompileResult,
/// Why it doesn't run on its timeline although it compiles: names from other frames that
/// aren't there (ADR 0013 tier 2.5).
/// aren't there (ADR 0052).
pub links: Vec<Problem>,
}
+1 -1
View File
@@ -486,7 +486,7 @@ impl<'a> Bake<'a> {
/// `nm`, labels `lb`, and per frame the scripts `a` and sounds `snd` of keyframes starting
/// there (top layer first). A scene's frames seen through its camera (ADR 0027) carry the
/// camera's tint (`cc`) and each layer its view (`v`: the camera and the layer's depth).
/// `decls`: the declarations its frame scripts share (ADR 0013 tier 2.5), for timelines that
/// `decls`: the declarations its frame scripts share (ADR 0052), for timelines that
/// run scripts; their functions go out as `fn` and their variables' types as `vt`.
fn timeline(&mut self, tl: &Timeline, scene: bool, decls: Option<&Decls>) -> Value {
let n = tl.frame_count();
+1 -1
View File
@@ -722,7 +722,7 @@ fn actionscript_plays_the_movie_its_hand_made_actions_play() {
}
}
/// A movie that uses the small-logic tier (ADR 0013 tier 2.5): typed variables kept per
/// A movie that uses the small-logic tier (ADR 0052): typed variables kept per
/// timeline and per clip instance, expressions, `if`, loops, `Math.random()`, functions from
/// another frame, property reads, enter-frame and keyboard listeners that add and remove
/// themselves, `e.target`, a runtime error and a loop that runs out of fuel.
+1 -1
View File
@@ -446,7 +446,7 @@ trace(n);]]></script></Actionscript><elements><DOMSymbolInstance libraryItemName
files.insert("PublishSettings.xml", "<flash_profiles><unclosed>");
let (d, report) = import(&files).unwrap();
assert!(d.document_class.is_empty() && !report.kept.contains_key("document class"));
// Read as ActionScript 3.0, its variable and `?:` are in the subset now (ADR 0013 tier 2.5).
// Read as ActionScript 3.0, its variable and `?:` are in the subset now (ADR 0052).
assert!(report.runs.contains_key("frame scripts in ActionScript 3.0"));
}
+1 -109
View File
@@ -2,7 +2,7 @@
* Status: accepted (2026-11-08) as scope and placement. **Tier 1 built** (2026-11-09, see
"Tier 1 as built" below). **Tier 2 built** (2026-11-10, see "Tier 2 as built"). **Tier 2.5,
small logic, built** (2026-11-11, see "Tier 2.5 as built")
small logic, built** (2026-11-11, ADR 0052)
* Relates to: requirements U2 (scripting surface), roadmap M6, ADR 0009 (XFL import),
`docs/legal/compliance.md`
@@ -241,111 +241,3 @@ Tier 2 follows the decision above. Where the build refines it:
event bubbling from a clip's children to its listeners, `e.target`, `getChildByName`,
sound and `stage`, and ActionScript 1.0 and 2.0. Each is reported where it is, so the
subset can grow from what users' files actually use.
## Tier 2.5 as built (2026-11-11): small logic
Item 2 of the context ("variables, `if`, loops, `trace`, setting instance properties, simple
functions"), which tier 2 left out. Where the build refines the decision:
* **A script IR, run by an evaluator, instead of a flat action list.** Small logic can't be
lowered to actions ahead of time (a loop's count, a condition, a computed frame depend on
the movie), so a compiled script is now a small typed tree of statements and expressions
(`anicraft_actions::as3::ir`: `Stmt`, `Expr`, `LValue`, `Place`, `Function`) and
`as3::run` evaluates it against a `World` trait that the player implements. It is data, not
code: no dynamic evaluation, no `eval`, no reflection. Timeline control still ends in the
same `Action`s (an `Act` statement builds one with the frame and scene computed), so hand-made
actions, plug-in frame scripts and ActionScript keep one runtime. The tier-2 `ScriptOp`
list is gone; `script.check` returns `steps` (a count), `program` (the IR as JSON) and
`uses`. Both the evaluator and its interface stay in the L0 crate: it knows values and
names, not documents.
* **Values and types.** ActionScript's primitives (`undefined`, `null`, Boolean, Number,
String), with ECMA-262's operators exactly: `+` joins when either side is text, `==` and
`<` as §11.8–11.9 (text compares by UTF-16 units), ToNumber as browsers read text (decimal,
`Infinity`, `0x`/`0o`/`0b`), ToString as `Number.toString`. Typed variables coerce on every
write: `int` and `uint` as ToInt32/ToUint32 (so `2147483647 + 1` wraps), Number, Boolean,
String (`null` stays `null`), untyped keeps anything; each starts at its type's default (0,
NaN, false, null, undefined). `int(…)`, `uint(…)`, `Number(…)`, `String(…)`, `Boolean(…)`
cast. Other types (`Array`, `MovieClip`, objects) are problems.
* **Where variables live, as ActionScript 3.0 timelines keep them.** A `var` at a frame
script's top level is a member of the timeline: one table per timeline *instance*
(`PlayerState.vars`, by instance path), shared by every frame script of that timeline, kept
while the instance stays on the stage and gone when it leaves (a clip that comes back starts
afresh), as an instance is constructed again. Every variable any frame of the timeline
declares exists from the start with its default, so frame 1 can read what frame 5 declares
(`null` until it runs). `var` inside a function is that call's (hoisted, numbered slots).
The main timeline's scenes share one table, as they are one timeline.
* **Linking across frames.** A script compiles on its own (the cached compile stays a pure
function of its text) and lists the names it takes from elsewhere (`Compiled::free`). A
timeline's **declarations** (`Decls`: its scripts' functions and variable types, the first
of each name in frame order, top layer first) are built from its compiled scripts; a script
whose free names the timeline doesn't declare, or that declares a function or a variable
type another frame already declares differently, doesn't run (whole, as before), and Test
Movie's first lines, the Script view, `script.set` and `script.list` say which name and
where. So functions on **any** frame of the same timeline can be called (ActionScript makes
them methods of the timeline), not only earlier ones. Calls go by name through the
declarations at run time.
* **Statements.** `if`/`else`, `for (init; cond; next)`, `while`, `do … while`, `break` and
`continue` (no labels), `return` with a value (coerced to the declared result type), calls
with parameters (typed, defaults written out) and recursion, `++`/`--` and `+= -= *= /= %=`
on variables and instance properties, `&&`/`||`/`?:`, `Math.min/max/abs/floor/ceil/round/
random`, `Math.PI` and `Math.E`, the `Keyboard` key constants. Not yet: `switch`, `for in`/
`for each`, arrays and objects, `new`, bitwise operators, string methods, nested function
declarations, closures, `try`/`throw`.
* **Reading properties.** `x`, `y`, `alpha`, `visible`, `rotation`, `scaleX/Y`, `name`,
`mouseX/Y` of named instances, the timeline (`this`, `parent`, `root`) and the event's
targets; `currentFrame` (1-based), `totalFrames` (every scene's for the main timeline),
`currentLabel` (the label at or before the playhead, or `null`) of movie clips and the main
timeline. A value a script set reads back as set; one the timeline gives is decomposed from
its transform. Values are the transform's `f32` numbers written shortest (`0.1`, not
`0.10000000149011612`), which is also what the HTML page reads from its JSON, so both say
the same. `mouseX/Y` keep the pointer's last place after it leaves, as in ActionScript.
Reading an instance that isn't there **stops the script there** (ActionScript throws), unlike
an action on a missing instance, which still writes an Output line and goes on (tier 2).
* **Listeners.** `removeEventListener` (by event, timeline and function name; an inline
function can't be removed). `Event.ENTER_FRAME` on the timeline, a movie clip, a button or
the stage: every frame, playing or stopped, **after playheads move and before that frame's
scripts run** (ActionScript dispatches `enterFrame` before frame scripts), in the order the
listeners were added. `KeyboardEvent.KEY_DOWN` and `KEY_UP` on the **stage** (where keys go
when nothing has focus, as in a published movie) with `e.keyCode`; elsewhere they would
never fire, so they are ignored and noted. `e.target` and `e.currentTarget` are the instance
listened to (the stage for keys); with no bubbling yet, a part inside a clip is not a
target of its own. `e == …` between instances compares them (`e.currentTarget == btn_a`).
The event passes on to a function whose parameter is typed `…Event`. Mouse listeners on
the stage and other event fields (`stageX`, `charCode`, `type`) are not yet.
* **Deterministic random.** `Math.random()` draws from a seeded generator in the player state
(Marsaglia's xorshift128, 53 bits per number), so the same document, seed and events give
the same movie, tested. `start_seeded(doc, seed, …)`; `control.test_movie` takes `seed`
(default 0); the app's Test Movie seeds from the clock on each start (screenshots use 0), and
the HTML page from `crypto.getRandomValues`.
* **Fuel, and how a script stops.** Every statement and expression costs one unit of fuel, a
loop's turn one more, and making text one more per 64 characters. A frame script or one
listener call gets 100,000; a step 1,000,000 over all of them. A script that runs out stops
where it is with one Output line ("Script on frame 3 of the main timeline stopped: it ran
more than 100000 steps (an endless loop?)"), and so does one that hits a run-time error
("… stopped: line 4: no instance named “ghost” here"); what it did before stays done, as an
ActionScript error leaves it, and the movie plays on. When the step's fuel is used up, the
step stops running actions with the existing message. Calls nest at most 16 deep, text is
at most 16,384 UTF-16 units, an Output line 1,000 (cut at a whole character); a binary
operator chain counts toward the 64-level nesting limit, so evaluating never recurses
without bound (a test runs the deepest allowed code on a 512 KiB stack). Measured (this
build's optimised dev profile): a 100,000-fuel loop runs in about 2 ms, so a step's whole
budget is about 20 ms.
* **Test Movie keyboard.** The movie surface takes the keyboard when the window opens and when
it is clicked; its keys (letters, digits, arrows, Space, Enter, Tab, Backspace, F1–F12, …)
go to the movie as ActionScript key codes, Tab and the arrows included; shortcuts with Ctrl
(⌘) or Alt still reach the app (Restart is Ctrl+Enter) and Esc closes the window. The window
says "Keys go to the movie" (or "Click the movie to give it the keyboard") when the movie
listens for keys. `control.test_movie` events take `{type: key_down|key_up|key, key}` with a
code, a letter or a `Keyboard` name.
* **HTML canvas export.** A script that runs goes out as its IR (`{"as": {"b": body, "i":
inline functions}}`), each timeline that runs scripts with its declarations (`fn`, `vt`),
and `player.js` mirrors the evaluator line for line, using JavaScript's own operators for
ECMAScript's. Parity tests play the same scripted documents in both, step by step, comparing
output, state (variables and stage listeners included) and display list, and compare
`Math.random()` number for number at several seeds. Keys reach the page's movie from the
window (arrows and Space stop scrolling the page when the movie listens for keys).
* **Not in tier 2.5:** `switch`, `for in`/`for each`, arrays, objects and `new`, string
methods, bitwise operators, closures and nested functions, event bubbling and `e.target`
inside a clip, mouse listeners on the stage, other event fields, `getChildByName`, `stage`
properties, sound, timers, `navigateToURL` (still noted), and ActionScript 1.0 and 2.0. The
XFL import report counts a script that compiles as running before the timeline is linked.
+130
View File
@@ -0,0 +1,130 @@
# ADR 0052: ActionScript small logic (tier 2.5)
* Status: accepted (2026-11-11), built
* Relates to: ADR 0013 (ActionScript compatibility: tiers 1 and 2, the plan), ADR 0024 (the
action IR and the pure player), ADR 0028 (HTML canvas export and `player.js`), roadmap M6
## Context
ADR 0013's tier 2 runs the ActionScript 3.0 timeline subset by lowering scripts to a flat list
of timeline actions ahead of time. Item 2 of that ADR's context, "small logic" (variables,
`if`, loops, `trace`, setting and reading instance properties, simple functions), can't be said
that way: a loop's count, a condition or a computed frame depend on the movie as it plays.
Tier 2 left out variables and conditions, reading properties, `removeEventListener`,
enter-frame and keyboard events, functions on other frames, `e.target` and `Math.random`.
## Decision
* **A script IR, run by an evaluator, instead of a flat action list.** Small logic can't be
lowered to actions ahead of time (a loop's count, a condition, a computed frame depend on
the movie), so a compiled script is now a small typed tree of statements and expressions
(`anicraft_actions::as3::ir`: `Stmt`, `Expr`, `LValue`, `Place`, `Function`) and
`as3::run` evaluates it against a `World` trait that the player implements. It is data, not
code: no dynamic evaluation, no `eval`, no reflection. Timeline control still ends in the
same `Action`s (an `Act` statement builds one with the frame and scene computed), so hand-made
actions, plug-in frame scripts and ActionScript keep one runtime. The tier-2 `ScriptOp`
list is gone; `script.check` returns `steps` (a count), `program` (the IR as JSON) and
`uses`. Both the evaluator and its interface stay in the L0 crate: it knows values and
names, not documents.
* **Values and types.** ActionScript's primitives (`undefined`, `null`, Boolean, Number,
String), with ECMA-262's operators exactly: `+` joins when either side is text, `==` and
`<` as §11.8–11.9 (text compares by UTF-16 units), ToNumber as browsers read text (decimal,
`Infinity`, `0x`/`0o`/`0b`), ToString as `Number.toString`. Typed variables coerce on every
write: `int` and `uint` as ToInt32/ToUint32 (so `2147483647 + 1` wraps), Number, Boolean,
String (`null` stays `null`), untyped keeps anything; each starts at its type's default (0,
NaN, false, null, undefined). `int(…)`, `uint(…)`, `Number(…)`, `String(…)`, `Boolean(…)`
cast. Other types (`Array`, `MovieClip`, objects) are problems.
* **Where variables live, as ActionScript 3.0 timelines keep them.** A `var` at a frame
script's top level is a member of the timeline: one table per timeline *instance*
(`PlayerState.vars`, by instance path), shared by every frame script of that timeline, kept
while the instance stays on the stage and gone when it leaves (a clip that comes back starts
afresh), as an instance is constructed again. Every variable any frame of the timeline
declares exists from the start with its default, so frame 1 can read what frame 5 declares
(`null` until it runs). `var` inside a function is that call's (hoisted, numbered slots).
The main timeline's scenes share one table, as they are one timeline.
* **Linking across frames.** A script compiles on its own (the cached compile stays a pure
function of its text) and lists the names it takes from elsewhere (`Compiled::free`). A
timeline's **declarations** (`Decls`: its scripts' functions and variable types, the first
of each name in frame order, top layer first) are built from its compiled scripts; a script
whose free names the timeline doesn't declare, or that declares a function or a variable
type another frame already declares differently, doesn't run (whole, as before), and Test
Movie's first lines, the Script view, `script.set` and `script.list` say which name and
where. So functions on **any** frame of the same timeline can be called (ActionScript makes
them methods of the timeline), not only earlier ones. Calls go by name through the
declarations at run time.
* **Statements.** `if`/`else`, `for (init; cond; next)`, `while`, `do … while`, `break` and
`continue` (no labels), `return` with a value (coerced to the declared result type), calls
with parameters (typed, defaults written out) and recursion, `++`/`--` and `+= -= *= /= %=`
on variables and instance properties, `&&`/`||`/`?:`, `Math.min/max/abs/floor/ceil/round/
random`, `Math.PI` and `Math.E`, the `Keyboard` key constants. Not yet: `switch`, `for in`/
`for each`, arrays and objects, `new`, bitwise operators, string methods, nested function
declarations, closures, `try`/`throw`.
* **Reading properties.** `x`, `y`, `alpha`, `visible`, `rotation`, `scaleX/Y`, `name`,
`mouseX/Y` of named instances, the timeline (`this`, `parent`, `root`) and the event's
targets; `currentFrame` (1-based), `totalFrames` (every scene's for the main timeline),
`currentLabel` (the label at or before the playhead, or `null`) of movie clips and the main
timeline. A value a script set reads back as set; one the timeline gives is decomposed from
its transform. Values are the transform's `f32` numbers written shortest (`0.1`, not
`0.10000000149011612`), which is also what the HTML page reads from its JSON, so both say
the same. `mouseX/Y` keep the pointer's last place after it leaves, as in ActionScript.
Reading an instance that isn't there **stops the script there** (ActionScript throws), unlike
an action on a missing instance, which still writes an Output line and goes on (tier 2).
* **Listeners.** `removeEventListener` (by event, timeline and function name; an inline
function can't be removed). `Event.ENTER_FRAME` on the timeline, a movie clip, a button or
the stage: every frame, playing or stopped, **after playheads move and before that frame's
scripts run** (ActionScript dispatches `enterFrame` before frame scripts), in the order the
listeners were added. `KeyboardEvent.KEY_DOWN` and `KEY_UP` on the **stage** (where keys go
when nothing has focus, as in a published movie) with `e.keyCode`; elsewhere they would
never fire, so they are ignored and noted. `e.target` and `e.currentTarget` are the instance
listened to (the stage for keys); with no bubbling yet, a part inside a clip is not a
target of its own. `e == …` between instances compares them (`e.currentTarget == btn_a`).
The event passes on to a function whose parameter is typed `…Event`. Mouse listeners on
the stage and other event fields (`stageX`, `charCode`, `type`) are not yet.
* **Deterministic random.** `Math.random()` draws from a seeded generator in the player state
(Marsaglia's xorshift128, 53 bits per number), so the same document, seed and events give
the same movie, tested. `start_seeded(doc, seed, …)`; `control.test_movie` takes `seed`
(default 0); the app's Test Movie seeds from the clock on each start (screenshots use 0), and
the HTML page from `crypto.getRandomValues`.
* **Fuel, and how a script stops.** Every statement and expression costs one unit of fuel, a
loop's turn one more, and making text one more per 64 characters. A frame script or one
listener call gets 100,000; a step 1,000,000 over all of them. A script that runs out stops
where it is with one Output line ("Script on frame 3 of the main timeline stopped: it ran
more than 100000 steps (an endless loop?)"), and so does one that hits a run-time error
("… stopped: line 4: no instance named “ghost” here"); what it did before stays done, as an
ActionScript error leaves it, and the movie plays on. When the step's fuel is used up, the
step stops running actions with the existing message. Calls nest at most 16 deep, text is
at most 16,384 UTF-16 units, an Output line 1,000 (cut at a whole character); a binary
operator chain counts toward the 64-level nesting limit, so evaluating never recurses
without bound (a test runs the deepest allowed code on a 512 KiB stack). Measured (this
build's optimised dev profile): a 100,000-fuel loop runs in about 2 ms, so a step's whole
budget is about 20 ms.
* **Test Movie keyboard.** The movie surface takes the keyboard when the window opens and when
it is clicked; its keys (letters, digits, arrows, Space, Enter, Tab, Backspace, F1–F12, …)
go to the movie as ActionScript key codes, Tab and the arrows included; shortcuts with Ctrl
(⌘) or Alt still reach the app (Restart is Ctrl+Enter) and Esc closes the window. The window
says "Keys go to the movie" (or "Click the movie to give it the keyboard") when the movie
listens for keys. `control.test_movie` events take `{type: key_down|key_up|key, key}` with a
code, a letter or a `Keyboard` name.
* **HTML canvas export.** A script that runs goes out as its IR (`{"as": {"b": body, "i":
inline functions}}`), each timeline that runs scripts with its declarations (`fn`, `vt`),
and `player.js` mirrors the evaluator line for line, using JavaScript's own operators for
ECMAScript's. Parity tests play the same scripted documents in both, step by step, comparing
output, state (variables and stage listeners included) and display list, and compare
`Math.random()` number for number at several seeds. Keys reach the page's movie from the
window (arrows and Space stop scrolling the page when the movie listens for keys).
* **Not in tier 2.5:** `switch`, `for in`/`for each`, arrays, objects and `new`, string
methods, bitwise operators, closures and nested functions, event bubbling and `e.target`
inside a clip, mouse listeners on the stage, other event fields, `getChildByName`, `stage`
properties, sound, timers, `navigateToURL` (still noted), and ActionScript 1.0 and 2.0. The
XFL import report counts a script that compiles as running before the timeline is linked.
## Consequences
* Scripts from Animate files that count, branch, loop, read where things are or answer the
keyboard now play in Test Movie and the HTML page; the rest are still kept, not run, with
the reason in place.
* The player and `player.js` now share an evaluator's semantics, not just a list of actions:
every change to the IR or the evaluator needs both sides and a parity test.
* Exports other than HTML canvas, the stage and `evaluate` are unchanged: scripts never touch
the document (ADR 0013's "time stays a function").
+3 -3
View File
@@ -13,7 +13,7 @@ milestone ends with a green tree: build, tests, clippy, a `--screenshot` check a
| 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, 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 one-frame copy onto every keyframe between the markers), Clear, Align (Ctrl+Alt+1…6, To Stage), Rotate 90° and Flip, and **Free Transform** of the selection on every keyframe about one shared pivot (one box, one undo step per drag); raw shapes moved, transformed or pasted merge again on their own keyframe; **onion skin and Edit Multiple Frames inside a symbol edited in place**, on its own timeline and markers. Headless: `frames.transform`, `frames.align`, `frames.delete`, `frames.copy`, `frames.cut`, `frames.paste`, `frames.merge`, `merge` on `frames.edit_multiple`. Not yet: per-layer onion toggles, Duplicate/Distribute/Arrange and recolouring across keyframes, scaling a motion tween's object on several frames, a draggable pivot, onion frames of the timeline around an open symbol. **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 exportsLine 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, 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 commands and `paint.ink`. Not yet: Animate's ragged, stipple and hatched styles, multi-dash patterns in Properties (kept and editable by command), stroke scale modes and hairlines. **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 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. 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`; **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 0013 tier 2.5): 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`, `totalFrames`, `currentLabel`, `mouseX/Y`, `name`), `removeEventListener`, `Event.ENTER_FRAME`, `KeyboardEvent.KEY_DOWN/KEY_UP` on the stage with `e.keyCode`, `e.target`/`e.currentTarget`, seeded `Math.random()`; keyboard in Test Movie and the HTML page, `control.test_movie` key events and `seed`; `player.js` mirrors the evaluator, checked step by step in Boa. Not yet: ActionScript `switch`, `for in`, arrays and objects, string methods, closures, event bubbling, mouse listeners on the stage, ActionScript 1.0/2.0, 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. |
| 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`; **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`, `totalFrames`, `currentLabel`, `mouseX/Y`, `name`), `removeEventListener`, `Event.ENTER_FRAME`, `KeyboardEvent.KEY_DOWN/KEY_UP` on the stage with `e.keyCode`, `e.target`/`e.currentTarget`, seeded `Math.random()`; keyboard in Test Movie and the HTML page, `control.test_movie` key events and `seed`; `player.js` mirrors the evaluator, checked step by step in Boa. Not yet: ActionScript `switch`, `for in`, arrays and objects, string methods, closures, event bubbling, mouse listeners on the stage, ActionScript 1.0/2.0, 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. |
| Sound | **Audio layers, first slice** (ADR 0020): WAV (own reader), Ogg Vorbis (`lewton`) and MP3 (`nanomp3`) import, bounded and crash-proof; sounds live in the library, stored in `.anicraft` as imported, decoded once in the background. A sound belongs to a keyframe as in Animate (Properties › Sound: name, Sync Event/Start/Stop/Stream, Repeat ×N or Loop); Import to Stage puts one on a new layer spanning its length, Import to Library only adds it, the Library previews, places and deletes sounds. The timeline draws each sound's waveform over its span. Stage playback plays the mix through `cpal` (default feature `sound-output`) and the playhead follows the audio clock; stream sounds resync after a jump and scrubbing plays one-frame snippets. Mixing is pure and sample-exact (`doc::sound::voices` + `audio::mix`, Catmull-Rom resampling between rates). Headless: `sound.place/set/remove/rename/delete`, `file.import_to_library`, **`file.export_audio`** (WAV, 16/24-bit or float, any rate), and Export Video carries the soundtrack (Opus in WebM, AAC in MP4, by the user's ffmpeg). **Second slice** (ADR 0039): each frame sound has an **Effect** (None, Left channel, Right channel, Fade left to right, Fade right to left, Fade in, Fade out, shaped over the time it is heard, or **Custom**: up to 16 volume points per channel in the **Edit Envelope** window, drawn on each channel's waveform; the timeline's waveform follows the envelope). Layers holding sounds get a **Volume** and **Mute** (Properties, and a speaker toggle in the timeline); volumes multiply down through symbols and muted layers are silent in playback and every export. **Sounds inside symbols** play: a graphic's on its own frames mapped to the parent's time (loop mode and first frame apply; streams join mid-way and follow the parent playhead), a movie clip's on a loop from when the instance appeared; in the interactive player and **Test Movie** (which now has sound, the picture keeping time with it) movie clips start theirs as their own timelines reach them. The HTML page carries envelopes, volumes and graphic sounds. Headless: `sound.set {effect, envelope}`, `layer.set_volume`, `layer.toggle_mute`. Not yet: sounds on button frames, sound panning beyond the envelope, sounds from XFL (Animate keeps sound data in an undocumented binary form, so neither sounds nor their envelopes come across), audio in Lottie, stream sounds that follow go-tos in the HTML page, lossless compression of stored WAVs, latency compensation. |
| Files | `.anicraft` JSON load/save (v3, with scenes; v1 and v2 files open as one scene), PNG frame and sequence export, **animated GIF export** (parallel render and quantize, exact frame timing, looping), **SVG frame export** (from the same evaluated frame as the renderer: stage-space paths, renderer-matched stroke widths, caps, joins and dashes, gradients under `gradientTransform`, colour effects baked in, masks as nested `clipPath`s). **Opens Animate documents** (`.fla`, `.xfl`, XFL folders; ADR 0009; `.fla` archives in every common zip layout, ZIP64 included, and hostile ones refused with a readable error, ADR 0054): stage, first scene, layers, keyframes, labels, classic tweens with ease, shapes (solid/linear/radial fills, strokes), groups, primitives, symbol instances (matrix, alpha, tint, loop, blend mode, all seven filters), library symbols, **shape tweens**, **layer folders** and **mask layers** (masks inside folders too); imported files are untitled so Save never overwrites them; what isn't supported yet is reported after opening. Every scene comes across. **Bitmaps**: library items whose image is in the package as PNG or JPEG (the original in `LIBRARY/`, else the `bin/` data file when it is PNG or JPEG), instances, and bitmap fills with their matrix (twips scale removed; repeating unless clipped); Animate's own bitmap encodings are not public and are reported, not decoded. **Text** (ADR 0014): static, dynamic and input text fields become text blocks laid out by `anicraft-text`, with face (by PostScript name, family, or the family the name suggests; `_sans`/`_serif`/`_typewriter`), size, colour, bold/italic, alignment, letter and line spacing, margins, matrix, fixed width (wraps) or auto-size, and several lines; runs in different styles become one block per run of same-style lines, stacked as in Animate; a line mixing styles takes its main style and is counted; missing families fall back and are named in the report; dynamic/input fields come across as static text (reported). **Shape hints** on shape tweens (a tolerant self-authored `shapeHints` reader, ADR 0023). Brightness colour effects (as a tint towards white or black), movie clip and button instance names, one-segment custom eases (as cubic Béziers); a symbol without `symbolType` is a movie clip; frame comments aren't labels. Stroke caps, joins and miter limit, dashed and dotted strokes (ADR 0046; ragged, stipple and hatched are drawn solid and reported). Reported rather than silently changed: gradient strokes, repeating/reflecting, focal-point, elliptical and linear-RGB gradients, advanced colour effects, reverse loop modes, extra tween spins. A self-authored corpus with golden renders covers all of it (ADR 0035). No per-character styles or motion tweens from XFL yet; **frame scripts are kept** verbatim (scenes and every symbol, with the language from the publish settings), with symbol linkage classes and the document class, and the report lists them as kept, not run (ADR 0013 tier 1; scripts on instances and linkage on bitmaps and sounds are reported); **Import to Stage (Ctrl+R) for SVG drawings**: editable shapes on a new layer at the playhead, with groups, use and symbols, transforms, viewBox, styles, opacity and gradients; **clip paths and opaque masks** (ADR 0021) become mask layers in a folder named after the file (clips that cut nothing dropped, clips inside clips intersected exactly when all but one are convex polygons, curves kept), and **text** becomes text blocks, one per text chunk (position, anchor, font family list, size, weight, style, letter spacing, fill), with missing fonts named; stroke caps, joins, miter limits and dashes come across (ADR 0046); soft masks, per-character positions and text on a path are reported, as is anything else unsupported. **Sprite sheet export**: movie frames on one PNG grid (parallel render, columns/padding/scale, transparent or stage background) with a "JSON hash" frame map (rectangles, sizes, per-frame durations). **Video export**: WebM (VP9) or MP4 (H.264) by streaming raw frames, in order and rendered in parallel batches, to the user's own ffmpeg (no encoder bundled; ffmpeg from a parameter, `ANICRAFT_FFMPEG` or the PATH; argument lists, never a shell). **Lottie export** (`file.export_lottie`): frame-accurate rather than re-keyed: each frame is evaluated, artwork that persists (same layer, element, occurrence and path structure) becomes one shape layer with outlines baked to stage space, and whatever changes (outlines, colours, gradient points, stroke width, opacity, masks as layer masks) is written as hold keyframes where it changes; one layer order consistent with every frame (topological); checked against the reference web player (matches the renderer). Reported, not exported: bitmap fills, nested masks (innermost kept), group fades (per shape), stretched radial gradients (circles). **HTML canvas export** (`file.export_html`, ADR 0028): one self-contained web page that plays the movie, buLine truncated
@@ -37,7 +37,7 @@ milestone ends with a green tree: build, tests, clippy, a `--screenshot` check a
| **M3** | GPU stage *(in progress; the default stage renderer since ADR 0032)* | ~~wgpu renderer behind a feature flag~~ ✅ first slice (ADR 0019: the oracle's fills, CPU tile binning with backdrops, compute coverage; gradient tables in a storage buffer); ~~per-pixel parity tests vs the CPU oracle~~ ✅ (max 1/255, mean < 0.0001/255); ~~4K at 60 fps for 1,000 shapes~~ ✅ (8.8–9.0 ms); ~~no-readback textures, masks/groups/blend modes on the GPU~~ ✅ second slice (ADR 0029: window's device, 4K 10k shapes in 10.2 ms as tiles); ~~GPU binning~~ ✅ fourth slice (ADR 0048: heavy frames without masks or groups binned on the GPU, 50k shapes at 4K 122 → 22.5 ms in one texture; outline mode's hairlines as fast as tinted onion skin); ~~bitmaps and filters on the GPU~~ ✅ third slice (ADR 0032: bitmaps byte-identical, filters max 1/255; 4K filtered sample 3.9 ms, 200 bitmaps 4.4 ms); ~~hardware breadth~~ ✅ Vulkan and DX12 (FXC), software adapters refused, oracle-checked self-test; ~~GPU as the default stage renderer~~ ✅ (`gpu-stage` on by default for the app, automatic CPU fallback); next: GPU binning inside masks and groups, shared filtered layers across tiles, an image atlas, GPU exports. |
| **M4** | Interchange *(in progress)* | **XFL import** (DOMDocument.xml, symbols, edges/fill styles decoded from the public format descriptions) with a corpus of self-authored files: first slice ✅ (see Files above); ~~larger self-authored corpus with golden render tests~~ ✅ (ADR 0035: twelve packages covering every mapped feature, exact report expectations, hostile variants, CPU-oracle goldens); ~~`.fla` variants of the corpus and a hardened zip reader~~ ✅ (ADR 0054: nine zip layouts imported identically to the folder, ZIP64, CP437 names, a 9,664-archive hostile fuzz; a 54.6 MB `.fla` imports in 0.31 s); not yet: sound and video items, self-extracting and top-folder `.fla` archives; ~~SVG import (Import to Stage)~~ ✅, ~~SVG frame export~~ ✅; ~~Lottie export~~ ✅ (frame-accurate; easing curves instead of per-frame keys later); ~~sprite sheet + JSON~~ ✅; ~~MP4/WebM via ffmpeg pipe~~ ✅. |
| **M5** | Rich media | ~~Text engine~~ ✅ first slice (ADR 0012: `harfrust` shaping, `skrifa` outlines, line wrapping, outlines stored with the text; per-character styles, text on a path and input fields later); ~~bitmap import and bitmap fills~~ ✅; ~~audio layers, waveform display, stream sync~~ ✅ first slice (ADR 0020: WAV, Ogg Vorbis, MP3; `cpal` output); ~~effect envelopes, layer volume and mute, sounds inside symbols~~ ✅ (ADR 0039; button sounds and XFL sounds later); ~~filters (blur, drop shadow, glow, colour matrix)~~ ✅, ~~bevel, gradient glow and gradient bevel~~ ✅ (ADR 0025; SVG export and XFL import; filter presets, reordering, on/off and tweened filter values later) and ~~blend modes~~ ✅ on Movie Clips. |
| **M6** | Interactivity & extensibility | **Plug-ins: the Craft-family WebAssembly system** (same host model as PhotoCraft: `wasmi` sandbox, `plugin.*` commands; AniCraft ABI for vector/timeline operations and exporters): first slice ✅ (command plug-ins over the registry, ADR 0017; exporter and easing kinds later); ~~frame scripts on the same sandbox~~ ✅ and ~~button states in test-movie preview~~ ✅ first slice (ADR 0024: action IR, pure player, Actions panel, Test Movie); ~~HTML canvas runtime export~~ ✅ first slice (ADR 0028: one self-contained page, baked frames, a JS port of the player tested against it); command macros. **ActionScript compatibility, low priority** (ADR 0013), last in M6 and free to slip past M8: ~~tier 1 keeps scripts~~ ✅ (XFL frame scripts and class names stored verbatim, the Actions panel's Script view, `script.*` commands); ~~tier 2 runs the ActionScript 3 timeline subset (stop, play, go to frame or label, named instances, button events) in Test Movie and HTML canvas export through the same action IR as WebAssembly frame scripts~~ ✅; ~~tier 2.5 small logic (typed variables, expressions, `if` and loops, property reads, functions across frames, enter-frame and keyboard listeners, seeded random)~~ ✅. The full language, the `flash.*` API and SWF bytecode are not planned. |
| **M6** | Interactivity & extensibility | **Plug-ins: the Craft-family WebAssembly system** (same host model as PhotoCraft: `wasmi` sandbox, `plugin.*` commands; AniCraft ABI for vector/timeline operations and exporters): first slice ✅ (command plug-ins over the registry, ADR 0017; exporter and easing kinds later); ~~frame scripts on the same sandbox~~ ✅ and ~~button states in test-movie preview~~ ✅ first slice (ADR 0024: action IR, pure player, Actions panel, Test Movie); ~~HTML canvas runtime export~~ ✅ first slice (ADR 0028: one self-contained page, baked frames, a JS port of the player tested against it); command macros. **ActionScript compatibility, low priority** (ADR 0013), last in M6 and free to slip past M8: ~~tier 1 keeps scripts~~ ✅ (XFL frame scripts and class names stored verbatim, the Actions panel's Script view, `script.*` commands); ~~tier 2 runs the ActionScript 3 timeline subset (stop, play, go to frame or label, named instances, button events) in Test Movie and HTML canvas export through the same action IR as WebAssembly frame scripts~~ ✅; ~~tier 2.5 small logic (typed variables, expressions, `if` and loops, property reads, functions across frames, enter-frame and keyboard listeners, seeded random, ADR 0052)~~ ✅. The full language, the `flash.*` API and SWF bytecode are not planned. |
| **M7** | Advanced animation | ~~Bone/IK tool~~ ✅ first slice (ADR 0043: symbol-instance armatures on an armature layer, Bone tool, joint-angle poses tweened with easing, CCD inverse kinematics with joint limits and pins, posing with the Selection tool, Bone properties, every export; not yet: shape armatures, spring, joint translation, runtime armatures, XFL armature import, editing member instances' properties in place); ~~camera layer with depth~~ ✅ first slice (ADR 0027: one camera layer per scene, pan/zoom/rotate/tint, classic and motion tweens, pan-only layer depth, Camera tool, Preview Through Camera, every export; not yet: editing while previewing, perspective depth, brightness/advanced colour, attaching layers to the camera, XFL camera import); ~~variable-width strokes~~ ✅ first slice (ADR 0018: width profiles, Width tool, exports, tweens); ~~Brush tool~~ ✅ first slice (ADR 0033: filled sweeps, tips, pressure, Paint Normal/Fills/Behind; not yet: Paint Selection/Inside); ~~Eraser and Eyedropper~~ ✅ first slice (ADR 0034: five erase modes, Faucet, Erase Everything; picks solid, gradient, bitmap and line styles; not yet: erasing inside symbols, gradients and width profiles in the merge) and brush library; asset warp; graph-based easing presets library. |
| **M8** | Release quality | ~~Installers and signing for Windows/macOS/Linux~~ ✅ first slice (ADR 0026: family `packaging/` layout, MSI, DMG, AppImage/deb/rpm/Flatpak/tar.gz, `.anicraft` registered everywhere, signing wired to the release environment; next: opening documents from Finder, AppImage desktop integration, portable mode, store submissions); ~~web build (wasm) of the editor~~ ✅ first slice (ADR 0036: browser file picker and downloads, autosave in browser storage, CPU stage, CI wasm build and tests in Node; next: Web Audio, WebGPU stage, verified in browsers); ~~localisation~~ ✅ first slice (ADR 0040: `tr!` everywhere in the shell, craft-i18n catalogs, Preferences language, pseudo-locale; next: AniCraft's catalog in craft-i18n, engine messages, right to left once egui can lay it out); accessibility: first pass ✅ (ADR 0022: screen-reader names for every control, Ctrl+F6 panel focus, high-contrast theme, 200 % scale), next: stage elements and frames for screen readers, keyboard menu bar, the OS contrast setting; ~~crash-recovery autosave~~ ✅ (ADR 0015); documentation book. |
@@ -58,7 +58,7 @@ titled with its milestone.
| M3 | GPU stage: GPU binning inside masks and groups, filtered layers shared across a frame's tiles, more than 16 images per tile (first slice ✅ ADR 0019, no readback and masks/groups ✅ ADR 0029, bitmaps, filters and the default ✅ ADR 0032, GPU binning and hairlines ✅ ADR 0048) | CPU oracle, tiled stage, GPU stage slices 1–4 |
| M4 | Text from Animate files | XFL import, text engine (M5 first slice) |
| M5 | Audio layers: import, waveform, playback sync | timeline, layers |
| M6 | ~~WebAssembly plug-ins (U2)~~ ✅ first slice (ADR 0017); ~~frame scripts and Test Movie on the plug-in host~~ ✅ first slice (ADR 0024); ~~HTML canvas runtime export~~ ✅ first slice (ADR 0028); ~~ActionScript tier 1: keep scripts~~ ✅ (ADR 0013); ~~ActionScript tier 2: run the timeline subset~~ ✅ (ADR 0013); ~~ActionScript tier 2.5: small logic~~ ✅ (ADR 0013); next: command macros, or growing the ActionScript subset (`switch`, arrays, event bubbling) | command registry, plug-in host, action IR and player |
| M6 | ~~WebAssembly plug-ins (U2)~~ ✅ first slice (ADR 0017); ~~frame scripts and Test Movie on the plug-in host~~ ✅ first slice (ADR 0024); ~~HTML canvas runtime export~~ ✅ first slice (ADR 0028); ~~ActionScript tier 1: keep scripts~~ ✅ (ADR 0013); ~~ActionScript tier 2: run the timeline subset~~ ✅ (ADR 0013); ~~ActionScript tier 2.5: small logic~~ ✅ (ADR 0052); next: command macros, or growing the ActionScript subset (`switch`, arrays, event bubbling) | command registry, plug-in host, action IR and player |
| M7 | ~~Variable-width strokes~~ ✅ (ADR 0018), ~~camera layer with depth~~ ✅ first slice (ADR 0027), ~~Bone tool and IK~~ ✅ first slice (ADR 0043), ~~Brush tool~~ ✅ first slice (ADR 0033), ~~Eraser and Eyedropper~~ ✅ first slice (ADR 0034); next: Paint Selection/Inside and the brush library | strokes, Pen and Pencil, width profiles, timeline evaluation |
| M8 | ~~Crash-recovery autosave~~ ✅, ~~accessibility first pass~~ ✅ (ADR 0022), ~~installers and signing~~ ✅ first slice (ADR 0026), ~~web build~~ ✅ first slice (ADR 0036), ~~localisation~~ ✅ first slice (ADR 0040); next: the accessibility follow-ups, or macOS document opening | `.anicraft` format, session, AccessKit in eframe |
+1 -1
View File
@@ -379,7 +379,7 @@ fn script_view(app: &mut App, ui: &mut egui::Ui, t: &FrameTarget, src: Option<&S
let code = font(Type::Path);
let rows = shown.split('\n').count().max(1);
let editor_id = ui.make_persistent_id("act_script_editor");
// Names it takes from other frames of its timeline that aren't there (ADR 0013 tier 2.5).
// Names it takes from other frames of its timeline that aren't there (ADR 0052).
let links = match src.map(|s| s.compiled()) {
Some(Ok(c)) if t.runs => {
let which = t.base.get("symbol").and_then(Value::as_u64).map_or(anicraft_engine::doc::player::TimelineRef::Root, |id| anicraft_engine::doc::player::TimelineRef::Symbol(SymbolId(id)));
+1 -1
View File
@@ -1874,7 +1874,7 @@ impl App {
if keys == crate::a11y::Keyboard::Text || self.palette.is_some() {
return;
}
// The Test Movie window's movie has the keyboard (ADR 0013 tier 2.5): its keys are the
// The Test Movie window's movie has the keyboard (ADR 0052): its keys are the
// movie's; only shortcuts with Ctrl (⌘) or Alt reach the app (Restart is Ctrl+Enter).
if self.test_movie.is_some() && crate::test_movie::has_keys(ctx) {
let fire: Vec<&'static str> = ctx.input_mut(|i| self.shortcuts.iter().filter(|(m, _, _)| m.command || m.ctrl || m.alt).filter_map(|(m, k, id)| i.consume_key(*m, *k).then_some(*id)).collect());
+1 -1
View File
@@ -10,7 +10,7 @@
//! (`doc::sound::trigger`), movie clips' and graphics' included, and while sound plays the
//! movie keeps time with it, as the stage does.
//!
//! Its keyboard (ADR 0013 tier 2.5): while the movie has the focus (it takes it when the window
//! Its keyboard (ADR 0052): while the movie has the focus (it takes it when the window
//! opens and when clicked), keys go to the movie's keyboard listeners as ActionScript key
//! codes, Tab and the arrows included; shortcuts with Ctrl (⌘ on macOS) still reach the app,
//! and Esc closes the window.