pub struct AnimationBuilder<T> { /* private fields */ }
Expand description

An AnimationBuilder is used to build an animation for a component value.

Set options on it such as curve / easing type, delay, target and finally submit the animation.

Note: bools and integers (also all kinds of entity references) will be set to their target directly, however delay can be used to delay the set of the value.

Implementations§

source§

impl<T> AnimationBuilder<T>where ValueConverter: ValueConverterTrait<T>,

source

pub fn new(accessor: &ValueAccessorReadWriteAnimate<T>) -> Self

Creates an AnimationBuilder from a ValueAccessor.

source

pub fn delay(&mut self, seconds: f32) -> &mut Self

Sets the delay of the animation (how long to wait before it starts)

source

pub fn target(&mut self, target: T, duration: f32) -> &mut Self

Sets the target value that the animated value will approach.

source

pub fn curve(&mut self, curve: AnimationCurve) -> &mut Self

Sets the curve shape of the value animation.

source

pub fn loop_count(&mut self, loop_count: u32) -> &mut Self

Sets the number of times the animation will loop. 0 is currently undefined.

source

pub fn smoothing(&mut self, smoothing: f32) -> &mut Self

Sets the method of smoothing when the animation target changes.

source

pub fn enqueue(&mut self) -> &mut Self

Enqueues the animation instead of cancelling a currently on-going animation (if any).

source

pub fn submit(&self)

Finalizes the animation.

source

pub fn submit_messenger( &self, callback: Option<Box<dyn FnMut(&AnimationReplyType) + 'static>> )

Finalizes the animation.

Also gives you the opportunity to pass in a callback that will be called once the animation is finished. For this to work, you must call entity_messenger().process_messages() from your world_update function.

Trait Implementations§

source§

impl<T> Deref for AnimationBuilder<T>where ValueConverter: ValueConverterTrait<T>,

§

type Target = AnimationRequest

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for AnimationBuilder<T>where T: RefUnwindSafe,

§

impl<T> Send for AnimationBuilder<T>where T: Send,

§

impl<T> Sync for AnimationBuilder<T>where T: Sync,

§

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

§

impl<T> UnwindSafe for AnimationBuilder<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.