summaryrefslogtreecommitdiff
path: root/src/animation.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-22 09:50:43 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:24 -0300
commita8b457a306a4442975210bcac3f04b56513c61c3 (patch)
tree6e2026ecb15da2fb919a0202f5d8b38e3b36a595 /src/animation.zig
parenta8a1499bdffffc5b6919e24ec957e92fabaf003b (diff)
parent7e9d2c4169245072265b483ffaa6aa05f23f08d3 (diff)
downloadpardes-a8b457a306a4442975210bcac3f04b56513c61c3.tar.gz
pardes-a8b457a306a4442975210bcac3f04b56513c61c3.zip
Merge: Def/Refs, the diff viewer, Helix n/N, Callstack, Zig 0.17, Window mode and the terminal cwd fix onto 0.24
The docs keep both sides: 0.24's Ctrl-i fallbacks and typed ls with this line's Window mode, raw Esc and Helix n/N wording. The CHANGELOG's unreleased entries go above 0.24, Def/Refs and the context rows among them. cheatsheet-a4.pdf rendered again; .scratch/ ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/animation.zig')
-rw-r--r--src/animation.zig11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/animation.zig b/src/animation.zig
index 19f7ce0b..547b9201 100644
--- a/src/animation.zig
+++ b/src/animation.zig
@@ -897,7 +897,7 @@ test "each flavour is its own motion: off lands at once, bouncy overshoots, play
last = now;
}
try std.testing.expect(t < 1600 * ms);
- settle[@intFromEnum(flavour)] = t;
+ settle[@backingInt(flavour)] = t;
switch (flavour) {
.crisp, .smooth => try std.testing.expect(peak <= 1.0005 and low >= 0),
// Clearly past the mark, not a hint of it.
@@ -909,8 +909,8 @@ test "each flavour is its own motion: off lands at once, bouncy overshoots, play
// Smooth takes twice crisp's time and more: a character, not a tuning.
// Yet as the default a pane's arrival (a slide's 12 frames, scaled) is
// inside ยง8.1's 220 ms, and a lift is still before 300 ms.
- try std.testing.expect(settle[@intFromEnum(Motion.Flavour.smooth)] > 2 * settle[@intFromEnum(Motion.Flavour.crisp)]);
- try std.testing.expect(settle[@intFromEnum(Motion.Flavour.smooth)] <= 300 * ms);
+ try std.testing.expect(settle[@backingInt(Motion.Flavour.smooth)] > 2 * settle[@backingInt(Motion.Flavour.crisp)]);
+ try std.testing.expect(settle[@backingInt(Motion.Flavour.smooth)] <= 300 * ms);
try std.testing.expect(@round(@as(f32, 12) * Motion.of(.smooth).span) * frame_ms <= 220);
// A fixed-length move lands exactly on its mark, whatever the flavour.
for (std.enums.values(Motion.Flavour)) |flavour| try std.testing.expectEqual(@as(f32, 1), Motion.of(flavour).ease(1));
@@ -920,7 +920,7 @@ test "a flavour's stretched pane lands exactly on its box, and a click finds the
const from: Box = .{ .x = 0, .y = 2, .w = 30, .h = 10 };
const to: Box = .{ .x = 37.3, .y = 2, .w = 30, .h = 10 };
for (std.enums.values(Motion.Flavour)) |flavour| {
- var track: Track = .{ .effect = .slide, .motion = @intFromEnum(flavour) + 1, .frame_count = 20, .from = from, .to = to };
+ var track: Track = .{ .effect = .slide, .motion = @backingInt(flavour) + 1, .frame_count = 20, .from = from, .to = to };
track.frame = track.frames() - 1;
const landed = track.presented();
// Bit for bit: no stretch or float residue once it lands.
@@ -929,7 +929,7 @@ test "a flavour's stretched pane lands exactly on its box, and a click finds the
// Playful at its most stretched: the pane is drawn wider than its box,
// and the drawn place of a cell maps back to that cell (the pointer
// inverts the same box: target + (x - shown.x) / shown.w * target.w).
- var track: Track = .{ .effect = .slide, .motion = @intFromEnum(Motion.Flavour.playful) + 1, .frame_count = 20, .from = from, .to = to };
+ var track: Track = .{ .effect = .slide, .motion = @backingInt(Motion.Flavour.playful) + 1, .frame_count = 20, .from = from, .to = to };
var most: u16 = 0;
var widest: f32 = 0;
while (track.frame < track.frames()) : (track.frame += 1) {
@@ -1309,4 +1309,3 @@ test "retarget starts at the currently displayed value" {
for (0..transition_steps) |_| tween.advance();
try std.testing.expectEqual(third, tween.displayed);
}
-