Struct mina::MergedTimeline

source ·
pub struct MergedTimeline<T>where
    T: Timeline,{ /* private fields */ }
Expand description

A Timeline that is composed of multiple inner timelines.

Merged timelines are useful in scenarios where a single animation behavior is difficult to specify purely in terms of keyframes - for example, if different properties should animate with different easing functions but share the same keyframe times, or if there will be different animations that each have entirely different timescales, e.g. one loops/reverses and the other does not, or the cycle durations are different.

A common example would be a spinner-like widget that fades in briefly, but also has a repeating progress animation (say rotation). This relationship cannot be described by the keyframes of a single timeline because repeat and reverse are determined for the entire timeline. However, it can be easily represented by a merged timeline whose constituent parts each have keyframes referring to only one of the “parts”, either rotation or alpha.

Refer to the tests and the merged_timeline example for details and usage.

Implementations§

source§

impl<T> MergedTimeline<T>where T: Timeline,

source

pub fn of(timelines: impl IntoIterator<Item = T>) -> MergedTimeline<T>

Creates a MergedTimeline using a sequence of component Timelines.

Timelines are queried in sequential order, meaning that if a merged timeline is created from [t1, t2], and they each have a value for property foo at a given point in time, then only the value from t2 is used; the values from t1 and t2 are not blended in any way. If t2 does not have a value for the property, but t1 does, then t1 is used.

Any number of timelines can be merged, but generally they should not overlap in the properties that they animate, otherwise the above-mentioned precedence rule above may produce unexpected outcomes.

Trait Implementations§

source§

impl<T> Clone for MergedTimeline<T>where T: Timeline + Clone,

source§

fn clone(&self) -> MergedTimeline<T>

Returns a copy 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> From<T> for MergedTimeline<T>where T: Timeline,

source§

fn from(value: T) -> MergedTimeline<T>

Converts to this type from the input type.
source§

impl<T> Timeline for MergedTimeline<T>where T: Timeline,

§

type Target = <T as Timeline>::Target

The target type that holds the set of animation properties. This is the original type from which the timeline was derived, not the generated AnimatorValues type.
source§

fn start_with(&mut self, values: &<MergedTimeline<T> as Timeline>::Target)

Changes this timeline to start with a different set of values from the defaults that it was originally configured with. Read more
source§

fn update( &self, values: &mut <MergedTimeline<T> as Timeline>::Target, time: f32 )

Updates a set of animator values to represent the timeline at a given time. Read more
source§

impl<T> TimelineOrBuilder<T> for MergedTimeline<T>where T: Timeline,

source§

fn build(self) -> MergedTimeline<T>

Returns the built timeline as a MergedTimeline. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for MergedTimeline<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> DynClone for Twhere T: Clone,

source§

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

source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
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> ToOwned for Twhere T: Clone,

§

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