Commit f3655f34 authored by Hixie's avatar Hixie

Minor clean up of animation_performance.dart

- Reorder the methods so they are closer to run order.
- Reindent the code to match style guide.
parent ebf71f59
...@@ -115,23 +115,25 @@ class AnimationPerformance { ...@@ -115,23 +115,25 @@ class AnimationPerformance {
variable.setProgress(_curvedProgress, _curveDirection); variable.setProgress(_curvedProgress, _curveDirection);
} }
/// Start running this animation in the given direction
Future play([Direction direction = Direction.forward]) {
_direction = direction;
return resume();
}
/// Start running this animation forwards (towards the end) /// Start running this animation forwards (towards the end)
Future forward() => play(Direction.forward); Future forward() => play(Direction.forward);
/// Start running this animation in reverse (towards the beginning) /// Start running this animation in reverse (towards the beginning)
Future reverse() => play(Direction.reverse); Future reverse() => play(Direction.reverse);
/// Start running this animation in the given direction
Future play([Direction direction = Direction.forward]) {
_direction = direction;
return resume();
}
/// Start running this animation in the most recently direction /// Start running this animation in the most recently direction
Future resume() { Future resume() {
if (attachedForce != null) { if (attachedForce != null) {
return fling(velocity: _direction == Direction.forward ? 1.0 : -1.0, return fling(
force: attachedForce); velocity: _direction == Direction.forward ? 1.0 : -1.0,
force: attachedForce
);
} }
return _animateTo(_direction == Direction.forward ? 1.0 : 0.0); return _animateTo(_direction == Direction.forward ? 1.0 : 0.0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment