Permalink
Browse files

Fix Animated spring jest test

Reviewed By: TheSavior

Differential Revision: D5786252

fbshipit-source-id: 9f97b36bd2d6faebc95f2f78889fb382a3544479
  • Loading branch information...
sahrens authored and facebook-github-bot committed Sep 8, 2017
1 parent c88b2b2 commit 1afc93d18aaa03a547d5928610085e18eb826726
Showing with 4 additions and 1 deletion.
  1. +4 −1 Libraries/Animated/src/animations/SpringAnimation.js
@@ -196,7 +196,10 @@ class SpringAnimation extends Animation {
// The following post provides a lot of thoughts into how to build this
// loop: http://gafferongames.com/game-physics/fix-your-timestep/
const TIMESTEP_MSEC = 1;
const numSteps = Math.floor((now - this._lastTime) / TIMESTEP_MSEC);
const numSteps = Math.max(
1, // Always take at least one step to make progress.
Math.floor((now - this._lastTime) / TIMESTEP_MSEC),
);
for (let i = 0; i < numSteps; ++i) {
// Velocity is based on seconds instead of milliseconds

0 comments on commit 1afc93d

Please sign in to comment.