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