TimelineAnimation<T> class
A timeline-based animation built from multiple keyframes.
This class extends Animatable<T> and orchestrates complex animations by
sequencing multiple Keyframes. Each keyframe defines a segment of the
animation with its own duration and interpolation strategy.
Type Parameters
T- The type of value being animated.
Overview
Use TimelineAnimation to create sophisticated multi-stage animations. Keyframes can be absolute, relative, or still, allowing for diverse animation patterns. The timeline automatically calculates total duration from all keyframes.
Example
final timeline = TimelineAnimation<double>(
lerp: Transformers.typeDouble,
keyframes: [
AbsoluteKeyframe(Duration(milliseconds: 100), 0.0, 1.0),
StillKeyframe(Duration(milliseconds: 50)),
RelativeKeyframe(Duration(milliseconds: 100), 0.5),
],
);
- Inheritance
-
- Object
- Animatable<
T> - TimelineAnimation
Constructors
-
TimelineAnimation({PropertyLerp<
T> ? lerp, required List<Keyframe< keyframes})T> > -
Creates a timeline animation from a list of keyframes.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keyframes
→ List<
Keyframe< T> > -
The list of keyframes that make up this timeline.
final
-
lerp
→ PropertyLerp<
T> -
The interpolation function used for this timeline.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalDuration → Duration
-
The total duration of all keyframes combined.
final
Methods
-
animate(
Animation< double> parent) → Animation<T> -
Returns a new Animation that is driven by the given animation but that
takes on values determined by this object.
inherited
-
chain(
Animatable< double> parent) → Animatable<T> -
Returns a new Animatable whose value is determined by first evaluating
the given parent and then evaluating this object at the result.
inherited
-
drive(
AnimationController controller) → TimelineAnimatable< T> - Binds this timeline to an AnimationController.
-
evaluate(
Animation< double> animation) → T -
The current value of this object for the given Animation.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
double t) → T -
Returns the value of the object at point
t.override -
transformWithController(
AnimationController controller) → T - Transforms the timeline using the controller's current value.
-
withTotalDuration(
Duration duration) → TimelineAnimatable< T> - Creates a TimelineAnimatable with the specified total duration.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultLerp<
T> (T a, T b, double t) → T - Default lerp function that works with numeric types.