Struct Options

Source
pub struct Options<T: Animatable> { /* private fields */ }
Expand description

options to build an Animation

Implementations§

Source§

impl<T: Animatable> Options<T>

Source

pub fn new(from: T, to: T) -> Self

create new Options from range

Source

pub fn from(self, value: T) -> Self

animation from value

Source

pub fn to(self, value: T) -> Self

animation to value

Source

pub fn auto_reverse(self, auto_reverse: bool) -> Self

auto reverse animation when it reaches the end; default false. Note: it will not increase the duration or repeat times.

auto_reverseeffect
falsefrom -> to
truefrom -> to -> from
Source

pub fn begin_time(self, begin_time: Duration) -> Self

👎Deprecated

deprecated, use Options::skip() instead

Source

pub fn skip(self, skip: Duration) -> Self

play animation from the specified progress, same effect as Animation::skip()

see Animation::skip()

Source

pub fn delay(self, delay: Duration) -> Self

play animation with delay, same effect as Animation::delay(); take effect only once when the animation loops more than once.

see Animation::delay()

Source

pub fn duration(self, duration: Duration) -> Self

animation simple duration, this animation will last for how long if it plays once. default 1 second.

If Options::repeat() is specified, the animation might play more than once.

Source

pub fn repeat(self, behavior: RepeatBehavior) -> Self

repeat behavior

Source

pub fn forever(self) -> Self

your Animation repeats indefinitely

alias of Options::cycle(), see Options::repeat()

Source

pub fn cycle(self) -> Self

your Animation repeats indefinitely

Source

pub fn times(self, count: f32) -> Self

your Animation repeats for specified times

see Options::repeat()

panics if count<=0

Source

pub fn easing(self, func: impl Function + Clone + 'static) -> Self

set ease function, default easing::linear

Source

pub fn build(self) -> impl Animation<Item = T> + Clone

build Animation

Source§

impl<T: Animatable + 'static> Options<T>

Source

pub fn begin_animation(self) -> Timeline<T>

build Timeline and start animation

Trait Implementations§

Source§

impl<T: Animatable> Clone for Options<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Animatable + Debug> Debug for Options<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Animatable + Default> Default for Options<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Animatable + 'static> From<Options<T>> for Timeline<T>

Source§

fn from(opt: Options<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Animatable + 'static> From<Options<T>> for Timeline<T>

Source§

fn from(opt: Options<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Options<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Options<T>

§

impl<T> !Send for Options<T>

§

impl<T> !Sync for Options<T>

§

impl<T> Unpin for Options<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Options<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V