[][src]Struct bevy_core::Timer

pub struct Timer { /* fields omitted */ }

Tracks elapsed time. Enters the finished state once duration is reached.

Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick duration is reached or exceeded, and can still be reset at any given point.

Paused timers will not have elapsed time increased.

Implementations

impl Timer[src]

pub fn new(duration: Duration, repeating: bool) -> Self[src]

pub fn from_seconds(seconds: f32, repeating: bool) -> Self[src]

pub fn pause(&mut self)[src]

pub fn unpause(&mut self)[src]

pub fn paused(&self) -> bool[src]

pub fn elapsed(&self) -> f32[src]

Returns the time elapsed on the timer. Guaranteed to be between 0.0 and duration, inclusive.

pub fn set_elapsed(&mut self, elapsed: f32)[src]

pub fn duration(&self) -> f32[src]

pub fn set_duration(&mut self, duration: f32)[src]

pub fn finished(&self) -> bool[src]

Returns the finished state of the timer.

Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick duration is reached or exceeded, and can still be reset at any given point.

pub fn just_finished(&self) -> bool[src]

Will only be true on the tick the timer's duration is reached or exceeded.

pub fn repeating(&self) -> bool[src]

pub fn set_repeating(&mut self, repeating: bool)[src]

pub fn tick(&mut self, delta: f32) -> &Self[src]

Advances the timer by delta seconds.

pub fn reset(&mut self)[src]

pub fn percent(&self) -> f32[src]

Percent timer has elapsed (goes from 0.0 to 1.0)

pub fn percent_left(&self) -> f32[src]

Percent left on timer (goes from 1.0 to 0.0)

Trait Implementations

impl Clone for Timer[src]

impl Debug for Timer[src]

impl Default for Timer[src]

impl GetTypeRegistration for Timer[src]

impl Reflect for Timer[src]

impl Struct for Timer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: 'static + Send + Sync
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T> FromResources for T where
    T: Default
[src]

impl<S> GetField for S where
    S: Struct
[src]

impl<T> GetPath for T where
    T: Reflect
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: 'static + Send + Sync
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> TypeData for T where
    T: 'static + Send + Sync + Clone
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,