Struct mina::StateAnimatorBuilder
source · 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,
impl<State, Timeline> StateAnimatorBuilder<State, Timeline>where State: Clone + Default + EnumArray<Option<MergedTimeline<Timeline>>> + PartialEq<State>, Timeline: Timeline, <Timeline as Timeline>::Target: Clone + Default,
sourcepub fn new() -> StateAnimatorBuilder<State, Timeline>
pub fn new() -> StateAnimatorBuilder<State, Timeline>
Creates a new StateAnimatorBuilder with default values.
sourcepub fn build(
self
) -> MappedTimelineAnimator<State, Timeline, EnumMap<State, Option<MergedTimeline<Timeline>>>>
pub fn build( self ) -> MappedTimelineAnimator<State, Timeline, EnumMap<State, Option<MergedTimeline<Timeline>>>>
Builds the StateAnimator, consuming self.
sourcepub fn from_state(self, state: State) -> StateAnimatorBuilder<State, Timeline>
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.
sourcepub fn from_values(
self,
values: <Timeline as Timeline>::Target
) -> StateAnimatorBuilder<State, Timeline>
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.
sourcepub fn on(
self,
state: State,
timeline: impl TimelineOrBuilder<Timeline>
) -> StateAnimatorBuilder<State, Timeline>
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.