| OLD | NEW |
| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:vector_math/vector_math.dart'; | 7 import 'package:vector_math/vector_math.dart'; |
| 8 | 8 |
| 9 import '../animation/animated_value.dart'; | 9 import '../animation/animated_value.dart'; |
| 10 import '../animation/animation_performance.dart'; | 10 import '../animation/animation_performance.dart'; |
| 11 import '../animation/curves.dart'; | 11 import '../animation/curves.dart'; |
| 12 import 'basic.dart'; | 12 import 'basic.dart'; |
| 13 | 13 |
| 14 class _AnimationEntry { | 14 class _AnimationEntry { |
| 15 _AnimationEntry(this.value); | 15 _AnimationEntry(this.value); |
| 16 final AnimatedValue value; | 16 final AnimatedValue value; |
| 17 StreamSubscription<double> subscription; | 17 StreamSubscription<double> subscription; |
| 18 } | 18 } |
| 19 | 19 |
| 20 abstract class AnimatedComponent extends Component { | 20 abstract class AnimatedComponent extends StatefulComponent { |
| 21 | 21 |
| 22 AnimatedComponent({ String key }) : super(key: key, stateful: true); | 22 AnimatedComponent({ String key }) : super(key: key); |
| 23 | 23 |
| 24 void syncFields(AnimatedComponent source) { } | 24 void syncFields(AnimatedComponent source) { } |
| 25 | 25 |
| 26 List<_AnimationEntry> _animatedFields = new List<_AnimationEntry>(); | 26 List<_AnimationEntry> _animatedFields = new List<_AnimationEntry>(); |
| 27 | 27 |
| 28 watch(AnimatedValue value) { | 28 watch(AnimatedValue value) { |
| 29 assert(!mounted); | 29 assert(!mounted); |
| 30 // TODO(ianh): we really should assert that we're not doing this | 30 // TODO(ianh): we really should assert that we're not doing this |
| 31 // in the constructor since doing it there is pointless and | 31 // in the constructor since doing it there is pointless and |
| 32 // expensive, since we'll be doing it for every copy of the object | 32 // expensive, since we'll be doing it for every copy of the object |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 class AnimatedPosition extends AnimatedType<Point> { | 66 class AnimatedPosition extends AnimatedType<Point> { |
| 67 AnimatedPosition(Point begin, Point end, {Curve curve: linear}) | 67 AnimatedPosition(Point begin, Point end, {Curve curve: linear}) |
| 68 : super(begin, end, curve: curve); | 68 : super(begin, end, curve: curve); |
| 69 | 69 |
| 70 Widget build(Widget child) { | 70 Widget build(Widget child) { |
| 71 Matrix4 transform = new Matrix4.identity(); | 71 Matrix4 transform = new Matrix4.identity(); |
| 72 transform.translate(value.x, value.y); | 72 transform.translate(value.x, value.y); |
| 73 return new Transform(transform: transform, child: child); | 73 return new Transform(transform: transform, child: child); |
| 74 } | 74 } |
| 75 } | 75 } |
| OLD | NEW |