diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-12 04:45:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 07:03:05 -0300 |
| commit | 4907e35bc45d12102d0e09380994814fc2e0a369 (patch) | |
| tree | 7cfd90224653d73b63fbadaf2881fa0e6ba92860 /anim/src/ties.zig | |
| parent | ebdebe04a76f0302aeb24c1ac08fa9217b1a8257 (diff) | |
| download | computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.tar.gz computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.zip | |
canim: the introduction, from the review
The introduction records the plain build (clang -O0, no instrumentation),
so reverse's frame is the compiler's own push, mov and sub. The stack
chapter says its convention once and keeps four free words over rsp so
a push moves the pin and nothing else; reverse's rows stand under main's
and are stepped, each touching its word, the call before the push, the
aim drawn head first to the row it returns to. The close-up frames the
bytes and the stack together with their 128 bytes marked. Nothing is
named before it is shown; offsets are written in hex as the operands are;
the dump folds into its tag; the map is announced before it is shown.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/ties.zig')
| -rw-r--r-- | anim/src/ties.zig | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/anim/src/ties.zig b/anim/src/ties.zig index b5214e3..3048e32 100644 --- a/anim/src/ties.zig +++ b/anim/src/ties.zig @@ -765,7 +765,10 @@ const Cx = struct { line.target = .beyond; line.words = bb.words; } else return; - cx.linkTo(line, drawn, back); + // Drawn back toward its head, the head goes over the last third, not in a frame. + var faded = cx; + faded.raw = cx.raw.faded(1 - std.math.clamp((back - 2.0 / 3.0) * 3, 0, 1)); + faded.linkTo(line, drawn, back); } /// The step's projection: the first run of bytes it read or wrote in @@ -862,7 +865,9 @@ const Cx = struct { } const right = row_box[2]; // How much it shows: standing with the knob (18 f in and out), for the step from the word's mark to the advance. - var drawn: f32 = 1; + // Standing, drawn as a step's when the scene says (`aim(.drawn)`): head first, then the row's frame. + var drawn: f32 = if (step) 1 else cursors.standard(std.math.clamp(now.aim_drawn / 18.0, 0, 1)); + var framed: f32 = if (step) 1 else std.math.clamp((now.aim_drawn - 18.0) / 6.0, 0, 1); var shows: f32 = if (step) 1 else @min(now.aim, 1); if (step) { if (now.resting()) return; @@ -870,23 +875,24 @@ const Cx = struct { const long = @abs(y_row - y_word) > 10 * theme.metric.context.row * k; drawn = cursors.standard(std.math.clamp((now.time - from) / @as(f32, if (long) 24.0 / 60.0 else 18.0 / 60.0), 0, 1)); shows = 1 - std.math.clamp((now.time - now.plan.advance) / time.quick, 0, 1); + framed = if (drawn >= 1) 1 else 0; } if (drawn <= 0 or shows <= 0) return; - // Standing, 60% toward the page; fraying, dashed over its first 12 f, then fading. - const ink = if (step) ui.rgb(theme.color.region.code_) else ui.mix(theme.color.region.code_, theme.color.page, 0.6); + // Standing, 60% toward the page (at full ink while lit); fraying, dashed over its first 12 f, then fading. + const ink = if (step) ui.rgb(theme.color.region.code_) else ui.mix(theme.color.region.code_, theme.color.page, 0.6 * (1 - std.math.clamp(now.aim_lit, 0, 1))); const v = cx.raw.faded(shows * (1 - std.math.clamp((fray - 0.4) / 0.6, 0, 1))); const points = [4]ui.Vec{ .{ rule, y_word }, .{ lane, y_word }, .{ lane, y_row }, .{ right, y_row } }; if (fray > 0) { // Dashed, 12 on 8, the gaps opening over the fray's first 12 f. const open = std.math.clamp(fray / 0.4, 0, 1); dashed(v, &points, ink, theme.stroke.rule * k, 12 * k, 8 * k * open); - } else v.route(&points, ink, .{ .width = theme.stroke.rule * k, .head = .{ 8 * k, 8 * k }, .progress = drawn, .radius = theme.metric.tie.radius * k }); + } else v.route(&points, ink, .{ .width = theme.stroke.rule * k, .head = .{ 10 * k, 10 * k }, .progress = drawn, .radius = theme.metric.tie.radius * k }); // The row's address framed in code's ink as the head lands. - if (drawn >= 1 and fray == 0) { + if (drawn >= 1 and fray == 0 and framed > 0) { const adv = ui.advance(theme.size.mono.context) * k; const digits: f32 = @floatFromInt(ui.digits(if (row_box[1] == line.to[1]) line.value else line.was)); const x0 = row_box[0] + (theme.metric.insn.address - 4) * k; - v.frame(.{ .x = x0, .y = row_box[1], .w = digits * adv + 8 * k, .h = row_box[3] - row_box[1] }, ink, theme.stroke.rule * k); + v.faded(framed).frame(.{ .x = x0, .y = row_box[1], .w = digits * adv + 8 * k, .h = row_box[3] - row_box[1] }, ink, theme.stroke.rule * k); } } }; |
