Skip to content

Commit

Permalink
added 21 new spinners and stop and cleanup for multiline animations
Browse files Browse the repository at this point in the history
new animations:
- dwarf_fortress
- matrix_glitch
- matrix_glitch2
- matrix_glitch2_small
- layer
- soccer
- wavy
- wavy2
- wavy3
- wavy4
- pray
- red_pulse
- dot_bounce2
- dot_box
- arrows
- bomb
- simple_line_spin
- orange_pulse
-blue_pulse
- green_pulse
- other

new features:
- cleanup console after multiline drops
  • Loading branch information
Arteiii committed Apr 7, 2024
1 parent c98008c commit a007799
Show file tree
Hide file tree
Showing 6 changed files with 423 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
categories = ["command-line-utilities", "command-line-interface"]


description = "Elevate your Rust command-line interfaces with 81+ spinner animations and multiline support (Yet Another Spinner Lib)"
description = "100+ Cool Animations and Support for Multiple Animations at Once (Yet Another Spinner Lib)"
repository = "https://github.com/Arteiii/zenity"
keywords = ["console", "animations", "cli", "spinner", "loading"]
homepage = "https://arteiii.github.io"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Elevate your Rust command-line interfaces with 81+ spinner animations and multil

Do you often find yourself gazing into the void of your terminal, wondering if your computer has decided to take a coffee break without notifying you?

81+ predefined animations
100+ predefined animations

[List Of Animations](https://docs.rs/zenity/latest/zenity/animations/frames/spinner/struct.PreDefined.html)

Expand Down
26 changes: 26 additions & 0 deletions examples/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ macro_rules! test_predefined_animation {
}

fn main() {
// new:
test_predefined_animation!(PreDefined::dwarf_fortress(false), "dwarf_fortress");

test_predefined_animation!(PreDefined::matrix_glitch(false), "matrix_glitch");
test_predefined_animation!(PreDefined::matrix_glitch2(false), "matrix_glitch2");
test_predefined_animation!(PreDefined::matrix_glitch2_small(false), "matrix_glitch2_small");
test_predefined_animation!(PreDefined::layer(false), "layer");
test_predefined_animation!(PreDefined::soccer(false), "soccer");
test_predefined_animation!(PreDefined::wavy(false), "wavy");
test_predefined_animation!(PreDefined::wavy2(false), "wavy2");
test_predefined_animation!(PreDefined::wavy3(false), "wavy3");
test_predefined_animation!(PreDefined::wavy4(false), "wavy4");
test_predefined_animation!(PreDefined::pray(false), "pray");

test_predefined_animation!(PreDefined::red_pulse(false), "red_pulse");
test_predefined_animation!(PreDefined::dot_bounce2(false), "dot_bounce2");
test_predefined_animation!(PreDefined::dot_box(false), "dot_box");
test_predefined_animation!(PreDefined::arrows(false), "arrows");
test_predefined_animation!(PreDefined::bomb(false), "bomb");
test_predefined_animation!(PreDefined::simple_line_spin(false), "simple_line_spin");
test_predefined_animation!(PreDefined::orange_pulse(false), "orange_pulse");
test_predefined_animation!(PreDefined::blue_pulse(false), "blue_pulse");
test_predefined_animation!(PreDefined::green_pulse(false), "green_pulse");
test_predefined_animation!(PreDefined::other(false), "other");


test_predefined_animation!(
PreDefined::short_loading_bar_with_arrow(false),
"short_loading_bar_with_arrow"
Expand Down
62 changes: 35 additions & 27 deletions examples/multi_spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,51 @@ use zenity::multi_spinner::MultiSpinner;
use zenity::spinner::PreDefined;

fn main() {
let check_mark_text = check_mark_button();
let cross_mark_text = cross_mark();
{
let check_mark_text = check_mark_button();
let cross_mark_text = cross_mark();

let mut spinner = MultiSpinner::default();
let mut spinner = MultiSpinner::default();

// main thread operations
let spinner1 = spinner.add(PreDefined::dot_spinner11(false));
let spinner2 = spinner.add(PreDefined::binary(false));
let spinner3 = spinner.add(PreDefined::dot_spinner9(false));
let spinner4 = spinner.add(PreDefined::dot_spinner8(false));
// main thread operations
let spinner1 = spinner.add(PreDefined::dot_spinner11(false));
let spinner2 = spinner.add(PreDefined::binary(false));
let spinner3 = spinner.add(PreDefined::dot_spinner9(false));
let spinner4 = spinner.add(PreDefined::dot_spinner8(false));

// access the spinner through the Arc<Mutex<MultiSpinner>> reference
spinner.run_all();
sleep(Duration::from_secs(2));

sleep(Duration::from_secs(2));
// access the spinner through the Arc<Mutex<MultiSpinner>> reference
spinner.run_all();

sleep(Duration::from_secs(8));
spinner.set_text(&spinner2, "spinner2".to_string());
// stop spinner1
spinner.set_text(&spinner1, "spinner1".to_string());
sleep(Duration::from_secs(2));

sleep(Duration::from_secs(2));
sleep(Duration::from_secs(8));
spinner.set_text(&spinner2, "spinner2".to_string());
// stop spinner1
spinner.set_text(&spinner1, "spinner1".to_string());

spinner.stop(&spinner2);
spinner.set_text(&spinner2, format!("{} Successfully", &check_mark_text));
sleep(Duration::from_secs(2));

sleep(Duration::from_secs(2));
spinner.set_text(&spinner1, "spinner1 stopped".to_string());
spinner.stop(&spinner2);
spinner.set_text(&spinner2, format!("{} Successfully", &check_mark_text));

spinner.stop(&spinner1);
sleep(Duration::from_secs(2));
spinner.set_text(&spinner1, "spinner1 stopped".to_string());

sleep(Duration::from_secs(9));
spinner.stop(&spinner3);
spinner.stop(&spinner4);
spinner.stop(&spinner1);

spinner.set_text(&spinner3, format!("{} Failed!", &cross_mark_text));
spinner.set_text(&spinner4, format!("{} Failed!", &cross_mark_text));
sleep(Duration::from_secs(9));
spinner.stop(&spinner3);
spinner.stop(&spinner4);

sleep(Duration::from_secs(3000000));
spinner.set_text(&spinner3, format!("{} Failed!", &cross_mark_text));
spinner.set_text(&spinner4, format!("{} Failed!", &cross_mark_text));

sleep(Duration::from_secs(1));
}

println!("animation stopped");

sleep(Duration::from_secs(5));
}
Loading

0 comments on commit a007799

Please sign in to comment.