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/framework/animation/generator.dart

Issue 979283002: Move animationgenerator.dart to sky/framework/animation/generator.dart (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 | « sky/examples/fn/widgets/widgets.dart ('k') | 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 part of widgets; 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
3 // found in the LICENSE file.
4
5 import 'curves.dart';
6 import 'dart:async';
7 import 'dart:math' as math;
8 import 'dart:sky' as sky;
2 9
3 class FrameGenerator { 10 class FrameGenerator {
4
5 Function onDone; 11 Function onDone;
6 StreamController _controller; 12 StreamController _controller;
7 13
8 Stream<double> get onTick => _controller.stream; 14 Stream<double> get onTick => _controller.stream;
9 15
10 int _animationId = 0; 16 int _animationId = 0;
11 bool _cancelled = false; 17 bool _cancelled = false;
12 18
13 FrameGenerator({this.onDone}) { 19 FrameGenerator({this.onDone}) {
14 _controller = new StreamController( 20 _controller = new StreamController(
(...skipping 24 matching lines...) Expand all
39 void _tick(double timeStamp) { 45 void _tick(double timeStamp) {
40 _animationId = 0; 46 _animationId = 0;
41 _controller.add(timeStamp); 47 _controller.add(timeStamp);
42 if (!_cancelled) { 48 if (!_cancelled) {
43 _scheduleTick(); 49 _scheduleTick();
44 } 50 }
45 } 51 }
46 } 52 }
47 53
48 class AnimationGenerator extends FrameGenerator { 54 class AnimationGenerator extends FrameGenerator {
49
50 Stream<double> get onTick => _stream; 55 Stream<double> get onTick => _stream;
51 final double duration; 56 final double duration;
52 final double begin; 57 final double begin;
53 final double end; 58 final double end;
54 final Curve curve; 59 final Curve curve;
55 Stream<double> _stream; 60 Stream<double> _stream;
56 bool _done = false; 61 bool _done = false;
57 62
58 AnimationGenerator(this.duration, { 63 AnimationGenerator(this.duration, {
59 this.begin: 0.0, 64 this.begin: 0.0,
(...skipping 14 matching lines...) Expand all
74 .map((t) => begin + (end - begin) * curve.transform(t)); 79 .map((t) => begin + (end - begin) * curve.transform(t));
75 } 80 }
76 81
77 bool _checkForCompletion(double t) { 82 bool _checkForCompletion(double t) {
78 if (_done) 83 if (_done)
79 return false; 84 return false;
80 _done = t >= 1; 85 _done = t >= 1;
81 return true; 86 return true;
82 } 87 }
83 } 88 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/widgets.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698