use super::*;
pub struct Tween<T: Interpolable + Copy> {
pub(crate) from: T,
pub(crate) to: T,
pub(crate) duration: f64,
pub(crate) easing: Easing,
pub(crate) delay: f64,
pub(crate) elapsed: f64,
pub(crate) state: TweenState,
pub(crate) mode: AnimationMode,
pub(crate) direction: f64,
pub(crate) on_complete: Option<Rc<dyn Fn()>>,
}
impl<T: Interpolable + Copy> Clone for Tween<T> {
fn clone(&self) -> Tween<T> {
Tween {
from: self.from,
to: self.to,
duration: self.duration,
easing: self.easing,
delay: self.delay,
elapsed: self.elapsed,
state: self.state,
mode: self.mode,
direction: self.direction,
on_complete: self.on_complete.clone(),
}
}
}
impl<T: Interpolable + Copy + Debug> Debug for Tween<T> {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter
.debug_struct("Tween")
.field("from", &self.from)
.field("to", &self.to)
.field("duration", &self.duration)
.field("easing", &self.easing)
.field("delay", &self.delay)
.field("elapsed", &self.elapsed)
.field("state", &self.state)
.field("mode", &self.mode)
.field("direction", &self.direction)
.finish_non_exhaustive()
}
}