@tweenjs/tween.js 23.1.3 → 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/README.md +191 -103
- package/dist/tween.amd.js +540 -35
- package/dist/tween.cjs +540 -35
- package/dist/tween.d.ts +541 -30
- package/dist/tween.esm.js +540 -35
- package/dist/tween.umd.js +540 -35
- 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) {
|
|
@@ -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) {
|
|
@@ -685,12 +721,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
685
721
|
if (this._isPaused)
|
|
686
722
|
return true;
|
|
687
723
|
var property;
|
|
688
|
-
var endTime = this._startTime + this._duration;
|
|
689
724
|
if (!this._goToEnd && !this._isPlaying) {
|
|
690
|
-
if (time > endTime)
|
|
691
|
-
return false;
|
|
692
725
|
if (autoStart)
|
|
693
726
|
this.start(time, true);
|
|
727
|
+
else
|
|
728
|
+
return false;
|
|
694
729
|
}
|
|
695
730
|
this._goToEnd = false;
|
|
696
731
|
if (time < this._startTime) {
|
|
@@ -832,7 +867,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
832
867
|
return Tween;
|
|
833
868
|
}());
|
|
834
869
|
|
|
835
|
-
var VERSION = '
|
|
870
|
+
var VERSION = '24.0.0';
|
|
836
871
|
|
|
837
872
|
/**
|
|
838
873
|
* Tween.js - Licensed under the MIT license
|
|
@@ -854,10 +889,245 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
854
889
|
// Modules and CommonJS, without build hacks, and so as not to break the
|
|
855
890
|
// existing API.
|
|
856
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
|
+
*/
|
|
857
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
|
+
*/
|
|
858
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
|
+
*/
|
|
859
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
|
+
*/
|
|
860
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
|
+
*/
|
|
861
1131
|
var update = TWEEN.update.bind(TWEEN);
|
|
862
1132
|
var exports$1 = {
|
|
863
1133
|
Easing: Easing,
|
|
@@ -868,10 +1138,245 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
868
1138
|
nextId: nextId,
|
|
869
1139
|
Tween: Tween,
|
|
870
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
|
+
*/
|
|
871
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
|
+
*/
|
|
872
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
|
+
*/
|
|
873
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
|
+
*/
|
|
874
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
|
+
*/
|
|
875
1380
|
update: update,
|
|
876
1381
|
};
|
|
877
1382
|
|