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:
parent
89a9ca6688
commit
d7672d80fc
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue