Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: sky/framework/animation/generators.dart

Issue 1092423003: [Effen] Reduce splashes when scrolling. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix comments from eseidel Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/animation/animated_value.dart ('k') | sky/framework/components/ink_splash.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/generators.dart
diff --git a/sky/framework/animation/generators.dart b/sky/framework/animation/generators.dart
index 3f05eee382ca642938843d913cb117b992e7cd11..7dab878a1b1ddf46b66a645b6768f679a6ce388f 100644
--- a/sky/framework/animation/generators.dart
+++ b/sky/framework/animation/generators.dart
@@ -68,6 +68,7 @@ class AnimationGenerator extends Generator {
FrameGenerator _generator;
Stream<double> _stream;
bool _done = false;
+ double _lastTime;
AnimationGenerator({
this.initialDelay: 0.0,
@@ -87,13 +88,20 @@ class AnimationGenerator extends Generator {
startTime = timeStamp;
double t = (timeStamp - (startTime + initialDelay)) / duration;
- return math.max(0.0, math.min(t, 1.0));
+ _lastTime = math.max(0.0, math.min(t, 1.0));
+ return _lastTime;
})
.takeWhile(_checkForCompletion)
.where((t) => t >= 0.0)
.map(_transform);
}
+ double get remainingTime {
+ if (_lastTime == null)
+ return duration;
+ return duration - _lastTime;
+ }
+
void cancel() {
_generator.cancel();
}
« no previous file with comments | « sky/framework/animation/animated_value.dart ('k') | sky/framework/components/ink_splash.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698