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
This commit is contained in:
Joel Arvidsson 2016-06-30 05:18:31 -07:00 committed by Facebook Github Bot 4
parent 89a9ca6688
commit d7672d80fc
1 changed files with 2 additions and 1 deletions

View File

@ -255,9 +255,10 @@ class TimingAnimation extends Animation {
_getNativeAnimationConfig(): any { _getNativeAnimationConfig(): any {
var frameDuration = 1000.0 / 60.0; var frameDuration = 1000.0 / 60.0;
var frames = []; 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(dt / this._duration));
} }
frames.push(this._easing(1));
return { return {
type: 'frames', type: 'frames',
frames, frames,