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