AnimationTimeline class final

Small TEA-native animation sequencer built on top of AnimationController.

Hosts typically call start from handleInit, then forward messages from handleUpdate into handleMessage:

late final AnimationTimeline _timeline;

@override
void initState() {
  super.initState();
  _timeline = AnimationTimeline(
    steps: [
      AnimationTimelineStep.forward(_fade),
      AnimationTimelineStep.delay(const Duration(milliseconds: 80)),
      AnimationTimelineStep.parallel([
        AnimationTimelineStep.forward(_slide),
        AnimationTimelineStep.forward(_scale),
      ]),
    ],
    alternate: true,
    repeat: true,
  );
}

@override
Cmd? handleInit() => _timeline.start();

@override
Cmd? handleUpdate(Msg msg) => _timeline.handleMessage(msg);

Constructors

AnimationTimeline({required List<AnimationTimelineStep> steps, bool repeat = false, bool alternate = false, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?, Object? id})
AnimationTimeline.accordion({required List<AnimationController> controllers, Duration gap = Duration.zero, Duration crestHold = Duration.zero, Duration returnGap = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a pairwise accordion choreography expanding from the center.
factory
AnimationTimeline.breath({required List<AnimationController> controllers, Duration hold = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a synchronized multi-controller pulse.
factory
AnimationTimeline.cascade({required List<AnimationController> controllers, Duration hold = Duration.zero, Duration gap = Duration.zero, Duration rest = Duration.zero, bool repeat = false, bool alternate = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a serial pulse choreography across multiple controllers.
factory
AnimationTimeline.converge({required List<AnimationController> controllers, Duration gap = Duration.zero, Duration crestHold = Duration.zero, Duration returnGap = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds an edge-origin convergence across multiple controllers.
factory
AnimationTimeline.fan({required List<AnimationController> controllers, Duration gap = Duration.zero, Duration hold = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a fan choreography with staggered entrance and synchronized exit.
factory
AnimationTimeline.pulse({required AnimationController controller, Duration hold = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String? forwardLabel, String? holdLabel, String? reverseLabel, String? restLabel, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a common pulse cycle for one controller.
factory
AnimationTimeline.ripple({required List<AnimationController> controllers, int? originIndex, Duration gap = Duration.zero, Duration crestHold = Duration.zero, Duration returnGap = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a center-origin ripple across multiple controllers.
factory
AnimationTimeline.staggered({required List<AnimationController> controllers, required TimelineStepBuilder buildStep, Duration gap = Duration.zero, bool repeat = false, bool alternate = false, Object? id, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
factory
AnimationTimeline.staggeredForward({required List<AnimationController> controllers, required Duration gap, bool repeat = false, bool alternate = false, Object? id, String labelForController(int index)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
factory
AnimationTimeline.wave({required List<AnimationController> controllers, Duration gap = Duration.zero, Duration crestHold = Duration.zero, Duration returnGap = Duration.zero, Duration rest = Duration.zero, bool repeat = false, Object? id, String labelBuilder(int index, String phase)?, void onStepStart(int index, AnimationTimelineStep step, TimelineDirection direction)?, void onStepComplete(int index, AnimationTimelineStep step, TimelineDirection direction)?})
Builds a traveling wave across multiple controllers.
factory

Properties

alternate bool
final
completedCycles int
Number of completed full passes through the configured step list.
no setter
currentStep AnimationTimelineStep?
Active step metadata, or null when idle.
no setter
currentStepIndex int
Zero-based index of the currently active step, or -1 when idle.
no setter
currentStepLabel String?
Optional label for the currently active step.
no setter
direction TimelineDirection
Current playback direction.
no setter
hashCode int
The hash code for this object.
no setterinherited
id Object
Stable identity used by internal TimelineDelayMsg instances.
no setter
isRunning bool
Whether the timeline currently has an active step.
no setter
onStepComplete → void Function(int index, AnimationTimelineStep step, TimelineDirection direction)?
final
onStepStart → void Function(int index, AnimationTimelineStep step, TimelineDirection direction)?
final
repeat bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handleMessage(Msg msg) Cmd?
Processes a Msg produced by the active timeline step.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the timeline back to its idle state.
start({TimelineDirection direction = TimelineDirection.forward}) Cmd?
Starts playback from the first configured step.
stop() → void
Stops playback without mutating the underlying controllers.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited