[−][src]Struct tetra::graphics::animation::Animation
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]
texture: Texture,
frames: Vec<Rectangle>,
frame_length: i32
) -> Animation
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]
fn draw<P>(&self, ctx: &mut Context, params: P) where
P: Into<DrawParams>,
[src]
P: Into<DrawParams>,
impl Clone for Animation
[src]
fn clone(&self) -> 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
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.