From d7672d80fc882c3794576802ba4151d086b93eec Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Thu, 30 Jun 2016 05:18:31 -0700 Subject: [PATCH] Fix frame calculation for natively driven animations Summary: Currently the algorithm for calculating frames will not always have an correct value for the endframe making some natively driven animations stuck almost at the end. This PR ensures the animation ends at `1`. **Test plan** Tested with the code in `NativeAnimationsExample.js`. Closes https://github.com/facebook/react-native/pull/8489 Differential Revision: D3502973 fbshipit-source-id: b9b114d3982341571ac6ff315620d3d2292d9266 --- Libraries/Animated/src/AnimatedImplementation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 09b960aa1..1b6e560b4 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -255,9 +255,10 @@ class TimingAnimation extends Animation { _getNativeAnimationConfig(): any { var frameDuration = 1000.0 / 60.0; var frames = []; - for (var dt = 0.0; dt <= this._duration; dt += frameDuration) { + for (var dt = 0.0; dt < this._duration; dt += frameDuration) { frames.push(this._easing(dt / this._duration)); } + frames.push(this._easing(1)); return { type: 'frames', frames,