pub struct Animation { /* private fields */ }Expand description
Create an animation
Make the animation easy
§Example
draw a cube and rotate it
use rsille::{extra::Object3D, Animation};
let cube = Object3D::cube(30.0);
let mut anime = Animation::new();
anime.push(cube, |cube| {
cube.rotate((1.0, 2.0, 3.0));
false
}, (30, -30));
anime.run();Implementations§
Source§impl Animation
impl Animation
Sourcepub fn push<T, F, N>(&mut self, obj: T, f: F, xy: (N, N))
pub fn push<T, F, N>(&mut self, obj: T, f: F, xy: (N, N))
Push an object to the animation
obj- the object to paintf- the function to update the objectxy- the position to paint the object
Sourcepub fn run(&mut self)
pub fn run(&mut self)
Run the animation
When all the objects are end or press ctrl+c or esc, the animation will stop.
Sourcepub fn hide_cursor(&mut self, hide_cursor: bool)
pub fn hide_cursor(&mut self, hide_cursor: bool)
Hide the cursor or not
Sourcepub fn set_size<T>(&mut self, width: T, height: T)
pub fn set_size<T>(&mut self, width: T, height: T)
Set the size of the canvas
Give a look at Canvas::set_size
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnwindSafe for Animation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more