Skip to content

Commit

Permalink
Make this._currentTime always equal to "now", remove "first step" c…
Browse files Browse the repository at this point in the history
…alculation
  • Loading branch information
Adam Miskiewicz committed Jan 16, 2018
1 parent b89559f commit 4589723
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4589723

Please sign in to comment.