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

Unified Diff: sky/sdk/lib/animation/animation_performance.dart

Issue 1228233004: Port PopupMenu to the new animation system (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | sky/sdk/lib/animation/timeline.dart » ('j') | sky/sdk/lib/widgets/popup_menu.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/animation/animation_performance.dart
diff --git a/sky/sdk/lib/animation/animation_performance.dart b/sky/sdk/lib/animation/animation_performance.dart
index d6d9edc1f8fc268c630c6fd64fb9fab5f85b5bf4..50f9c8a2368a994553009f846ed62f0701466cc7 100644
--- a/sky/sdk/lib/animation/animation_performance.dart
+++ b/sky/sdk/lib/animation/animation_performance.dart
@@ -60,11 +60,11 @@ class AnimationPerformance {
bool get isCompleted => progress == 1.0;
bool get isAnimating => timeline.isAnimating;
- void play() {
- _animateTo(1.0);
+ void play({ Duration delay: Duration.ZERO }) {
+ _animateTo(1.0, delay: delay);
}
- void reverse() {
- _animateTo(0.0);
+ void reverse({ Duration delay: Duration.ZERO }) {
+ _animateTo(0.0, delay: delay);
}
void stop() {
@@ -99,11 +99,14 @@ class AnimationPerformance {
listener();
}
- void _animateTo(double target) {
+ void _animateTo(double target, { Duration delay }) {
+ assert(delay != null);
double remainingDistance = (target - timeline.value).abs();
timeline.stop();
- if (remainingDistance != 0.0)
- timeline.animateTo(target, duration: remainingDistance * duration.inMilliseconds);
+ if (remainingDistance != 0.0) {
+ timeline.animateTo(target, duration: remainingDistance * duration.inMilliseconds,
+ delay: delay.inMilliseconds.toDouble());
+ }
}
void _tick(double t) {
« no previous file with comments | « no previous file | sky/sdk/lib/animation/timeline.dart » ('j') | sky/sdk/lib/widgets/popup_menu.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698