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

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

Issue 1170033005: Add some TODOs for renaming onTick and onValueChanged. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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/sdk/lib/framework/animation/generators.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 'curves.dart'; 5 import 'curves.dart';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'generators.dart'; 7 import 'generators.dart';
8 8
9 typedef void Callback (); 9 typedef void Callback ();
10 10
11 class AnimatedValue { 11 class AnimatedValue {
12 StreamController<double> _controller = new StreamController<double>.broadcast( sync: true); 12 StreamController<double> _controller = new StreamController<double>.broadcast( sync: true);
13 AnimationGenerator _animation; 13 AnimationGenerator _animation;
14 Completer _completer; 14 Completer _completer;
15 double _value; 15 double _value;
16 16
17 AnimatedValue(double initial, { Callback onChange }) { 17 AnimatedValue(double initial, { Callback onChange }) {
18 _value = initial; 18 _value = initial;
19 _onChange = onChange; 19 _onChange = onChange;
20 } 20 }
21 Callback _onChange; 21 Callback _onChange;
22 22
23 // A stream of change in value from |initial|. The stream does not 23 // A stream of change in value from |initial|. The stream does not
24 // contain the initial value. Consumers should check the initial value via 24 // contain the initial value. Consumers should check the initial value via
25 // the |value| accessor. 25 // the |value| accessor.
26 // TODO(ianh): Rename this to valueStream once we've landed the fn2 fork
26 Stream<double> get onValueChanged => _controller.stream; 27 Stream<double> get onValueChanged => _controller.stream;
27 28
28 double get value => _value; 29 double get value => _value;
29 30
30 void set value(double value) { 31 void set value(double value) {
31 stop(); 32 stop();
32 _setValue(value); 33 _setValue(value);
33 } 34 }
34 35
35 bool get isAnimating => _animation != null; 36 bool get isAnimating => _animation != null;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return _completer.future; 74 return _completer.future;
74 } 75 }
75 76
76 double get remainingTime { 77 double get remainingTime {
77 if (_animation == null) 78 if (_animation == null)
78 return 0.0; 79 return 0.0;
79 return _animation.remainingTime; 80 return _animation.remainingTime;
80 } 81 }
81 82
82 } 83 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/animation/generators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698