@tweenjs/tween.js 23.1.3 → 25.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.esm.js CHANGED
@@ -223,33 +223,61 @@ var now = function () { return performance.now(); };
223
223
  */
224
224
  var Group = /** @class */ (function () {
225
225
  function Group() {
226
+ var tweens = [];
227
+ for (var _i = 0; _i < arguments.length; _i++) {
228
+ tweens[_i] = arguments[_i];
229
+ }
226
230
  this._tweens = {};
227
231
  this._tweensAddedDuringUpdate = {};
232
+ this.add.apply(this, tweens);
228
233
  }
229
234
  Group.prototype.getAll = function () {
230
235
  var _this = this;
231
- return Object.keys(this._tweens).map(function (tweenId) {
232
- return _this._tweens[tweenId];
233
- });
236
+ return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });
234
237
  };
235
238
  Group.prototype.removeAll = function () {
236
239
  this._tweens = {};
237
240
  };
238
- Group.prototype.add = function (tween) {
239
- this._tweens[tween.getId()] = tween;
240
- this._tweensAddedDuringUpdate[tween.getId()] = tween;
241
+ Group.prototype.add = function () {
242
+ var _a;
243
+ var tweens = [];
244
+ for (var _i = 0; _i < arguments.length; _i++) {
245
+ tweens[_i] = arguments[_i];
246
+ }
247
+ for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
248
+ var tween = tweens_1[_b];
249
+ // Remove from any other group first, a tween can only be in one group at a time.
250
+ // @ts-expect-error library internal access
251
+ (_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
252
+ // @ts-expect-error library internal access
253
+ tween._group = this;
254
+ this._tweens[tween.getId()] = tween;
255
+ this._tweensAddedDuringUpdate[tween.getId()] = tween;
256
+ }
257
+ };
258
+ Group.prototype.remove = function () {
259
+ var tweens = [];
260
+ for (var _i = 0; _i < arguments.length; _i++) {
261
+ tweens[_i] = arguments[_i];
262
+ }
263
+ for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
264
+ var tween = tweens_2[_a];
265
+ // @ts-expect-error library internal access
266
+ tween._group = undefined;
267
+ delete this._tweens[tween.getId()];
268
+ delete this._tweensAddedDuringUpdate[tween.getId()];
269
+ }
241
270
  };
242
- Group.prototype.remove = function (tween) {
243
- delete this._tweens[tween.getId()];
244
- delete this._tweensAddedDuringUpdate[tween.getId()];
271
+ /** Return true if all tweens in the group are not paused or playing. */
272
+ Group.prototype.allStopped = function () {
273
+ return this.getAll().every(function (tween) { return !tween.isPlaying(); });
245
274
  };
246
275
  Group.prototype.update = function (time, preserve) {
247
276
  if (time === void 0) { time = now(); }
248
- if (preserve === void 0) { preserve = false; }
277
+ if (preserve === void 0) { preserve = true; }
249
278
  var tweenIds = Object.keys(this._tweens);
250
- if (tweenIds.length === 0) {
251
- return false;
252
- }
279
+ if (tweenIds.length === 0)
280
+ return;
253
281
  // Tweens are updated in "batches". If you add a new tween during an
254
282
  // update, then the new tween will be updated in the next batch.
255
283
  // If you remove a tween during an update, it may or may not be updated.
@@ -260,13 +288,11 @@ var Group = /** @class */ (function () {
260
288
  for (var i = 0; i < tweenIds.length; i++) {
261
289
  var tween = this._tweens[tweenIds[i]];
262
290
  var autoStart = !preserve;
263
- if (tween && tween.update(time, autoStart) === false && !preserve) {
264
- delete this._tweens[tweenIds[i]];
265
- }
291
+ if (tween && tween.update(time, autoStart) === false && !preserve)
292
+ this.remove(tween);
266
293
  }
267
294
  tweenIds = Object.keys(this._tweensAddedDuringUpdate);
268
295
  }
269
- return true;
270
296
  };
271
297
  return Group;
272
298
  }());
@@ -375,10 +401,7 @@ var mainGroup = new Group();
375
401
  * Thank you all, you're awesome!
376
402
  */
377
403
  var Tween = /** @class */ (function () {
378
- function Tween(_object, _group) {
379
- if (_group === void 0) { _group = mainGroup; }
380
- this._object = _object;
381
- this._group = _group;
404
+ function Tween(object, group) {
382
405
  this._isPaused = false;
383
406
  this._pauseStart = 0;
384
407
  this._valuesStart = {};
@@ -403,6 +426,16 @@ var Tween = /** @class */ (function () {
403
426
  this._isChainStopped = false;
404
427
  this._propertiesAreSetUp = false;
405
428
  this._goToEnd = false;
429
+ this._object = object;
430
+ if (typeof group === 'object') {
431
+ this._group = group;
432
+ group.add(this);
433
+ }
434
+ // Use "true" to restore old behavior (will be removed in future release).
435
+ else if (group === true) {
436
+ this._group = mainGroup;
437
+ mainGroup.add(this);
438
+ }
406
439
  }
407
440
  Tween.prototype.getId = function () {
408
441
  return this._id;
@@ -441,8 +474,6 @@ var Tween = /** @class */ (function () {
441
474
  if (this._isPlaying) {
442
475
  return this;
443
476
  }
444
- // eslint-disable-next-line
445
- this._group && this._group.add(this);
446
477
  this._repeat = this._initialRepeat;
447
478
  if (this._reversed) {
448
479
  // If we were reversed (f.e. using the yoyo feature) then we need to
@@ -559,8 +590,6 @@ var Tween = /** @class */ (function () {
559
590
  if (!this._isPlaying) {
560
591
  return this;
561
592
  }
562
- // eslint-disable-next-line
563
- this._group && this._group.remove(this);
564
593
  this._isPlaying = false;
565
594
  this._isPaused = false;
566
595
  if (this._onStopCallback) {
@@ -570,7 +599,7 @@ var Tween = /** @class */ (function () {
570
599
  };
571
600
  Tween.prototype.end = function () {
572
601
  this._goToEnd = true;
573
- this.update(Infinity);
602
+ this.update(this._startTime + this._duration);
574
603
  return this;
575
604
  };
576
605
  Tween.prototype.pause = function (time) {
@@ -580,8 +609,6 @@ var Tween = /** @class */ (function () {
580
609
  }
581
610
  this._isPaused = true;
582
611
  this._pauseStart = time;
583
- // eslint-disable-next-line
584
- this._group && this._group.remove(this);
585
612
  return this;
586
613
  };
587
614
  Tween.prototype.resume = function (time) {
@@ -592,8 +619,6 @@ var Tween = /** @class */ (function () {
592
619
  this._isPaused = false;
593
620
  this._startTime += time - this._pauseStart;
594
621
  this._pauseStart = 0;
595
- // eslint-disable-next-line
596
- this._group && this._group.add(this);
597
622
  return this;
598
623
  };
599
624
  Tween.prototype.stopChainedTweens = function () {
@@ -603,8 +628,19 @@ var Tween = /** @class */ (function () {
603
628
  return this;
604
629
  };
605
630
  Tween.prototype.group = function (group) {
606
- if (group === void 0) { group = mainGroup; }
607
- this._group = group;
631
+ if (!group) {
632
+ console.warn('tween.group() without args has been removed, use group.add(tween) instead.');
633
+ return this;
634
+ }
635
+ group.add(this);
636
+ return this;
637
+ };
638
+ /**
639
+ * Removes the tween from whichever group it is in.
640
+ */
641
+ Tween.prototype.remove = function () {
642
+ var _a;
643
+ (_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
608
644
  return this;
609
645
  };
610
646
  Tween.prototype.delay = function (amount) {
@@ -674,21 +710,24 @@ var Tween = /** @class */ (function () {
674
710
  * @returns true if the tween is still playing after the update, false
675
711
  * otherwise (calling update on a paused tween still returns true because
676
712
  * it is still playing, just paused).
713
+ *
714
+ * @param autoStart - When true, calling update will implicitly call start()
715
+ * as well. Note, if you stop() or end() the tween, but are still calling
716
+ * update(), it will start again!
677
717
  */
678
718
  Tween.prototype.update = function (time, autoStart) {
679
719
  var _this = this;
680
720
  var _a;
681
721
  if (time === void 0) { time = now(); }
682
- if (autoStart === void 0) { autoStart = true; }
722
+ if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }
683
723
  if (this._isPaused)
684
724
  return true;
685
725
  var property;
686
- var endTime = this._startTime + this._duration;
687
726
  if (!this._goToEnd && !this._isPlaying) {
688
- if (time > endTime)
689
- return false;
690
727
  if (autoStart)
691
728
  this.start(time, true);
729
+ else
730
+ return false;
692
731
  }
693
732
  this._goToEnd = false;
694
733
  if (time < this._startTime) {
@@ -827,10 +866,11 @@ var Tween = /** @class */ (function () {
827
866
  }
828
867
  this._valuesEnd[property] = tmp;
829
868
  };
869
+ Tween.autoStartOnUpdate = false;
830
870
  return Tween;
831
871
  }());
832
872
 
833
- var VERSION = '23.1.3';
873
+ var VERSION = '25.0.0';
834
874
 
835
875
  /**
836
876
  * Tween.js - Licensed under the MIT license
@@ -852,10 +892,245 @@ var TWEEN = mainGroup;
852
892
  // Modules and CommonJS, without build hacks, and so as not to break the
853
893
  // existing API.
854
894
  // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
895
+ /**
896
+ * @deprecated The global TWEEN Group will be removed in a following major
897
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
898
+ * group.
899
+ *
900
+ * Old code:
901
+ *
902
+ * ```js
903
+ * import * as TWEEN from '@tweenjs/tween.js'
904
+ *
905
+ * //...
906
+ *
907
+ * const tween = new TWEEN.Tween(obj)
908
+ * const tween2 = new TWEEN.Tween(obj2)
909
+ *
910
+ * //...
911
+ *
912
+ * requestAnimationFrame(function loop(time) {
913
+ * TWEEN.update(time)
914
+ * requestAnimationFrame(loop)
915
+ * })
916
+ * ```
917
+ *
918
+ * New code:
919
+ *
920
+ * ```js
921
+ * import {Tween, Group} from '@tweenjs/tween.js'
922
+ *
923
+ * //...
924
+ *
925
+ * const tween = new Tween(obj)
926
+ * const tween2 = new TWEEN.Tween(obj2)
927
+ *
928
+ * //...
929
+ *
930
+ * const group = new Group()
931
+ * group.add(tween)
932
+ * group.add(tween2)
933
+ *
934
+ * //...
935
+ *
936
+ * requestAnimationFrame(function loop(time) {
937
+ * group.update(time)
938
+ * requestAnimationFrame(loop)
939
+ * })
940
+ * ```
941
+ */
855
942
  var getAll = TWEEN.getAll.bind(TWEEN);
943
+ /**
944
+ * @deprecated The global TWEEN Group will be removed in a following major
945
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
946
+ * group.
947
+ *
948
+ * Old code:
949
+ *
950
+ * ```js
951
+ * import * as TWEEN from '@tweenjs/tween.js'
952
+ *
953
+ * //...
954
+ *
955
+ * const tween = new TWEEN.Tween(obj)
956
+ * const tween2 = new TWEEN.Tween(obj2)
957
+ *
958
+ * //...
959
+ *
960
+ * requestAnimationFrame(function loop(time) {
961
+ * TWEEN.update(time)
962
+ * requestAnimationFrame(loop)
963
+ * })
964
+ * ```
965
+ *
966
+ * New code:
967
+ *
968
+ * ```js
969
+ * import {Tween, Group} from '@tweenjs/tween.js'
970
+ *
971
+ * //...
972
+ *
973
+ * const tween = new Tween(obj)
974
+ * const tween2 = new TWEEN.Tween(obj2)
975
+ *
976
+ * //...
977
+ *
978
+ * const group = new Group()
979
+ * group.add(tween)
980
+ * group.add(tween2)
981
+ *
982
+ * //...
983
+ *
984
+ * requestAnimationFrame(function loop(time) {
985
+ * group.update(time)
986
+ * requestAnimationFrame(loop)
987
+ * })
988
+ * ```
989
+ */
856
990
  var removeAll = TWEEN.removeAll.bind(TWEEN);
991
+ /**
992
+ * @deprecated The global TWEEN Group will be removed in a following major
993
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
994
+ * group.
995
+ *
996
+ * Old code:
997
+ *
998
+ * ```js
999
+ * import * as TWEEN from '@tweenjs/tween.js'
1000
+ *
1001
+ * //...
1002
+ *
1003
+ * const tween = new TWEEN.Tween(obj)
1004
+ * const tween2 = new TWEEN.Tween(obj2)
1005
+ *
1006
+ * //...
1007
+ *
1008
+ * requestAnimationFrame(function loop(time) {
1009
+ * TWEEN.update(time)
1010
+ * requestAnimationFrame(loop)
1011
+ * })
1012
+ * ```
1013
+ *
1014
+ * New code:
1015
+ *
1016
+ * ```js
1017
+ * import {Tween, Group} from '@tweenjs/tween.js'
1018
+ *
1019
+ * //...
1020
+ *
1021
+ * const tween = new Tween(obj)
1022
+ * const tween2 = new TWEEN.Tween(obj2)
1023
+ *
1024
+ * //...
1025
+ *
1026
+ * const group = new Group()
1027
+ * group.add(tween)
1028
+ * group.add(tween2)
1029
+ *
1030
+ * //...
1031
+ *
1032
+ * requestAnimationFrame(function loop(time) {
1033
+ * group.update(time)
1034
+ * requestAnimationFrame(loop)
1035
+ * })
1036
+ * ```
1037
+ */
857
1038
  var add = TWEEN.add.bind(TWEEN);
1039
+ /**
1040
+ * @deprecated The global TWEEN Group will be removed in a following major
1041
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1042
+ * group.
1043
+ *
1044
+ * Old code:
1045
+ *
1046
+ * ```js
1047
+ * import * as TWEEN from '@tweenjs/tween.js'
1048
+ *
1049
+ * //...
1050
+ *
1051
+ * const tween = new TWEEN.Tween(obj)
1052
+ * const tween2 = new TWEEN.Tween(obj2)
1053
+ *
1054
+ * //...
1055
+ *
1056
+ * requestAnimationFrame(function loop(time) {
1057
+ * TWEEN.update(time)
1058
+ * requestAnimationFrame(loop)
1059
+ * })
1060
+ * ```
1061
+ *
1062
+ * New code:
1063
+ *
1064
+ * ```js
1065
+ * import {Tween, Group} from '@tweenjs/tween.js'
1066
+ *
1067
+ * //...
1068
+ *
1069
+ * const tween = new Tween(obj)
1070
+ * const tween2 = new TWEEN.Tween(obj2)
1071
+ *
1072
+ * //...
1073
+ *
1074
+ * const group = new Group()
1075
+ * group.add(tween)
1076
+ * group.add(tween2)
1077
+ *
1078
+ * //...
1079
+ *
1080
+ * requestAnimationFrame(function loop(time) {
1081
+ * group.update(time)
1082
+ * requestAnimationFrame(loop)
1083
+ * })
1084
+ * ```
1085
+ */
858
1086
  var remove = TWEEN.remove.bind(TWEEN);
1087
+ /**
1088
+ * @deprecated The global TWEEN Group will be removed in a following major
1089
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1090
+ * group.
1091
+ *
1092
+ * Old code:
1093
+ *
1094
+ * ```js
1095
+ * import * as TWEEN from '@tweenjs/tween.js'
1096
+ *
1097
+ * //...
1098
+ *
1099
+ * const tween = new TWEEN.Tween(obj)
1100
+ * const tween2 = new TWEEN.Tween(obj2)
1101
+ *
1102
+ * //...
1103
+ *
1104
+ * requestAnimationFrame(function loop(time) {
1105
+ * TWEEN.update(time)
1106
+ * requestAnimationFrame(loop)
1107
+ * })
1108
+ * ```
1109
+ *
1110
+ * New code:
1111
+ *
1112
+ * ```js
1113
+ * import {Tween, Group} from '@tweenjs/tween.js'
1114
+ *
1115
+ * //...
1116
+ *
1117
+ * const tween = new Tween(obj)
1118
+ * const tween2 = new TWEEN.Tween(obj2)
1119
+ *
1120
+ * //...
1121
+ *
1122
+ * const group = new Group()
1123
+ * group.add(tween)
1124
+ * group.add(tween2)
1125
+ *
1126
+ * //...
1127
+ *
1128
+ * requestAnimationFrame(function loop(time) {
1129
+ * group.update(time)
1130
+ * requestAnimationFrame(loop)
1131
+ * })
1132
+ * ```
1133
+ */
859
1134
  var update = TWEEN.update.bind(TWEEN);
860
1135
  var exports = {
861
1136
  Easing: Easing,
@@ -866,10 +1141,245 @@ var exports = {
866
1141
  nextId: nextId,
867
1142
  Tween: Tween,
868
1143
  VERSION: VERSION,
1144
+ /**
1145
+ * @deprecated The global TWEEN Group will be removed in a following major
1146
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1147
+ * group.
1148
+ *
1149
+ * Old code:
1150
+ *
1151
+ * ```js
1152
+ * import * as TWEEN from '@tweenjs/tween.js'
1153
+ *
1154
+ * //...
1155
+ *
1156
+ * const tween = new TWEEN.Tween(obj)
1157
+ * const tween2 = new TWEEN.Tween(obj2)
1158
+ *
1159
+ * //...
1160
+ *
1161
+ * requestAnimationFrame(function loop(time) {
1162
+ * TWEEN.update(time)
1163
+ * requestAnimationFrame(loop)
1164
+ * })
1165
+ * ```
1166
+ *
1167
+ * New code:
1168
+ *
1169
+ * ```js
1170
+ * import {Tween, Group} from '@tweenjs/tween.js'
1171
+ *
1172
+ * //...
1173
+ *
1174
+ * const tween = new Tween(obj)
1175
+ * const tween2 = new TWEEN.Tween(obj2)
1176
+ *
1177
+ * //...
1178
+ *
1179
+ * const group = new Group()
1180
+ * group.add(tween)
1181
+ * group.add(tween2)
1182
+ *
1183
+ * //...
1184
+ *
1185
+ * requestAnimationFrame(function loop(time) {
1186
+ * group.update(time)
1187
+ * requestAnimationFrame(loop)
1188
+ * })
1189
+ * ```
1190
+ */
869
1191
  getAll: getAll,
1192
+ /**
1193
+ * @deprecated The global TWEEN Group will be removed in a following major
1194
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1195
+ * group.
1196
+ *
1197
+ * Old code:
1198
+ *
1199
+ * ```js
1200
+ * import * as TWEEN from '@tweenjs/tween.js'
1201
+ *
1202
+ * //...
1203
+ *
1204
+ * const tween = new TWEEN.Tween(obj)
1205
+ * const tween2 = new TWEEN.Tween(obj2)
1206
+ *
1207
+ * //...
1208
+ *
1209
+ * requestAnimationFrame(function loop(time) {
1210
+ * TWEEN.update(time)
1211
+ * requestAnimationFrame(loop)
1212
+ * })
1213
+ * ```
1214
+ *
1215
+ * New code:
1216
+ *
1217
+ * ```js
1218
+ * import {Tween, Group} from '@tweenjs/tween.js'
1219
+ *
1220
+ * //...
1221
+ *
1222
+ * const tween = new Tween(obj)
1223
+ * const tween2 = new TWEEN.Tween(obj2)
1224
+ *
1225
+ * //...
1226
+ *
1227
+ * const group = new Group()
1228
+ * group.add(tween)
1229
+ * group.add(tween2)
1230
+ *
1231
+ * //...
1232
+ *
1233
+ * requestAnimationFrame(function loop(time) {
1234
+ * group.update(time)
1235
+ * requestAnimationFrame(loop)
1236
+ * })
1237
+ * ```
1238
+ */
870
1239
  removeAll: removeAll,
1240
+ /**
1241
+ * @deprecated The global TWEEN Group will be removed in a following major
1242
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1243
+ * group.
1244
+ *
1245
+ * Old code:
1246
+ *
1247
+ * ```js
1248
+ * import * as TWEEN from '@tweenjs/tween.js'
1249
+ *
1250
+ * //...
1251
+ *
1252
+ * const tween = new TWEEN.Tween(obj)
1253
+ * const tween2 = new TWEEN.Tween(obj2)
1254
+ *
1255
+ * //...
1256
+ *
1257
+ * requestAnimationFrame(function loop(time) {
1258
+ * TWEEN.update(time)
1259
+ * requestAnimationFrame(loop)
1260
+ * })
1261
+ * ```
1262
+ *
1263
+ * New code:
1264
+ *
1265
+ * ```js
1266
+ * import {Tween, Group} from '@tweenjs/tween.js'
1267
+ *
1268
+ * //...
1269
+ *
1270
+ * const tween = new Tween(obj)
1271
+ * const tween2 = new TWEEN.Tween(obj2)
1272
+ *
1273
+ * //...
1274
+ *
1275
+ * const group = new Group()
1276
+ * group.add(tween)
1277
+ * group.add(tween2)
1278
+ *
1279
+ * //...
1280
+ *
1281
+ * requestAnimationFrame(function loop(time) {
1282
+ * group.update(time)
1283
+ * requestAnimationFrame(loop)
1284
+ * })
1285
+ * ```
1286
+ */
871
1287
  add: add,
1288
+ /**
1289
+ * @deprecated The global TWEEN Group will be removed in a following major
1290
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1291
+ * group.
1292
+ *
1293
+ * Old code:
1294
+ *
1295
+ * ```js
1296
+ * import * as TWEEN from '@tweenjs/tween.js'
1297
+ *
1298
+ * //...
1299
+ *
1300
+ * const tween = new TWEEN.Tween(obj)
1301
+ * const tween2 = new TWEEN.Tween(obj2)
1302
+ *
1303
+ * //...
1304
+ *
1305
+ * requestAnimationFrame(function loop(time) {
1306
+ * TWEEN.update(time)
1307
+ * requestAnimationFrame(loop)
1308
+ * })
1309
+ * ```
1310
+ *
1311
+ * New code:
1312
+ *
1313
+ * ```js
1314
+ * import {Tween, Group} from '@tweenjs/tween.js'
1315
+ *
1316
+ * //...
1317
+ *
1318
+ * const tween = new Tween(obj)
1319
+ * const tween2 = new TWEEN.Tween(obj2)
1320
+ *
1321
+ * //...
1322
+ *
1323
+ * const group = new Group()
1324
+ * group.add(tween)
1325
+ * group.add(tween2)
1326
+ *
1327
+ * //...
1328
+ *
1329
+ * requestAnimationFrame(function loop(time) {
1330
+ * group.update(time)
1331
+ * requestAnimationFrame(loop)
1332
+ * })
1333
+ * ```
1334
+ */
872
1335
  remove: remove,
1336
+ /**
1337
+ * @deprecated The global TWEEN Group will be removed in a following major
1338
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1339
+ * group.
1340
+ *
1341
+ * Old code:
1342
+ *
1343
+ * ```js
1344
+ * import * as TWEEN from '@tweenjs/tween.js'
1345
+ *
1346
+ * //...
1347
+ *
1348
+ * const tween = new TWEEN.Tween(obj)
1349
+ * const tween2 = new TWEEN.Tween(obj2)
1350
+ *
1351
+ * //...
1352
+ *
1353
+ * requestAnimationFrame(function loop(time) {
1354
+ * TWEEN.update(time)
1355
+ * requestAnimationFrame(loop)
1356
+ * })
1357
+ * ```
1358
+ *
1359
+ * New code:
1360
+ *
1361
+ * ```js
1362
+ * import {Tween, Group} from '@tweenjs/tween.js'
1363
+ *
1364
+ * //...
1365
+ *
1366
+ * const tween = new Tween(obj)
1367
+ * const tween2 = new TWEEN.Tween(obj2)
1368
+ *
1369
+ * //...
1370
+ *
1371
+ * const group = new Group()
1372
+ * group.add(tween)
1373
+ * group.add(tween2)
1374
+ *
1375
+ * //...
1376
+ *
1377
+ * requestAnimationFrame(function loop(time) {
1378
+ * group.update(time)
1379
+ * requestAnimationFrame(loop)
1380
+ * })
1381
+ * ```
1382
+ */
873
1383
  update: update,
874
1384
  };
875
1385