withTotalDuration method

TimelineAnimatable<T> withTotalDuration(
  1. Duration duration
)

Creates a TimelineAnimatable with the specified total duration.

Parameters

  • duration - The desired total duration for this timeline.

Returns

A TimelineAnimatable that scales this timeline to the given duration.

Example

// Timeline with natural duration of 500ms
final timeline = TimelineAnimation<double>(...);

// Scale to 2 seconds
final animatable = timeline.withTotalDuration(Duration(seconds: 2));

Implementation

TimelineAnimatable<T> withTotalDuration(Duration duration) {
  return TimelineAnimatable(duration, this);
}