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,
impl<T> MergedTimeline<T>where T: Timeline,
sourcepub fn of(timelines: impl IntoIterator<Item = T>) -> MergedTimeline<T>
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,
impl<T> Clone for MergedTimeline<T>where T: Timeline + Clone,
source§fn clone(&self) -> MergedTimeline<T>
fn clone(&self) -> MergedTimeline<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T> From<T> for MergedTimeline<T>where
T: Timeline,
impl<T> From<T> for MergedTimeline<T>where T: Timeline,
source§fn from(value: T) -> MergedTimeline<T>
fn from(value: T) -> MergedTimeline<T>
source§impl<T> Timeline for MergedTimeline<T>where
T: Timeline,
impl<T> Timeline for MergedTimeline<T>where T: Timeline,
§type Target = <T as Timeline>::Target
type Target = <T as Timeline>::Target
AnimatorValues type.source§fn start_with(&mut self, values: &<MergedTimeline<T> as Timeline>::Target)
fn start_with(&mut self, values: &<MergedTimeline<T> as Timeline>::Target)
source§impl<T> TimelineOrBuilder<T> for MergedTimeline<T>where
T: Timeline,
impl<T> TimelineOrBuilder<T> for MergedTimeline<T>where T: Timeline,
source§fn build(self) -> MergedTimeline<T>
fn build(self) -> MergedTimeline<T>
MergedTimeline. Read more