StateAnimatorBuilder

Struct StateAnimatorBuilder 

Source
pub struct StateAnimatorBuilder<State, Timeline>
where State: Clone + Default + EnumArray<Option<MergedTimeline<Timeline>>> + PartialEq, Timeline: Timeline, <Timeline as Timeline>::Target: Clone + Default,
{ /* private fields */ }
Expand description

Builder for a StateAnimator.

Provides a fluent interface for configuring the Timeline associated with each state.

Implementations§

Source§

impl<State, Timeline> StateAnimatorBuilder<State, Timeline>
where State: Clone + Default + EnumArray<Option<MergedTimeline<Timeline>>> + PartialEq, Timeline: Timeline, <Timeline as Timeline>::Target: Clone + Default,

Source

pub fn new() -> StateAnimatorBuilder<State, Timeline>

Creates a new StateAnimatorBuilder with default values.

Source

pub fn build( self, ) -> MappedTimelineAnimator<State, Timeline, EnumMap<State, Option<MergedTimeline<Timeline>>>>

Builds the StateAnimator, consuming self.

Source

pub fn from_state(self, state: State) -> StateAnimatorBuilder<State, Timeline>

Specifies the default State in which the animator starts, typically a “None” or “Idle” state depending on the actual type of State.

Source

pub fn from_values( self, values: <Timeline as Timeline>::Target, ) -> StateAnimatorBuilder<State, Timeline>

Specifies the default Values that the resulting animator will provide in its current_values before any time advances. Not required unless the values should be different from the Default for the target type.

Commonly, these are the same values that the timeline for the default State (or whichever state is specified in from_state has at its 100% keyframe; using these values means that no visible animation will occur until the state changes. Specifying any other values implies that the animator should be immediately playing an animation.

Source

pub fn on( self, state: State, timeline: impl TimelineOrBuilder<Timeline>, ) -> StateAnimatorBuilder<State, Timeline>

Configures the Timeline for a given State value.

The timeline can be the actual timeline for the given Values type that was generated by Animate, or a builder for that type, or a MergedTimeline.

Multiple calls to on with the same state argument will result in the most recent timelines being used, and previous timelines being dropped. To apply multiple independent animations to a single state, use a MergedTimeline.

Trait Implementations§

Source§

impl<State, Timeline> Default for StateAnimatorBuilder<State, Timeline>
where State: Clone + Default + EnumArray<Option<MergedTimeline<Timeline>>> + PartialEq, Timeline: Timeline, <Timeline as Timeline>::Target: Clone + Default,

Source§

fn default() -> StateAnimatorBuilder<State, Timeline>

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

Auto Trait Implementations§

§

impl<State, Timeline> Freeze for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + Freeze, State: Freeze, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: Freeze,

§

impl<State, Timeline> RefUnwindSafe for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + RefUnwindSafe, State: RefUnwindSafe, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: RefUnwindSafe,

§

impl<State, Timeline> Send for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + Send, State: Send, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: Send,

§

impl<State, Timeline> Sync for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + Sync, State: Sync, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: Sync,

§

impl<State, Timeline> Unpin for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + Unpin, State: Unpin, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: Unpin,

§

impl<State, Timeline> UnwindSafe for StateAnimatorBuilder<State, Timeline>
where <Timeline as Timeline>::Target: Sized + UnwindSafe, State: UnwindSafe, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: UnwindSafe,

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 = 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.