fix animated lint warnings

Summary:
fix lint warnings under 'Libraries/Animated' directory
Closes https://github.com/facebook/react-native/pull/4448

Reviewed By: svcscm

Differential Revision: D2753880

Pulled By: androidtrunkagent

fb-gh-sync-id: c6619c636ff67a74e6f063f70526327d756271db
This commit is contained in:
Huang Yu 2015-12-13 11:42:53 -08:00 committed by facebook-github-bot-3
parent 90be04610c
commit 4373aa6822
2 changed files with 15 additions and 13 deletions

View File

@ -72,14 +72,14 @@ class Easing {
static elastic(bounciness: number = 1): (t: number) => number {
var p = bounciness * Math.PI;
return (t) => 1 - Math.pow(Math.cos(t * Math.PI / 2), 3) * Math.cos(t * p);
};
}
static back(s: number): (t: number) => number {
if (s === undefined) {
s = 1.70158;
}
return (t) => t * t * ((s + 1) * t - s);
};
}
static bounce(t: number): number {
if (t < 1 / 2.75) {
@ -98,7 +98,7 @@ class Easing {
t -= 2.625 / 2.75;
return 7.5625 * t * t + 0.984375;
};
}
static bezier(
x1: number,

View File

@ -42,7 +42,7 @@ module.exports = function(x1, y1, x2, y2, epsilon){
var derivativeCurveX = function(t){
var v = 1 - t;
return 3 * (2 * (t - 1) * t + v * v) * x1 + 3 * (- t * t * t + 2 * v * t) * x2;
return 3 * (2 * (t - 1) * t + v * v) * x1 + 3 * (-t * t * t + 2 * v * t) * x2;
};
return function(t){
@ -52,24 +52,26 @@ module.exports = function(x1, y1, x2, y2, epsilon){
// First try a few iterations of Newton's method -- normally very fast.
for (t2 = x, i = 0; i < 8; i++){
x2 = curveX(t2) - x;
if (Math.abs(x2) < epsilon) return curveY(t2);
if (Math.abs(x2) < epsilon) { return curveY(t2); }
d2 = derivativeCurveX(t2);
if (Math.abs(d2) < 1e-6) break;
if (Math.abs(d2) < 1e-6) { break; }
t2 = t2 - x2 / d2;
}
t0 = 0, t1 = 1, t2 = x;
t0 = 0;
t1 = 1;
t2 = x;
if (t2 < t0) return curveY(t0);
if (t2 > t1) return curveY(t1);
if (t2 < t0) { return curveY(t0); }
if (t2 > t1) { return curveY(t1); }
// Fallback to the bisection method for reliability.
while (t0 < t1){
x2 = curveX(t2);
if (Math.abs(x2 - x) < epsilon) return curveY(t2);
if (x > x2) t0 = t2;
else t1 = t2;
t2 = (t1 - t0) * .5 + t0;
if (Math.abs(x2 - x) < epsilon) { return curveY(t2); }
if (x > x2) { t0 = t2; }
else { t1 = t2; }
t2 = (t1 - t0) * 0.5 + t0;
}
// Failure