[][src]Struct tetra::graphics::animation::Animation

pub struct Animation { /* fields omitted */ }

An animaton, cycling between regions of a texture at a regular interval.

As the rendering speed of the game is not fixed, use the tick method in your update handler to progress the animation.

Methods

impl Animation[src]

pub fn new(
    texture: Texture,
    frames: Vec<Rectangle>,
    frame_length: i32
) -> Animation
[src]

Creates a new animation.

pub fn tick(&mut self)[src]

Advances the animation's timer, switching the texture region if required.

pub fn set_frames(&mut self, new_frames: Vec<Rectangle>)[src]

Set new frames for this animation, while keeping the old texture and frame length. This will reset the current animation.

pub fn set_frame_length(&mut self, new_frame_length: i32)[src]

Set the new frame length for this animation. This will make the animation run at the new length right away. If you want to reset the animation to 0, call restart

pub fn restart(&mut self)[src]

Will restart the current animation from the beginning.

Trait Implementations

impl Drawable for Animation[src]

impl Clone for Animation[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Animation[src]

Auto Trait Implementations

impl !Send for Animation

impl !Sync for Animation

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.