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

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

Issue 983893002: Sometimes the drawer doesn't fully close (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | no next file » | 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 'dart:math' as math; 7 import 'dart:math' as math;
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 9
10 class FrameGenerator { 10 class FrameGenerator {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 this.curve: linear, 66 this.curve: linear,
67 Function onDone 67 Function onDone
68 }):super(onDone: onDone) { 68 }):super(onDone: onDone) {
69 double startTime = 0.0; 69 double startTime = 0.0;
70 _stream = super.onTick.map((timeStamp) { 70 _stream = super.onTick.map((timeStamp) {
71 if (startTime == 0.0) 71 if (startTime == 0.0)
72 startTime = timeStamp; 72 startTime = timeStamp;
73 return math.min((timeStamp - startTime) / duration, 1.0); 73 return math.min((timeStamp - startTime) / duration, 1.0);
74 }) 74 })
75 .takeWhile(_checkForCompletion) 75 .takeWhile(_checkForCompletion)
76 .map((t) => begin + (end - begin) * curve.transform(t)); 76 .map(_transform);
77 }
78
79 double _transform(double t) {
80 if (_done)
81 return end;
82 return begin + (end - begin) * curve.transform(t);
77 } 83 }
78 84
79 bool _checkForCompletion(double t) { 85 bool _checkForCompletion(double t) {
80 if (_done) 86 if (_done)
81 return false; 87 return false;
82 _done = t >= 1; 88 _done = t >= 1;
83 return true; 89 return true;
84 } 90 }
85 } 91 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698