diff --git a/dist/tween.amd.js b/dist/tween.amd.js index 8d82ed6e..33b05114 100644 --- a/dist/tween.amd.js +++ b/dist/tween.amd.js @@ -751,16 +751,9 @@ define(['exports'], (function (exports) { 'use strict'; var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime); var totalTime = this._duration + this._repeat * durationAndDelay; var calculateElapsedPortion = function () { - if (_this._duration === 0) + if (_this._duration === 0 || elapsedTime > totalTime) return 1; - if (elapsedTime > totalTime) { - return 1; - } - var timesRepeated = Math.trunc(elapsedTime / durationAndDelay); - var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay; - // TODO use %? - // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay - var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1); + var portion = Math.min(elapsedTime / _this._duration, 1); if (portion === 0 && elapsedTime === _this._duration) { return 1; } diff --git a/dist/tween.cjs b/dist/tween.cjs index 5c25edb8..dd5018ec 100644 --- a/dist/tween.cjs +++ b/dist/tween.cjs @@ -753,16 +753,9 @@ var Tween = /** @class */ (function () { var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime); var totalTime = this._duration + this._repeat * durationAndDelay; var calculateElapsedPortion = function () { - if (_this._duration === 0) + if (_this._duration === 0 || elapsedTime > totalTime) return 1; - if (elapsedTime > totalTime) { - return 1; - } - var timesRepeated = Math.trunc(elapsedTime / durationAndDelay); - var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay; - // TODO use %? - // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay - var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1); + var portion = Math.min(elapsedTime / _this._duration, 1); if (portion === 0 && elapsedTime === _this._duration) { return 1; } diff --git a/dist/tween.esm.js b/dist/tween.esm.js index e87520da..3607728c 100644 --- a/dist/tween.esm.js +++ b/dist/tween.esm.js @@ -749,16 +749,9 @@ var Tween = /** @class */ (function () { var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime); var totalTime = this._duration + this._repeat * durationAndDelay; var calculateElapsedPortion = function () { - if (_this._duration === 0) + if (_this._duration === 0 || elapsedTime > totalTime) return 1; - if (elapsedTime > totalTime) { - return 1; - } - var timesRepeated = Math.trunc(elapsedTime / durationAndDelay); - var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay; - // TODO use %? - // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay - var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1); + var portion = Math.min(elapsedTime / _this._duration, 1); if (portion === 0 && elapsedTime === _this._duration) { return 1; } diff --git a/dist/tween.umd.js b/dist/tween.umd.js index b3bd4cdb..5da82ec3 100644 --- a/dist/tween.umd.js +++ b/dist/tween.umd.js @@ -755,16 +755,9 @@ var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime); var totalTime = this._duration + this._repeat * durationAndDelay; var calculateElapsedPortion = function () { - if (_this._duration === 0) + if (_this._duration === 0 || elapsedTime > totalTime) return 1; - if (elapsedTime > totalTime) { - return 1; - } - var timesRepeated = Math.trunc(elapsedTime / durationAndDelay); - var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay; - // TODO use %? - // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay - var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1); + var portion = Math.min(elapsedTime / _this._duration, 1); if (portion === 0 && elapsedTime === _this._duration) { return 1; } diff --git a/examples/10_yoyo.html b/examples/10_yoyo.html index 2045ce36..8b8c813e 100644 --- a/examples/10_yoyo.html +++ b/examples/10_yoyo.html @@ -37,6 +37,9 @@