diff options
Diffstat (limited to 'anim/src/ties.zig')
| -rw-r--r-- | anim/src/ties.zig | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/anim/src/ties.zig b/anim/src/ties.zig index 1f2532d..0df8e34 100644 --- a/anim/src/ties.zig +++ b/anim/src/ties.zig @@ -100,7 +100,8 @@ fn find(place: Place) ?[4]f32 { /// When register `i` strikes in this step: the registers one step wrote /// strike 6 f apart, in the registers' order; from the fourth on with the /// third, within the CPU's slot of the cascade; in a crossing, once the -/// call is back. Its pin and its link go with it. +/// call is back; in a continue, a wave, 2 f after the one above it. Its +/// pin and its link go with it. pub fn strikeDelay(now: cursors.Now, i: usize) f32 { var before: f32 = 0; for (theme.metric.all_registers[0..16]) |name| { @@ -108,9 +109,17 @@ pub fn strikeDelay(now: cursors.Now, i: usize) f32 { if (k == i) break; if (now.registerAge(k) == 0) before += 1; } + if (now.plan.wave) return before * time.continue_wave; return @min(before * cursors.write_apart, time.cascade) + @import("syscalls.zig").crossingDelay(now); } +/// Seconds since register `i`'s link (and its pin) set off: its strike; +/// in a continue, memory's, when the stack's window is at its new place +/// (a tie arrives at what is on screen, not at a window about to go). +fn linkSince(now: cursors.Now, i: usize) f32 { + return if (now.plan.wave) now.since(.memory, 0) else now.since(.cpu, strikeDelay(now, i)); +} + /// How long a link draws: to a slot near by, or across to the lens. pub fn linkTime(target: enum { slot, node }) f32 { return if (target == .slot) time.link.in else time.link.in_far; @@ -120,11 +129,12 @@ pub fn linkTime(target: enum { slot, node }) f32 { /// before this step (`old`) and at the one it points at now (`new`): /// 6 f after its strike the old pin fades (12 f); the new lands with /// its link's head and settles (12 f). At a run or a sprint it moves -/// with its level; at rest, and for a register the step did not write, -/// both are 1. +/// with its level; at rest it is where the register points, and only +/// there; for a register the step did not write, the two are one place. pub fn pinShows(now: cursors.Now, i: usize, target: enum { slot, node }) struct { old: f32, new: f32 } { - if (now.resting() or now.registerAge(i) != 0) return .{ .old = 1, .new = 1 }; - const since = now.since(.cpu, strikeDelay(now, i)); + if (now.registerAge(i) != 0) return .{ .old = 1, .new = 1 }; + if (now.resting()) return .{ .old = 0, .new = 1 }; + const since = linkSince(now, i); if (!now.walking()) return if (since >= 0) .{ .old = 0, .new = 1 } else .{ .old = 1, .new = 0 }; const l = time.link; const arrives = l.after + linkTime(if (target == .slot) .slot else .node); @@ -221,7 +231,7 @@ pub const Ties = struct { const y = if (words < 0) w.top else w.top + @as(f32, @floatFromInt(w.slots - 1)) * w.row; break :edge [4]f32{ w.x, y, w.x + 10 * k, y + w.row }; }; - const since = now.since(.cpu, strikeDelay(now, i)); + const since = linkSince(now, i); const l = time.link; const drawn = cursors.standard(std.math.clamp((since - l.after) / linkTime(if (node != null) .node else .slot), 0, 1)); const back = std.math.clamp((now.time - now.plan.advance) / l.out, 0, 1); |
