Skip to main content

Color

Enum Color 

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

Color event

Variants§

§

Static(usize, i32, Color)

§

Dynamic(usize, Easing, i32, i32, Color, Color)

Trait Implementations§

Source§

impl Event for Color

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<Color> for (i32, Color)

Creates a static Color event with the timestamp and the colorization of the element

Uses a Linear easing

Example:

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

let time = 0;
let color = Color::from(42, 42, 42);

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

fn into(self) -> Color

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

impl Into<Color> for (i32, i32, i32, i32)

Creates a static Color event with the timestamp and the colorization of the element

Uses a Linear easing

Example:

use osb::Sprite;

let time = 0;
let r = 42;
let g = 42;
let b = 42;

let mut sprite = Sprite::new("res/sprite.png");
sprite.color_((time, r, g, b));
Source§

fn into(self) -> Color

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

impl Into<Color> for (i32, i32, Color, Color)

Creates a dynamic Color event with the timestamps and the colorizations of the element

Uses a Linear easing

Example:

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

let start_time = 0;
let end_time = 1000;
let start_color = Color::from(0, 0, 0);
let end_color = Color::from(255, 255, 255);

let mut sprite = Sprite::new("res/sprite.png");
sprite.color_((start_time, end_time, start_color, end_color));
Source§

fn into(self) -> Color

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

impl Into<Color> for (i32, i32, i32, i32, i32, i32, i32, i32)

Creates a dynamic Color event with the timestamps and the colorizations of the element

Uses a Linear easing

Example:

use osb::{Sprite};

let start_time = 0;
let end_time = 1000;
let start_r = 0;
let start_g = 0;
let start_b = 0;
let end_r = 255;
let end_g = 255;
let end_b = 255;

let mut sprite = Sprite::new("res/sprite.png");
sprite.color_((start_time, end_time, start_r, start_g, start_b, end_r, end_g, end_b));
Source§

fn into(self) -> Color

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

impl Into<Color> for (Easing, i32, i32, Color, Color)

Creates a dynamic Color event with the easing, the timestamps and the colorizations of the element

Example:

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

let easing = Easing::Out;
let start_time = 0;
let end_time = 1000;
let start_color = Color::from(0, 0, 0);
let end_color = Color::from(255, 255, 255);

let mut sprite = Sprite::new("res/sprite.png");
sprite.color_((easing, start_time, end_time, start_color, end_color));
Source§

fn into(self) -> Color

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

impl Into<Color> for (Easing, i32, i32, i32, i32, i32, i32, i32, i32)

Creates a dynamic Color event with the timestamps and the colorizations of the element

Example:

use osb::{Easing, Sprite};

let easing = Easing::Out;
let start_time = 0;
let end_time = 1000;
let start_r = 0;
let start_g = 0;
let start_b = 0;
let end_r = 255;
let end_g = 255;
let end_b = 255;

let mut sprite = Sprite::new("res/sprite.png");
sprite.color_((easing, start_time, end_time, start_r, start_g, start_b, end_r, end_g, end_b));
Source§

fn into(self) -> Color

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

Auto Trait Implementations§

§

impl Freeze for Color

§

impl RefUnwindSafe for Color

§

impl Send for Color

§

impl Sync for Color

§

impl Unpin for Color

§

impl UnsafeUnpin for Color

§

impl UnwindSafe for Color

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.