diff options
Diffstat (limited to 'examples/vecanim')
| -rw-r--r-- | examples/vecanim/README.md | 15 | ||||
| -rw-r--r-- | examples/vecanim/scenes/live.zig | 9 | ||||
| -rw-r--r-- | examples/vecanim/test/intro.script | 14 | ||||
| -rw-r--r-- | examples/vecanim/test/live.script | 5 |
4 files changed, 23 insertions, 20 deletions
diff --git a/examples/vecanim/README.md b/examples/vecanim/README.md index 7627fe4..cc6dc0e 100644 --- a/examples/vecanim/README.md +++ b/examples/vecanim/README.md @@ -18,18 +18,19 @@ zig build export -- - --size 3840x2160 --fps 60 | ffmpeg -f rawvideo -pix_fmt rgba -s 3840x2160 -r 60 -i - -pix_fmt yuv420p intro.mp4 ``` -Keys: space pause, click to continue after a `pause`, left/right -previous/next play, `,`/`.` step a frame, home/end, up/down speed, B GPU/CPU, -L loop, G guides (bounding boxes, origins and the scene's axes, with scene -coordinates and the pointer's); drag and wheel to look around, R to reset -the view. +Keys: click, space or page down for the next step of a scene that pauses +(space plays and pauses one that does not), page up back a step, `]`/`[` +next/previous slide, P play/pause, left/right previous/next play, `,`/`.` +step a frame, home/end, up/down speed, B GPU/CPU, L loop, G guides +(bounding boxes, origins and the scene's axes, with scene coordinates and +the pointer's); drag and wheel to look around, R to reset the view. - `scenes/intro.zig`, compiled: shapes, Pythagoras morphing from one equation to the next, a camera move with an updater swinging an arrow, Typst math and a paragraph. - `scenes/live.zig`, live, presented like slides: a wave of dots whose - height the timeline animates, whose phase is the wall clock, and which - rise to meet the mouse. + height the timeline animates, whose phase runs on while a pause waits, + and which rise to meet the mouse. `build.zig` lists the scenes with the script `zig build test` plays each through (screenshots in `.zig-cache/e2e`). `-Dscene` picks the one `run`, 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; diff --git a/examples/vecanim/test/intro.script b/examples/vecanim/test/intro.script index 75ce751..9dd61bb 100644 --- a/examples/vecanim/test/intro.script +++ b/examples/vecanim/test/intro.script @@ -2,28 +2,28 @@ # then the same instants on the CPU renderer. frames 60 screenshot .zig-cache/e2e/title.png -console set t 7.5 +console set deck.t 7.5 frames 1 screenshot .zig-cache/e2e/shapes.png -console set t 13 +console set deck.t 13 frames 1 screenshot .zig-cache/e2e/morph.png -console set t 16.5 +console set deck.t 16.5 frames 1 screenshot .zig-cache/e2e/zoom.png -console set t 24 +console set deck.t 24 frames 1 screenshot .zig-cache/e2e/text.png key b expect backend cpu -console set t 13 +console set deck.t 13 frames 1 screenshot .zig-cache/e2e/morph-cpu.png -console set t 24 +console set deck.t 24 frames 1 screenshot .zig-cache/e2e/text-cpu.png key g expect guides true -console set t 16.5 +console set deck.t 16.5 frames 1 screenshot .zig-cache/e2e/guides.png diff --git a/examples/vecanim/test/live.script b/examples/vecanim/test/live.script index a3ddcdc..d955b6f 100644 --- a/examples/vecanim/test/live.script +++ b/examples/vecanim/test/live.script @@ -1,5 +1,6 @@ -# Plays the live scene headless: it holds at each pause until a click, the -# dots follow the pointer, and the guides draw over everything. +# Plays the live scene headless: it waits at each pause for a click, the +# wave running on, the dots follow the pointer, and the guides draw over +# everything. frames 150 expect t 2 screenshot .zig-cache/e2e/live-title.png |
