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

Side by Side Diff: sky/sdk/lib/animation/animation_performance.dart

Issue 1213573006: Fix remaining analyzer warnings in Sky (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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/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 'animated_value.dart'; 5 import 'animated_value.dart';
6 import 'curves.dart'; 6 import 'curves.dart';
7 7
8 // TODO(mpcomplete): merge this stuff with AnimatedValue somehow. We shouldn't 8 // TODO(mpcomplete): merge this stuff with AnimatedValue somehow. We shouldn't
9 // have 2 different ways to animate values. 9 // have 2 different ways to animate values.
10 abstract class AnimatedVariable { 10 abstract class AnimatedVariable {
11 void setFraction(double t); 11 void setFraction(double t);
12 } 12 }
13 13
14 class AnimatedType<T> extends AnimatedVariable { 14 class AnimatedType<T extends dynamic> extends AnimatedVariable {
15 T value; 15 T value;
16 final T begin, end; 16 final T begin, end;
17 final Curve curve; 17 final Curve curve;
18 18
19 AnimatedType(this.begin, this.end, {this.curve: linear}) { 19 AnimatedType(this.begin, this.end, {this.curve: linear}) {
20 value = begin; 20 value = begin;
21 } 21 }
22 22
23 void setFraction(double t) { 23 void setFraction(double t) {
24 // TODO(mpcomplete): Reverse the timeline and curve. 24 // TODO(mpcomplete): Reverse the timeline and curve.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // time. 80 // time.
81 void fling({double velocity: 1.0}) { 81 void fling({double velocity: 1.0}) {
82 double target = velocity.sign < 0.0 ? 0.0 : 1.0; 82 double target = velocity.sign < 0.0 ? 0.0 : 1.0;
83 double distance = (target - timeline.value).abs(); 83 double distance = (target - timeline.value).abs();
84 double duration = distance / velocity.abs(); 84 double duration = distance / velocity.abs();
85 85
86 if (distance > 0.0) 86 if (distance > 0.0)
87 timeline.animateTo(target, duration, curve: linear); 87 timeline.animateTo(target, duration, curve: linear);
88 } 88 }
89 } 89 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/animation/generators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698