summaryrefslogtreecommitdiff
path: root/anim/src/nodes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/nodes.zig')
-rw-r--r--anim/src/nodes.zig18
1 files changed, 13 insertions, 5 deletions
diff --git a/anim/src/nodes.zig b/anim/src/nodes.zig
index 81a9953..7c842d3 100644
--- a/anim/src/nodes.zig
+++ b/anim/src/nodes.zig
@@ -77,7 +77,7 @@ pub const Nodes = struct {
const shown = @min(count, (hi - first) / 16);
const v = hexdump.panel(f, placed, g.stage, u.print("the heap, {x} to {x}", .{ first, first + 16 * shown - 1 }), &legend);
if (v.rows > 0) hexdump.draw(v.u, now, 0, m.tag + m.pad, first, @min(shown, v.rows), .{ .things = things });
- if (v.rows > 0) @import("map.zig").window(.view, first, first + 16 * (@min(shown, v.rows) -| 1));
+ if (v.rows > 0) @import("map.zig").window(.view, .{ first, first + 16 * (@min(shown, v.rows) -| 1) }, .{ first, first + 16 * (@min(shown, v.rows) -| 1) }, 1);
v.veil(now);
u.clip(.{ .x = 0, .y = 0, .w = box.w, .h = box.h });
}
@@ -221,7 +221,10 @@ pub const Nodes = struct {
const names = g.pins(u, now, o.addr);
const cx = r.x + r.w / 2;
ties.anchor(u, .{ .node_pin = o.addr }, .{ .x = cx - 1, .y = r.y + r.h, .w = 2, .h = label + 10 });
- if (names.names.len > 0 and names.shows > 0) u.faded(names.shows).pinUnderInked(cx, r.y + r.h, names.names, names.inks, heap, label);
+ if (names.names.len > 0 and names.shows > 0) {
+ u.faded(names.shows).pinUnderInked(cx, r.y + r.h, &.{}, &.{}, heap, label);
+ u.faded(names.shows * names.text).pinNames(cx, r.y + r.h, names.names, names.inks, label);
+ }
}
/// Where variable `name`'s tag is: it travels from node to node in the
@@ -279,7 +282,10 @@ pub const Nodes = struct {
}
}
- const Pins = struct { names: []const []const u8, inks: []const u24, shows: f32 };
+ /// `text`: how much its names show: a register joining or leaving
+ /// crosses the middle of its change with them faded out, so the names
+ /// it leaves and those it gets never swap in a frame.
+ const Pins = struct { names: []const []const u8, inks: []const u24, shows: f32, text: f32 = 1 };
/// The registers that hold `addr` (before this step, and after it once
/// their link has landed), then the scene's variables that do.
@@ -288,6 +294,7 @@ pub const Nodes = struct {
var out: std.ArrayList([]const u8) = .empty;
var inks: std.ArrayList(u24) = .empty;
var shows: f32 = 0;
+ var text: f32 = 1;
const is = (now.moment().regs(rec.tid) catch null) orelse zt.Regs{};
const was = (now.before().regs(rec.tid) catch null) orelse is;
// The scene's variables first: what the narration names, in the ink
@@ -309,6 +316,7 @@ pub const Nodes = struct {
if (!before and !after) continue;
const s = ties.pinShows(now, i, .node);
const this = if (before and after) 1 else if (after) s.new else s.old;
+ if (before != after) text = @min(text, @abs(2 * this - 1));
if (this < 0.5) continue;
out.append(u.f.scratch, name) catch break;
inks.append(u.f.scratch, t.primary) catch break;
@@ -317,7 +325,7 @@ pub const Nodes = struct {
// Names keep their side: the first to come is on the left, the next
// on the right, and a name that lands where another is stays on the
// right it travelled on; one left alone where it was on the right stays there.
- const came = u.f.scratch.alloc(u64, out.items.len) catch return .{ .names = out.items, .inks = inks.items, .shows = shows };
+ const came = u.f.scratch.alloc(u64, out.items.len) catch return .{ .names = out.items, .inks = inks.items, .shows = shows, .text = text };
for (out.items, came) |name, *at| at.* = g.arrival(u, now, name, addr);
for (1..@max(out.items.len, 1)) |i| {
var k = i;
@@ -345,7 +353,7 @@ pub const Nodes = struct {
inks.insert(u.f.scratch, 0, t.primary) catch {};
}
}
- return .{ .names = out.items, .inks = inks.items, .shows = shows };
+ return .{ .names = out.items, .inks = inks.items, .shows = shows, .text = text };
}
/// When `name` came to point at `addr`: the moment its value last