@tweenjs/tween.js 23.1.2 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -108
- package/dist/tween.amd.js +600 -106
- package/dist/tween.cjs +600 -106
- package/dist/tween.d.ts +541 -33
- package/dist/tween.esm.js +600 -106
- package/dist/tween.umd.js +600 -106
- package/package.json +4 -4
package/dist/tween.umd.js
CHANGED
|
@@ -229,33 +229,61 @@
|
|
|
229
229
|
*/
|
|
230
230
|
var Group = /** @class */ (function () {
|
|
231
231
|
function Group() {
|
|
232
|
+
var tweens = [];
|
|
233
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
234
|
+
tweens[_i] = arguments[_i];
|
|
235
|
+
}
|
|
232
236
|
this._tweens = {};
|
|
233
237
|
this._tweensAddedDuringUpdate = {};
|
|
238
|
+
this.add.apply(this, tweens);
|
|
234
239
|
}
|
|
235
240
|
Group.prototype.getAll = function () {
|
|
236
241
|
var _this = this;
|
|
237
|
-
return Object.keys(this._tweens).map(function (tweenId) {
|
|
238
|
-
return _this._tweens[tweenId];
|
|
239
|
-
});
|
|
242
|
+
return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });
|
|
240
243
|
};
|
|
241
244
|
Group.prototype.removeAll = function () {
|
|
242
245
|
this._tweens = {};
|
|
243
246
|
};
|
|
244
|
-
Group.prototype.add = function (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
Group.prototype.add = function () {
|
|
248
|
+
var _a;
|
|
249
|
+
var tweens = [];
|
|
250
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
251
|
+
tweens[_i] = arguments[_i];
|
|
252
|
+
}
|
|
253
|
+
for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
|
|
254
|
+
var tween = tweens_1[_b];
|
|
255
|
+
// Remove from any other group first, a tween can only be in one group at a time.
|
|
256
|
+
// @ts-expect-error library internal access
|
|
257
|
+
(_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
|
|
258
|
+
// @ts-expect-error library internal access
|
|
259
|
+
tween._group = this;
|
|
260
|
+
this._tweens[tween.getId()] = tween;
|
|
261
|
+
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
Group.prototype.remove = function () {
|
|
265
|
+
var tweens = [];
|
|
266
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
267
|
+
tweens[_i] = arguments[_i];
|
|
268
|
+
}
|
|
269
|
+
for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
|
|
270
|
+
var tween = tweens_2[_a];
|
|
271
|
+
// @ts-expect-error library internal access
|
|
272
|
+
tween._group = undefined;
|
|
273
|
+
delete this._tweens[tween.getId()];
|
|
274
|
+
delete this._tweensAddedDuringUpdate[tween.getId()];
|
|
275
|
+
}
|
|
247
276
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
277
|
+
/** Return true if all tweens in the group are not paused or playing. */
|
|
278
|
+
Group.prototype.allStopped = function () {
|
|
279
|
+
return this.getAll().every(function (tween) { return !tween.isPlaying(); });
|
|
251
280
|
};
|
|
252
281
|
Group.prototype.update = function (time, preserve) {
|
|
253
282
|
if (time === void 0) { time = now(); }
|
|
254
|
-
if (preserve === void 0) { preserve =
|
|
283
|
+
if (preserve === void 0) { preserve = true; }
|
|
255
284
|
var tweenIds = Object.keys(this._tweens);
|
|
256
|
-
if (tweenIds.length === 0)
|
|
257
|
-
return
|
|
258
|
-
}
|
|
285
|
+
if (tweenIds.length === 0)
|
|
286
|
+
return;
|
|
259
287
|
// Tweens are updated in "batches". If you add a new tween during an
|
|
260
288
|
// update, then the new tween will be updated in the next batch.
|
|
261
289
|
// If you remove a tween during an update, it may or may not be updated.
|
|
@@ -266,13 +294,11 @@
|
|
|
266
294
|
for (var i = 0; i < tweenIds.length; i++) {
|
|
267
295
|
var tween = this._tweens[tweenIds[i]];
|
|
268
296
|
var autoStart = !preserve;
|
|
269
|
-
if (tween && tween.update(time, autoStart) === false && !preserve)
|
|
270
|
-
|
|
271
|
-
}
|
|
297
|
+
if (tween && tween.update(time, autoStart) === false && !preserve)
|
|
298
|
+
this.remove(tween);
|
|
272
299
|
}
|
|
273
300
|
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
|
274
301
|
}
|
|
275
|
-
return true;
|
|
276
302
|
};
|
|
277
303
|
return Group;
|
|
278
304
|
}());
|
|
@@ -381,10 +407,7 @@
|
|
|
381
407
|
* Thank you all, you're awesome!
|
|
382
408
|
*/
|
|
383
409
|
var Tween = /** @class */ (function () {
|
|
384
|
-
function Tween(
|
|
385
|
-
if (_group === void 0) { _group = mainGroup; }
|
|
386
|
-
this._object = _object;
|
|
387
|
-
this._group = _group;
|
|
410
|
+
function Tween(object, group) {
|
|
388
411
|
this._isPaused = false;
|
|
389
412
|
this._pauseStart = 0;
|
|
390
413
|
this._valuesStart = {};
|
|
@@ -409,6 +432,16 @@
|
|
|
409
432
|
this._isChainStopped = false;
|
|
410
433
|
this._propertiesAreSetUp = false;
|
|
411
434
|
this._goToEnd = false;
|
|
435
|
+
this._object = object;
|
|
436
|
+
if (typeof group === 'object') {
|
|
437
|
+
this._group = group;
|
|
438
|
+
group.add(this);
|
|
439
|
+
}
|
|
440
|
+
// Use "true" to restore old behavior (will be removed in future release).
|
|
441
|
+
else if (group === true) {
|
|
442
|
+
this._group = mainGroup;
|
|
443
|
+
mainGroup.add(this);
|
|
444
|
+
}
|
|
412
445
|
}
|
|
413
446
|
Tween.prototype.getId = function () {
|
|
414
447
|
return this._id;
|
|
@@ -447,8 +480,6 @@
|
|
|
447
480
|
if (this._isPlaying) {
|
|
448
481
|
return this;
|
|
449
482
|
}
|
|
450
|
-
// eslint-disable-next-line
|
|
451
|
-
this._group && this._group.add(this);
|
|
452
483
|
this._repeat = this._initialRepeat;
|
|
453
484
|
if (this._reversed) {
|
|
454
485
|
// If we were reversed (f.e. using the yoyo feature) then we need to
|
|
@@ -565,8 +596,6 @@
|
|
|
565
596
|
if (!this._isPlaying) {
|
|
566
597
|
return this;
|
|
567
598
|
}
|
|
568
|
-
// eslint-disable-next-line
|
|
569
|
-
this._group && this._group.remove(this);
|
|
570
599
|
this._isPlaying = false;
|
|
571
600
|
this._isPaused = false;
|
|
572
601
|
if (this._onStopCallback) {
|
|
@@ -586,8 +615,6 @@
|
|
|
586
615
|
}
|
|
587
616
|
this._isPaused = true;
|
|
588
617
|
this._pauseStart = time;
|
|
589
|
-
// eslint-disable-next-line
|
|
590
|
-
this._group && this._group.remove(this);
|
|
591
618
|
return this;
|
|
592
619
|
};
|
|
593
620
|
Tween.prototype.resume = function (time) {
|
|
@@ -598,8 +625,6 @@
|
|
|
598
625
|
this._isPaused = false;
|
|
599
626
|
this._startTime += time - this._pauseStart;
|
|
600
627
|
this._pauseStart = 0;
|
|
601
|
-
// eslint-disable-next-line
|
|
602
|
-
this._group && this._group.add(this);
|
|
603
628
|
return this;
|
|
604
629
|
};
|
|
605
630
|
Tween.prototype.stopChainedTweens = function () {
|
|
@@ -609,8 +634,19 @@
|
|
|
609
634
|
return this;
|
|
610
635
|
};
|
|
611
636
|
Tween.prototype.group = function (group) {
|
|
612
|
-
if (group
|
|
613
|
-
|
|
637
|
+
if (!group) {
|
|
638
|
+
console.warn('tween.group() without args has been removed, use group.add(tween) instead.');
|
|
639
|
+
return this;
|
|
640
|
+
}
|
|
641
|
+
group.add(this);
|
|
642
|
+
return this;
|
|
643
|
+
};
|
|
644
|
+
/**
|
|
645
|
+
* Removes the tween from whichever group it is in.
|
|
646
|
+
*/
|
|
647
|
+
Tween.prototype.remove = function () {
|
|
648
|
+
var _a;
|
|
649
|
+
(_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
|
|
614
650
|
return this;
|
|
615
651
|
};
|
|
616
652
|
Tween.prototype.delay = function (amount) {
|
|
@@ -682,17 +718,18 @@
|
|
|
682
718
|
* it is still playing, just paused).
|
|
683
719
|
*/
|
|
684
720
|
Tween.prototype.update = function (time, autoStart) {
|
|
721
|
+
var _this = this;
|
|
685
722
|
var _a;
|
|
686
723
|
if (time === void 0) { time = now(); }
|
|
687
724
|
if (autoStart === void 0) { autoStart = true; }
|
|
688
725
|
if (this._isPaused)
|
|
689
726
|
return true;
|
|
690
|
-
var
|
|
727
|
+
var property;
|
|
691
728
|
if (!this._goToEnd && !this._isPlaying) {
|
|
692
|
-
if (time > endTime)
|
|
693
|
-
return false;
|
|
694
729
|
if (autoStart)
|
|
695
730
|
this.start(time, true);
|
|
731
|
+
else
|
|
732
|
+
return false;
|
|
696
733
|
}
|
|
697
734
|
this._goToEnd = false;
|
|
698
735
|
if (time < this._startTime) {
|
|
@@ -713,85 +750,72 @@
|
|
|
713
750
|
var elapsedTime = time - this._startTime;
|
|
714
751
|
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
|
715
752
|
var totalTime = this._duration + this._repeat * durationAndDelay;
|
|
716
|
-
var
|
|
753
|
+
var calculateElapsedPortion = function () {
|
|
754
|
+
if (_this._duration === 0)
|
|
755
|
+
return 1;
|
|
756
|
+
if (elapsedTime > totalTime) {
|
|
757
|
+
return 1;
|
|
758
|
+
}
|
|
759
|
+
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
|
760
|
+
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
|
761
|
+
// TODO use %?
|
|
762
|
+
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
|
763
|
+
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
|
764
|
+
if (portion === 0 && elapsedTime === _this._duration) {
|
|
765
|
+
return 1;
|
|
766
|
+
}
|
|
767
|
+
return portion;
|
|
768
|
+
};
|
|
769
|
+
var elapsed = calculateElapsedPortion();
|
|
717
770
|
var value = this._easingFunction(elapsed);
|
|
718
|
-
|
|
719
|
-
if (status === 'repeat') {
|
|
720
|
-
// the current update is happening after the instant the tween repeated
|
|
721
|
-
this._processRepetition(elapsedTime, durationAndDelay);
|
|
722
|
-
}
|
|
771
|
+
// properties transformations
|
|
723
772
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
|
724
|
-
if (status === 'about-to-repeat') {
|
|
725
|
-
// the current update is happening at the exact instant the tween is going to repeat
|
|
726
|
-
// the values should match the end of the tween, not the beginning,
|
|
727
|
-
// that's why _processRepetition happens after _updateProperties
|
|
728
|
-
this._processRepetition(elapsedTime, durationAndDelay);
|
|
729
|
-
}
|
|
730
773
|
if (this._onUpdateCallback) {
|
|
731
774
|
this._onUpdateCallback(this._object, elapsed);
|
|
732
775
|
}
|
|
733
|
-
if (
|
|
734
|
-
if (this.
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return portion;
|
|
762
|
-
};
|
|
763
|
-
Tween.prototype._calculateCompletionStatus = function (elapsedTime, durationAndDelay) {
|
|
764
|
-
if (this._duration !== 0 && elapsedTime < this._duration) {
|
|
765
|
-
return 'playing';
|
|
766
|
-
}
|
|
767
|
-
if (this._repeat <= 0) {
|
|
768
|
-
return 'completed';
|
|
769
|
-
}
|
|
770
|
-
if (elapsedTime === this._duration) {
|
|
771
|
-
return 'about-to-repeat';
|
|
772
|
-
}
|
|
773
|
-
return 'repeat';
|
|
774
|
-
};
|
|
775
|
-
Tween.prototype._processRepetition = function (elapsedTime, durationAndDelay) {
|
|
776
|
-
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
|
777
|
-
if (isFinite(this._repeat)) {
|
|
778
|
-
this._repeat -= completeCount;
|
|
779
|
-
}
|
|
780
|
-
// Reassign starting values, restart by making startTime = now
|
|
781
|
-
for (var property in this._valuesStartRepeat) {
|
|
782
|
-
var valueEnd = this._valuesEnd[property];
|
|
783
|
-
if (!this._yoyo && typeof valueEnd === 'string') {
|
|
784
|
-
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(valueEnd);
|
|
776
|
+
if (this._duration === 0 || elapsedTime >= this._duration) {
|
|
777
|
+
if (this._repeat > 0) {
|
|
778
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
|
779
|
+
if (isFinite(this._repeat)) {
|
|
780
|
+
this._repeat -= completeCount;
|
|
781
|
+
}
|
|
782
|
+
// Reassign starting values, restart by making startTime = now
|
|
783
|
+
for (property in this._valuesStartRepeat) {
|
|
784
|
+
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
|
785
|
+
this._valuesStartRepeat[property] =
|
|
786
|
+
// eslint-disable-next-line
|
|
787
|
+
// @ts-ignore FIXME?
|
|
788
|
+
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
|
789
|
+
}
|
|
790
|
+
if (this._yoyo) {
|
|
791
|
+
this._swapEndStartRepeatValues(property);
|
|
792
|
+
}
|
|
793
|
+
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
794
|
+
}
|
|
795
|
+
if (this._yoyo) {
|
|
796
|
+
this._reversed = !this._reversed;
|
|
797
|
+
}
|
|
798
|
+
this._startTime += durationAndDelay * completeCount;
|
|
799
|
+
if (this._onRepeatCallback) {
|
|
800
|
+
this._onRepeatCallback(this._object);
|
|
801
|
+
}
|
|
802
|
+
this._onEveryStartCallbackFired = false;
|
|
803
|
+
return true;
|
|
785
804
|
}
|
|
786
|
-
|
|
787
|
-
this.
|
|
805
|
+
else {
|
|
806
|
+
if (this._onCompleteCallback) {
|
|
807
|
+
this._onCompleteCallback(this._object);
|
|
808
|
+
}
|
|
809
|
+
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
810
|
+
// Make the chained tweens start exactly at the time they should,
|
|
811
|
+
// even if the `update()` method was called way past the duration of the tween
|
|
812
|
+
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
|
813
|
+
}
|
|
814
|
+
this._isPlaying = false;
|
|
815
|
+
return false;
|
|
788
816
|
}
|
|
789
|
-
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
790
817
|
}
|
|
791
|
-
|
|
792
|
-
this._reversed = !this._reversed;
|
|
793
|
-
}
|
|
794
|
-
this._startTime += durationAndDelay * completeCount;
|
|
818
|
+
return true;
|
|
795
819
|
};
|
|
796
820
|
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
|
797
821
|
for (var property in _valuesEnd) {
|
|
@@ -847,7 +871,7 @@
|
|
|
847
871
|
return Tween;
|
|
848
872
|
}());
|
|
849
873
|
|
|
850
|
-
var VERSION = '
|
|
874
|
+
var VERSION = '24.0.0';
|
|
851
875
|
|
|
852
876
|
/**
|
|
853
877
|
* Tween.js - Licensed under the MIT license
|
|
@@ -869,10 +893,245 @@
|
|
|
869
893
|
// Modules and CommonJS, without build hacks, and so as not to break the
|
|
870
894
|
// existing API.
|
|
871
895
|
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
|
896
|
+
/**
|
|
897
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
898
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
899
|
+
* group.
|
|
900
|
+
*
|
|
901
|
+
* Old code:
|
|
902
|
+
*
|
|
903
|
+
* ```js
|
|
904
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
905
|
+
*
|
|
906
|
+
* //...
|
|
907
|
+
*
|
|
908
|
+
* const tween = new TWEEN.Tween(obj)
|
|
909
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
910
|
+
*
|
|
911
|
+
* //...
|
|
912
|
+
*
|
|
913
|
+
* requestAnimationFrame(function loop(time) {
|
|
914
|
+
* TWEEN.update(time)
|
|
915
|
+
* requestAnimationFrame(loop)
|
|
916
|
+
* })
|
|
917
|
+
* ```
|
|
918
|
+
*
|
|
919
|
+
* New code:
|
|
920
|
+
*
|
|
921
|
+
* ```js
|
|
922
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
923
|
+
*
|
|
924
|
+
* //...
|
|
925
|
+
*
|
|
926
|
+
* const tween = new Tween(obj)
|
|
927
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
928
|
+
*
|
|
929
|
+
* //...
|
|
930
|
+
*
|
|
931
|
+
* const group = new Group()
|
|
932
|
+
* group.add(tween)
|
|
933
|
+
* group.add(tween2)
|
|
934
|
+
*
|
|
935
|
+
* //...
|
|
936
|
+
*
|
|
937
|
+
* requestAnimationFrame(function loop(time) {
|
|
938
|
+
* group.update(time)
|
|
939
|
+
* requestAnimationFrame(loop)
|
|
940
|
+
* })
|
|
941
|
+
* ```
|
|
942
|
+
*/
|
|
872
943
|
var getAll = TWEEN.getAll.bind(TWEEN);
|
|
944
|
+
/**
|
|
945
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
946
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
947
|
+
* group.
|
|
948
|
+
*
|
|
949
|
+
* Old code:
|
|
950
|
+
*
|
|
951
|
+
* ```js
|
|
952
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
953
|
+
*
|
|
954
|
+
* //...
|
|
955
|
+
*
|
|
956
|
+
* const tween = new TWEEN.Tween(obj)
|
|
957
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
958
|
+
*
|
|
959
|
+
* //...
|
|
960
|
+
*
|
|
961
|
+
* requestAnimationFrame(function loop(time) {
|
|
962
|
+
* TWEEN.update(time)
|
|
963
|
+
* requestAnimationFrame(loop)
|
|
964
|
+
* })
|
|
965
|
+
* ```
|
|
966
|
+
*
|
|
967
|
+
* New code:
|
|
968
|
+
*
|
|
969
|
+
* ```js
|
|
970
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
971
|
+
*
|
|
972
|
+
* //...
|
|
973
|
+
*
|
|
974
|
+
* const tween = new Tween(obj)
|
|
975
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
976
|
+
*
|
|
977
|
+
* //...
|
|
978
|
+
*
|
|
979
|
+
* const group = new Group()
|
|
980
|
+
* group.add(tween)
|
|
981
|
+
* group.add(tween2)
|
|
982
|
+
*
|
|
983
|
+
* //...
|
|
984
|
+
*
|
|
985
|
+
* requestAnimationFrame(function loop(time) {
|
|
986
|
+
* group.update(time)
|
|
987
|
+
* requestAnimationFrame(loop)
|
|
988
|
+
* })
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
873
991
|
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
|
992
|
+
/**
|
|
993
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
994
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
995
|
+
* group.
|
|
996
|
+
*
|
|
997
|
+
* Old code:
|
|
998
|
+
*
|
|
999
|
+
* ```js
|
|
1000
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1001
|
+
*
|
|
1002
|
+
* //...
|
|
1003
|
+
*
|
|
1004
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1005
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1006
|
+
*
|
|
1007
|
+
* //...
|
|
1008
|
+
*
|
|
1009
|
+
* requestAnimationFrame(function loop(time) {
|
|
1010
|
+
* TWEEN.update(time)
|
|
1011
|
+
* requestAnimationFrame(loop)
|
|
1012
|
+
* })
|
|
1013
|
+
* ```
|
|
1014
|
+
*
|
|
1015
|
+
* New code:
|
|
1016
|
+
*
|
|
1017
|
+
* ```js
|
|
1018
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1019
|
+
*
|
|
1020
|
+
* //...
|
|
1021
|
+
*
|
|
1022
|
+
* const tween = new Tween(obj)
|
|
1023
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1024
|
+
*
|
|
1025
|
+
* //...
|
|
1026
|
+
*
|
|
1027
|
+
* const group = new Group()
|
|
1028
|
+
* group.add(tween)
|
|
1029
|
+
* group.add(tween2)
|
|
1030
|
+
*
|
|
1031
|
+
* //...
|
|
1032
|
+
*
|
|
1033
|
+
* requestAnimationFrame(function loop(time) {
|
|
1034
|
+
* group.update(time)
|
|
1035
|
+
* requestAnimationFrame(loop)
|
|
1036
|
+
* })
|
|
1037
|
+
* ```
|
|
1038
|
+
*/
|
|
874
1039
|
var add = TWEEN.add.bind(TWEEN);
|
|
1040
|
+
/**
|
|
1041
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1042
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1043
|
+
* group.
|
|
1044
|
+
*
|
|
1045
|
+
* Old code:
|
|
1046
|
+
*
|
|
1047
|
+
* ```js
|
|
1048
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1049
|
+
*
|
|
1050
|
+
* //...
|
|
1051
|
+
*
|
|
1052
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1053
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1054
|
+
*
|
|
1055
|
+
* //...
|
|
1056
|
+
*
|
|
1057
|
+
* requestAnimationFrame(function loop(time) {
|
|
1058
|
+
* TWEEN.update(time)
|
|
1059
|
+
* requestAnimationFrame(loop)
|
|
1060
|
+
* })
|
|
1061
|
+
* ```
|
|
1062
|
+
*
|
|
1063
|
+
* New code:
|
|
1064
|
+
*
|
|
1065
|
+
* ```js
|
|
1066
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1067
|
+
*
|
|
1068
|
+
* //...
|
|
1069
|
+
*
|
|
1070
|
+
* const tween = new Tween(obj)
|
|
1071
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1072
|
+
*
|
|
1073
|
+
* //...
|
|
1074
|
+
*
|
|
1075
|
+
* const group = new Group()
|
|
1076
|
+
* group.add(tween)
|
|
1077
|
+
* group.add(tween2)
|
|
1078
|
+
*
|
|
1079
|
+
* //...
|
|
1080
|
+
*
|
|
1081
|
+
* requestAnimationFrame(function loop(time) {
|
|
1082
|
+
* group.update(time)
|
|
1083
|
+
* requestAnimationFrame(loop)
|
|
1084
|
+
* })
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
875
1087
|
var remove = TWEEN.remove.bind(TWEEN);
|
|
1088
|
+
/**
|
|
1089
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1090
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1091
|
+
* group.
|
|
1092
|
+
*
|
|
1093
|
+
* Old code:
|
|
1094
|
+
*
|
|
1095
|
+
* ```js
|
|
1096
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1097
|
+
*
|
|
1098
|
+
* //...
|
|
1099
|
+
*
|
|
1100
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1101
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1102
|
+
*
|
|
1103
|
+
* //...
|
|
1104
|
+
*
|
|
1105
|
+
* requestAnimationFrame(function loop(time) {
|
|
1106
|
+
* TWEEN.update(time)
|
|
1107
|
+
* requestAnimationFrame(loop)
|
|
1108
|
+
* })
|
|
1109
|
+
* ```
|
|
1110
|
+
*
|
|
1111
|
+
* New code:
|
|
1112
|
+
*
|
|
1113
|
+
* ```js
|
|
1114
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1115
|
+
*
|
|
1116
|
+
* //...
|
|
1117
|
+
*
|
|
1118
|
+
* const tween = new Tween(obj)
|
|
1119
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1120
|
+
*
|
|
1121
|
+
* //...
|
|
1122
|
+
*
|
|
1123
|
+
* const group = new Group()
|
|
1124
|
+
* group.add(tween)
|
|
1125
|
+
* group.add(tween2)
|
|
1126
|
+
*
|
|
1127
|
+
* //...
|
|
1128
|
+
*
|
|
1129
|
+
* requestAnimationFrame(function loop(time) {
|
|
1130
|
+
* group.update(time)
|
|
1131
|
+
* requestAnimationFrame(loop)
|
|
1132
|
+
* })
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
876
1135
|
var update = TWEEN.update.bind(TWEEN);
|
|
877
1136
|
var exports$1 = {
|
|
878
1137
|
Easing: Easing,
|
|
@@ -883,10 +1142,245 @@
|
|
|
883
1142
|
nextId: nextId,
|
|
884
1143
|
Tween: Tween,
|
|
885
1144
|
VERSION: VERSION,
|
|
1145
|
+
/**
|
|
1146
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1147
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1148
|
+
* group.
|
|
1149
|
+
*
|
|
1150
|
+
* Old code:
|
|
1151
|
+
*
|
|
1152
|
+
* ```js
|
|
1153
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1154
|
+
*
|
|
1155
|
+
* //...
|
|
1156
|
+
*
|
|
1157
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1158
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1159
|
+
*
|
|
1160
|
+
* //...
|
|
1161
|
+
*
|
|
1162
|
+
* requestAnimationFrame(function loop(time) {
|
|
1163
|
+
* TWEEN.update(time)
|
|
1164
|
+
* requestAnimationFrame(loop)
|
|
1165
|
+
* })
|
|
1166
|
+
* ```
|
|
1167
|
+
*
|
|
1168
|
+
* New code:
|
|
1169
|
+
*
|
|
1170
|
+
* ```js
|
|
1171
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1172
|
+
*
|
|
1173
|
+
* //...
|
|
1174
|
+
*
|
|
1175
|
+
* const tween = new Tween(obj)
|
|
1176
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1177
|
+
*
|
|
1178
|
+
* //...
|
|
1179
|
+
*
|
|
1180
|
+
* const group = new Group()
|
|
1181
|
+
* group.add(tween)
|
|
1182
|
+
* group.add(tween2)
|
|
1183
|
+
*
|
|
1184
|
+
* //...
|
|
1185
|
+
*
|
|
1186
|
+
* requestAnimationFrame(function loop(time) {
|
|
1187
|
+
* group.update(time)
|
|
1188
|
+
* requestAnimationFrame(loop)
|
|
1189
|
+
* })
|
|
1190
|
+
* ```
|
|
1191
|
+
*/
|
|
886
1192
|
getAll: getAll,
|
|
1193
|
+
/**
|
|
1194
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1195
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1196
|
+
* group.
|
|
1197
|
+
*
|
|
1198
|
+
* Old code:
|
|
1199
|
+
*
|
|
1200
|
+
* ```js
|
|
1201
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1202
|
+
*
|
|
1203
|
+
* //...
|
|
1204
|
+
*
|
|
1205
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1206
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1207
|
+
*
|
|
1208
|
+
* //...
|
|
1209
|
+
*
|
|
1210
|
+
* requestAnimationFrame(function loop(time) {
|
|
1211
|
+
* TWEEN.update(time)
|
|
1212
|
+
* requestAnimationFrame(loop)
|
|
1213
|
+
* })
|
|
1214
|
+
* ```
|
|
1215
|
+
*
|
|
1216
|
+
* New code:
|
|
1217
|
+
*
|
|
1218
|
+
* ```js
|
|
1219
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1220
|
+
*
|
|
1221
|
+
* //...
|
|
1222
|
+
*
|
|
1223
|
+
* const tween = new Tween(obj)
|
|
1224
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1225
|
+
*
|
|
1226
|
+
* //...
|
|
1227
|
+
*
|
|
1228
|
+
* const group = new Group()
|
|
1229
|
+
* group.add(tween)
|
|
1230
|
+
* group.add(tween2)
|
|
1231
|
+
*
|
|
1232
|
+
* //...
|
|
1233
|
+
*
|
|
1234
|
+
* requestAnimationFrame(function loop(time) {
|
|
1235
|
+
* group.update(time)
|
|
1236
|
+
* requestAnimationFrame(loop)
|
|
1237
|
+
* })
|
|
1238
|
+
* ```
|
|
1239
|
+
*/
|
|
887
1240
|
removeAll: removeAll,
|
|
1241
|
+
/**
|
|
1242
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1243
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1244
|
+
* group.
|
|
1245
|
+
*
|
|
1246
|
+
* Old code:
|
|
1247
|
+
*
|
|
1248
|
+
* ```js
|
|
1249
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1250
|
+
*
|
|
1251
|
+
* //...
|
|
1252
|
+
*
|
|
1253
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1254
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1255
|
+
*
|
|
1256
|
+
* //...
|
|
1257
|
+
*
|
|
1258
|
+
* requestAnimationFrame(function loop(time) {
|
|
1259
|
+
* TWEEN.update(time)
|
|
1260
|
+
* requestAnimationFrame(loop)
|
|
1261
|
+
* })
|
|
1262
|
+
* ```
|
|
1263
|
+
*
|
|
1264
|
+
* New code:
|
|
1265
|
+
*
|
|
1266
|
+
* ```js
|
|
1267
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1268
|
+
*
|
|
1269
|
+
* //...
|
|
1270
|
+
*
|
|
1271
|
+
* const tween = new Tween(obj)
|
|
1272
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1273
|
+
*
|
|
1274
|
+
* //...
|
|
1275
|
+
*
|
|
1276
|
+
* const group = new Group()
|
|
1277
|
+
* group.add(tween)
|
|
1278
|
+
* group.add(tween2)
|
|
1279
|
+
*
|
|
1280
|
+
* //...
|
|
1281
|
+
*
|
|
1282
|
+
* requestAnimationFrame(function loop(time) {
|
|
1283
|
+
* group.update(time)
|
|
1284
|
+
* requestAnimationFrame(loop)
|
|
1285
|
+
* })
|
|
1286
|
+
* ```
|
|
1287
|
+
*/
|
|
888
1288
|
add: add,
|
|
1289
|
+
/**
|
|
1290
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1291
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1292
|
+
* group.
|
|
1293
|
+
*
|
|
1294
|
+
* Old code:
|
|
1295
|
+
*
|
|
1296
|
+
* ```js
|
|
1297
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1298
|
+
*
|
|
1299
|
+
* //...
|
|
1300
|
+
*
|
|
1301
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1302
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1303
|
+
*
|
|
1304
|
+
* //...
|
|
1305
|
+
*
|
|
1306
|
+
* requestAnimationFrame(function loop(time) {
|
|
1307
|
+
* TWEEN.update(time)
|
|
1308
|
+
* requestAnimationFrame(loop)
|
|
1309
|
+
* })
|
|
1310
|
+
* ```
|
|
1311
|
+
*
|
|
1312
|
+
* New code:
|
|
1313
|
+
*
|
|
1314
|
+
* ```js
|
|
1315
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1316
|
+
*
|
|
1317
|
+
* //...
|
|
1318
|
+
*
|
|
1319
|
+
* const tween = new Tween(obj)
|
|
1320
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1321
|
+
*
|
|
1322
|
+
* //...
|
|
1323
|
+
*
|
|
1324
|
+
* const group = new Group()
|
|
1325
|
+
* group.add(tween)
|
|
1326
|
+
* group.add(tween2)
|
|
1327
|
+
*
|
|
1328
|
+
* //...
|
|
1329
|
+
*
|
|
1330
|
+
* requestAnimationFrame(function loop(time) {
|
|
1331
|
+
* group.update(time)
|
|
1332
|
+
* requestAnimationFrame(loop)
|
|
1333
|
+
* })
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
889
1336
|
remove: remove,
|
|
1337
|
+
/**
|
|
1338
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1339
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1340
|
+
* group.
|
|
1341
|
+
*
|
|
1342
|
+
* Old code:
|
|
1343
|
+
*
|
|
1344
|
+
* ```js
|
|
1345
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1346
|
+
*
|
|
1347
|
+
* //...
|
|
1348
|
+
*
|
|
1349
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1350
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1351
|
+
*
|
|
1352
|
+
* //...
|
|
1353
|
+
*
|
|
1354
|
+
* requestAnimationFrame(function loop(time) {
|
|
1355
|
+
* TWEEN.update(time)
|
|
1356
|
+
* requestAnimationFrame(loop)
|
|
1357
|
+
* })
|
|
1358
|
+
* ```
|
|
1359
|
+
*
|
|
1360
|
+
* New code:
|
|
1361
|
+
*
|
|
1362
|
+
* ```js
|
|
1363
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1364
|
+
*
|
|
1365
|
+
* //...
|
|
1366
|
+
*
|
|
1367
|
+
* const tween = new Tween(obj)
|
|
1368
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1369
|
+
*
|
|
1370
|
+
* //...
|
|
1371
|
+
*
|
|
1372
|
+
* const group = new Group()
|
|
1373
|
+
* group.add(tween)
|
|
1374
|
+
* group.add(tween2)
|
|
1375
|
+
*
|
|
1376
|
+
* //...
|
|
1377
|
+
*
|
|
1378
|
+
* requestAnimationFrame(function loop(time) {
|
|
1379
|
+
* group.update(time)
|
|
1380
|
+
* requestAnimationFrame(loop)
|
|
1381
|
+
* })
|
|
1382
|
+
* ```
|
|
1383
|
+
*/
|
|
890
1384
|
update: update,
|
|
891
1385
|
};
|
|
892
1386
|
|