summaryrefslogtreecommitdiff
path: root/examples/vecanim/scenes/live.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 23:59:29 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitaabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d (patch)
treef5139ed90cf1747f3aa3aaa0f6266bab2a335c10 /examples/vecanim/scenes/live.zig
parentc7ebfb6d18c44fec676da3d683e0b4e54001bd21 (diff)
parentbc6fe168278957ad15cf87826c8410e7358e0849 (diff)
downloadsketchbook-aabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d.tar.gz
sketchbook-aabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d.zip
Merge the session recorder and the talk primitives
Recording (sessions, marks, clips, the reload speed-ups under them) and anim's Deck with its example talk, together; no conflicts; zig build test: 161/161 steps, 127/127 tests. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'examples/vecanim/scenes/live.zig')
-rw-r--r--examples/vecanim/scenes/live.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/vecanim/scenes/live.zig b/examples/vecanim/scenes/live.zig
index cefdbc5..9b94d17 100644
--- a/examples/vecanim/scenes/live.zig
+++ b/examples/vecanim/scenes/live.zig
@@ -1,6 +1,7 @@
//! A live scene, presented like slides: `frame` runs every frame, so the
-//! code after the plays can follow the mouse, the clock or any data, and
-//! `pause` holds until a click. Everything it needs is in this file.
+//! code after the plays can follow the mouse, the time or any data, and
+//! what comes after a `pause` waits for a click while time runs on.
+//! Everything it needs is in this file.
const anim = @import("anim");
pub const typst_preamble =
@@ -28,7 +29,7 @@ fn frame(s: *anim.Frame) void {
s.play(.{ title.fadeOut(), hint.fadeOut() }, .{ .seconds = 0.6 });
// A wave of dots: its height is a value the timeline animates, its
- // phase the wall clock, which runs on through pauses.
+ // phase the scene's time, which runs on while a pause waits.
const wave = s.typst(typst.wave, .{ .y = -220, .scale = 1.2 });
const note = s.typst(typst.note, .{ .y = 230 });
const height = s.value(0);
@@ -61,7 +62,7 @@ fn frame(s: *anim.Frame) void {
for (dots) |d| {
const p = s.pose(d);
const envelope = 1 - s.get(damping) * (1 - @exp(-p.x * p.x / 1e5));
- p.y = s.get(height) * envelope * @sin(p.x / 90 - s.clock * 2);
+ p.y = s.get(height) * envelope * @sin(p.x / 90 - s.t * 2);
const near = @max(0, 1 - @abs(p.x - s.pointer[0]) / 120);
p.scale = 1 + near;
p.y -= 40 * near;