progress method

double progress(
  1. Duration time
)

Queries the current progress value based on the specified startTime and duration as a value between 0.0 and 1.0. It will automatically clamp values this interval to fit in.

Implementation

double progress(Duration time) => math.max(
    0.0,
    math.min(
        (time - startTime).inMilliseconds / duration.inMilliseconds, 1.0));