use core::time::Duration;
use crate::render_target::RenderTarget;
mod animate;
pub mod collections;
mod container;
mod empty;
mod hint_background;
#[cfg(feature = "embedded-graphics")]
mod image;
mod offset;
mod one_of;
mod opacity;
mod option;
mod scroll_renderable;
mod shade_subtree;
pub mod shape;
pub mod text;
mod transform;
mod transition_option;
pub use animate::Animate;
pub use container::Container;
pub use hint_background::HintBackground;
#[cfg(feature = "embedded-graphics")]
pub use image::Image;
pub use offset::Offset;
pub use one_of::{OneOf2, OneOf3, OneOf4, OneOf5, OneOf6, OneOf7};
pub use opacity::Opacity;
pub use scroll_renderable::ScrollRenderable;
pub use shade_subtree::ShadeSubtree;
pub use shape::Capsule;
pub use shape::Circle;
pub use shape::Rect;
pub use shape::RoundedRect;
pub use shape::StrokedShape;
pub use text::Text;
pub use transform::Transform;
pub use transition_option::TransitionOption;
pub trait AnimatedJoin {
fn join_from(&mut self, source: &Self, domain: &AnimationDomain);
}
pub trait Render<Color>: AnimatedJoin {
fn render(&self, render_target: &mut impl RenderTarget<ColorFormat = Color>, style: &Color);
fn render_animated(
render_target: &mut impl RenderTarget<ColorFormat = Color>,
source: &Self,
target: &Self,
style: &Color,
domain: &AnimationDomain,
);
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AnimationDomain {
pub factor: u8,
pub app_time: Duration,
}
impl AnimationDomain {
#[must_use]
pub const fn new(factor: u8, app_time: Duration) -> Self {
Self { factor, app_time }
}
#[must_use]
pub const fn top_level(app_time: Duration) -> Self {
Self {
factor: 255,
app_time,
}
}
#[must_use]
pub const fn is_complete(&self) -> bool {
self.factor == 255
}
}