summaryrefslogtreecommitdiff
path: root/anim/src/root.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 18:06:30 -0300
committerGabriel Schneider <[email protected]>2026-11-10 19:01:23 -0300
commite63b0624f57472d40af32a006c32cc47d403b822 (patch)
treeb7295da62acd96bc7aba425720eed95605526693 /anim/src/root.zig
parent318e16181a28725e218121363555580725d6d0d4 (diff)
downloadcomputeranim-e63b0624f57472d40af32a006c32cc47d403b822.tar.gz
computeranim-e63b0624f57472d40af32a006c32cc47d403b822.zip
canim: what the review found; the band as two panels; list and sort by instruction
The first videos were reviewed frame by frame and the catalogue changed with them. A lens is a drawing over the program column and its view over the state column, so the stack keeps six slots, its window on the whole frame. Operands are whole. list and sort are recorded by instruction from main (record --from), so their registers strike, links reach nodes and cells, rows that ran are marked and jumps are drawn. A call's node is a projection of its return address; pins travel and keep their side; a mark covers the bytes that changed, at the element's width; a syscall's result is stored after the kernel returns it and every panel is of one moment; fast passes are veiled; the clock stands still during a step; captions get their reading time and a scene's first step comes by four seconds. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'anim/src/root.zig')
-rw-r--r--anim/src/root.zig33
1 files changed, 32 insertions, 1 deletions
diff --git a/anim/src/root.zig b/anim/src/root.zig
index a69cda9..6aa47de 100644
--- a/anim/src/root.zig
+++ b/anim/src/root.zig
@@ -99,8 +99,10 @@ pub fn enter(s: *anim.Frame, views: anytype) void {
/// then the picture is still long enough to be read, a second and half a
/// second for each panel, before a word is said about it.
pub fn establish(s: *anim.Frame, views: anytype) void {
+ const start = s.cursor;
enter(s, views);
- s.wait(time.establish + time.establish_per_panel * @as(f32, @floatFromInt(views.len - 1)));
+ // The first caption at a second: the picture is read under it.
+ s.wait(@max(start + time.establish - s.cursor, 0));
}
/// And takes them away: quicker than they came.
@@ -117,17 +119,28 @@ pub fn leave(s: *anim.Frame, views: anytype) void {
/// it, longer after a scene's first: the eye reads, then is shown.
pub const Narrator = struct {
current: ?anim.Obj = null,
+ /// When the caption on screen has been up long enough to be read.
+ read_by: f32 = 0,
pub fn line(n: *Narrator, s: *anim.Frame, text: []const u8) void {
const next = add(s, Caption{ .text = text });
if (n.current) |old| {
+ // Not before the one up has been read: what follows waits.
+ s.wait(@max(n.read_by - s.cursor, 0));
s.play(.{old.fadeOut()}, .{ .seconds = time.caption_out, .ease = ease.exit });
s.wait(time.caption_gap);
}
s.play(.{next.fadeIn()}, .{ .seconds = time.caption_in, .ease = ease.enter });
+ n.read_by = s.cursor + time.caption(@intCast(std.unicode.utf8CountCodepoints(text) catch text.len));
s.wait(if (n.current == null) time.caption_lead_first else time.caption_lead);
n.current = next;
}
+
+ /// A scene's close: the last picture still, and the last caption read.
+ pub fn close(n: *Narrator, s: *anim.Frame) void {
+ s.wait(time.before_cut);
+ s.wait(@max(n.read_by - s.cursor, 0));
+ }
};
/// The camera, directed: a way of reading the context, not a place to be
@@ -218,6 +231,24 @@ pub const Context = struct {
pub fn ties(c: Context, s: *anim.Frame) anim.Obj {
return add(s, Ties{ .cursor = c.cursor, .stage = c.stage, .quiet = c.quiet });
}
+
+ /// A scene's opening with a lens drawn from bytes (`nodes`, `array`):
+ /// as `establish`, and from half a second in the drawing's
+ /// `elements` come in, each rising 8 units, 2 f apart in address
+ /// order (`ties.rise`), beside their rows' quiet brackets; no lines.
+ pub fn establish(c: Context, s: *anim.Frame, views: anytype, elements: usize) void {
+ const start = s.cursor;
+ s.play(.{c.stage.rise.to(0)}, .{ .seconds = 0 });
+ s.cursor = start;
+ enter(s, views);
+ const done = s.cursor;
+ s.cursor = start + time.establish_rise;
+ const rising = tying.riseTime(elements);
+ s.play(.{c.stage.rise.to(rising)}, .{ .seconds = rising, .ease = anim.ease.linear });
+ s.cursor = @max(s.cursor, done);
+ // The first caption at a second.
+ s.wait(@max(start + time.establish - s.cursor, 0));
+ }
};
pub fn context(s: *anim.Frame, at: Cursor, options: Context.Options) Context {