summaryrefslogtreecommitdiff
path: root/anim/src/ties.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/ties.zig')
-rw-r--r--anim/src/ties.zig20
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);
}
}
};