| Index: sky/framework/animation/scroll_curve.dart
|
| diff --git a/sky/framework/animation/scroll_curve.dart b/sky/framework/animation/scroll_curve.dart
|
| index 54b6385bd1e5d10cccb8fc4dc209ca919b0ab0d9..4aa9483297eb39c971eb988cddf105b2227d2a50 100644
|
| --- a/sky/framework/animation/scroll_curve.dart
|
| +++ b/sky/framework/animation/scroll_curve.dart
|
| @@ -3,8 +3,14 @@
|
| // found in the LICENSE file.
|
|
|
| import 'dart:math' as math;
|
| +import 'kinematics.dart';
|
| +import 'simulation.dart';
|
| +
|
| +const double _kSlope = 0.01;
|
|
|
| abstract class ScrollCurve {
|
| + Simulation release(Particle particle) => null;
|
| +
|
| // Returns the new scroll offset.
|
| double apply(double scrollOffset, double scrollDelta);
|
| }
|
| @@ -26,6 +32,18 @@ class BoundedScrollCurve extends ScrollCurve {
|
| }
|
|
|
| class OverscrollCurve extends ScrollCurve {
|
| + Simulation release(Particle particle) {
|
| + if (particle.position >= 0.0)
|
| + return null;
|
| + System system = new ParticleClimbingHill(
|
| + particle: particle,
|
| + box: new Box(max: 0.0),
|
| + slope: _kSlope,
|
| + targetPosition: 0.0);
|
| + return new Simulation(system,
|
| + terminationCondition: () => particle.position == 0.0);
|
| + }
|
| +
|
| double apply(double scrollOffset, double scrollDelta) {
|
| double newScrollOffset = scrollOffset + scrollDelta;
|
| if (newScrollOffset < 0.0) {
|
|
|