diff --git a/dist/tween.amd.js b/dist/tween.amd.js index 85ceb1ea..5e0e46ad 100644 --- a/dist/tween.amd.js +++ b/dist/tween.amd.js @@ -773,16 +773,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 924fcea8..378c6669 100644 --- a/dist/tween.cjs +++ b/dist/tween.cjs @@ -775,16 +775,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 709871d1..93f367cc 100644 --- a/dist/tween.esm.js +++ b/dist/tween.esm.js @@ -771,16 +771,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 50f3ae3b..3fb49a8a 100644 --- a/dist/tween.umd.js +++ b/dist/tween.umd.js @@ -777,16 +777,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 @@