# The talk example (examples/talk.zig): a Deck in the sketch's own State, # stepped by the clicks and keys the sketch turns into asks. frames 90 expect deck.waiting false expect deck.slide 1 # Slide 2 lies after the choice, which has not been made. expect deck.slides 1 # A click during the first step finishes it: held at the first pause. click 100 100 expect deck.t 2.5 ~0.0001 expect deck.waiting true expect deck.log.len 0 # The mass bobs while the deck waits. screenshot .zig-cache/talk/bob-a.png frames 14 screenshot .zig-cache/talk/bob-b.png expect-different-screenshot .zig-cache/talk/bob-a.png .zig-cache/talk/bob-b.png # The next click opens the pause where it lands: the slider comes in, and # the deck waits at the choice. click 100 100 expect deck.log.len 1 expect deck.log.buffer[0].wait 0.2833 ~0.001 await deck.waiting true frames 5 # Reloaded mid-wait, the first step retimed from 2 s to 3: the same step, # as far into it, a second later. console set deck.playing false expect deck.t 3.4833 ~0.001 load {v2} expect deck.t 4.4833 ~0.001 expect deck.waiting true expect deck.log.len 1 expect deck.log.buffer[0].wait 0.2833 ~0.001 console set deck.playing true # A click on the slider is the slider's: zeta goes there, the deck stays. click 790 580 expect app.zeta 1.5 ~0.01 expect deck.log.len 1 expect deck.waiting true # So is a drag along it, let go and all. down 640 580 move 400 580 up 400 580 expect app.zeta 0.2 ~0.01 expect app.dragging false expect deck.log.len 1 expect deck.waiting true # Going on chooses by the slider: under 1, it rings; slide 2 is laid. key space expect deck.log.len 2 expect deck.log.buffer[1].value 0 expect deck.slides 2 frames 90 screenshot .zig-cache/talk/rings.png # Back: held at the choice again; over 1, it creeps. key page_up expect deck.log.len 1 expect deck.waiting true click 840 580 expect app.zeta 1.667 ~0.01 key space expect deck.log.len 2 expect deck.log.buffer[1].value 1 frames 90 screenshot .zig-cache/talk/creeps.png expect-different-screenshot .zig-cache/talk/rings.png .zig-cache/talk/creeps.png # Slide 2 at rest: it holds no pause, so its end. key right_bracket expect deck.slide 2 expect deck.log.len 3 expect deck.waiting false # Back a slide: slide 1 at rest, held at its first pause (3 s of writing # in this build, then the mass). key left_bracket expect deck.slide 1 expect deck.log.len 0 expect deck.t 3.5 ~0.0001 expect deck.waiting true # Recorded, clicks, the slider and keys replay to the same State: the deck # opens gates in update, from events and State alone. console record 0 click 100 100 frames 40 click 790 580 key space frames 30 key page_up key right_bracket frames 10 console save 2 console play 0 frames 120 expect-snapshot 2 console stop # Exported ({a}, {b}: 30 fps, half size), each gate holds 2 s: the mass # bobs through the first hold (to 4.5 s), nothing moves at the choice # (5.1 to 7.1 s), and the verdict writes after it. Twice, the same frames. expect-different-screenshot {a}/000080.png {a}/000090.png expect-different-screenshot {a}/000130.png {a}/000170.png expect-same-screenshot {a}/000170.png {a}/000200.png expect-different-screenshot {a}/000200.png {a}/000230.png expect-same-screenshot {a}/000080.png {b}/000080.png expect-same-screenshot {a}/000230.png {b}/000230.png expect-same-screenshot {a}/000350.png {b}/000350.png