diff options
Diffstat (limited to 'anim/src/words.zig')
| -rw-r--r-- | anim/src/words.zig | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/anim/src/words.zig b/anim/src/words.zig index 5411385..6549dfb 100644 --- a/anim/src/words.zig +++ b/anim/src/words.zig @@ -24,17 +24,26 @@ pub const Clock = struct { box: Rect = .{ .x = theme.canvas.stage.x, .y = theme.canvas.clock_y - 12, .w = theme.canvas.stage.w, .h = 24 }, /// The map: with `CANIM_MAP`, drawn over everything (`Map.wholeMap`). map: ?*const @import("map.zig").Map = null, + /// The stage: in the column (`Stage.column`) the clock is under the text column alone. + stage: ?*const @import("stage.zig").Stage = null, pub fn draw(k: *const Clock, f: *sk.Frame, at: anim.Placed) void { const u = fixed(f, at, 0); const c = theme.canvas; const now = k.cursor.now(at); - const stage = c.stage; - // The margins are the page's, whatever the camera has brought under them. - u.fill(.{ .x = -c.width, .y = -c.height, .w = 3 * c.width, .h = c.height + stage.y }, theme.color.page); - u.fill(.{ .x = -c.width, .y = stage.y + stage.h, .w = 3 * c.width, .h = 2 * c.height }, theme.color.page); - u.fill(.{ .x = -c.width, .y = 0, .w = c.width + stage.x - 8, .h = c.height }, theme.color.page); - u.fill(.{ .x = stage.x + stage.w + 8, .y = 0, .w = c.width, .h = c.height }, theme.color.page); + const in_column = if (k.stage) |st| at.value(st.column) else 0; + const whole = c.stage; + // The margins are the page's, whatever the camera has brought under them + // (in the column the panes run on under the floor, 888 to 1032). + u.fill(.{ .x = -c.width, .y = -c.height, .w = 3 * c.width, .h = c.height + whole.y }, theme.color.page); + const floor_x: f32 = if (in_column > 0) theme.layout.state.x - c.gutter / 2 else -c.width; + u.fill(.{ .x = floor_x, .y = whole.y + whole.h, .w = 3 * c.width, .h = 2 * c.height }, theme.color.page); + u.fill(.{ .x = -c.width, .y = 0, .w = c.width + whole.x - 8, .h = c.height }, theme.color.page); + u.fill(.{ .x = whole.x + whole.w + 8, .y = 0, .w = c.width, .h = c.height }, theme.color.page); + // The rule: the stage's width, or the text column's. + var stage = whole; + stage.x = std.math.lerp(whole.x, theme.layout.state.x, theme.ease(.glide, in_column)); + stage.w = whole.x + whole.w - stage.x; u.fill(.{ .x = stage.x, .y = c.clock_y - 1, .w = stage.w, .h = theme.stroke.rule }, theme.color.rule); // Time itself: still while a step plays at a walk or a run; once its // mark has landed, the step's piece fades in (12 f, 8 at a run) and |
