Skip to main content

Move

Enum Move 

Source
pub enum Move {
    Static(usize, i32, Vec2),
    Dynamic(usize, Easing, i32, i32, Vec2, Vec2),
}
Expand description

Move event

Variants§

§

Static(usize, i32, Vec2)

§

Dynamic(usize, Easing, i32, i32, Vec2, Vec2)

Trait Implementations§

Source§

impl Event for Move

Source§

fn to_line(&self) -> String

Source§

fn set_depth(&mut self, depth: usize)

Source§

fn get_start_time(&self) -> i32

Source§

fn get_end_time(&self) -> i32

Source§

impl Into<Move> for (i32, Vec2)

Creates a static Move event with the timestamp and the position of the element

Uses a Linear easing

Example:

use osb::{utils::Vec2, Sprite};

let time = 0;
let pos = Vec2::from(320, 240);

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((time, pos));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.
Source§

impl<T, U> Into<Move> for (i32, T, U)
where T: Into<Number>, U: Into<Number>,

Creates a static Move event with the timestamp and the position of the element

Uses a Linear easing

Example:

use osb::Sprite;

let time = 0;
let x = 320;
let y = 240;

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((time, x, y));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.
Source§

impl Into<Move> for (i32, i32, Vec2, Vec2)

Creates a dynamic Move event with the timestamps and the positions of the element

Uses a Linear easing

Example:

use osb::{utils::Vec2, Sprite};

let start_time = 0;
let end_time = 1000;
let start_pos = Vec2::from(0, 0);
let end_pos = Vec2::from(320, 240);

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((start_time, end_time, start_pos, end_pos));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.
Source§

impl<T, U, V, W> Into<Move> for (i32, i32, T, U, V, W)
where T: Into<Number>, U: Into<Number>, V: Into<Number>, W: Into<Number>,

Creates a dynamic Move event with the timestamps and the positions of the element

Uses a Linear easing

Example:

use osb::Sprite;

let start_time = 0;
let end_time = 1000;
let start_x = 0;
let start_y = 0;
let end_x = 320;
let end_y = 240;

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((start_time, end_time, start_x, start_y, end_x, end_y));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.
Source§

impl Into<Move> for (Easing, i32, i32, Vec2, Vec2)

Creates a dynamic Move event with the easing, the timestamps and the positions of the element

Example:

use osb::{utils::Vec2, Easing, Sprite};

let easing = Easing::Out;
let start_time = 0;
let end_time = 1000;
let start_pos = Vec2::from(0, 0);
let end_pos = Vec2::from(320, 240);

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((easing, start_time, end_time, start_pos, end_pos));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.
Source§

impl<T, U, V, W> Into<Move> for (Easing, i32, i32, T, U, V, W)
where T: Into<Number>, U: Into<Number>, V: Into<Number>, W: Into<Number>,

Creates a dynamic Move event with the timestamps and the positions of the element

Example:

use osb::{Easing, Sprite};

let easing = Easing::Out;
let start_time = 0;
let end_time = 1000;
let start_x = 0;
let start_y = 0;
let end_x = 320;
let end_y = 240;

let mut sprite = Sprite::new("res/sprite.png");
sprite.move_((easing, start_time, end_time, start_x, start_y, end_x, end_y));
Source§

fn into(self) -> Move

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

§

impl Freeze for Move

§

impl RefUnwindSafe for Move

§

impl Send for Move

§

impl Sync for Move

§

impl Unpin for Move

§

impl UnsafeUnpin for Move

§

impl UnwindSafe for Move

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.