Registry / Framework

framework · v0.1.2
Animation Scrub
Fence asynchronous preview callbacks to the most recently selected animation frame.
Use Animation Scrub
use vendor::animation_scrub::animation_scrub;
Run the example
nest demo animation_scrub@0.1.2
blyxc native-run animation_scrub-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::animation_scrub::animation_scrub;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = animation_scrub_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = animation_scrub_step(live, args_at(arguments, i), text_number(input));
let command = animation_scrub_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = animation_scrub_start();
state = animation_scrub_step(state, "seek", 4.0);
println!(animation_scrub_command(state));
state = animation_scrub_step(state, "seek", 7.0);
println!(animation_scrub_command(state));
state = animation_scrub_step(state, "loaded", 4.0);
println!(animation_scrub_command(state));
state = animation_scrub_step(state, "loaded", 7.0);
println!(animation_scrub_command(state));
state = animation_scrub_step(state, "play", 0.0);
println!(animation_scrub_command(state));
state = animation_scrub_step(state, "pause", 9.0);
println!(animation_scrub_command(state));
}
Expected output
request_frame
supersede_frame
reject
draw_frame
resume_timeline
freeze_frame
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | b9031fa078 | 97e46231678afd349a983779d24507e487a5bcc61e127b3683789a1c381173a9 |
| 0.1.1 | Download ZIP · Browse files | c43566384d | 497c066b3200dbc25ad2997dba9b113e486f4cdbe3bf6003ca0e34e10f3eb62e |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | 5ad04a884924f162a6bf9e162eda533ab75f223c2027966159bd275174f8e6d8 |