Reviewed By: TheSavior

Differential Revision: D5786252

fbshipit-source-id: 9f97b36bd2d6faebc95f2f78889fb382a3544479
This commit is contained in:
Spencer Ahrens 2017-09-08 16:26:48 -07:00 коммит произвёл Facebook Github Bot
Родитель c88b2b2c65
Коммит 1afc93d18a
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -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