Purify Animation API and introduce application::timed

This commit is contained in:
Héctor Ramón Jiménez 2025-04-29 03:03:32 +02:00
parent 4334923add
commit 29a19fcde1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
9 changed files with 281 additions and 104 deletions

View file

@ -1,5 +1,5 @@
use iced::mouse;
use iced::time::{self, Instant, milliseconds};
use iced::time::{self, milliseconds};
use iced::widget::canvas;
use iced::{
Color, Element, Fill, Font, Point, Rectangle, Renderer, Subscription, Theme,
@ -22,13 +22,13 @@ struct TheMatrix {
#[derive(Debug, Clone, Copy)]
enum Message {
Tick(Instant),
Tick,
}
impl TheMatrix {
fn update(&mut self, message: Message) {
match message {
Message::Tick(_now) => {
Message::Tick => {
self.tick += 1;
}
}
@ -39,7 +39,7 @@ impl TheMatrix {
}
fn subscription(&self) -> Subscription<Message> {
time::every(milliseconds(50)).map(Message::Tick)
time::every(milliseconds(50)).map(|_| Message::Tick)
}
}