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

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

Issue 1232473003: Delete AnimationValue (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 | « sky/sdk/lib/animation/animation_performance.dart ('k') | sky/sdk/lib/widgets/animated_component.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/animation/generators.dart
diff --git a/sky/sdk/lib/animation/generators.dart b/sky/sdk/lib/animation/generators.dart
index f7bf0f04ff16e8ff379a89db8df2e02073a408dd..542490eac353735bc93c38fff09ee4867bbb4cd1 100644
--- a/sky/sdk/lib/animation/generators.dart
+++ b/sky/sdk/lib/animation/generators.dart
@@ -57,71 +57,6 @@ class FrameGenerator extends Generator {
}
}
-class AnimationGenerator extends Generator {
- Stream<double> get onTick => _stream;
- final double initialDelay;
- final double duration;
- final double begin;
- final double end;
- final Curve curve;
-
- FrameGenerator _generator;
- Stream<double> _stream;
- bool _done = false;
- double _lastTime;
-
- AnimationGenerator({
- this.initialDelay: 0.0,
- this.duration,
- this.begin: 0.0,
- this.end: 1.0,
- this.curve: linear,
- Function onDone
- }) {
- assert(curve != null);
- assert(duration != null && duration > 0.0);
- _generator = new FrameGenerator(onDone: onDone);
-
- double startTime = 0.0;
- _stream = _generator.onTick.map((timeStamp) {
- if (startTime == 0.0)
- startTime = timeStamp;
-
- double t = (timeStamp - (startTime + initialDelay)) / duration;
- _lastTime = t.clamp(0.0, 1.0);
- return _lastTime;
- })
- .takeWhile(_checkForCompletion)
- .where((t) => t >= 0.0)
- .map(_transform);
- }
-
- double get remainingTime {
- if (_lastTime == null)
- return duration;
- return duration - _lastTime;
- }
-
- void cancel() {
- _generator.cancel();
- }
-
- double _transform(double t) {
- if (_done)
- return end;
- return begin + (end - begin) * curve.transform(t);
- }
-
- // This is required because Dart Streams don't have takeUntil (inclusive).
- bool _checkForCompletion(double t) {
- if (_done)
- return false;
-
- _done = t >= 1;
- return true;
- }
-}
-
class Simulation extends Generator {
Stream<double> get onTick => _stream;
final System system;
« no previous file with comments | « sky/sdk/lib/animation/animation_performance.dart ('k') | sky/sdk/lib/widgets/animated_component.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698