1
Fork 0

interpolate updates

This commit is contained in:
Andy Killorin 2023-10-28 20:58:24 -05:00
parent 8cb9587119
commit 0c820ef0ce
Signed by: ank
GPG key ID: B6241CA3B552BCA4

View file

@ -15,8 +15,10 @@ fn main() -> Result<()> {
println!("Hello, {}!", players[0].identity()); println!("Hello, {}!", players[0].identity());
loop { loop {
let tick = tracker.tick(); let tick = tracker.tick();
let elapsed = tick.progress.position().as_secs(); let elapsed = tick.progress.position().as_millis() as f64
let total = tick.progress.length().unwrap().as_secs(); + tick.progress.age().as_millis() as f64
* tick.progress.playback_rate();
let total = tick.progress.length().unwrap().as_millis();
println!("{elapsed}s/{total}s!"); println!("{elapsed}s/{total}s!");
let prog = elapsed as f32 / total as f32; let prog = elapsed as f32 / total as f32;
println!("{prog}"); println!("{prog}");
@ -37,10 +39,10 @@ fn gen_icon(prog: f32) -> Vec<u8> {
let y = pix / RES as usize; let y = pix / RES as usize;
icon.push(1); icon.push(1);
icon.push( icon.push(
if prog / 256.0 > x as f32 / RES as f32 { if prog > x as f32 / RES as f32 {
255 255
} else { } else {
0 127
}); });
icon.push(0); icon.push(0);
icon.push(0); icon.push(0);