From ab31baff1fbfd38180be8eed921b97082184f185 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:17:19 -0300 Subject: T3: PanelCurtain wipes behind a soft edge two cells wide The curtain's glyph slide becomes a wipe: the new grid behind a head that crosses the pane, the old ahead, and between them two columns whose colours step from the old ground to the new in OKLab (CharSource.edge). Only the head's columns change from frame to frame. --- src/draw.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/draw.zig') diff --git a/src/draw.zig b/src/draw.zig index 93d5b2d9..b0b16e12 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -723,6 +723,7 @@ fn composedCell( return switch (animation.charSource(track, col - area.x0, row - area.y0, area)) { .old => canonical.previous_cells[index], .byte => |byte| withByte(canonical.cells[index], byte), + .edge => |weight| towardGround(canonical.cells[index], canonical.previous_cells[index].style.bg, weight), // Churn belongs on the glyph, not on the pane's empty space, and it // borrows whichever side of the diff actually has one. .churn => |byte| blk: { @@ -749,6 +750,25 @@ fn composedCell( }; } +/// A cell with its ink and ground drawn `weight` of the way toward another +/// ground, in OKLab. A palette or default colour cannot be mixed, so the +/// ground steps over at the halfway point instead. +fn towardGround(cell: Cell, ground: Color, weight: f32) Cell { + var out = cell; + const to = switch (ground) { + .rgb => |rgb| rgb, + .default, .index => return if (weight >= 0.5) blk: { + out.style.bg = ground; + break :blk out; + } else out, + }; + inline for (.{ &out.style.fg, &out.style.bg }) |color| switch (color.*) { + .rgb => |rgb| color.* = .{ .rgb = colors.mixOklab(rgb, to, weight) }, + .default, .index => {}, + }; + return out; +} + fn withByte(cell: Cell, byte: u8) Cell { var out = cell; out.text[0] = byte; -- cgit v1.3