@tweenjs/tween.js 22.0.0 → 23.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/tween.amd.js +27 -12
- package/dist/tween.cjs +27 -12
- package/dist/tween.d.ts +1 -1
- package/dist/tween.esm.js +27 -12
- package/dist/tween.umd.js +27 -12
- package/package.json +1 -1
package/dist/tween.amd.js
CHANGED
@@ -675,12 +675,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
675
675
|
* it is still playing, just paused).
|
676
676
|
*/
|
677
677
|
Tween.prototype.update = function (time, autoStart) {
|
678
|
+
var _this = this;
|
679
|
+
var _a;
|
678
680
|
if (time === void 0) { time = now(); }
|
679
681
|
if (autoStart === void 0) { autoStart = true; }
|
680
682
|
if (this._isPaused)
|
681
683
|
return true;
|
682
684
|
var property;
|
683
|
-
var elapsed;
|
684
685
|
var endTime = this._startTime + this._duration;
|
685
686
|
if (!this._goToEnd && !this._isPlaying) {
|
686
687
|
if (time > endTime)
|
@@ -704,18 +705,37 @@ define(['exports'], (function (exports) { 'use strict';
|
|
704
705
|
}
|
705
706
|
this._onEveryStartCallbackFired = true;
|
706
707
|
}
|
707
|
-
|
708
|
-
|
708
|
+
var elapsedTime = time - this._startTime;
|
709
|
+
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
710
|
+
var totalTime = this._duration + this._repeat * durationAndDelay;
|
711
|
+
var calculateElapsedPortion = function () {
|
712
|
+
if (_this._duration === 0)
|
713
|
+
return 1;
|
714
|
+
if (elapsedTime > totalTime) {
|
715
|
+
return 1;
|
716
|
+
}
|
717
|
+
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
718
|
+
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
719
|
+
// TODO use %?
|
720
|
+
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
721
|
+
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
722
|
+
if (portion === 0 && elapsedTime === _this._duration) {
|
723
|
+
return 1;
|
724
|
+
}
|
725
|
+
return portion;
|
726
|
+
};
|
727
|
+
var elapsed = calculateElapsedPortion();
|
709
728
|
var value = this._easingFunction(elapsed);
|
710
729
|
// properties transformations
|
711
730
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
712
731
|
if (this._onUpdateCallback) {
|
713
732
|
this._onUpdateCallback(this._object, elapsed);
|
714
733
|
}
|
715
|
-
if (
|
734
|
+
if (this._duration === 0 || elapsedTime >= this._duration) {
|
716
735
|
if (this._repeat > 0) {
|
736
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
717
737
|
if (isFinite(this._repeat)) {
|
718
|
-
this._repeat
|
738
|
+
this._repeat -= completeCount;
|
719
739
|
}
|
720
740
|
// Reassign starting values, restart by making startTime = now
|
721
741
|
for (property in this._valuesStartRepeat) {
|
@@ -733,12 +753,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
733
753
|
if (this._yoyo) {
|
734
754
|
this._reversed = !this._reversed;
|
735
755
|
}
|
736
|
-
|
737
|
-
this._startTime = time + this._repeatDelayTime;
|
738
|
-
}
|
739
|
-
else {
|
740
|
-
this._startTime = time + this._delayTime;
|
741
|
-
}
|
756
|
+
this._startTime += durationAndDelay * completeCount;
|
742
757
|
if (this._onRepeatCallback) {
|
743
758
|
this._onRepeatCallback(this._object);
|
744
759
|
}
|
@@ -814,7 +829,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
814
829
|
return Tween;
|
815
830
|
}());
|
816
831
|
|
817
|
-
var VERSION = '
|
832
|
+
var VERSION = '23.0.0';
|
818
833
|
|
819
834
|
/**
|
820
835
|
* Tween.js - Licensed under the MIT license
|
package/dist/tween.cjs
CHANGED
@@ -677,12 +677,13 @@ var Tween = /** @class */ (function () {
|
|
677
677
|
* it is still playing, just paused).
|
678
678
|
*/
|
679
679
|
Tween.prototype.update = function (time, autoStart) {
|
680
|
+
var _this = this;
|
681
|
+
var _a;
|
680
682
|
if (time === void 0) { time = now(); }
|
681
683
|
if (autoStart === void 0) { autoStart = true; }
|
682
684
|
if (this._isPaused)
|
683
685
|
return true;
|
684
686
|
var property;
|
685
|
-
var elapsed;
|
686
687
|
var endTime = this._startTime + this._duration;
|
687
688
|
if (!this._goToEnd && !this._isPlaying) {
|
688
689
|
if (time > endTime)
|
@@ -706,18 +707,37 @@ var Tween = /** @class */ (function () {
|
|
706
707
|
}
|
707
708
|
this._onEveryStartCallbackFired = true;
|
708
709
|
}
|
709
|
-
|
710
|
-
|
710
|
+
var elapsedTime = time - this._startTime;
|
711
|
+
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
712
|
+
var totalTime = this._duration + this._repeat * durationAndDelay;
|
713
|
+
var calculateElapsedPortion = function () {
|
714
|
+
if (_this._duration === 0)
|
715
|
+
return 1;
|
716
|
+
if (elapsedTime > totalTime) {
|
717
|
+
return 1;
|
718
|
+
}
|
719
|
+
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
720
|
+
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
721
|
+
// TODO use %?
|
722
|
+
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
723
|
+
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
724
|
+
if (portion === 0 && elapsedTime === _this._duration) {
|
725
|
+
return 1;
|
726
|
+
}
|
727
|
+
return portion;
|
728
|
+
};
|
729
|
+
var elapsed = calculateElapsedPortion();
|
711
730
|
var value = this._easingFunction(elapsed);
|
712
731
|
// properties transformations
|
713
732
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
714
733
|
if (this._onUpdateCallback) {
|
715
734
|
this._onUpdateCallback(this._object, elapsed);
|
716
735
|
}
|
717
|
-
if (
|
736
|
+
if (this._duration === 0 || elapsedTime >= this._duration) {
|
718
737
|
if (this._repeat > 0) {
|
738
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
719
739
|
if (isFinite(this._repeat)) {
|
720
|
-
this._repeat
|
740
|
+
this._repeat -= completeCount;
|
721
741
|
}
|
722
742
|
// Reassign starting values, restart by making startTime = now
|
723
743
|
for (property in this._valuesStartRepeat) {
|
@@ -735,12 +755,7 @@ var Tween = /** @class */ (function () {
|
|
735
755
|
if (this._yoyo) {
|
736
756
|
this._reversed = !this._reversed;
|
737
757
|
}
|
738
|
-
|
739
|
-
this._startTime = time + this._repeatDelayTime;
|
740
|
-
}
|
741
|
-
else {
|
742
|
-
this._startTime = time + this._delayTime;
|
743
|
-
}
|
758
|
+
this._startTime += durationAndDelay * completeCount;
|
744
759
|
if (this._onRepeatCallback) {
|
745
760
|
this._onRepeatCallback(this._object);
|
746
761
|
}
|
@@ -816,7 +831,7 @@ var Tween = /** @class */ (function () {
|
|
816
831
|
return Tween;
|
817
832
|
}());
|
818
833
|
|
819
|
-
var VERSION = '
|
834
|
+
var VERSION = '23.0.0';
|
820
835
|
|
821
836
|
/**
|
822
837
|
* Tween.js - Licensed under the MIT license
|
package/dist/tween.d.ts
CHANGED
package/dist/tween.esm.js
CHANGED
@@ -673,12 +673,13 @@ var Tween = /** @class */ (function () {
|
|
673
673
|
* it is still playing, just paused).
|
674
674
|
*/
|
675
675
|
Tween.prototype.update = function (time, autoStart) {
|
676
|
+
var _this = this;
|
677
|
+
var _a;
|
676
678
|
if (time === void 0) { time = now(); }
|
677
679
|
if (autoStart === void 0) { autoStart = true; }
|
678
680
|
if (this._isPaused)
|
679
681
|
return true;
|
680
682
|
var property;
|
681
|
-
var elapsed;
|
682
683
|
var endTime = this._startTime + this._duration;
|
683
684
|
if (!this._goToEnd && !this._isPlaying) {
|
684
685
|
if (time > endTime)
|
@@ -702,18 +703,37 @@ var Tween = /** @class */ (function () {
|
|
702
703
|
}
|
703
704
|
this._onEveryStartCallbackFired = true;
|
704
705
|
}
|
705
|
-
|
706
|
-
|
706
|
+
var elapsedTime = time - this._startTime;
|
707
|
+
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
708
|
+
var totalTime = this._duration + this._repeat * durationAndDelay;
|
709
|
+
var calculateElapsedPortion = function () {
|
710
|
+
if (_this._duration === 0)
|
711
|
+
return 1;
|
712
|
+
if (elapsedTime > totalTime) {
|
713
|
+
return 1;
|
714
|
+
}
|
715
|
+
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
716
|
+
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
717
|
+
// TODO use %?
|
718
|
+
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
719
|
+
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
720
|
+
if (portion === 0 && elapsedTime === _this._duration) {
|
721
|
+
return 1;
|
722
|
+
}
|
723
|
+
return portion;
|
724
|
+
};
|
725
|
+
var elapsed = calculateElapsedPortion();
|
707
726
|
var value = this._easingFunction(elapsed);
|
708
727
|
// properties transformations
|
709
728
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
710
729
|
if (this._onUpdateCallback) {
|
711
730
|
this._onUpdateCallback(this._object, elapsed);
|
712
731
|
}
|
713
|
-
if (
|
732
|
+
if (this._duration === 0 || elapsedTime >= this._duration) {
|
714
733
|
if (this._repeat > 0) {
|
734
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
715
735
|
if (isFinite(this._repeat)) {
|
716
|
-
this._repeat
|
736
|
+
this._repeat -= completeCount;
|
717
737
|
}
|
718
738
|
// Reassign starting values, restart by making startTime = now
|
719
739
|
for (property in this._valuesStartRepeat) {
|
@@ -731,12 +751,7 @@ var Tween = /** @class */ (function () {
|
|
731
751
|
if (this._yoyo) {
|
732
752
|
this._reversed = !this._reversed;
|
733
753
|
}
|
734
|
-
|
735
|
-
this._startTime = time + this._repeatDelayTime;
|
736
|
-
}
|
737
|
-
else {
|
738
|
-
this._startTime = time + this._delayTime;
|
739
|
-
}
|
754
|
+
this._startTime += durationAndDelay * completeCount;
|
740
755
|
if (this._onRepeatCallback) {
|
741
756
|
this._onRepeatCallback(this._object);
|
742
757
|
}
|
@@ -812,7 +827,7 @@ var Tween = /** @class */ (function () {
|
|
812
827
|
return Tween;
|
813
828
|
}());
|
814
829
|
|
815
|
-
var VERSION = '
|
830
|
+
var VERSION = '23.0.0';
|
816
831
|
|
817
832
|
/**
|
818
833
|
* Tween.js - Licensed under the MIT license
|
package/dist/tween.umd.js
CHANGED
@@ -679,12 +679,13 @@
|
|
679
679
|
* it is still playing, just paused).
|
680
680
|
*/
|
681
681
|
Tween.prototype.update = function (time, autoStart) {
|
682
|
+
var _this = this;
|
683
|
+
var _a;
|
682
684
|
if (time === void 0) { time = now(); }
|
683
685
|
if (autoStart === void 0) { autoStart = true; }
|
684
686
|
if (this._isPaused)
|
685
687
|
return true;
|
686
688
|
var property;
|
687
|
-
var elapsed;
|
688
689
|
var endTime = this._startTime + this._duration;
|
689
690
|
if (!this._goToEnd && !this._isPlaying) {
|
690
691
|
if (time > endTime)
|
@@ -708,18 +709,37 @@
|
|
708
709
|
}
|
709
710
|
this._onEveryStartCallbackFired = true;
|
710
711
|
}
|
711
|
-
|
712
|
-
|
712
|
+
var elapsedTime = time - this._startTime;
|
713
|
+
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
714
|
+
var totalTime = this._duration + this._repeat * durationAndDelay;
|
715
|
+
var calculateElapsedPortion = function () {
|
716
|
+
if (_this._duration === 0)
|
717
|
+
return 1;
|
718
|
+
if (elapsedTime > totalTime) {
|
719
|
+
return 1;
|
720
|
+
}
|
721
|
+
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
722
|
+
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
723
|
+
// TODO use %?
|
724
|
+
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
725
|
+
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
726
|
+
if (portion === 0 && elapsedTime === _this._duration) {
|
727
|
+
return 1;
|
728
|
+
}
|
729
|
+
return portion;
|
730
|
+
};
|
731
|
+
var elapsed = calculateElapsedPortion();
|
713
732
|
var value = this._easingFunction(elapsed);
|
714
733
|
// properties transformations
|
715
734
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
716
735
|
if (this._onUpdateCallback) {
|
717
736
|
this._onUpdateCallback(this._object, elapsed);
|
718
737
|
}
|
719
|
-
if (
|
738
|
+
if (this._duration === 0 || elapsedTime >= this._duration) {
|
720
739
|
if (this._repeat > 0) {
|
740
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
721
741
|
if (isFinite(this._repeat)) {
|
722
|
-
this._repeat
|
742
|
+
this._repeat -= completeCount;
|
723
743
|
}
|
724
744
|
// Reassign starting values, restart by making startTime = now
|
725
745
|
for (property in this._valuesStartRepeat) {
|
@@ -737,12 +757,7 @@
|
|
737
757
|
if (this._yoyo) {
|
738
758
|
this._reversed = !this._reversed;
|
739
759
|
}
|
740
|
-
|
741
|
-
this._startTime = time + this._repeatDelayTime;
|
742
|
-
}
|
743
|
-
else {
|
744
|
-
this._startTime = time + this._delayTime;
|
745
|
-
}
|
760
|
+
this._startTime += durationAndDelay * completeCount;
|
746
761
|
if (this._onRepeatCallback) {
|
747
762
|
this._onRepeatCallback(this._object);
|
748
763
|
}
|
@@ -818,7 +833,7 @@
|
|
818
833
|
return Tween;
|
819
834
|
}());
|
820
835
|
|
821
|
-
var VERSION = '
|
836
|
+
var VERSION = '23.0.0';
|
822
837
|
|
823
838
|
/**
|
824
839
|
* Tween.js - Licensed under the MIT license
|
package/package.json
CHANGED