mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
anime: gif-image
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{env, fs::File, path::Path, thread::sleep, time::Duration};
|
||||
use std::{env, path::Path, thread::sleep};
|
||||
|
||||
use rog_anime::AniMeSequence;
|
||||
use rog_dbus::AuraDbusClient;
|
||||
|
||||
29
asusctl/examples/animatrix-png-gif.rs
Normal file
29
asusctl/examples/animatrix-png-gif.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use std::{env, path::Path, thread::sleep};
|
||||
|
||||
use rog_anime::AniMeSequence;
|
||||
use rog_dbus::AuraDbusClient;
|
||||
|
||||
fn main() {
|
||||
let (client, _) = AuraDbusClient::new().unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().into_iter().collect();
|
||||
if args.len() != 3 {
|
||||
println!("Please supply filepath and brightness");
|
||||
return;
|
||||
}
|
||||
|
||||
let path = Path::new(&args[1]);
|
||||
let brightness = args[2].parse::<f32>().unwrap();
|
||||
let gif = AniMeSequence::png_gif(path, brightness).unwrap();
|
||||
|
||||
loop {
|
||||
for frame in gif.get_animation().unwrap().frames() {
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(frame.frame().clone())
|
||||
.unwrap();
|
||||
sleep(frame.delay());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user