From d2129a6e2c6348ee9630c5b5918fbcfadf4411fe Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:02:30 -0300 Subject: drawing: dead code goes: colors.carryTheme and Motion.speed (no caller anywhere), animation.progress (only its own tests called it), Layer.pointAt (never called), Glide.kick (one caller, the line now), a stale first column header in the frame dump, panes.zig's unused vaxis import Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/animation.zig | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/animation.zig') diff --git a/src/animation.zig b/src/animation.zig index 37d74813..ce0b382a 100644 --- a/src/animation.zig +++ b/src/animation.zig @@ -280,10 +280,6 @@ pub fn sample(easing: Easing, raw: f32) f32 { }; } -pub fn progress(effect: Transition, frame: u16) f32 { - return progressEased(effect.easing(), effect.frames(), frame); -} - fn progressEased(easing: Easing, frames: u16, frame: u16) f32 { if (frames <= 1 or frame >= frames - 1) return 1.0; return sample(easing, @as(f32, @floatFromInt(frame)) / @as(f32, @floatFromInt(frames - 1))); @@ -460,12 +456,12 @@ test "easing presets have exact endpoints and intended shapes" { test "transition progress completes exactly" { inline for (std.enums.values(Transition)) |effect| { - try std.testing.expectEqual(@as(f32, 1), progress(effect, effect.frames())); + try std.testing.expectEqual(@as(f32, 1), progressEased(effect.easing(), effect.frames(), effect.frames())); if (effect.frames() > 0) - try std.testing.expectEqual(@as(f32, 1), progress(effect, effect.frames() - 1)); - try std.testing.expectEqual(@as(f32, 1), progress(effect, std.math.maxInt(u16))); + try std.testing.expectEqual(@as(f32, 1), progressEased(effect.easing(), effect.frames(), effect.frames() - 1)); + try std.testing.expectEqual(@as(f32, 1), progressEased(effect.easing(), effect.frames(), std.math.maxInt(u16))); } - try std.testing.expectEqual(@as(f32, 1), progress(.off, 0)); + try std.testing.expectEqual(@as(f32, 1), progressEased(Transition.off.easing(), Transition.off.frames(), 0)); const shrinking = lerpBox(.{ .w = 100, .h = 40 }, .{}, sample(.out_back, 0.8)); try std.testing.expectEqual(@as(f32, 0), shrinking.w); @@ -639,7 +635,7 @@ test "opening presets separate geometry and content transitions" { }; try std.testing.expectEqual(target, closing.contentBox()); closing.frame = 2; - try std.testing.expect(closing.amount() < progress(.vertical, closing.frame)); + try std.testing.expect(closing.amount() < progressEased(Transition.vertical.easing(), Transition.vertical.frames(), closing.frame)); } test "the ordered dissolve reveals a 4x4 block evenly, each cell once" { @@ -740,11 +736,8 @@ pub const Motion = struct { return spring.value(@intFromFloat(u * std.time.ns_per_s)); } - /// The same move's speed at `u`, in lengths per unit of `u`. - pub fn speed(motion: Motion, u: f32) f32 { - return motion.speedFrom(u, 0); - } - + /// The same move's speed at `u`, in lengths per unit of `u`, set off at + /// `launch` as `easeFrom` is. pub fn speedFrom(motion: Motion, u: f32, launch: f32) f32 { const h: f32 = 1.0 / 256.0; return (motion.easeFrom(@min(1, u + h), launch) - motion.easeFrom(@max(0, u - h), launch)) / (@min(1, u + h) - @max(0, u - h)); -- cgit v1.3