summaryrefslogtreecommitdiff
path: root/anim/src/loupe.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 02:11:12 -0300
committerGabriel Schneider <[email protected]>2026-11-11 04:20:25 -0300
commit5922ee911b9a6604f60dc83be36ba9e6c9abac98 (patch)
tree310b983f5205709e5db173f9f1bc8e8d499d24fe /anim/src/loupe.zig
parent64e64c74be6a3e46abeae8a30dd42efff91aaf91 (diff)
downloadcomputeranim-5922ee911b9a6604f60dc83be36ba9e6c9abac98.tar.gz
computeranim-5922ee911b9a6604f60dc83be36ba9e6c9abac98.zip
canim: what the second review found, fixed
A system call stepped over plays in order: the registers set, the crossing from the call row with the kernel's window under it, the stores after rax. A strike covers the bytes that changed. The band's view changes with the argument framing. In the descent a callee sits under its caller's return row, and rows fade before others glide. The heap scene follows the storyboard's nine captions: pushes at a run without marks, each free and the malloc that takes the head back walked, the tcache's loupe over the stack and closed with each advance, a chunk in neither list drawn, the freed node travelling to malloc's row. In the dive the map falls into the corner and becomes the minimap; on the map boxes are as long as their rows. A narrow read is shown at its width. The chart checks captions and one-frame changes. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/loupe.zig')
-rw-r--r--anim/src/loupe.zig39
1 files changed, 34 insertions, 5 deletions
diff --git a/anim/src/loupe.zig b/anim/src/loupe.zig
index 623e966..65a9463 100644
--- a/anim/src/loupe.zig
+++ b/anim/src/loupe.zig
@@ -54,9 +54,15 @@ pub const Loupe = struct {
/// `open`: its pointer framed as read; the stem draws and the loupe
/// rises with it, its shadow growing; its target's frame lands last.
+ /// It may open again after a `close`. (Its clock runs on past the
+ /// open, for the strikes in it: `opening` counts open's lengths.)
pub fn open(l: *const Loupe, s: *anim.Frame) void {
- s.play(.{l.opening.to(1)}, .{ .seconds = time.open, .ease = anim.ease.linear });
+ const start = s.cursor;
+ s.play(.{ l.opening.to(0), l.closing.to(0) }, .{ .seconds = 0 });
+ s.play(.{l.opening.to(open_lengths)}, .{ .seconds = open_lengths * time.open, .ease = anim.ease.linear });
+ s.cursor = start + time.open;
}
+ const open_lengths = 8;
/// `close`: the stem draws back and the loupe sinks, fading as it falls.
pub fn close(l: *const Loupe, s: *anim.Frame) void {
@@ -99,14 +105,24 @@ pub const Loupe = struct {
const b = back.apply(.{ px[2], px[3] });
pointer = .{ .x = a[0], .y = a[1], .w = b[0] - a[0], .h = b[1] - a[1] };
target = row.fields.base;
+ // From the band's view it lies over the stack, never the registers (what a step changes there is what the captions are about).
+ const stack = l.stage.box(u.at, .stack);
+ const h = theme.layout.panelH(k.rows);
+ return .{ .box = .{ .x = stack.x, .y = stack.y + stack.h - h, .w = k.width, .h = h }, .pointer = pointer, .target = target, .first = target, .ink = rows.ink(rows.regionOf(moment, target)) };
},
}
if (target == 0) return null;
// shortcut: it keeps to the stage and does not yet move past the current marks or a changed row; the scene picks a pointer whose loupe covers neither.
const stage = theme.canvas.stage;
const h = theme.layout.panelH(k.rows);
- const x = std.math.clamp(@max(pointer.x - k.hang, right), stage.x, stage.x + stage.w - k.width);
- const y = @min(pointer.y + pointer.h - 1, stage.y + stage.h - h);
+ var x = std.math.clamp(@max(pointer.x - k.hang, right), stage.x, stage.x + stage.w - k.width);
+ var y = @min(pointer.y + pointer.h - 1, stage.y + stage.h - h);
+ // A deeper one with no room to the right hangs under the one it opens from, both whole.
+ if (l.from == .field and x < right) {
+ const parent = l.from.field.loupe.place(u, now).?.box;
+ x = parent.x;
+ y = @min(parent.y + parent.h + k.shadow[0][1], stage.y + stage.h - h);
+ }
return .{ .box = .{ .x = x, .y = y, .w = k.width, .h = h }, .pointer = pointer, .target = target, .first = (target & ~@as(u64, 15)) - 16 * (k.rows / 2), .ink = rows.ink(rows.regionOf(moment, target)) };
}
@@ -171,7 +187,10 @@ pub const Loupe = struct {
const top = m.tag + m.pad;
v.clip(.{ .x = 0, .y = m.tag, .w = b.w, .h = b.h - m.tag });
// By the scene's fields: the rows that hold them, the rest `more`.
- if (l.from == .row) hexdump.fielded(.{ .u = v, .rows = k.rows, .box = b }, now, top, l.from.row.fields) else hexdump.drawArcs(v, now, 0, top, p.first, k.rows, .{ .things = things }, true, .{ m.tag, b.h - m.pad });
+ // Its fields strike once it has opened, 6 f after it and 6 f apart.
+ var fields = if (l.from == .row) l.from.row.fields else undefined;
+ if (l.from == .row and now.walking()) fields.struck = opened - time.open - cursors.write_apart;
+ if (l.from == .row) hexdump.fielded(.{ .u = v, .rows = k.rows, .box = b }, now, top, fields) else hexdump.drawArcs(v, now, 0, top, p.first, k.rows, .{ .things = things }, true, .{ m.tag, b.h - m.pad });
v.unclip();
// Its target, framed bright: each field of the struct, or the word.
const framed = std.math.clamp((since - time.stem - time.frame) / time.frame, 0, 1);
@@ -183,8 +202,18 @@ pub const Loupe = struct {
for (o.type.record.fields) |field| frameRun(w, row_y, shift, o.addr + field.offset - (p.target & ~@as(u64, 15)), field.type.size() orelse 8);
} else frameRun(w, row_y, shift, p.target % 16, 8);
}
- // The stem: a bracket under the pointer's digits, lying on the tag, drawn head first.
const drawn = cursors.standard(std.math.clamp(since / time.stem, 0, 1)) * (1 - closed);
+ // From a row of the band's view: the stem leaves the row's left, goes down the gutter's right lane, into the tag.
+ if (l.from == .row) {
+ const view = l.stage.box(placed, .view);
+ const mid = p.pointer.y + p.pointer.h / 2;
+ const lane = view.x - k.lane;
+ u.faded(@min(rise * 2, 1)).route(&.{ .{ view.x, mid }, .{ lane, mid }, .{ lane, b.y + lower + m.tag / 2 }, .{ b.x - 2, b.y + lower + m.tag / 2 } }, p.ink, .{ .width = theme.stroke.line, .head = .{ 10, 10 }, .radius = 4, .progress = drawn });
+ return;
+ }
+ // Hung under the one it opens from: the stem goes down from the pointer to its tag.
+ if (b.y > p.pointer.y + p.pointer.h + 1) u.faded(@min(rise * 2, 1)).fill(.{ .x = p.pointer.x + 8, .y = p.pointer.y + p.pointer.h - 3, .w = k.stem, .h = (b.y + lower - (p.pointer.y + p.pointer.h - 3)) * drawn }, p.ink);
+ // The stem: a bracket under the pointer's digits, lying on the tag, drawn head first.
u.faded(@min(rise * 2, 1)).fill(.{ .x = p.pointer.x - 2, .y = p.pointer.y + p.pointer.h - 3, .w = (p.pointer.w + 4) * drawn, .h = k.stem }, p.ink);
}
};