summaryrefslogtreecommitdiff
path: root/anim/src/cursor.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 03:17:32 -0300
committerGabriel Schneider <[email protected]>2026-11-12 04:45:57 -0300
commitebdebe04a76f0302aeb24c1ac08fa9217b1a8257 (patch)
tree81a915bc8cc2b6c63dbe765e9ee196a9e7c6d22f /anim/src/cursor.zig
parentbf0dfa135319f8c7ca49eace4d1f81152ebfd23e (diff)
downloadcomputeranim-ebdebe04a76f0302aeb24c1ac08fa9217b1a8257.tar.gz
computeranim-ebdebe04a76f0302aeb24c1ac08fa9217b1a8257.zip
canim: the ASan pair finished; a run's crossfade lasts its step
The ASan run is recorded --until __asan_report_store1 and the scene finds its moments by what they are, not by count. The pair's tags name their run, ASan's stopped call reads never returned, and both disassemblies start level on their line. At a run a row's crossfade now lasts the whole advance and a chain crossfades when its memory changed: the pair's fast pass had thirteen one-frame changes and has none. Stale videos re-exported. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/cursor.zig')
-rw-r--r--anim/src/cursor.zig21
1 files changed, 13 insertions, 8 deletions
diff --git a/anim/src/cursor.zig b/anim/src/cursor.zig
index e9aab67..b09db8d 100644
--- a/anim/src/cursor.zig
+++ b/anim/src/cursor.zig
@@ -866,6 +866,18 @@ pub fn jumps(rec: *const Recording, from: u64, to: u64) bool {
return a.src != b.src or rec.depths[from] != rec.depths[to] or rows > time.current_jump_rows;
}
+/// Whether the chain from `value` reads otherwise at `is` than at `was` (the
+/// values and texts of its hops).
+pub fn chainMoved(was: Recording.Moment, is: Recording.Moment, value: u64) bool {
+ var bufs: [2][6]zt.telescope.Link = undefined;
+ var texts: [2][48]u8 = undefined;
+ const a = zt.telescope.chase(was, value, &bufs[0], &texts[0]) catch return false;
+ const b = zt.telescope.chase(is, value, &bufs[1], &texts[1]) catch return false;
+ if (a.len != b.len) return true;
+ for (a, b) |x, y| if (x.value != y.value or !std.mem.eql(u8, x.text, y.text)) return true;
+ return false;
+}
+
/// The cursor at one instant.
pub const Now = struct {
rec: *const Recording,
@@ -1188,14 +1200,7 @@ pub const Now = struct {
const land = time.strike.in / 2.0;
// Followed again only while that shows (its hops 4 f apart, 6 f each).
if (struck < 0 or struck > land + 0.5) return .{ memory, null, 1 };
- var bufs: [2][6]zt.telescope.Link = undefined;
- var texts: [2][48]u8 = undefined;
- const was = zt.telescope.chase(n.before(), value, &bufs[0], &texts[0]) catch return .{ memory, null, 1 };
- const is = zt.telescope.chase(n.moment(), value, &bufs[1], &texts[1]) catch return .{ memory, null, 1 };
- const same = was.len == is.len and for (was, is) |a, b| {
- if (a.value != b.value or !std.mem.eql(u8, a.text, b.text)) break false;
- } else true;
- if (same) return .{ memory, null, 1 };
+ if (!chainMoved(n.before(), n.moment(), value)) return .{ memory, null, 1 };
if (!n.landedAt(value, 8)) return .{ memory, null, 1 - std.math.clamp(struck / land, 0, 1) };
return .{ memory, struck - 4.0 / 60.0, 1 };
}