summaryrefslogtreecommitdiff
path: root/anim/src/stage.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 18:06:30 -0300
committerGabriel Schneider <[email protected]>2026-11-10 19:01:23 -0300
commite63b0624f57472d40af32a006c32cc47d403b822 (patch)
treeb7295da62acd96bc7aba425720eed95605526693 /anim/src/stage.zig
parent318e16181a28725e218121363555580725d6d0d4 (diff)
downloadcomputeranim-e63b0624f57472d40af32a006c32cc47d403b822.tar.gz
computeranim-e63b0624f57472d40af32a006c32cc47d403b822.zip
canim: what the review found; the band as two panels; list and sort by instruction
The first videos were reviewed frame by frame and the catalogue changed with them. A lens is a drawing over the program column and its view over the state column, so the stack keeps six slots, its window on the whole frame. Operands are whole. list and sort are recorded by instruction from main (record --from), so their registers strike, links reach nodes and cells, rows that ran are marked and jumps are drawn. A call's node is a projection of its return address; pins travel and keep their side; a mark covers the bytes that changed, at the element's width; a syscall's result is stored after the kernel returns it and every panel is of one moment; fast passes are veiled; the clock stands still during a step; captions get their reading time and a scene's first step comes by four seconds. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'anim/src/stage.zig')
-rw-r--r--anim/src/stage.zig37
1 files changed, 33 insertions, 4 deletions
diff --git a/anim/src/stage.zig b/anim/src/stage.zig
index 31a149a..595b9f5 100644
--- a/anim/src/stage.zig
+++ b/anim/src/stage.zig
@@ -10,18 +10,31 @@ const theme = ui.theme;
const Split = theme.layout.Split;
const Rect = theme.Rect;
-pub const Part = enum { band, source, disasm, registers, stack, backtrace };
+pub const Part = enum { band, view, source, disasm, registers, stack, backtrace };
pub const Stage = struct {
first: Split,
moves: [8]Move = undefined,
count: usize = 0,
+ /// Seconds into the band's lens rising from its bytes (`Context.establish`,
+ /// `ties.rise`); far past it, for a scene that does not raise one.
+ rise: anim.Value,
+ /// 1, or less while a relayout fades the drawing out and in round its move.
+ drawing: anim.Value,
+ /// 1, or less while the camera visits the drawing and its view is cleared.
+ view: anim.Value,
+ /// While the camera visits the stack: the moment whose window it holds
+ /// still (negative: none), and how many `free` words above its rsp it shows.
+ hold: anim.Value,
+ hold_free: anim.Value,
+ /// 0 to 1 as the window goes from where it was to where it is held (and back).
+ hold_in: anim.Value,
const Move = struct { from: Split, to: Split, p: anim.Value };
/// A stage at `split`, made where a scene's components can keep a pointer to it.
pub fn init(s: *anim.Frame, split: Split) *Stage {
- return s.new(Stage{ .first = split });
+ return s.new(Stage{ .first = split, .rise = s.value(std.math.floatMax(f32)), .drawing = s.value(1), .view = s.value(1), .hold = s.value(-1), .hold_free = s.value(0), .hold_in = s.value(0) });
}
/// The split the stage ends in, after every move so far.
@@ -34,7 +47,23 @@ pub const Stage = struct {
const p = s.value(0);
st.moves[st.count] = .{ .from = st.last(), .to = to, .p = p };
st.count += 1;
+ // The drawing fades out (12 f), the panels move, it fades in at its new size.
+ s.play(.{st.drawing.to(0)}, .{ .seconds = theme.time.quick, .ease = anim.ease.linear });
s.play(.{p.to(1)}, .{ .seconds = theme.time.relayout, .ease = anim.ease.linear });
+ s.play(.{st.drawing.to(1)}, .{ .seconds = theme.time.quick, .ease = anim.ease.linear });
+ }
+
+ /// Holds the stack's window still as it is at moment `at`, with `free`
+ /// words above its rsp for pushes to fill: for the camera's visit.
+ pub fn holdStack(st: *Stage, s: *anim.Frame, at: u64, free: u32) void {
+ s.play(.{ st.hold.to(@floatFromInt(at)), st.hold_free.to(@floatFromInt(free)) }, .{ .seconds = 0 });
+ // It scrolls there by whole rows, as a window does.
+ s.play(.{st.hold_in.to(1)}, .{ .seconds = theme.time.move, .ease = anim.ease.linear });
+ }
+
+ pub fn releaseStack(st: *Stage, s: *anim.Frame) void {
+ s.play(.{st.hold_in.to(0)}, .{ .seconds = theme.time.move, .ease = anim.ease.linear });
+ s.play(.{st.hold.to(-1)}, .{ .seconds = 0 });
}
/// The split as it stands at this instant.
@@ -67,7 +96,7 @@ pub const Stage = struct {
fn between(a: Split, b: Split, p: f32) Split {
var out = b;
- inline for (.{ "band", "source", "disasm", "registers", "stack", "backtrace" }) |name| {
+ inline for (.{ "band", "view", "source", "disasm", "registers", "stack", "backtrace" }) |name| {
const x = @field(a, name);
const y = @field(b, name);
@field(out, name) = .{ .x = std.math.lerp(x.x, y.x, p), .y = std.math.lerp(x.y, y.y, p), .w = std.math.lerp(x.w, y.w, p), .h = std.math.lerp(x.h, y.h, p) };
@@ -79,6 +108,6 @@ fn between(a: Split, b: Split, p: f32) Split {
test "a relayout passes through the splits it joins" {
const sp = theme.layout.split;
const half = between(sp.beside, sp.subject, 0.5);
- try std.testing.expectEqual(@as(f32, 200), half.band.h);
+ try std.testing.expectEqual(@as(f32, 224), half.band.h);
try std.testing.expectEqual(sp.subject.stack, between(sp.beside, sp.subject, 1).stack);
}