tasks: use new animations api

This commit is contained in:
2026-02-28 16:59:29 +01:00
parent e8a7a18539
commit 816cc20087
4 changed files with 39 additions and 44 deletions

View File

@@ -32,7 +32,7 @@ impl Shader<OledUniforms, Matrix2DSpace, BinaryColor> for OverlayShader {
}
impl<S: core::fmt::Debug + Surface<CoordinateSpace = Matrix2DSpace, Pixel = BinaryColor, Uniforms = OledUniforms>> OledUI<S> {
pub fn new<SS: Surfaces<Matrix2DSpace, Surface = S>>(surfaces: &mut SS, controls: DisplayControls, uniforms: LockedUniforms) -> Self where SS::Error: core::fmt::Debug {
pub fn new<SS: Surfaces<Surface = S>>(surfaces: &mut SS, controls: DisplayControls, uniforms: LockedUniforms) -> Self where SS::Error: core::fmt::Debug {
Self {
overlay: SurfaceBuilder::build(surfaces)
.rect(Rectangle::everything())
@@ -48,12 +48,12 @@ impl<S: core::fmt::Debug + Surface<CoordinateSpace = Matrix2DSpace, Pixel = Bina
const FADE_IN: Animation<Fract8> = Animation::new().from(Fract8::MIN).to(Fract8::MAX).duration(Duration::from_millis(300));
const FADE_OUT: Animation<Fract8> = Animation::new().from(Fract8::MAX).to(Fract8::MIN).duration(Duration::from_millis(300));
info!("Fading in to screen {next_screen:?}");
FADE_IN.apply(&mut self.overlay).await;
FADE_IN.apply([&mut self.overlay]).await;
{
let mut locked = self.uniforms.lock().await;
locked.current_screen = next_screen;
}
FADE_OUT.apply(&mut self.overlay).await;
FADE_OUT.apply([&mut self.overlay]).await;
}
pub async fn on_event(&mut self, event: Prediction) {