diff options
Diffstat (limited to 'anim/src/array.zig')
| -rw-r--r-- | anim/src/array.zig | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/anim/src/array.zig b/anim/src/array.zig index 8d53fb8..fad10c5 100644 --- a/anim/src/array.zig +++ b/anim/src/array.zig @@ -191,19 +191,23 @@ pub const Array = struct { // cell to cell as the idea strikes; two in one cell share its pin. var at_cell: [32]std.ArrayList([]const u8) = @splat(.empty); var slide: [32]?f32 = @splat(null); + // At a sprint the pins hold, and move only where a phrase ends: at the mark's moments. + const sprint = now.plan.gait == .sprint; + const pin_is = if (sprint) rec.moment(now.marks[1]) else now.moment(); + const pin_was = if (sprint) rec.moment(now.marks[0]) else now.before(); for (g.indices) |name| { - const iv = rec.variable(f.scratch, now.moment(), name) orelse continue; - const here = number(now.moment(), iv.addr, @min(iv.size, 8), true) orelse continue; + const iv = rec.variable(f.scratch, pin_is, name) orelse continue; + const here = number(pin_is, iv.addr, @min(iv.size, 8), true) orelse continue; if (here < 0 or here >= count) continue; const k: usize = @intCast(here); at_cell[k].append(f.scratch, name) catch {}; - if (number(now.before(), iv.addr, @min(iv.size, 8), true)) |was| if (was != here and was >= 0 and was < count) { + if (number(pin_was, iv.addr, @min(iv.size, 8), true)) |was| if (was != here and was >= 0 and was < count) { slide[k] = @floatFromInt(was); }; } // And the registers that hold a cell's address: a pin, where a link lands. - const is = (now.moment().regs(rec.tid) catch null) orelse @import("ztrace").Regs{}; - const was_regs = (now.before().regs(rec.tid) catch null) orelse is; + const is = (pin_is.regs(rec.tid) catch null) orelse @import("ztrace").Regs{}; + const was_regs = (pin_was.regs(rec.tid) catch null) orelse is; const ink = context.ink(context.regionOf(moment, v.addr)); for (&at_cell, 0..) |*names, k| { const addr = v.addr + k * elem; @@ -218,10 +222,20 @@ pub const Array = struct { const before = was_regs.named(name) == addr; const after = is.named(name) == addr; if (!before and !after) continue; - const s = ties.pinShows(now, i, .node); + const s = if (sprint) blk: { + const p = now.moving(.idea, 0, 0); + break :blk @TypeOf(ties.pinShows(now, i, .node)){ .old = 1 - p, .new = p }; + } else ties.pinShows(now, i, .node); const this = if (before and after) 1 else if (after) s.new else s.old; if (before != after and indices > 0) text = @min(text, @abs(2 * this - 1)); if (this < 0.5) continue; + // Under a sprint's veil the registers' names leave the cells (a cell's + // right name would print over the next cell's left), fading through its middle. + const veiled = now.sprint_veil; + if (veiled > 0) { + if (indices > 0) text = @min(text, @abs(2 * veiled - 1)) else shows = @min(shows, std.math.clamp(1 - 2 * veiled, 0, 1)); + } + if (veiled >= 0.5) continue; names.append(f.scratch, name) catch {}; if (indices == 0) shows = @min(shows, this); } |
