use std::time::Duration;
#[derive(Debug, Clone)]
pub struct AudioTween {
pub duration: Duration,
pub easing: AudioEasing,
}
#[derive(Debug, Clone, Copy)]
pub enum AudioEasing {
Linear,
EaseIn,
EaseOut,
EaseInOut,
}
impl AudioTween {
pub fn new(duration: Duration, easing: AudioEasing) -> Self {
Self { duration, easing }
}
pub fn linear(duration: Duration) -> Self {
Self::new(duration, AudioEasing::Linear)
}
pub fn with_easing(mut self, easing: AudioEasing) -> Self {
self.easing = easing;
self
}
}
impl Default for AudioTween {
fn default() -> Self {
Self::new(Duration::from_millis(10), AudioEasing::Linear)
}
}