pub struct StateAnimatorBuilder<State, Timeline>where
    State: Clone + Default + EnumArray<Option<MergedTimeline<Timeline>>> + PartialEq<State>,
    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<State>, 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<State>, 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> RefUnwindSafe for StateAnimatorBuilder<State, Timeline>where State: RefUnwindSafe, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: RefUnwindSafe, <Timeline as Timeline>::Target: RefUnwindSafe,

§

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

§

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

§

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

§

impl<State, Timeline> UnwindSafe for StateAnimatorBuilder<State, Timeline>where State: UnwindSafe, <State as EnumArray<Option<MergedTimeline<Timeline>>>>::Array: UnwindSafe, <Timeline as Timeline>::Target: 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.