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

Unified Diff: sky/framework/animation/scroll_behavior.dart

Issue 1004363002: Improve Sky's Scrollable physics (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/animation/mechanics.dart ('k') | sky/framework/components/scrollable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/scroll_behavior.dart
diff --git a/sky/framework/animation/scroll_behavior.dart b/sky/framework/animation/scroll_behavior.dart
index 433909cb2c21d189b8632a901305dec97370cc3a..fcc65a43e3892e1002da56e884c3874fc741036d 100644
--- a/sky/framework/animation/scroll_behavior.dart
+++ b/sky/framework/animation/scroll_behavior.dart
@@ -6,7 +6,8 @@ import 'dart:math' as math;
import 'mechanics.dart';
import 'generators.dart';
-const double _kSlope = 0.01;
+const double _kSlope = 0.02;
+const double _kFriction = 0.004;
abstract class ScrollBehavior {
Simulation release(Particle particle) => null;
@@ -33,8 +34,16 @@ class BoundedScrollBehavior extends ScrollBehavior {
class OverscrollBehavior extends ScrollBehavior {
Simulation release(Particle particle) {
- if (particle.position >= 0.0)
- return null;
+ if (particle.position >= 0.0) {
+ if (particle.velocity == 0.0)
+ return null;
+ System system = new ParticleInBoxWithFriction(
+ particle: particle,
+ box: new Box(min: 0.0),
+ friction: _kFriction);
+ return new Simulation(system,
+ terminationCondition: () => particle.velocity == 0.0);
+ }
System system = new ParticleClimbingRamp(
particle: particle,
box: new Box(max: 0.0),
« no previous file with comments | « sky/framework/animation/mechanics.dart ('k') | sky/framework/components/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698