Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 ensure canvas is cleared before loading a new animation #86

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions demo-player/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dotlottie_player_core::{Config, DotLottiePlayer, Mode, Observer};
use minifb::{Key, Window, WindowOptions};
use minifb::{Key, KeyRepeat, Window, WindowOptions};
use std::fs::{self, File};
use std::io::Read;
use std::sync::Arc;
Expand Down Expand Up @@ -102,15 +102,16 @@ impl Timer {
}

fn main() {
let mut window = Window::new(
"dotLottie rust demo - ESC to exit",
WIDTH,
HEIGHT,
WindowOptions::default(),
)
.unwrap_or_else(|e| {
panic!("{}", e);
});
let mut window =
Window::new(
"dotLottie rust demo - ESC to exit",
WIDTH,
HEIGHT,
WindowOptions::default(),
)
.unwrap_or_else(|e| {
panic!("{}", e);
});

let base_path = env::var("CARGO_MANIFEST_DIR").unwrap();

Expand Down Expand Up @@ -201,7 +202,7 @@ fn main() {
lottie_player.set_config(config)
}

if window.is_key_down(Key::Right) {
if window.is_key_pressed(Key::Right, KeyRepeat::No) {
if let Some(manifest) = lottie_player.manifest() {
println!("{:?}", i);

Expand Down
Loading
Loading