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