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

Side by Side Diff: sky/framework/animation/animated_value.dart

Issue 1074883005: [Effen] Tapping on a menu while it's closing should not make it instantly disappear. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix enum case 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/framework/components/popup_menu.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../fn.dart'; 5 import '../fn.dart';
6 import 'curves.dart'; 6 import 'curves.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 import 'generators.dart'; 8 import 'generators.dart';
9 9
10 class AnimatedValue { 10 class AnimatedValue {
(...skipping 29 matching lines...) Expand all
40 _animation = null; 40 _animation = null;
41 if (_completer == null) 41 if (_completer == null)
42 return; 42 return;
43 Completer completer = _completer; 43 Completer completer = _completer;
44 _completer = null; 44 _completer = null;
45 completer.complete(_value); 45 completer.complete(_value);
46 } 46 }
47 47
48 void stop() { 48 void stop() {
49 if (_animation != null) { 49 if (_animation != null) {
50 _animation.cancel(); 50 _animation.cancel(); // will call _done() if it isn't already finished
51 _done(); 51 _done();
52 } 52 }
53 } 53 }
54 54
55 Future<double> animateTo(double newValue, double duration, 55 Future<double> animateTo(double newValue, double duration,
56 { Curve curve: linear, double initialDelay: 0.0 }) { 56 { Curve curve: linear, double initialDelay: 0.0 }) {
57 stop(); 57 stop();
58 58
59 _animation = new AnimationGenerator( 59 _animation = new AnimationGenerator(
60 duration: duration, 60 duration: duration,
61 begin: _value, 61 begin: _value,
62 end: newValue, 62 end: newValue,
63 curve: curve, 63 curve: curve,
64 initialDelay: initialDelay) 64 initialDelay: initialDelay)
65 ..onTick.listen(_setValue, onDone: _done); 65 ..onTick.listen(_setValue, onDone: _done);
66 66
67 _completer = new Completer(); 67 _completer = new Completer();
68 return _completer.future; 68 return _completer.future;
69 } 69 }
70 70
71 double get remainingTime { 71 double get remainingTime {
72 if (_animation == null) 72 if (_animation == null)
73 return 0.0; 73 return 0.0;
74 return _animation.remainingTime; 74 return _animation.remainingTime;
75 } 75 }
76 76
77 } 77 }
OLDNEW
« no previous file with comments | « no previous file | sky/framework/components/popup_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698