diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-12 04:45:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 07:03:05 -0300 |
| commit | 4907e35bc45d12102d0e09380994814fc2e0a369 (patch) | |
| tree | 7cfd90224653d73b63fbadaf2881fa0e6ba92860 /anim/src/segments.zig | |
| parent | ebdebe04a76f0302aeb24c1ac08fa9217b1a8257 (diff) | |
| download | computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.tar.gz computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.zip | |
canim: the introduction, from the review
The introduction records the plain build (clang -O0, no instrumentation),
so reverse's frame is the compiler's own push, mov and sub. The stack
chapter says its convention once and keeps four free words over rsp so
a push moves the pin and nothing else; reverse's rows stand under main's
and are stepped, each touching its word, the call before the push, the
aim drawn head first to the row it returns to. The close-up frames the
bytes and the stack together with their 128 bytes marked. Nothing is
named before it is shown; offsets are written in hex as the operands are;
the dump folds into its tag; the map is announced before it is shown.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/segments.zig')
| -rw-r--r-- | anim/src/segments.zig | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/anim/src/segments.zig b/anim/src/segments.zig index db9d28f..a304993 100644 --- a/anim/src/segments.zig +++ b/anim/src/segments.zig @@ -572,6 +572,10 @@ pub const Place = struct { /// Frames into the tie (negative: not begun); frames into its quieting. clock: anim.Value, quiet: anim.Value, + /// 0 to 1: the dump's place marked on its box for a camera's visit (it + /// is far thinner than a unit there): a 2-unit tick across the box in + /// the stack's ink, `128 bytes` over it, left of where the link comes down. + tick: ?anim.Value = null, pub fn draw(p: *const Place, f: *sk.Frame, placed: anim.Placed) void { const clock = placed.value(p.clock); @@ -590,9 +594,15 @@ pub const Place = struct { u.route(&.{ .{ p.x, p.y0 }, .{ p.x, top }, .{ to[0], top }, .{ to[0], to[1] } }, ink, .{ .width = theme.stroke.tie.link, .head = .{ 10, 10 }, .progress = drawn, .radius = 8 }); // The stack's band framed bright as the head lands. const bright = std.math.clamp((clock - 42) / 6, 0, 1) * (1 - std.math.clamp((clock - 48) / 12, 0, 1)); - if (bright > 0) for (l.space.clusters, 0..) |c, i| if (i < 6 and p.addr >= c.lo and p.addr < c.hi) { + const marked = if (p.tick) |tv| std.math.clamp(placed.value(tv), 0, 1) else 0; + if (bright > 0 or marked > 0) for (l.space.clusters, 0..) |c, i| if (i < 6 and p.addr >= c.lo and p.addr < c.hi) { const b = l.boxes[i]; - u.faded(bright).frame(.{ .x = b.x - 5, .y = b.y - 5, .w = b.w + 10, .h = b.h + 10 }, t.bright, theme.stroke.line); + if (bright > 0) u.faded(bright).frame(.{ .x = b.x - 5, .y = b.y - 5, .w = b.w + 10, .h = b.h + 10 }, t.bright, theme.stroke.line); + if (marked > 0) { + const label = "128 bytes"; + u.faded(marked).fill(.{ .x = b.x, .y = to[1] - 1, .w = b.w, .h = 2 }, region.stack); + u.faded(marked).text(.sans, theme.size.sans.tag, to[0] - 8 - u.width(.sans, theme.size.sans.tag, label), to[1] - 6, label, region.stack); + } }; } }; |
