| Index: sky/framework/animation/mechanics.dart
|
| diff --git a/sky/framework/animation/mechanics.dart b/sky/framework/animation/mechanics.dart
|
| index 7ed6da19f7e58f97abbc842522ec646d1cb729c6..d862d75c8d38a3c08660b20d33ca5e0a16c56438 100644
|
| --- a/sky/framework/animation/mechanics.dart
|
| +++ b/sky/framework/animation/mechanics.dart
|
| @@ -5,7 +5,7 @@
|
| import 'dart:math' as math;
|
|
|
| const double kGravity = -0.980;
|
| -const double _kMinVelocity = 0.1;
|
| +const double _kMinVelocity = 0.01;
|
|
|
| abstract class System {
|
| void update(double deltaT);
|
| @@ -69,6 +69,23 @@ class ParticleInBox extends System {
|
| }
|
| }
|
|
|
| +class ParticleInBoxWithFriction extends ParticleInBox {
|
| + final double friction;
|
| + final double _sign;
|
| +
|
| + ParticleInBoxWithFriction({Particle particle, Box box, this.friction})
|
| + : super(particle: particle, box: box),
|
| + _sign = particle.velocity.sign;
|
| +
|
| + void update(double deltaT) {
|
| + double force = -_sign * friction;
|
| + particle.applyImpluse(force * deltaT);
|
| + if (particle.velocity.sign != _sign)
|
| + particle.velocity = 0.0;
|
| + super.update(deltaT);
|
| + }
|
| +}
|
| +
|
| class Spring {
|
| final double k;
|
| double displacement;
|
|
|