summaryrefslogtreecommitdiff
path: root/anim/src/stage.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/stage.zig')
-rw-r--r--anim/src/stage.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/anim/src/stage.zig b/anim/src/stage.zig
index bbf5887..7b18064 100644
--- a/anim/src/stage.zig
+++ b/anim/src/stage.zig
@@ -102,6 +102,20 @@ pub const Stage = struct {
return false;
}
+ /// A move under way that changes `part`'s height: its height before and
+ /// after, and how far it has got (eased as the boxes are). Null otherwise.
+ pub fn resizing(st: *const Stage, at: anim.Placed, part: Part) ?struct { from: f32, to: f32, p: f32 } {
+ for (st.moves[0..st.count]) |m| {
+ const p = at.value(m.p);
+ if (p <= 0 or p >= 1) continue;
+ const a, const b = switch (part) {
+ inline else => |tag| .{ @field(m.from, @tagName(tag)).h, @field(m.to, @tagName(tag)).h },
+ };
+ if (a != b) return .{ .from = a, .to = b, .p = theme.ease(.glide, p) };
+ }
+ return null;
+ }
+
pub fn box(st: *const Stage, at: anim.Placed, part: Part) Rect {
const split = st.now(at);
return switch (part) {