Returns a Stream of relative time which fires for time
seconds.
The stream returns the relative time since the start of the method.
The stream ends automatically after time
seconds.
This method is based on the onElapsedTimeChange stream and is therefore executed before all other animatables.
await for (var time in juggler.timespan(2.0)) {
print(time);
}
var stream = juggler.timespan(2.0).map((time) => 2.0 * time);
stream.listen((value) => print(value));
Source
Stream<num> timespan(num time) async* { var startTime = this.elapsedTime; await for (var elapsedTime in this.onElapsedTimeChange) { var currentTime = elapsedTime - startTime; var clampedTime = currentTime < time ? currentTime : time; yield clampedTime; if (currentTime >= time) break; } }