summaryrefslogtreecommitdiff
path: root/anim/src/stage.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 23:46:02 -0300
committerGabriel Schneider <[email protected]>2026-11-12 01:40:04 -0300
commit60e07feef401d9044db3a1c925cb9d1f6d20dac9 (patch)
tree98957ba8425193f686c8e8692cd10a10f27dbf4b /anim/src/stage.zig
parent9c0696447dbc5cf37e56aee562c7ebba4f4d4e6b (diff)
downloadcomputeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.tar.gz
computeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.zip
canim: relations as one data-oriented subsystem; aim; the ASan pair; the introduction's chapters
From the user. Relations between panes are one subsystem: per-frame tables of places and values in struct-of-arrays, owned by the frame; the kinds one table of data; a resolver of pure passes (join, filter, priority, cut) unit-tested on hand-written tables. Ported kinds draw byte-identical frames; a synthetic map of 4000 places and 6000 values resolves in 0.56 ms against the old table's 5.7. aim, a word holding a code address tied to its row, is the first new kind, off unless a scene turns it on. The ASan pair: one overflow built plain and with ASan, recorded by instruction; the frame as bytes eight a row; the plain run goes on alone in the column, its return address aimed at main's row until the letters reach it; the fault at ret. The introduction's three chapters are built and tested, not yet exported. Annotations, rows and scrolls that changed in one frame now fade; captions stand twelve seconds at most. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/stage.zig')
-rw-r--r--anim/src/stage.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/anim/src/stage.zig b/anim/src/stage.zig
index bbf5887..7b18064 100644
--- a/anim/src/stage.zig
+++ b/anim/src/stage.zig
@@ -102,6 +102,20 @@ pub const Stage = struct {
return false;
}
+ /// A move under way that changes `part`'s height: its height before and
+ /// after, and how far it has got (eased as the boxes are). Null otherwise.
+ pub fn resizing(st: *const Stage, at: anim.Placed, part: Part) ?struct { from: f32, to: f32, p: f32 } {
+ for (st.moves[0..st.count]) |m| {
+ const p = at.value(m.p);
+ if (p <= 0 or p >= 1) continue;
+ const a, const b = switch (part) {
+ inline else => |tag| .{ @field(m.from, @tagName(tag)).h, @field(m.to, @tagName(tag)).h },
+ };
+ if (a != b) return .{ .from = a, .to = b, .p = theme.ease(.glide, p) };
+ }
+ return null;
+ }
+
pub fn box(st: *const Stage, at: anim.Placed, part: Part) Rect {
const split = st.now(at);
return switch (part) {