Skip to main content

AnimLagged

Struct AnimLagged 

Source
pub struct AnimLagged {
    animations: Vec<AnimNode>,
    lag_ratio: f64,
    cursor_sec: f64,
    duration_secs: f64,
    leading: LaggedFill,
    trailing: LaggedFill,
}
Expand description

Dynamic lagged (staggered, end-filled) animation container.

Children are pushed un-placed (Unplaced); the container computes the placement itself: child i starts at start_{i-1} + lag_ratio · d_{i-1}. lag_ratio interpolates between the other two containers:

  • 0.0 — all children start together (like AnimStack);
  • 1.0 — each child starts when the previous ends (like AnimSequence);
  • in between — overlapping succession.

By default the time outside a child’s window is filled with real static cells (LaggedFill::Hold on both ends): each item is materialized at build time as a per-item sequence track [leading fill][anim][trailing fill] spanning the whole extent — before its start the item shows its initial state, after its end it keeps showing its final state, and the preview timeline shows exactly what is rendered. Configure with with_leading / with_trailing — e.g. Empty leading makes items appear only at their window; to hide an item after its window instead of holding it, give it an animation that ends hidden, e.g. seq![item.fade_in(), item.hide()].

Fills are sampled at build time: empty fills are skipped, and a zero-duration child gets no leading fill (it appears at its point, which is what “show from that point on” means). Because fills are build-time samples, children are expected to be pure (closed-form) animations — a stateful child’s trailing fill would be its initial state, not its true final state.

Fields§

§animations: Vec<AnimNode>§lag_ratio: f64§cursor_sec: f64

Start offset for the next pushed child.

§duration_secs: f64§leading: LaggedFill§trailing: LaggedFill

Implementations§

Source§

impl AnimLagged

Source

pub fn new(lag_ratio: f64) -> Self

Create an empty lagged container with the given stagger ratio.

Source

pub fn lag_ratio(&self) -> f64

The stagger ratio between successive children.

Source

pub fn with_leading(self, behavior: LaggedFill) -> Self

Configure the fill before each child’s window (default LaggedFill::Hold).

Source

pub fn with_trailing(self, behavior: LaggedFill) -> Self

Configure the fill after each child’s window (default LaggedFill::Hold).

Source

pub fn push<A: Unplaced + 'static>(&mut self, animation: A) -> &mut Self

Add an animation, placed by the container’s stagger rule.

Source

fn materialize_fills(&mut self)

Materialize each child as a per-item sequence track: [leading fill][anim][trailing fill] (empty fills skipped).

The lagged container is thus a stack of per-item sequences — each item’s track spans the whole extent, with its window-edge states held by real static cells.

Source

pub fn duration_secs(&self) -> f64

Current total extent (the last child’s end).

Source

pub fn built_animations(&self) -> &[AnimNode]

Borrow the children as placed by the stagger rule — the pre-materialization view, before build turns them into filled tracks.

Trait Implementations§

Source§

impl IntoAnimNode for AnimLagged

Source§

fn into_anim_node(self) -> AnimNode

Desugar: materialize each item into a full-extent sequence track, then lower the whole container to a plain runtime stack node — the stagger is ordinary window placement, so lagged needs no runtime kind of its own. anim_name keeps the authoring identity.

Source§

impl Unplaced for AnimLagged

Source§

fn at(self, offset_sec: f64) -> At<Self>

Place this definition at an offset in its parent’s local time coordinates.

Auto Trait Implementations§

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> Discard for T

Source§

fn discard(&self)

Simply returns ()
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<A> PlaybackExt for A
where A: Unplaced,

Source§

fn with_rate_func(self, rate_func: fn(f64) -> f64) -> Paramed<Self>

Change the animation’s rate function.
Source§

fn with_duration(self, duration_secs: f64) -> Paramed<Self>

Change the animation’s duration.
Source§

fn with_enabled(self, enabled: bool) -> Paramed<Self>

Enable or disable this animation’s output.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> TransformedExt for T

Source§

fn transformed<G>(self, transform: G) -> Transformed<Self, G>

Return self wrapped with transform stored exactly as G.
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.
Source§

impl<T> With for T

Source§

fn with(self, f: impl Fn(&mut Self)) -> Self
where Self: Sized,

Mutating a value in place
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more