summaryrefslogtreecommitdiff
path: root/anim/scenes
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 23:36:18 -0300
committerGabriel Schneider <[email protected]>2026-11-10 23:55:42 -0300
commit81d97a9e38c740a96af13a8a981878947a508bc0 (patch)
treebbe53f2f4c195f378a5a8cb67dfac1277ac68c82 /anim/scenes
parent2a46b60e1d115ff5149a112bc0f800467c0efaee (diff)
downloadcomputeranim-81d97a9e38c740a96af13a8a981878947a508bc0.tar.gz
computeranim-81d97a9e38c740a96af13a8a981878947a508bc0.zip
canim: quieter marks, the stack's roles, the loupe, arcs, the minimap, the map and the dive
From the user's notes on the second videos. The current row is a white wash, a strike a softened vermilion, held a turned corner. A stack row has its offset from rsp and its role from the tracer (a saved register, a local by name, argc and argv). The loupe is the telescope as a floating panel: the memory round what a pointer leads to, a pointer inside it opening the next. A pointer to a row of its own panel is an arc in a lane, in dumps, loupes and the stack. Every scene has the minimap; the map is the same moment with every panel at full length on 3840 by 2160, and the list opens on it and dives to the working frame, each panel travelling to its place. Recordings hold more round each stop. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/scenes')
-rw-r--r--anim/scenes/fib.zig1
-rw-r--r--anim/scenes/gallery.zig29
-rw-r--r--anim/scenes/list.zig31
-rw-r--r--anim/scenes/sort.zig1
-rw-r--r--anim/scenes/syscalls.zig1
5 files changed, 50 insertions, 13 deletions
diff --git a/anim/scenes/fib.zig b/anim/scenes/fib.zig
index 214f768..7e5380c 100644
--- a/anim/scenes/fib.zig
+++ b/anim/scenes/fib.zig
@@ -32,6 +32,7 @@ fn frame(s: *anim.Frame) void {
const ctx = canim.context(s, at, .{ .split = split });
// The lens: every call of fib as a tree, beside the frames they are on the stack.
const tree = canim.callTree(s, .{ .cursor = at, .stage = ctx.stage, .function = "fib", .focus = true });
+ ctx.map.add(s, canim.CallTree{ .cursor = at, .stage = ctx.map.stage, .function = "fib" });
var says: canim.Narrator = .{};
// Staging: the whole picture, still, before a word; the words, before a step.
diff --git a/anim/scenes/gallery.zig b/anim/scenes/gallery.zig
index fce9d43..7c480ec 100644
--- a/anim/scenes/gallery.zig
+++ b/anim/scenes/gallery.zig
@@ -9,6 +9,7 @@
//! 2 s the frame at rest, `beside`: every panel, the thread (mock 9)
//! 3.6 s a step, mid-way: struck, read, projection, echo (mock 10)
//! 6 s `subject` (mock 11); 8 s `none`, with the backtrace
+//! 10.8 s two loupes in depth, from rax and its node's `next` (mock 21)
const std = @import("std");
const sk = @import("sketch");
const anim = @import("anim");
@@ -60,15 +61,15 @@ fn atoms(u: ui.Ui, p: *const Pages) void {
x += 120;
x = u.address(x, rows.baseline(y), regs.rip, .{ .ink = ui.rgb(region.code_), .name = p.rec.strings.get(regs.rip) orelse "" }) + 40;
x = u.address(x, rows.baseline(y), 0x7ffff7ff0000, .{ .ink = ui.rgb(region.data), .rwx = true }) + 40;
- const struck: ui.Heat = .{ .level = 1, .solid = 1 };
+ const struck: ui.Heat = .struck;
const cell: canim.Rect = .{ .x = x, .y = y, .w = 6 * 12, .h = row };
- _ = u.written(cell, struck, 9);
- _ = u.address(x, rows.baseline(y), 0x407050, .{ .ink = ui.rgb(t.ink), .face = .mono_bold });
+ _ = u.written(cell, struck);
+ _ = u.address(x, rows.baseline(y), 0x407050, .{ .ink = ui.rgb(t.bright), .face = .mono_bold });
x += 112;
u.read(.{ .x = x, .y = y, .w = 72, .h = row }, 1);
_ = u.address(x, rows.baseline(y), 0x407058, .{ .ink = ui.rgb(region.heap) });
x += 112;
- _ = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, .ember, 9);
+ _ = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, .ember);
_ = u.address(x, rows.baseline(y), 0x407030, .{ .ink = ui.rgb(region.heap) });
// value
@@ -121,7 +122,7 @@ fn atoms(u: ui.Ui, p: *const Pages) void {
u.text(.mono_bold, theme.size.mono.context, 64 + 46 - 24, rows.baseline(y), "21", t.ink);
x = 300;
for ([_]ui.Heat{ .{ .arm = 1 }, struck, .ember }) |h| {
- const ink = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, h, 9);
+ const ink = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, h);
_ = u.address(x, rows.baseline(y), 0x407070, .{ .ink = if (ink) |i| i.ink else ui.rgb(region.heap), .face = if (ink) |i| i.face else .mono });
x += 120;
}
@@ -226,19 +227,19 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void {
y += 12;
var panel = u.moved(64, y);
_ = rows.reg(panel, 0, 880, "rsi", m, regs.rsi, .{});
- _ = rows.reg(panel, row, 880, "rdi", m, regs.rdi, .{ .first = .{ .level = 1, .solid = 1 } });
+ _ = rows.reg(panel, row, 880, "rdi", m, regs.rdi, .{ .first = .struck });
_ = rows.reg(panel, 2 * row, 880, "rax", m, regs.rax, .{ .first = .ember });
_ = rows.reg(panel, 3 * row, 880, "rbp", m, regs.rbp, .{ .read = 1, .read_shows = 1 });
rows.rip(panel, 4 * row, 880, m, regs.rip, regs.eflags, 1 << 6, 1, 0);
y = 380;
title(u, 64, y, "slot");
- note(u, 140, y, "its pins in the lane; the chain from 122; `call` spans at the right");
+ note(u, 140, y, "its pins in the lane; the offset from rsp; the address from 184 and its chain; a role; `call` spans at the right");
y += 12;
panel = u.moved(64, y);
for (0..4) |i| {
const addr = regs.rsp + 8 * i;
- _ = rows.slot(panel, @as(f32, @floatFromInt(i)) * row, 880, m, addr, if (i == 0) &.{ "rsp", "rbp" } else &.{}, 1, .{ .lead = ui.shared(&.{ regs.rsp, regs.rsp + 24 }), .first = if (i == 2) .ember else .none });
+ _ = rows.slot(panel, @as(f32, @floatFromInt(i)) * row, 880, m, addr, @intCast(8 * i), if (i == 0) &.{ "rsp", "rbp" } else &.{}, 1, .{ .lead = ui.shared(&.{ regs.rsp, regs.rsp + 24 }), .first = if (i == 2) .ember else .none }, if (i == 0) "saved rbp" else if (i == 1) "cur" else "", i == 1);
}
rows.span(panel, 880, 0, 2 * row, "reverse", true, false);
rows.span(panel, 880, 2 * row, 4 * row, "main", false, true);
@@ -271,7 +272,7 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void {
panel = u.moved(976, y);
var values: [16]u8 = .{ 12, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x70, 0x40, 0, 0, 0, 0, 0 };
var known: [16]bool = @splat(true);
- rows.bytes(panel, 0, 0x407030, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number, .read = 1 }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .{ .level = 1, .solid = 1 } } }, region.heap, 4, true, m);
+ rows.bytes(panel, 0, 0x407030, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number, .read = 1 }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .struck } }, region.heap, 4, true, m);
values[8] = 0x50;
rows.bytes(panel, row, 0x407050, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .ember } }, region.heap, 4, true, m);
known = @splat(false);
@@ -298,6 +299,12 @@ fn frame(s: *anim.Frame) void {
const at = canim.cursor(s, rec, rest);
const ctx = canim.context(s, at, .{ .split = canim.layout.split.beside, .quiet = true });
const list = canim.nodes(s, .{ .cursor = at, .stage = ctx.stage, .root = "head", .track = &.{ "prev", "cur", "next" }, .quiet = true });
+ ctx.map.add(s, canim.Nodes{ .cursor = at, .stage = ctx.map.stage, .root = "head", .track = &.{ "prev", "cur", "next" }, .quiet = true });
+ // A loupe from rax (the last node, whose `next` is NULL by then), and
+ // one from the `next` of the node before it in the first's rows: two in depth.
+ const rax = rec.register(rec.next(.line, rest), "rax");
+ const near = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .register = "rax" } });
+ const deeper = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .field = .{ .loupe = near, .at = rax - 0x20 + 8 } } });
const joins = ctx.ties(s);
const says = canim.caption(s, "The gallery: the frame, at rest. Every panel, the thread,\nthe lens beside it: the list and the bytes it is drawn from.");
const panels = .{ ctx.clock, ctx.registers, ctx.stack, ctx.backtrace, ctx.source, ctx.disasm, list, joins, says };
@@ -313,4 +320,8 @@ fn frame(s: *anim.Frame) void {
s.wait(7 - s.cursor);
ctx.stage.relayout(s, canim.layout.split.none);
s.wait(9 - s.cursor);
+ near.open(s);
+ s.wait(9.8 - s.cursor);
+ deeper.open(s);
+ s.wait(11 - s.cursor);
}
diff --git a/anim/scenes/list.zig b/anim/scenes/list.zig
index d6f1a76..b7e6c4a 100644
--- a/anim/scenes/list.zig
+++ b/anim/scenes/list.zig
@@ -6,8 +6,10 @@
//! trip round the loop is walked (each local strikes on the stack and in
//! the table, then its tag slides to its node; the pointer's rewrite is
//! armed with its old arrow going dashed, strikes, and the new arrow grows
-//! to the node it lands on); the second trip is hurried, with a rest; the
-//! third is walked again, and `head` takes the last node.
+//! to the node it lands on); after its first load the pointer loaded is
+//! opened in a loupe, and the `next` in it one deeper; the second trip is
+//! hurried, with a rest; the third is walked again, and `head` takes the
+//! last node.
const anim = @import("anim");
const canim = @import("canim");
const recordings = @import("recordings");
@@ -32,17 +34,38 @@ fn frame(s: *anim.Frame) void {
const split = canim.layout.split.subject;
const ctx = canim.context(s, at, .{ .split = split });
const list = canim.nodes(s, .{ .cursor = at, .stage = ctx.stage, .root = "head", .track = &tracked });
+ ctx.map.add(s, canim.Nodes{ .cursor = at, .stage = ctx.map.stage, .root = "head", .track = &tracked });
var says: canim.Narrator = .{};
+ // The pointer just loaded, opened: rax holds `cur->next` after the
+ // first trip's line 21; a loupe under it, and one from that node's `next`.
+ const loaded = rec.lineMoment(22, rec.lineMoment(21, reverse.enter));
+ const near = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .register = "rax" } });
+ const deeper = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .field = .{ .loupe = near, .at = rec.register(loaded, "rax") + 8 } } });
const joins = ctx.ties(s);
- // The nodes come in beside their bytes, one by one: three of them.
- ctx.establish(s, .{ ctx.clock, ctx.registers, ctx.stack, ctx.source, ctx.disasm, list, joins }, 3);
+ // It opens on the map, the whole context unfolded: the first caption at
+ // 1 s, the dive into the working frame at 2.5 s, the first step at 5 s.
+ ctx.map.show(s, .{ ctx.clock, ctx.registers, ctx.stack, ctx.source, ctx.disasm, list, joins });
+ s.wait(@max(t.establish - s.cursor, 0));
says.line(s, "A list is nodes on the heap, each holding the address of the next.\nReversing it moves no node: it rewrites every `next`.");
+ s.cursor = 2.5;
+ ctx.map.dive(s);
// Three names are set up.
const first_trip = rec.lineMoment(21, reverse.enter);
at.walk(s, .line, first_trip);
// The loop's caption leads the loop.
says.line(s, "`next` remembers the way on, `cur->next` is turned round,\nand `prev` and `cur` each step along.");
+ at.walk(s, .line, loaded);
+ // A beat of its own: the pointer just loaded is opened, and the one in it.
+ says.line(s, "`rax` holds `cur->next`: under it opens the heap round that node,\nand from its `next`, one deeper, the node after it.");
+ near.open(s);
+ s.wait(t.beat);
+ deeper.open(s);
+ s.wait(2 * t.beat + t.loupe.open);
+ deeper.close(s);
+ s.wait(t.stagger * 3);
+ near.close(s);
+ s.wait(t.beat);
const second_trip = rec.lineMoment(21, rec.lineMoment(24, first_trip));
at.walk(s, .line, second_trip);
// Pacing: the second trip is the same, so hurried; it keeps its rest.
diff --git a/anim/scenes/sort.zig b/anim/scenes/sort.zig
index c9b5b07..82a99e1 100644
--- a/anim/scenes/sort.zig
+++ b/anim/scenes/sort.zig
@@ -32,6 +32,7 @@ fn frame(s: *anim.Frame) void {
const ctx = canim.context(s, at, .{ .split = split });
// The lens: the array as cells, and the two indices that walk it.
const cells = canim.array(s, .{ .cursor = at, .stage = ctx.stage, .variable = "a", .indices = &.{ "i", "j" }, .focus = true });
+ ctx.map.add(s, canim.Array{ .cursor = at, .stage = ctx.map.stage, .variable = "a", .indices = &.{ "i", "j" } });
var says: canim.Narrator = .{};
// A swap, start to finish, as one step of sort(): over the call.
const swap = struct {
diff --git a/anim/scenes/syscalls.zig b/anim/scenes/syscalls.zig
index 6e2f0b9..1c875f3 100644
--- a/anim/scenes/syscalls.zig
+++ b/anim/scenes/syscalls.zig
@@ -33,6 +33,7 @@ fn frame(s: *anim.Frame) void {
const ctx = canim.context(s, at, .{ .split = split, .syscalls = true });
// The lens: the kernel's side of each call.
const kernel = canim.crossing(s, .{ .cursor = at, .stage = ctx.stage, .focus = true });
+ ctx.map.add(s, canim.Crossing{ .cursor = at, .stage = ctx.map.stage });
var says: canim.Narrator = .{};
const t = canim.theme.time;