summaryrefslogtreecommitdiff
path: root/src/animation.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:02:30 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:20:23 -0300
commitd2129a6e2c6348ee9630c5b5918fbcfadf4411fe (patch)
tree0ee85d9856dc5720a6371da5645b63779835dcc8 /src/animation.zig
parent8b0b342f300c7ccf6b71994965cc03244545db04 (diff)
downloadpardes-d2129a6e2c6348ee9630c5b5918fbcfadf4411fe.tar.gz
pardes-d2129a6e2c6348ee9630c5b5918fbcfadf4411fe.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/animation.zig')
-rw-r--r--src/animation.zig21
1 files changed, 7 insertions, 14 deletions
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));