Skip to content

Commit d7672d8

Browse files
obladorFacebook Github Bot 4
authored andcommitted
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 facebook#8489 Differential Revision: D3502973 fbshipit-source-id: b9b114d3982341571ac6ff315620d3d2292d9266
1 parent 89a9ca6 commit d7672d8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Libraries/Animated/src/AnimatedImplementation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ class TimingAnimation extends Animation {
255255
_getNativeAnimationConfig(): any {
256256
var frameDuration = 1000.0 / 60.0;
257257
var frames = [];
258-
for (var dt = 0.0; dt <= this._duration; dt += frameDuration) {
258+
for (var dt = 0.0; dt < this._duration; dt += frameDuration) {
259259
frames.push(this._easing(dt / this._duration));
260260
}
261+
frames.push(this._easing(1));
261262
return {
262263
type: 'frames',
263264
frames,

0 commit comments

Comments
 (0)