summaryrefslogtreecommitdiff
path: root/anim/scenes/gallery.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 17:42:07 -0300
committerGabriel Schneider <[email protected]>2026-11-11 19:11:00 -0300
commitb54c6776953d3243ab5b8e676e747713827ab320 (patch)
treed53be6cef4587b94531880af6479a1b5fa1aac39 /anim/scenes/gallery.zig
parent3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6 (diff)
downloadcomputeranim-b54c6776953d3243ab5b8e676e747713827ab320.tar.gz
computeranim-b54c6776953d3243ab5b8e676e747713827ab320.zip
canim: the disassembly under the source everywhere; rings
From the user. In every split the disassembly stays under the source; registers a scene never changes fold three to a row, and the stack takes the room: nine to twenty slots where it had six. The graph's first form is rings: a loop a ring its blocks sit on, an inner loop a smaller ring touching its parent, a way out leaving along the tangent; layers stay for functions without loops. Its layout comes from the code alone and it shows nothing from after the moment: a block not reached yet is quiet and is reached, a fold of what is not reached yet opens when the run arrives. A pane unrolls from its strip into its whole column and rolls back. The sqlite scene's strips move before their panes. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/scenes/gallery.zig')
-rw-r--r--anim/scenes/gallery.zig109
1 files changed, 59 insertions, 50 deletions
diff --git a/anim/scenes/gallery.zig b/anim/scenes/gallery.zig
index f8964bd..17d38ed 100644
--- a/anim/scenes/gallery.zig
+++ b/anim/scenes/gallery.zig
@@ -10,11 +10,11 @@
//! 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)
-//! 21 s the `blocks` lens: at rest (blocks reached and not yet, the trail,
-//! an edge never taken), `leave` mid-way, `turn` landing, folds
-//! 24 s the graph with its rows, as the map draws it (here at half size):
-//! sort's (panned to its loop, the pc's block annotated) and libc's
-//! `open` at its syscall (the blocks not reached folded)
+//! 21 s the `blocks` lens in its two forms: sort in rings at rest (blocks
+//! reached and not yet, the trail, the turns), `leave` round the
+//! ring mid-way, `turn` just struck; libc's `open` in layers, folded
+//! 24 s a first time: `reach` (sort's first swap) landing, `unfold` (open
+//! past its syscall) making room; sort in layers; the unfold at rest
const std = @import("std");
const sk = @import("sketch");
const anim = @import("anim");
@@ -317,33 +317,23 @@ const GraphPages = struct {
pub fn draw(_: *const GraphPages, f: *sk.Frame, at: anim.Placed) void {
const u: ui.Ui = .{ .f = f, .at = at };
+ const spots = [_][2]f32{ .{ 64, 72 }, .{ 976, 72 }, .{ 64, 488 }, .{ 976, 488 } };
if (at.t >= 21 and at.t < 24) {
- title(u, 64, 40, "graph: the blocks lens");
- for ([_][2]f32{ .{ 64, 72 }, .{ 976, 72 }, .{ 64, 488 }, .{ 976, 488 } }, [_][]const u8{ "at rest: reached, not yet, the trail, not taken so far", "leave: the edge drawn gold, the mark on it", "turn: landed, the lane's count and the header's struck", "folds: libc's open, the blocks not reached" }) |p, words| note(u, p[0], p[1], words);
+ title(u, 64, 40, "graph: the blocks lens, its two forms");
+ for (spots, [_][]const u8{ "rings: sort at rest, reached and not yet, the trail, the turns", "leave: the edge drawn gold, the mark round the ring", "turn: landed, the ring's count struck", "layers: libc's open at its syscall, what it has not reached folded" }) |p, words| note(u, p[0], p[1], words);
} else if (at.t >= 24 and at.t < 27) {
- title(u, 64, 40, "graph: with its rows, as on the map (half size)");
+ title(u, 64, 40, "graph: a first time, reach and unfold");
+ for (spots, [_][]const u8{ "reach: the first swap, its pill filling as the mark lands", "unfold: open past its syscall, the way back from the kernel opening", "layers: sort, panned to the pc", "unfold, at rest: the fold open, the pane panned" }) |p, words| note(u, p[0], p[1], words);
}
}
};
-/// A component drawn at half its size (the map's rows as the map shows them filling a 1080p frame).
-fn Half(comptime T: type) type {
- return struct {
- inner: T,
- box: canim.Rect = .{ .x = 0, .y = 0, .w = 1920, .h = 1080 },
-
- pub fn draw(h: *const @This(), f: *sk.Frame, at: anim.Placed) void {
- var p = at;
- p.xf = p.xf.mul(.scale(0.5, 0.5));
- p.scale *= 0.5;
- h.inner.draw(f, p);
- }
- };
-}
-
-/// The graph pages: sort's blocks in the lens, at rest and in `leave` and
-/// `turn`, and libc's `open` folded; then the map's form of both.
-fn graphPages(s: *anim.Frame, at_time: f32) [3]anim.Obj {
+/// The graph pages, each four panes of the `blocks` lens (880 by 344): at
+/// 21 s sort in rings at rest, a `leave` round the ring mid-way, a `turn`
+/// just landed, libc's `open` in layers, folded; at 24 s a `reach` (the
+/// first swap) and an `unfold` (open past its syscall) caught in their
+/// moves, sort in layers, and the unfold at rest.
+fn graphPages(s: *anim.Frame) [9]anim.Obj {
const graph = canim.graph;
const sort = canim.open(recordings.gallery_sort);
const hello = canim.open(recordings.gallery_hello);
@@ -363,47 +353,64 @@ fn graphPages(s: *anim.Frame, at_time: f32) [3]anim.Obj {
break;
};
const place = struct {
- fn stage(s_: *anim.Frame, band: canim.Rect, disasm: canim.Rect) *canim.Stage {
+ fn stage(s_: *anim.Frame, band: canim.Rect) *canim.Stage {
var split = canim.layout.split.blocks;
split.band = band;
- split.disasm = disasm;
return canim.Stage.init(s_, split);
}
}.stage;
- const nowhere: canim.Rect = .{ .x = 0, .y = 0, .w = 0, .h = 0 };
+ const at = [_]canim.Rect{ .{ .x = 64, .y = 84, .w = 880, .h = 344 }, .{ .x = 976, .y = 84, .w = 880, .h = 344 }, .{ .x = 64, .y = 500, .w = 880, .h = 344 }, .{ .x = 976, .y = 500, .w = 880, .h = 344 } };
const rest = canim.cursor(s, sort, start);
- const leaving = canim.cursor(s, sort, jne);
+ // The scene's first leave: the inner test's `jle` not taken, round the ring's top to the compare.
+ const leaving = canim.cursor(s, sort, graph.blockEnd(sort, start));
const turning = canim.cursor(s, sort, back);
const open_at = canim.cursor(s, hello, syscall_at);
- const lenses = .{
- canim.add(s, graph.Blocks{ .cursor = rest, .stage = place(s, .{ .x = 64, .y = 84, .w = 880, .h = 296 }, nowhere) }),
- canim.add(s, graph.Blocks{ .cursor = leaving, .stage = place(s, .{ .x = 976, .y = 84, .w = 880, .h = 296 }, nowhere) }),
- canim.add(s, graph.Blocks{ .cursor = turning, .stage = place(s, .{ .x = 64, .y = 500, .w = 880, .h = 296 }, nowhere) }),
- canim.add(s, graph.Blocks{ .cursor = open_at, .stage = place(s, .{ .x = 976, .y = 500, .w = 880, .h = 296 }, nowhere) }),
+ const reaching = canim.cursor(s, sort, jne);
+ // Open from its syscall: the fold of the way back from the kernel opens as the run gets there.
+ const unfolding = canim.cursor(s, hello, syscall_at);
+ const unfolded = canim.cursor(s, hello, syscall_at);
+ const first = .{
+ canim.add(s, graph.Blocks{ .cursor = rest, .stage = place(s, at[0]) }),
+ canim.add(s, graph.Blocks{ .cursor = leaving, .stage = place(s, at[1]) }),
+ canim.add(s, graph.Blocks{ .cursor = turning, .stage = place(s, at[2]) }),
+ canim.add(s, graph.Blocks{ .cursor = open_at, .stage = place(s, at[3]) }),
+ };
+ const second = .{
+ canim.add(s, graph.Blocks{ .cursor = reaching, .stage = place(s, at[0]) }),
+ canim.add(s, graph.Blocks{ .cursor = unfolding, .stage = place(s, at[1]) }),
+ canim.add(s, graph.Blocks{ .cursor = rest, .stage = place(s, at[2]), .form = .layers }),
+ canim.add(s, graph.Blocks{ .cursor = unfolded, .stage = place(s, at[3]) }),
};
- // Each step played so that the page shows it at `at_time`: the leave with its mark mid-way, the turn just landed.
+ // Each step played so that its page shows it mid-move: the leave with its
+ // mark half-way, the turn just struck; the reach landed and filling, the
+ // unfold making room.
const l = canim.theme.time.leave;
- s.cursor = at_time - l.sets_off - l.mark / 2.0 - 0.05;
+ s.cursor = 0;
+ unfolding.jump(s, graph.blockEnd(hello, syscall_at));
+ unfolded.jump(s, graph.blockEnd(hello, syscall_at));
+ s.cursor = 21.8 - l.sets_off - 0.11;
graph.leave(leaving, s);
- s.cursor = at_time - l.sets_off - 0.30 - l.count;
+ s.cursor = 21.8 - l.sets_off - 0.22 - 0.12;
graph.leave(turning, s);
- // The map's form, at half size: the map's units, two columns wide each.
- const maps = .{
- canim.add(s, Half(graph.Map){ .inner = .{ .cursor = canim.cursor(s, sort, jne), .stage = place(s, nowhere, .{ .x = 128, .y = 176, .w = 1792, .h = 1688 }) } }),
- canim.add(s, Half(graph.Map){ .inner = .{ .cursor = canim.cursor(s, hello, syscall_at), .stage = place(s, nowhere, .{ .x = 1952, .y = 176, .w = 1792, .h = 1688 }) } }),
- };
+ s.cursor = 25.5 - l.sets_off - 0.24 - 0.10;
+ graph.leave(reaching, s);
+ s.cursor = 25.5 - l.sets_off - 0.18;
+ graph.leave(unfolding, s);
+ s.cursor = 23;
+ graph.leave(unfolded, s);
const pages = canim.add(s, GraphPages{});
- var all: [lenses.len]anim.Animation = undefined;
- inline for (lenses, 0..) |o, i| all[i] = o.fadeIn();
+ var all: [first.len]anim.Animation = undefined;
s.cursor = 21;
s.play(.{pages.fadeIn()}, .{ .seconds = 0 });
+ inline for (first, 0..) |o, i| all[i] = o.fadeIn();
s.play(all, .{ .seconds = 0 });
s.cursor = 24;
- inline for (lenses, 0..) |o, i| all[i] = o.fadeOut();
+ inline for (first, 0..) |o, i| all[i] = o.fadeOut();
+ s.play(all, .{ .seconds = 0 });
+ inline for (second, 0..) |o, i| all[i] = o.fadeIn();
s.play(all, .{ .seconds = 0 });
- s.play(.{ maps[0].fadeIn(), maps[1].fadeIn() }, .{ .seconds = 0 });
s.cursor = 27;
- return .{ pages, maps[0], maps[1] };
+ return .{ pages, first[0], first[1], first[2], first[3], second[0], second[1], second[2], second[3] };
}
fn frame(s: *anim.Frame) void {
@@ -414,7 +421,9 @@ fn frame(s: *anim.Frame) void {
const pages = canim.add(s, Pages{ .rec = rec, .moment = rest });
s.play(.{pages.fadeIn()}, .{ .seconds = 0 });
- const at = canim.cursor(s, rec, rest);
+ var at = canim.cursor(s, rec, rest);
+ // Its way, the one step it takes: the registers that step does not change are folded.
+ at.journey(.line, rec.next(.line, 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 });
@@ -448,5 +457,5 @@ fn frame(s: *anim.Frame) void {
// The graph's pages: the context stands aside.
inline for (panels, 0..) |o, i| all[i] = o.fadeOut();
s.play(all, .{ .seconds = 0 });
- _ = graphPages(s, 21.8);
+ _ = graphPages(s);
}