Purify Animation API and introduce application::timed
This commit is contained in:
parent
4334923add
commit
29a19fcde1
9 changed files with 281 additions and 104 deletions
|
|
@ -8,7 +8,7 @@ use iced::window;
|
|||
use iced::{Element, Fill, Point, Rectangle, Renderer, Subscription, Theme};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::application(Arc::default, Arc::update, Arc::view)
|
||||
iced::application(Arc::new, Arc::update, Arc::view)
|
||||
.subscription(Arc::subscription)
|
||||
.theme(|_| Theme::Dark)
|
||||
.run()
|
||||
|
|
@ -25,6 +25,13 @@ enum Message {
|
|||
}
|
||||
|
||||
impl Arc {
|
||||
fn new() -> Self {
|
||||
Arc {
|
||||
start: Instant::now(),
|
||||
cache: Cache::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _: Message) {
|
||||
self.cache.clear();
|
||||
}
|
||||
|
|
@ -38,15 +45,6 @@ impl Arc {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Arc {
|
||||
fn default() -> Self {
|
||||
Arc {
|
||||
start: Instant::now(),
|
||||
cache: Cache::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message> canvas::Program<Message> for Arc {
|
||||
type State = ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue