diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 06:49:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 06:50:11 -0300 |
| commit | 378379807fb4cd751e90808c8363caddb365bcd8 (patch) | |
| tree | f84c7d0e7cbd42a9b9c93e791ab2b5376499d23d /anim/src/calls.zig | |
| parent | 5922ee911b9a6604f60dc83be36ba9e6c9abac98 (diff) | |
| download | computeranim-378379807fb4cd751e90808c8363caddb365bcd8.tar.gz computeranim-378379807fb4cd751e90808c8363caddb365bcd8.zip | |
canim: nothing changes in one frame; the map's space is used; the heap scene at its storyboard's length
The motion check counts a third of the one-frame changes it did: the
minimap's changes fade, and a register's value, a flag, a role, a pin's
names, a tag's note, a backtrace row, a call tree's node and a dump row
crossfade where they changed at once. What still fires is named in the
README; an encoder's keyframe and the gallery's cuts are exempt by name.
No caption stands over twelve seconds or under its reading time. The
heap scene is 78 s: what the storyboard does not narrate runs, and each
free's line cascades onto its call row (line stepping stops at a
breakpoint for that). On the map, leftover space holds the stack
continued, dumps round what the registers and the stack point at, open
loupes and the key: between 1% and 13% of a map is page, where it was 14%
to 42%.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/calls.zig')
| -rw-r--r-- | anim/src/calls.zig | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/anim/src/calls.zig b/anim/src/calls.zig index 4a669f3..9c3df04 100644 --- a/anim/src/calls.zig +++ b/anim/src/calls.zig @@ -92,6 +92,17 @@ pub const Tree = struct { u.line(from, to, if (live or n.call.enter > moment) ui.rgb(t.primary) else ui.rgb(theme.color.rule), theme.stroke.line); } const deepest = deepestActive(nodes, moment); + // A node's look before the step: one that changes (the gold going on + // to the new call, a ring to done) crossfades as the new one comes in. + const deepest_was = deepestActive(nodes, now.stops[1]); + // From the frame the tree's moment changes (a return's, its badge's). + const turned = if (now.plan.gait == .sprint) appears else std.math.clamp((since - (if (returned) @as(f32, time.badge_after) else 0)) / time.snap, 0, 1); + const Look = enum { gold, ring, done }; + const look = struct { + fn of(n: Node, i: usize, at_moment: u64, deep: ?usize) Look { + return if (deep == i) .gold else if (n.call.active(at_moment)) .ring else .done; + } + }.of; for (nodes, 0..) |n, i| { const c = at_of(left, pitch, top, n); // Where a projection from its frame's way back (the word its @@ -99,12 +110,11 @@ pub const Tree = struct { // there before the node, which comes when it arrives. if (n.call.enter <= now.stops[0]) ties.anchor(u, .{ .node_address = n.call.sp }, .{ .x = c[0] - m.radius, .y = c[1] - m.radius, .w = 2 * m.radius, .h = 2 * m.radius }); if (n.call.enter > moment) continue; - const v = if (n.call.enter > now.stops[1]) u.faded(appears) else u; - if (deepest == i) { - v.disc(c, m.radius, ui.rgb(theme.mark(.current).solid), null, 0); - } else if (n.call.active(moment)) { - v.disc(c, m.radius - theme.stroke.line / 2, ui.rgb(theme.color.page), ui.rgb(t.primary), theme.stroke.line); - } else v.disc(c, m.radius, ui.rgb(theme.color.raised), null, 0); + const is = look(n, i, moment, deepest); + const was = if (n.call.enter > now.stops[1]) is else look(n, i, now.stops[1], deepest_was); + const shows = if (n.call.enter > now.stops[1]) appears else if (was != is) turned else 1; + if (was != is) disc(u.faded(1 - shows), c, was); + disc(u.faded(shows), c, is); } // Then the words, so shapes and text each go in one run. const size = theme.size.mono.small; @@ -114,10 +124,15 @@ pub const Tree = struct { const active = n.call.active(moment); const words = if (n.call.arg) |arg| u.print("{d}", .{@as(i64, @bitCast(arg))}) else "?"; const cell: Rect = .{ .x = c[0] - m.radius, .y = c[1] - m.radius, .w = 2 * m.radius, .h = 2 * m.radius }; - const v = if (n.call.enter > now.stops[1]) u.faded(appears) else u; - if (deepest == i) { - v.label(.mono_bold, size, cell, .center, words, theme.mark(.current).on_solid); - } else v.label(.mono, size, cell, .center, words, t.primary); + const is = look(n, i, moment, deepest) == .gold; + const was = n.call.enter <= now.stops[1] and look(n, i, now.stops[1], deepest_was) == .gold; + const shows = if (n.call.enter > now.stops[1]) appears else if (was != is) turned else 1; + for ([2]bool{ was, is }, [2]f32{ if (was != is) 1 - shows else 0, shows }) |gold, amount| { + if (amount <= 0) continue; + if (gold) { + u.faded(amount).label(.mono_bold, size, cell, .center, words, theme.mark(.current).on_solid); + } else u.faded(amount).label(.mono, size, cell, .center, words, t.primary); + } if (active) continue; // Done: what it returned, on its shoulder; struck as it lands. const badge: Rect = .{ .x = c[0] + m.badge_at[0], .y = c[1] - m.badge_at[1], .w = m.badge, .h = m.badge }; @@ -139,26 +154,22 @@ pub const Tree = struct { u.clip(.{ .x = 0, .y = 0, .w = box.w, .h = box.h }); defer u.unclip(); const now = k.cursor.now(at); - const rec = k.cursor.rec; - // A frame is its words on the stack: the view changes with memory. - const moment = now.stop(.memory); - var buf: [24]context.Frame = undefined; - const chain = context.frames(rec, moment, &buf); - const room = theme.layout.rowsIn(box.h); - const body = u.panel(box.w, box.h, "backtrace", .{ .note = u.print("the calls waiting \u{00b7} {s}", .{context.newestAtBottom(u, chain.len, room)}) }); - const open = rec.stack(f.scratch, moment); // Newest at the bottom, as the tree grows down beside it; the oldest go from the top. - const shown = @min(chain.len, room); - for (chain[0..shown], 0..) |frame, i| { - const y = body.y + cm.pad + @as(f32, @floatFromInt(shown - 1 - i)) * cm.row; - const name = ui.symbol(u, rec.strings.get(frame.pc) orelse u.print("{x}", .{frame.pc})); - // The call this frame is, by its place on the chain: its arguments. - rows.callRow(u, y, box.w, i, name, context.callArguments(u, rec, open, i, frame.pc), context.frameWhere(u, rec, now.marked(), i, frame.pc), i == 0); - } + context.backtraceRows(u, now, k.cursor.rec, box, false, "the calls waiting \u{00b7} "); context.veiled(u, box, now.sprint_veil); } }; +/// A node of the tree as it looks: the deepest call gold, one waiting ringed, one done raised. +fn disc(u: ui.Ui, c: ui.Vec, look: anytype) void { + const m = metric; + switch (look) { + .gold => u.disc(c, m.radius, ui.rgb(theme.mark(.current).solid), null, 0), + .ring => u.disc(c, m.radius - theme.stroke.line / 2, ui.rgb(theme.color.page), ui.rgb(t.primary), theme.stroke.line), + .done => u.disc(c, m.radius, ui.rgb(theme.color.raised), null, 0), + } +} + /// A call's arguments as its backtrace row and its span say them: its /// parameter's name and value, `n=4`; "" for one that takes nothing. pub fn arguments(u: ui.Ui, rec: *const Recording, c: Recording.Call) []const u8 { |
