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