[][src]Struct termi_graphics::animation::Animation

pub struct Animation { /* fields omitted */ }

animation struct is used to connect between different screens and run them in a fixed speed.

Methods

impl Animation[src]

pub fn new(roll: Vec<Screen>, fps: u8, length: u8) -> Animation[src]

defines a new animation #Examples

 use termi_graphics::pixel_art::{Screen,PixelColors};
 use termi_graphics::animation::Animation;
 let screen1 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen2 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen3 = Screen::new(25,25,PixelColors::Red).unwrap();
 let anim = Animation::new(vec![screen1,screen2,screen3],15,10);

creates a new animation made of 3 reoccuring screen running at 15 fps for 10 seconds.

pub fn play(&self)[src]

starts the animation #Examples

 use termi_graphics::pixel_art::{Screen,PixelColors};
 use termi_graphics::animation::Animation;
 let screen1 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen2 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen3 = Screen::new(25,25,PixelColors::Red).unwrap();
 let anim = Animation::new(vec![screen1,screen2,screen3],15,10);
 anim.play();

running the 3 screen one after the other in rate of 15 screens per sec, for 10 seconds, then stops.

pub fn pause(&self)[src]

stops animation doesn't work well just yet - making threadpools in upcoming changes #Examples

 use termi_graphics::pixel_art::{Screen,PixelColors};
 use termi_graphics::animation::Animation;
 let screen1 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen2 = Screen::new(25,25,PixelColors::Red).unwrap();
 let screen3 = Screen::new(25,25,PixelColors::Red).unwrap();
 let anim = Animation::new(vec![screen1,screen2,screen3],15,10);
 anim.play();
 anim.pause();

Auto Trait Implementations

Blanket Implementations

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

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

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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