[Animated] Remove rebound dependency

Summary:
We already reimplement the spring computation, we were only using rebound for the tension/friction conversion. Turns out that it is quite small so we can just embed it. I'm doing this as I'm preparing for doing a web version of the feature and I'm trying to minimize the number of dependencies.

https://github.com/facebook/rebound-js/blob/master/rebound.js#L932
This commit is contained in:
Christopher Chedeau
2015-08-03 15:15:07 -07:00
parent 6a4b83c16f
commit afdeefc864
2 changed files with 105 additions and 3 deletions

View File

@@ -17,12 +17,12 @@ var InteractionManager = require('InteractionManager');
var Interpolation = require('Interpolation');
var React = require('React');
var Set = require('Set');
var SpringConfig = require('SpringConfig');
var Text = require('Text');
var View = require('View');
var invariant = require('invariant');
var flattenStyle = require('flattenStyle');
var rebound = require('rebound');
var requestAnimationFrame = require('requestAnimationFrame');
import type InterpolationConfigType from 'Interpolation';
@@ -351,12 +351,12 @@ class SpringAnimation extends Animation {
config.tension === undefined && config.friction === undefined,
'You can only define bounciness/speed or tension/friction but not both',
);
springConfig = rebound.SpringConfig.fromBouncinessAndSpeed(
springConfig = SpringConfig.fromBouncinessAndSpeed(
withDefault(config.bounciness, 8),
withDefault(config.speed, 12),
);
} else {
springConfig = rebound.SpringConfig.fromOrigamiTensionAndFriction(
springConfig = SpringConfig.fromOrigamiTensionAndFriction(
withDefault(config.tension, 40),
withDefault(config.friction, 7),
);