From 45897231dd8683f4e820d2030956fe34cb4866ee Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Mon, 15 Jan 2018 20:10:33 -0800 Subject: [PATCH] Make `this._currentTime` always equal to "now", remove "first step" calculation --- src/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index ebbe10c..e4e9ef6 100644 --- a/src/index.js +++ b/src/index.js @@ -221,7 +221,7 @@ export class Spring { } _reset() { - this._currentTime = 0.0; + this._currentTime = performance.now(); this._springTime = 0.0; this._currentValue = this._config.fromValue; this._currentVelocity = this._config.initialVelocity; @@ -264,11 +264,6 @@ export class Spring { return; } - const isFirstStep = this._currentTime === 0; - if (isFirstStep) { - this._currentTime = timestamp; - } - let deltaTime = timestamp - this._currentTime; // If for some reason we lost a lot of frames (e.g. process large payload or