Pure functional animation timeline.
A Timeline holds a list of property animations. It advances forward in
time via advance/2, producing interpolated values that components read
via value/2.
Timelines are plain structs stored in component state, no GenServer needed.
Summary
Functions
Add a property animation to the timeline.
Advance the timeline by dt milliseconds. Returns updated timeline.
Returns true when the timeline has completed (not looping).
Create a new timeline. Options: :duration, :loop, :alternate.
Set the timeline to playing state. A completed timeline starts over.
Get the current interpolated value for a property.
Types
@type item() :: %{ property: atom(), from: number(), to: number(), easing: atom(), duration: non_neg_integer(), delay: non_neg_integer() }
@type state() :: :idle | :playing | :complete
@type t() :: %ElixirOpentui.Animation.Timeline{ alternate: boolean(), duration: non_neg_integer(), elapsed: float(), items: [item()], loop: boolean() | pos_integer(), loop_count: non_neg_integer(), state: state(), values: %{optional(atom()) => number()} }
Functions
Add a property animation to the timeline.
Advance the timeline by dt milliseconds. Returns updated timeline.
Returns true when the timeline has completed (not looping).
Create a new timeline. Options: :duration, :loop, :alternate.
Set the timeline to playing state. A completed timeline starts over.
Get the current interpolated value for a property.