fn time(&mut self, now: Instant) -> Option<f32> {
        match self.start_time {
            Some(start_time) => {
                let time_as_duration = now - start_time;
                let time_as_secs = to_secs_f32(time_as_duration);
                if !self.loop_playback && time_as_secs > self.duration_secs {
                    self.start_time = None;
                }
                let time = time_as_secs % self.duration_secs;
                if time.is_nan() {
                    eprintln!(
                        "warn: animation channel time was NaN: time_as_secs: {}, channel_duration_secs: {}",
                        time_as_secs, self.duration_secs
                    );
                    self.start_time = None;
                    return None;
                }
                Some(time)
            }
            None => None,
        }
    }
/// Returns the current time for the animation loop. The value ranges between
/// `0.0` and `duration_secs`. Returns `None` if the animation is not playing.
Returns the current time for the animation loop. The value ranges between
`0.0` and `duration_secs`. Returns `None` if the animation is not playing.
Returns the current time for the animation loop . The value ranges between ` 0 . 0 ` and ` duration_secs ` . Returns ` None ` if the animation is not playing .
fn time(&mut self, now: Instant) -> Option<f32> {
        match self.start_time {
            Some(start_time) => {
                let time_as_duration = now - start_time;
                let time_as_secs = to_secs_f32(time_as_duration);
                if !self.loop_playback && time_as_secs > self.duration_secs {
                    self.start_time = None;
                }
                let time = time_as_secs % self.duration_secs;
                if time.is_nan() {
                    eprintln!(
                        "warn: animation channel time was NaN: time_as_secs: {}, channel_duration_secs: {}",
                        time_as_secs, self.duration_secs
                    );
                    self.start_time = None;
                    return None;
                }
                Some(time)
            }
            None => None,
        }
    }
fn time ( & mut self , now : Instant ) -> Option < f32 > { match self . start_time { Some ( start_time ) => { let time_as_duration = now - start_time ; let time_as_secs = to_secs_f32 ( time_as_duration ) ; if ! self . loop_playback && time_as_secs > self . duration_secs { self . start_time = None ; } let time = time_as_secs % self . duration_secs ; if time . is_nan ( ) { eprintln ! ( " " time_as_secs self duration_secs ) ; self . start_time = None ; return None ; } Some ( time ) } None => None , } }
Returns the current time for the animation loop.
Returns the current time for the animation loop .
&mut self
now
Instant
&mut self
now
Instant