commit 3451206f1afde0d75a1510d07732a6bcfebacb9f
parent 0770bab37c4116ed92a7161bd1efb6ae9d81f66d
Author: William Casarin <jb55@jb55.com>
Date: Mon, 4 Aug 2025 11:35:22 -0700
dave: switch to logical time
this fixes jumpy animations when we stop rendering
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/crates/notedeck_dave/src/avatar.rs b/crates/notedeck_dave/src/avatar.rs
@@ -13,6 +13,7 @@ use std::borrow::Cow;
pub struct DaveAvatar {
rotation: Quaternion,
rot_dir: Vec3,
+ logical_time: f32,
}
// Matrix utilities for perspective projection
@@ -246,6 +247,7 @@ impl DaveAvatar {
};
Self {
+ logical_time: 0.0,
rotation: initial_rot,
rot_dir: Vec3::new(0.0, 0.0, 0.0),
}
@@ -354,6 +356,8 @@ impl DaveAvatar {
-1.0
};
+ self.logical_time += ui.ctx().input(|i| i.stable_dt.min(0.1));
+
// Add paint callback
ui.painter().add(egui_wgpu::Callback::new_paint_callback(
rect,
@@ -361,7 +365,7 @@ impl DaveAvatar {
view_proj,
model,
camera_pos,
- time: ui.ctx().input(|i| i.time as f32),
+ time: self.logical_time,
is_light: [is_light, 0.0, 0.0, 0.0],
},
));