summaryrefslogtreecommitdiff
path: root/anim/src/theme.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/theme.zig')
-rw-r--r--anim/src/theme.zig139
1 files changed, 123 insertions, 16 deletions
diff --git a/anim/src/theme.zig b/anim/src/theme.zig
index 846014f..5a85f50 100644
--- a/anim/src/theme.zig
+++ b/anim/src/theme.zig
@@ -44,6 +44,31 @@ pub const canvas = struct {
pub const caption_max_width = 1400;
};
+/// The map (design/README.md, "The map and the minimap"): the working
+/// frame unfolded on a stage of 3840 by 2160 at the context's type size,
+/// four columns of 880; the working frame's windows outlined on it (2 in
+/// `dim`, 4 out). The minimap: the map at a twentieth in the caption
+/// band's right end, under the clock's, whose count moves left of it.
+pub const map = struct {
+ pub const width = 3840;
+ pub const height = 2160;
+ pub const stage: Rect = .{ .x = 112, .y = 96, .w = 3616, .h = 1688 };
+ pub const columns = [4]f32{ 112, 1024, 1936, 2848 };
+ pub const column = 880;
+ pub const outline = 2;
+ pub const outline_out = 4;
+ /// The stack's column: from this many words above rsp (the 128 bytes the recording keeps under it).
+ pub const stack_above = 16;
+ pub const disasm_rows = 69;
+ pub const memory_rows = 32;
+};
+pub const minimap = struct {
+ pub const box: Rect = .{ .x = 1664, .y = 912, .w = 192, .h = 108 };
+ pub const scale = 1.0 / 20.0;
+ /// The clock's count, ranged right here.
+ pub const count_end = 1648;
+};
+
/// Left edge of column `i` (0 to 11).
pub fn colX(i: u8) f32 {
return @floatFromInt(@as(u32, canvas.margin_x) + @as(u32, i) * (canvas.column + canvas.gutter));
@@ -219,6 +244,19 @@ pub const color = struct {
/// A node's pointer half.
pub const well: u24 = 0x101a48;
+ /// The current row's band: bright a tenth of the way over the page,
+ /// opaque. Gold is kept for the plaque, the pc's marker, rip's name,
+ /// the thread and the trail (design/README.md, `mark`).
+ pub const wash: u24 = 0x212644;
+ /// A loupe's surface and its tag: lifted off the page, the one
+ /// elevation in the frame; and its shadow, the one shadow there is.
+ pub const lift: u24 = 0x121c52;
+ pub const lift_tag: u24 = 0x22317a;
+ pub const shade: u24 = 0x02061a;
+ /// A strike's paper: vermilion 70% over the page, its digits bold and
+ /// bright. The arm, the turned corner and a projection stay `mark(.write).solid`.
+ pub const struck: u24 = 0xb54f42;
+
/// Drawn over everything that is not the subject, to dim it: for a
/// beat, and (deeper) under the camera.
pub const veil: u24 = page;
@@ -256,9 +294,9 @@ pub const Role = enum {
/// How a role is drawn. No two roles share a form, so none is told by hue alone.
pub const Form = enum {
- /// A solid plaque on the thing's label and its ember across the row.
+ /// A solid plaque on the thing's label and a white wash across the row.
plaque,
- /// A solid fill with ink letters, cooling to its ember and a solid bar along the bottom.
+ /// A softened fill with bright bold letters, cooling to nothing and a turned corner.
fill,
/// A frame, with its ember inside.
frame,
@@ -293,7 +331,7 @@ pub const Mark = struct {
pub fn mark(role: Role) Mark {
const t = color.text;
return switch (role) {
- .current => .{ .solid = 0xe8c46a, .ember = 0x4a3d1c, .on_solid = t.ink, .form = .plaque },
+ .current => .{ .solid = 0xe8c46a, .ember = color.wash, .on_solid = t.ink, .form = .plaque },
.write => .{ .solid = 0xff6a4a, .ember = 0x5a2218, .on_solid = t.ink, .form = .fill },
.read => .{ .solid = 0x6fd6e6, .ember = 0x1c4652, .on_solid = t.ink, .form = .frame },
// Its colour is the region's it points into (`color.region`); this is heap's.
@@ -473,8 +511,9 @@ pub const metric = struct {
/// highest non-zero one, this far.
pub const lead_alpha = 0.6;
pub const pad_alpha = 0.45;
- /// `held`: a tick 4 wide, the row less 6 tall, at the value's left.
- pub const tick = 4;
+ /// `held`: a turned corner, a vermilion right triangle this long on
+ /// its sides at the value's top left (4 left of its digits, 2 down).
+ pub const corner = 9;
/// `read`: a 2-unit frame, 6 out at the sides.
pub const read_frame = 2;
/// `struck`: solid 5 wider each side; its edges pulse out 3.
@@ -499,10 +538,12 @@ pub const metric = struct {
pub const annotation = 564;
};
- /// `bytes`: a hexdump row, from its panel's left edge (the band's right half).
+ /// `bytes`: a hexdump row, from its panel's left edge (the band's right
+ /// half): its `arc` lanes, the quiet bracket at 24, the address at 34,
+ /// the bytes 12 after it and at 132 at least.
pub const bytes = struct {
- pub const bracket = 7;
- pub const address = 18;
+ pub const bracket = 24;
+ pub const address = 34;
pub const first = 132;
/// Two digits in 24 units on a pitch of 30, 12 more after the eighth.
pub const pitch = 30;
@@ -510,12 +551,15 @@ pub const metric = struct {
pub const reading = 640;
};
- /// `slot`: a lane for `row` pins, the chain from 122, room to 136 from
- /// the right edge (which belongs to the `call` spans, 14 in).
+ /// `slot`: two `arc` lanes, a lane for `row` pins from 16 to 112, the offset from rsp
+ /// ranged right to 172, the address from 184 and its chain after it,
+ /// room to 136 from the right edge (which belongs to the `call` spans,
+ /// 14 in), a role ranged right where the room ends.
pub const slot = struct {
- pub const lane = 10;
+ pub const lane = 16;
pub const lane_end = 112;
- pub const chain = 122;
+ pub const offset = 172;
+ pub const address = 184;
pub const room = 136;
pub const span = 14;
};
@@ -573,6 +617,38 @@ pub const metric = struct {
pub const caller = [2]f32{ 64, 28 };
};
+ /// `arc`: a pointer to a row of its own panel, along a lane at the
+ /// panel's left edge (4, 10, 16 in a dump or a loupe; 4, 10 on the
+ /// stack), 2 wide, corners of 4; out of its row at 21, into the
+ /// target's at 22 with a head 7 by 8; going up it leaves its row 9 down
+ /// and arrives 15 down (going down, 15 and 9). Standing, its ink 60%
+ /// toward the page.
+ pub const arc = struct {
+ pub const lanes = [3]f32{ 4, 10, 16 };
+ pub const stack_lanes = 2;
+ pub const out = 21;
+ pub const in = 22;
+ pub const head = [2]f32{ 7, 8 };
+ pub const high = 9;
+ pub const low = 15;
+ pub const width = 2;
+ pub const radius = 4;
+ pub const standing = 0.6;
+ };
+
+ /// `loupe`: 880 wide, five rows round its target in the working frame;
+ /// it hangs from its pointer, its left edge 92 left of the pointer's
+ /// digits, its tag's top on the foot of the pointer's row; its shadow
+ /// 12 right and 16 down (20 and 26 for one opened from a loupe); its
+ /// stem a bracket 4 high under the pointer's digits.
+ pub const loupe = struct {
+ pub const width = 880;
+ pub const rows = 5;
+ pub const hang = 92;
+ pub const shadow = [2][2]f32{ .{ 12, 16 }, .{ 20, 26 } };
+ pub const stem = 4;
+ };
+
/// A lens's lanes: projections 4 under its tag, links 8 above its bottom edge.
pub const lens = struct {
pub const top_lane = 4;
@@ -589,8 +665,9 @@ pub const metric = struct {
pub const projection_radius = 6;
};
+ /// `held` on a lens's cell: the turned corner at its top left.
+ pub const corner_cell = 12;
/// A lens's cell, as the first pass drew them.
- pub const ember_bar = 4;
pub const pointer_frame_outset = 6;
pub const elision_h = 24;
pub const cell = [2]f32{ 96, 84 };
@@ -721,6 +798,8 @@ pub const time = struct {
pub const pulse = 0.20;
pub const hold = 0.50;
pub const cool = 0.40;
+ /// `held`'s turned corner fades in over the cool's last 6 f.
+ pub const corner = 0.10;
pub const ember_steps = 3;
pub const ember_seconds = 4.0;
pub const out = 0.60;
@@ -791,6 +870,31 @@ pub const time = struct {
pub const far = 0.50;
pub const out = 0.30;
};
+ /// `arc`: a pointer rewritten: from 6 f after the strike the old arc
+ /// fades (`fade`) as the new draws (`draw`), at full ink; it quiets
+ /// with the cool (`quiet`); a lane change glides (`lane`).
+ pub const arc = struct {
+ pub const after = 0.10;
+ pub const draw = 0.20;
+ pub const fade = 0.20;
+ pub const quiet = 0.40;
+ pub const lane = 0.20;
+ };
+ /// `open`, a loupe: its pointer framed as read (`read`); the stem
+ /// draws and the loupe rises with it (`stem`; it fades in over `rise`
+ /// from 8 units lower, its shadow grows over `shadow`); its target's
+ /// bright frame lands `frame` after. `close`: the stem draws back and
+ /// the loupe sinks, fading as it falls 8 units, over `close`.
+ pub const loupe = struct {
+ pub const read = 0.10;
+ pub const stem = 0.30;
+ pub const rise = 0.20;
+ pub const shadow = 0.30;
+ pub const frame = 0.10;
+ pub const close = 0.20;
+ /// From its first frame to its target's frame landed: read, stem, a frame's wait and the frame.
+ pub const open = 0.60;
+ };
/// `travel`, for a pin: it sets off `after` the strike that moved it;
/// in a drawing it takes `node` to the next node or cell, `nodes` to
/// one farther; in the stack's lane `row` to the next row and
@@ -921,16 +1025,19 @@ test "every mark stands off the page, and letters read on it" {
const m = mark(r);
try expect(contrast(m.solid, color.page) >= 4.5);
try expect(contrast(m.on_solid, m.solid) >= 4.5);
- // A role with a quiet form: text reads on it, and it is not the page.
+ // A role with a quiet form: text reads on it, and it is not the page
+ // (the current row's wash is the quietest: 1.2 on the page).
if (m.ember != m.solid and r != .freed and r != .fault) {
try expect(contrast(color.text.primary, m.ember) >= 7);
- try expect(contrast(m.ember, color.page) >= 1.4);
+ try expect(contrast(m.ember, color.page) >= @as(f64, if (r == .current) 1.2 else 1.4));
}
}
// The strokes that carry meaning on their own.
for ([_]Role{ .current, .write, .read, .link, .allocated }) |r|
try expect(contrast(mark(r).solid, color.page) >= 6.5);
try expect(contrast(color.text.ink, mark(.write).solid) >= 6.5);
+ // A strike's bright digits on its softened paper.
+ try expect(contrast(color.text.bright, color.struck) >= 4.5);
}
test "no two roles are drawn the same way" {
@@ -984,7 +1091,7 @@ test "easing runs from 0 to 1 without turning back" {
test "durations are whole frames" {
const t = time;
- for ([_]f32{ t.snap, t.quick, t.step, t.step_per_row, t.step_max, t.move, t.travel, t.layout, t.camera, t.camera_far, t.fire, t.cascade, t.read_value, t.read_more, t.rest, t.strike.arm, t.strike.in, t.strike.pulse, t.strike.hold, t.strike.cool, t.strike.out, t.read.out, t.current_jump, t.flight.lift, t.flight.near, t.flight.second, t.veil, t.link.after, t.link.pin_out, t.link.in, t.link.in_far, t.link.settle, t.link.out, t.project.bracket, t.project.draw, t.project.out, t.establish_rise, t.relayout, t.relayout_fade, t.continue_wave, t.badge_after, t.pin.after, t.pin.node, t.pin.nodes, t.pin.row, t.pin.step_per_row, t.pin.row_max, t.pin.in, t.pin.out, t.pin.names, t.caption_in, t.caption_out, t.caption_gap, t.walk, t.run, t.sprint, t.phrase_rest, t.before_cut }) |d| {
+ for ([_]f32{ t.snap, t.quick, t.step, t.step_per_row, t.step_max, t.move, t.travel, t.layout, t.camera, t.camera_far, t.fire, t.cascade, t.read_value, t.read_more, t.rest, t.strike.arm, t.strike.in, t.strike.pulse, t.strike.hold, t.strike.cool, t.strike.corner, t.strike.out, t.loupe.read, t.loupe.stem, t.loupe.rise, t.loupe.shadow, t.loupe.frame, t.loupe.close, t.loupe.open, t.arc.after, t.arc.draw, t.arc.fade, t.arc.quiet, t.arc.lane, t.read.out, t.current_jump, t.flight.lift, t.flight.near, t.flight.second, t.veil, t.link.after, t.link.pin_out, t.link.in, t.link.in_far, t.link.settle, t.link.out, t.project.bracket, t.project.draw, t.project.out, t.establish_rise, t.relayout, t.relayout_fade, t.continue_wave, t.badge_after, t.pin.after, t.pin.node, t.pin.nodes, t.pin.row, t.pin.step_per_row, t.pin.row_max, t.pin.in, t.pin.out, t.pin.names, t.caption_in, t.caption_out, t.caption_gap, t.walk, t.run, t.sprint, t.phrase_rest, t.before_cut }) |d| {
const frames = d * t.fps;
try expect(@abs(frames - @round(frames)) < 1e-3);
}