@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/README.md +191 -103
- package/dist/tween.amd.js +547 -37
- package/dist/tween.cjs +547 -37
- package/dist/tween.d.ts +546 -30
- package/dist/tween.esm.js +547 -37
- package/dist/tween.umd.js +547 -37
- package/package.json +1 -1
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 (
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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 =
|
|
281
|
+
if (preserve === void 0) { preserve = true; }
|
|
253
282
|
var tweenIds = Object.keys(this._tweens);
|
|
254
|
-
if (tweenIds.length === 0)
|
|
255
|
-
return
|
|
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
|
-
|
|
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(
|
|
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) {
|
|
@@ -574,7 +603,7 @@ var Tween = /** @class */ (function () {
|
|
|
574
603
|
};
|
|
575
604
|
Tween.prototype.end = function () {
|
|
576
605
|
this._goToEnd = true;
|
|
577
|
-
this.update(
|
|
606
|
+
this.update(this._startTime + this._duration);
|
|
578
607
|
return this;
|
|
579
608
|
};
|
|
580
609
|
Tween.prototype.pause = function (time) {
|
|
@@ -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
|
|
611
|
-
|
|
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) {
|
|
@@ -678,21 +714,24 @@ var Tween = /** @class */ (function () {
|
|
|
678
714
|
* @returns true if the tween is still playing after the update, false
|
|
679
715
|
* otherwise (calling update on a paused tween still returns true because
|
|
680
716
|
* it is still playing, just paused).
|
|
717
|
+
*
|
|
718
|
+
* @param autoStart - When true, calling update will implicitly call start()
|
|
719
|
+
* as well. Note, if you stop() or end() the tween, but are still calling
|
|
720
|
+
* update(), it will start again!
|
|
681
721
|
*/
|
|
682
722
|
Tween.prototype.update = function (time, autoStart) {
|
|
683
723
|
var _this = this;
|
|
684
724
|
var _a;
|
|
685
725
|
if (time === void 0) { time = now(); }
|
|
686
|
-
if (autoStart === void 0) { autoStart =
|
|
726
|
+
if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }
|
|
687
727
|
if (this._isPaused)
|
|
688
728
|
return true;
|
|
689
729
|
var property;
|
|
690
|
-
var endTime = this._startTime + this._duration;
|
|
691
730
|
if (!this._goToEnd && !this._isPlaying) {
|
|
692
|
-
if (time > endTime)
|
|
693
|
-
return false;
|
|
694
731
|
if (autoStart)
|
|
695
732
|
this.start(time, true);
|
|
733
|
+
else
|
|
734
|
+
return false;
|
|
696
735
|
}
|
|
697
736
|
this._goToEnd = false;
|
|
698
737
|
if (time < this._startTime) {
|
|
@@ -831,10 +870,11 @@ var Tween = /** @class */ (function () {
|
|
|
831
870
|
}
|
|
832
871
|
this._valuesEnd[property] = tmp;
|
|
833
872
|
};
|
|
873
|
+
Tween.autoStartOnUpdate = false;
|
|
834
874
|
return Tween;
|
|
835
875
|
}());
|
|
836
876
|
|
|
837
|
-
var VERSION = '
|
|
877
|
+
var VERSION = '25.0.0';
|
|
838
878
|
|
|
839
879
|
/**
|
|
840
880
|
* Tween.js - Licensed under the MIT license
|
|
@@ -856,10 +896,245 @@ var TWEEN = mainGroup;
|
|
|
856
896
|
// Modules and CommonJS, without build hacks, and so as not to break the
|
|
857
897
|
// existing API.
|
|
858
898
|
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
|
899
|
+
/**
|
|
900
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
901
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
902
|
+
* group.
|
|
903
|
+
*
|
|
904
|
+
* Old code:
|
|
905
|
+
*
|
|
906
|
+
* ```js
|
|
907
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
908
|
+
*
|
|
909
|
+
* //...
|
|
910
|
+
*
|
|
911
|
+
* const tween = new TWEEN.Tween(obj)
|
|
912
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
913
|
+
*
|
|
914
|
+
* //...
|
|
915
|
+
*
|
|
916
|
+
* requestAnimationFrame(function loop(time) {
|
|
917
|
+
* TWEEN.update(time)
|
|
918
|
+
* requestAnimationFrame(loop)
|
|
919
|
+
* })
|
|
920
|
+
* ```
|
|
921
|
+
*
|
|
922
|
+
* New code:
|
|
923
|
+
*
|
|
924
|
+
* ```js
|
|
925
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
926
|
+
*
|
|
927
|
+
* //...
|
|
928
|
+
*
|
|
929
|
+
* const tween = new Tween(obj)
|
|
930
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
931
|
+
*
|
|
932
|
+
* //...
|
|
933
|
+
*
|
|
934
|
+
* const group = new Group()
|
|
935
|
+
* group.add(tween)
|
|
936
|
+
* group.add(tween2)
|
|
937
|
+
*
|
|
938
|
+
* //...
|
|
939
|
+
*
|
|
940
|
+
* requestAnimationFrame(function loop(time) {
|
|
941
|
+
* group.update(time)
|
|
942
|
+
* requestAnimationFrame(loop)
|
|
943
|
+
* })
|
|
944
|
+
* ```
|
|
945
|
+
*/
|
|
859
946
|
var getAll = TWEEN.getAll.bind(TWEEN);
|
|
947
|
+
/**
|
|
948
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
949
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
950
|
+
* group.
|
|
951
|
+
*
|
|
952
|
+
* Old code:
|
|
953
|
+
*
|
|
954
|
+
* ```js
|
|
955
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
956
|
+
*
|
|
957
|
+
* //...
|
|
958
|
+
*
|
|
959
|
+
* const tween = new TWEEN.Tween(obj)
|
|
960
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
961
|
+
*
|
|
962
|
+
* //...
|
|
963
|
+
*
|
|
964
|
+
* requestAnimationFrame(function loop(time) {
|
|
965
|
+
* TWEEN.update(time)
|
|
966
|
+
* requestAnimationFrame(loop)
|
|
967
|
+
* })
|
|
968
|
+
* ```
|
|
969
|
+
*
|
|
970
|
+
* New code:
|
|
971
|
+
*
|
|
972
|
+
* ```js
|
|
973
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
974
|
+
*
|
|
975
|
+
* //...
|
|
976
|
+
*
|
|
977
|
+
* const tween = new Tween(obj)
|
|
978
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
979
|
+
*
|
|
980
|
+
* //...
|
|
981
|
+
*
|
|
982
|
+
* const group = new Group()
|
|
983
|
+
* group.add(tween)
|
|
984
|
+
* group.add(tween2)
|
|
985
|
+
*
|
|
986
|
+
* //...
|
|
987
|
+
*
|
|
988
|
+
* requestAnimationFrame(function loop(time) {
|
|
989
|
+
* group.update(time)
|
|
990
|
+
* requestAnimationFrame(loop)
|
|
991
|
+
* })
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
860
994
|
var removeAll = TWEEN.removeAll.bind(TWEEN);
|
|
995
|
+
/**
|
|
996
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
997
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
998
|
+
* group.
|
|
999
|
+
*
|
|
1000
|
+
* Old code:
|
|
1001
|
+
*
|
|
1002
|
+
* ```js
|
|
1003
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1004
|
+
*
|
|
1005
|
+
* //...
|
|
1006
|
+
*
|
|
1007
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1008
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1009
|
+
*
|
|
1010
|
+
* //...
|
|
1011
|
+
*
|
|
1012
|
+
* requestAnimationFrame(function loop(time) {
|
|
1013
|
+
* TWEEN.update(time)
|
|
1014
|
+
* requestAnimationFrame(loop)
|
|
1015
|
+
* })
|
|
1016
|
+
* ```
|
|
1017
|
+
*
|
|
1018
|
+
* New code:
|
|
1019
|
+
*
|
|
1020
|
+
* ```js
|
|
1021
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1022
|
+
*
|
|
1023
|
+
* //...
|
|
1024
|
+
*
|
|
1025
|
+
* const tween = new Tween(obj)
|
|
1026
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1027
|
+
*
|
|
1028
|
+
* //...
|
|
1029
|
+
*
|
|
1030
|
+
* const group = new Group()
|
|
1031
|
+
* group.add(tween)
|
|
1032
|
+
* group.add(tween2)
|
|
1033
|
+
*
|
|
1034
|
+
* //...
|
|
1035
|
+
*
|
|
1036
|
+
* requestAnimationFrame(function loop(time) {
|
|
1037
|
+
* group.update(time)
|
|
1038
|
+
* requestAnimationFrame(loop)
|
|
1039
|
+
* })
|
|
1040
|
+
* ```
|
|
1041
|
+
*/
|
|
861
1042
|
var add = TWEEN.add.bind(TWEEN);
|
|
1043
|
+
/**
|
|
1044
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1045
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1046
|
+
* group.
|
|
1047
|
+
*
|
|
1048
|
+
* Old code:
|
|
1049
|
+
*
|
|
1050
|
+
* ```js
|
|
1051
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1052
|
+
*
|
|
1053
|
+
* //...
|
|
1054
|
+
*
|
|
1055
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1056
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1057
|
+
*
|
|
1058
|
+
* //...
|
|
1059
|
+
*
|
|
1060
|
+
* requestAnimationFrame(function loop(time) {
|
|
1061
|
+
* TWEEN.update(time)
|
|
1062
|
+
* requestAnimationFrame(loop)
|
|
1063
|
+
* })
|
|
1064
|
+
* ```
|
|
1065
|
+
*
|
|
1066
|
+
* New code:
|
|
1067
|
+
*
|
|
1068
|
+
* ```js
|
|
1069
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1070
|
+
*
|
|
1071
|
+
* //...
|
|
1072
|
+
*
|
|
1073
|
+
* const tween = new Tween(obj)
|
|
1074
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1075
|
+
*
|
|
1076
|
+
* //...
|
|
1077
|
+
*
|
|
1078
|
+
* const group = new Group()
|
|
1079
|
+
* group.add(tween)
|
|
1080
|
+
* group.add(tween2)
|
|
1081
|
+
*
|
|
1082
|
+
* //...
|
|
1083
|
+
*
|
|
1084
|
+
* requestAnimationFrame(function loop(time) {
|
|
1085
|
+
* group.update(time)
|
|
1086
|
+
* requestAnimationFrame(loop)
|
|
1087
|
+
* })
|
|
1088
|
+
* ```
|
|
1089
|
+
*/
|
|
862
1090
|
var remove = TWEEN.remove.bind(TWEEN);
|
|
1091
|
+
/**
|
|
1092
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1093
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1094
|
+
* group.
|
|
1095
|
+
*
|
|
1096
|
+
* Old code:
|
|
1097
|
+
*
|
|
1098
|
+
* ```js
|
|
1099
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1100
|
+
*
|
|
1101
|
+
* //...
|
|
1102
|
+
*
|
|
1103
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1104
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1105
|
+
*
|
|
1106
|
+
* //...
|
|
1107
|
+
*
|
|
1108
|
+
* requestAnimationFrame(function loop(time) {
|
|
1109
|
+
* TWEEN.update(time)
|
|
1110
|
+
* requestAnimationFrame(loop)
|
|
1111
|
+
* })
|
|
1112
|
+
* ```
|
|
1113
|
+
*
|
|
1114
|
+
* New code:
|
|
1115
|
+
*
|
|
1116
|
+
* ```js
|
|
1117
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1118
|
+
*
|
|
1119
|
+
* //...
|
|
1120
|
+
*
|
|
1121
|
+
* const tween = new Tween(obj)
|
|
1122
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1123
|
+
*
|
|
1124
|
+
* //...
|
|
1125
|
+
*
|
|
1126
|
+
* const group = new Group()
|
|
1127
|
+
* group.add(tween)
|
|
1128
|
+
* group.add(tween2)
|
|
1129
|
+
*
|
|
1130
|
+
* //...
|
|
1131
|
+
*
|
|
1132
|
+
* requestAnimationFrame(function loop(time) {
|
|
1133
|
+
* group.update(time)
|
|
1134
|
+
* requestAnimationFrame(loop)
|
|
1135
|
+
* })
|
|
1136
|
+
* ```
|
|
1137
|
+
*/
|
|
863
1138
|
var update = TWEEN.update.bind(TWEEN);
|
|
864
1139
|
var exports$1 = {
|
|
865
1140
|
Easing: Easing,
|
|
@@ -870,10 +1145,245 @@ var exports$1 = {
|
|
|
870
1145
|
nextId: nextId,
|
|
871
1146
|
Tween: Tween,
|
|
872
1147
|
VERSION: VERSION,
|
|
1148
|
+
/**
|
|
1149
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1150
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1151
|
+
* group.
|
|
1152
|
+
*
|
|
1153
|
+
* Old code:
|
|
1154
|
+
*
|
|
1155
|
+
* ```js
|
|
1156
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1157
|
+
*
|
|
1158
|
+
* //...
|
|
1159
|
+
*
|
|
1160
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1161
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1162
|
+
*
|
|
1163
|
+
* //...
|
|
1164
|
+
*
|
|
1165
|
+
* requestAnimationFrame(function loop(time) {
|
|
1166
|
+
* TWEEN.update(time)
|
|
1167
|
+
* requestAnimationFrame(loop)
|
|
1168
|
+
* })
|
|
1169
|
+
* ```
|
|
1170
|
+
*
|
|
1171
|
+
* New code:
|
|
1172
|
+
*
|
|
1173
|
+
* ```js
|
|
1174
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1175
|
+
*
|
|
1176
|
+
* //...
|
|
1177
|
+
*
|
|
1178
|
+
* const tween = new Tween(obj)
|
|
1179
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1180
|
+
*
|
|
1181
|
+
* //...
|
|
1182
|
+
*
|
|
1183
|
+
* const group = new Group()
|
|
1184
|
+
* group.add(tween)
|
|
1185
|
+
* group.add(tween2)
|
|
1186
|
+
*
|
|
1187
|
+
* //...
|
|
1188
|
+
*
|
|
1189
|
+
* requestAnimationFrame(function loop(time) {
|
|
1190
|
+
* group.update(time)
|
|
1191
|
+
* requestAnimationFrame(loop)
|
|
1192
|
+
* })
|
|
1193
|
+
* ```
|
|
1194
|
+
*/
|
|
873
1195
|
getAll: getAll,
|
|
1196
|
+
/**
|
|
1197
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1198
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1199
|
+
* group.
|
|
1200
|
+
*
|
|
1201
|
+
* Old code:
|
|
1202
|
+
*
|
|
1203
|
+
* ```js
|
|
1204
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1205
|
+
*
|
|
1206
|
+
* //...
|
|
1207
|
+
*
|
|
1208
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1209
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1210
|
+
*
|
|
1211
|
+
* //...
|
|
1212
|
+
*
|
|
1213
|
+
* requestAnimationFrame(function loop(time) {
|
|
1214
|
+
* TWEEN.update(time)
|
|
1215
|
+
* requestAnimationFrame(loop)
|
|
1216
|
+
* })
|
|
1217
|
+
* ```
|
|
1218
|
+
*
|
|
1219
|
+
* New code:
|
|
1220
|
+
*
|
|
1221
|
+
* ```js
|
|
1222
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1223
|
+
*
|
|
1224
|
+
* //...
|
|
1225
|
+
*
|
|
1226
|
+
* const tween = new Tween(obj)
|
|
1227
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1228
|
+
*
|
|
1229
|
+
* //...
|
|
1230
|
+
*
|
|
1231
|
+
* const group = new Group()
|
|
1232
|
+
* group.add(tween)
|
|
1233
|
+
* group.add(tween2)
|
|
1234
|
+
*
|
|
1235
|
+
* //...
|
|
1236
|
+
*
|
|
1237
|
+
* requestAnimationFrame(function loop(time) {
|
|
1238
|
+
* group.update(time)
|
|
1239
|
+
* requestAnimationFrame(loop)
|
|
1240
|
+
* })
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
874
1243
|
removeAll: removeAll,
|
|
1244
|
+
/**
|
|
1245
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1246
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1247
|
+
* group.
|
|
1248
|
+
*
|
|
1249
|
+
* Old code:
|
|
1250
|
+
*
|
|
1251
|
+
* ```js
|
|
1252
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1253
|
+
*
|
|
1254
|
+
* //...
|
|
1255
|
+
*
|
|
1256
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1257
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1258
|
+
*
|
|
1259
|
+
* //...
|
|
1260
|
+
*
|
|
1261
|
+
* requestAnimationFrame(function loop(time) {
|
|
1262
|
+
* TWEEN.update(time)
|
|
1263
|
+
* requestAnimationFrame(loop)
|
|
1264
|
+
* })
|
|
1265
|
+
* ```
|
|
1266
|
+
*
|
|
1267
|
+
* New code:
|
|
1268
|
+
*
|
|
1269
|
+
* ```js
|
|
1270
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1271
|
+
*
|
|
1272
|
+
* //...
|
|
1273
|
+
*
|
|
1274
|
+
* const tween = new Tween(obj)
|
|
1275
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1276
|
+
*
|
|
1277
|
+
* //...
|
|
1278
|
+
*
|
|
1279
|
+
* const group = new Group()
|
|
1280
|
+
* group.add(tween)
|
|
1281
|
+
* group.add(tween2)
|
|
1282
|
+
*
|
|
1283
|
+
* //...
|
|
1284
|
+
*
|
|
1285
|
+
* requestAnimationFrame(function loop(time) {
|
|
1286
|
+
* group.update(time)
|
|
1287
|
+
* requestAnimationFrame(loop)
|
|
1288
|
+
* })
|
|
1289
|
+
* ```
|
|
1290
|
+
*/
|
|
875
1291
|
add: add,
|
|
1292
|
+
/**
|
|
1293
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1294
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1295
|
+
* group.
|
|
1296
|
+
*
|
|
1297
|
+
* Old code:
|
|
1298
|
+
*
|
|
1299
|
+
* ```js
|
|
1300
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1301
|
+
*
|
|
1302
|
+
* //...
|
|
1303
|
+
*
|
|
1304
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1305
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1306
|
+
*
|
|
1307
|
+
* //...
|
|
1308
|
+
*
|
|
1309
|
+
* requestAnimationFrame(function loop(time) {
|
|
1310
|
+
* TWEEN.update(time)
|
|
1311
|
+
* requestAnimationFrame(loop)
|
|
1312
|
+
* })
|
|
1313
|
+
* ```
|
|
1314
|
+
*
|
|
1315
|
+
* New code:
|
|
1316
|
+
*
|
|
1317
|
+
* ```js
|
|
1318
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1319
|
+
*
|
|
1320
|
+
* //...
|
|
1321
|
+
*
|
|
1322
|
+
* const tween = new Tween(obj)
|
|
1323
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1324
|
+
*
|
|
1325
|
+
* //...
|
|
1326
|
+
*
|
|
1327
|
+
* const group = new Group()
|
|
1328
|
+
* group.add(tween)
|
|
1329
|
+
* group.add(tween2)
|
|
1330
|
+
*
|
|
1331
|
+
* //...
|
|
1332
|
+
*
|
|
1333
|
+
* requestAnimationFrame(function loop(time) {
|
|
1334
|
+
* group.update(time)
|
|
1335
|
+
* requestAnimationFrame(loop)
|
|
1336
|
+
* })
|
|
1337
|
+
* ```
|
|
1338
|
+
*/
|
|
876
1339
|
remove: remove,
|
|
1340
|
+
/**
|
|
1341
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
1342
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
1343
|
+
* group.
|
|
1344
|
+
*
|
|
1345
|
+
* Old code:
|
|
1346
|
+
*
|
|
1347
|
+
* ```js
|
|
1348
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
1349
|
+
*
|
|
1350
|
+
* //...
|
|
1351
|
+
*
|
|
1352
|
+
* const tween = new TWEEN.Tween(obj)
|
|
1353
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1354
|
+
*
|
|
1355
|
+
* //...
|
|
1356
|
+
*
|
|
1357
|
+
* requestAnimationFrame(function loop(time) {
|
|
1358
|
+
* TWEEN.update(time)
|
|
1359
|
+
* requestAnimationFrame(loop)
|
|
1360
|
+
* })
|
|
1361
|
+
* ```
|
|
1362
|
+
*
|
|
1363
|
+
* New code:
|
|
1364
|
+
*
|
|
1365
|
+
* ```js
|
|
1366
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
1367
|
+
*
|
|
1368
|
+
* //...
|
|
1369
|
+
*
|
|
1370
|
+
* const tween = new Tween(obj)
|
|
1371
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
1372
|
+
*
|
|
1373
|
+
* //...
|
|
1374
|
+
*
|
|
1375
|
+
* const group = new Group()
|
|
1376
|
+
* group.add(tween)
|
|
1377
|
+
* group.add(tween2)
|
|
1378
|
+
*
|
|
1379
|
+
* //...
|
|
1380
|
+
*
|
|
1381
|
+
* requestAnimationFrame(function loop(time) {
|
|
1382
|
+
* group.update(time)
|
|
1383
|
+
* requestAnimationFrame(loop)
|
|
1384
|
+
* })
|
|
1385
|
+
* ```
|
|
1386
|
+
*/
|
|
877
1387
|
update: update,
|
|
878
1388
|
};
|
|
879
1389
|
|