@linorabolini/tween.js 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.
@@ -0,0 +1,1441 @@
1
+ define(['exports'], (function (exports) { 'use strict';
2
+
3
+ /**
4
+ * The Ease class provides a collection of easing functions for use with tween.js.
5
+ */
6
+ var Easing = Object.freeze({
7
+ Linear: Object.freeze({
8
+ None: function (amount) {
9
+ return amount;
10
+ },
11
+ In: function (amount) {
12
+ return amount;
13
+ },
14
+ Out: function (amount) {
15
+ return amount;
16
+ },
17
+ InOut: function (amount) {
18
+ return amount;
19
+ },
20
+ }),
21
+ Quadratic: Object.freeze({
22
+ In: function (amount) {
23
+ return amount * amount;
24
+ },
25
+ Out: function (amount) {
26
+ return amount * (2 - amount);
27
+ },
28
+ InOut: function (amount) {
29
+ if ((amount *= 2) < 1) {
30
+ return 0.5 * amount * amount;
31
+ }
32
+ return -0.5 * (--amount * (amount - 2) - 1);
33
+ },
34
+ }),
35
+ Cubic: Object.freeze({
36
+ In: function (amount) {
37
+ return amount * amount * amount;
38
+ },
39
+ Out: function (amount) {
40
+ return --amount * amount * amount + 1;
41
+ },
42
+ InOut: function (amount) {
43
+ if ((amount *= 2) < 1) {
44
+ return 0.5 * amount * amount * amount;
45
+ }
46
+ return 0.5 * ((amount -= 2) * amount * amount + 2);
47
+ },
48
+ }),
49
+ Quartic: Object.freeze({
50
+ In: function (amount) {
51
+ return amount * amount * amount * amount;
52
+ },
53
+ Out: function (amount) {
54
+ return 1 - --amount * amount * amount * amount;
55
+ },
56
+ InOut: function (amount) {
57
+ if ((amount *= 2) < 1) {
58
+ return 0.5 * amount * amount * amount * amount;
59
+ }
60
+ return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
61
+ },
62
+ }),
63
+ Quintic: Object.freeze({
64
+ In: function (amount) {
65
+ return amount * amount * amount * amount * amount;
66
+ },
67
+ Out: function (amount) {
68
+ return --amount * amount * amount * amount * amount + 1;
69
+ },
70
+ InOut: function (amount) {
71
+ if ((amount *= 2) < 1) {
72
+ return 0.5 * amount * amount * amount * amount * amount;
73
+ }
74
+ return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
75
+ },
76
+ }),
77
+ Sinusoidal: Object.freeze({
78
+ In: function (amount) {
79
+ return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
80
+ },
81
+ Out: function (amount) {
82
+ return Math.sin((amount * Math.PI) / 2);
83
+ },
84
+ InOut: function (amount) {
85
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
86
+ },
87
+ }),
88
+ Exponential: Object.freeze({
89
+ In: function (amount) {
90
+ return amount === 0 ? 0 : Math.pow(1024, amount - 1);
91
+ },
92
+ Out: function (amount) {
93
+ return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
94
+ },
95
+ InOut: function (amount) {
96
+ if (amount === 0) {
97
+ return 0;
98
+ }
99
+ if (amount === 1) {
100
+ return 1;
101
+ }
102
+ if ((amount *= 2) < 1) {
103
+ return 0.5 * Math.pow(1024, amount - 1);
104
+ }
105
+ return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
106
+ },
107
+ }),
108
+ Circular: Object.freeze({
109
+ In: function (amount) {
110
+ return 1 - Math.sqrt(1 - amount * amount);
111
+ },
112
+ Out: function (amount) {
113
+ return Math.sqrt(1 - --amount * amount);
114
+ },
115
+ InOut: function (amount) {
116
+ if ((amount *= 2) < 1) {
117
+ return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
118
+ }
119
+ return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
120
+ },
121
+ }),
122
+ Elastic: Object.freeze({
123
+ In: function (amount) {
124
+ if (amount === 0) {
125
+ return 0;
126
+ }
127
+ if (amount === 1) {
128
+ return 1;
129
+ }
130
+ return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
131
+ },
132
+ Out: function (amount) {
133
+ if (amount === 0) {
134
+ return 0;
135
+ }
136
+ if (amount === 1) {
137
+ return 1;
138
+ }
139
+ return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
140
+ },
141
+ InOut: function (amount) {
142
+ if (amount === 0) {
143
+ return 0;
144
+ }
145
+ if (amount === 1) {
146
+ return 1;
147
+ }
148
+ amount *= 2;
149
+ if (amount < 1) {
150
+ return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
151
+ }
152
+ return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
153
+ },
154
+ }),
155
+ Back: Object.freeze({
156
+ In: function (amount) {
157
+ var s = 1.70158;
158
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
159
+ },
160
+ Out: function (amount) {
161
+ var s = 1.70158;
162
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
163
+ },
164
+ InOut: function (amount) {
165
+ var s = 1.70158 * 1.525;
166
+ if ((amount *= 2) < 1) {
167
+ return 0.5 * (amount * amount * ((s + 1) * amount - s));
168
+ }
169
+ return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
170
+ },
171
+ }),
172
+ Bounce: Object.freeze({
173
+ In: function (amount) {
174
+ return 1 - Easing.Bounce.Out(1 - amount);
175
+ },
176
+ Out: function (amount) {
177
+ if (amount < 1 / 2.75) {
178
+ return 7.5625 * amount * amount;
179
+ }
180
+ else if (amount < 2 / 2.75) {
181
+ return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
182
+ }
183
+ else if (amount < 2.5 / 2.75) {
184
+ return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
185
+ }
186
+ else {
187
+ return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
188
+ }
189
+ },
190
+ InOut: function (amount) {
191
+ if (amount < 0.5) {
192
+ return Easing.Bounce.In(amount * 2) * 0.5;
193
+ }
194
+ return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
195
+ },
196
+ }),
197
+ generatePow: function (power) {
198
+ if (power === void 0) { power = 4; }
199
+ power = power < Number.EPSILON ? Number.EPSILON : power;
200
+ power = power > 10000 ? 10000 : power;
201
+ return {
202
+ In: function (amount) {
203
+ return Math.pow(amount, power);
204
+ },
205
+ Out: function (amount) {
206
+ return 1 - Math.pow((1 - amount), power);
207
+ },
208
+ InOut: function (amount) {
209
+ if (amount < 0.5) {
210
+ return Math.pow((amount * 2), power) / 2;
211
+ }
212
+ return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
213
+ },
214
+ };
215
+ },
216
+ });
217
+
218
+ var _nowFunc = function () { return performance.now(); };
219
+ var now = function () {
220
+ return _nowFunc();
221
+ };
222
+ function setNow(nowFunction) {
223
+ _nowFunc = nowFunction;
224
+ }
225
+
226
+ /**
227
+ * Controlling groups of tweens
228
+ *
229
+ * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
230
+ * In these cases, you may want to create your own smaller groups of tween
231
+ */
232
+ var Group = /** @class */ (function () {
233
+ function Group() {
234
+ var tweens = [];
235
+ for (var _i = 0; _i < arguments.length; _i++) {
236
+ tweens[_i] = arguments[_i];
237
+ }
238
+ this._tweens = {};
239
+ this._tweensAddedDuringUpdate = {};
240
+ this.add.apply(this, tweens);
241
+ }
242
+ Group.prototype.getAll = function () {
243
+ var _this = this;
244
+ return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });
245
+ };
246
+ Group.prototype.removeAll = function () {
247
+ this._tweens = {};
248
+ };
249
+ Group.prototype.add = function () {
250
+ var _a;
251
+ var tweens = [];
252
+ for (var _i = 0; _i < arguments.length; _i++) {
253
+ tweens[_i] = arguments[_i];
254
+ }
255
+ for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
256
+ var tween = tweens_1[_b];
257
+ // Remove from any other group first, a tween can only be in one group at a time.
258
+ // @ts-expect-error library internal access
259
+ (_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
260
+ // @ts-expect-error library internal access
261
+ tween._group = this;
262
+ this._tweens[tween.getId()] = tween;
263
+ this._tweensAddedDuringUpdate[tween.getId()] = tween;
264
+ }
265
+ };
266
+ Group.prototype.remove = function () {
267
+ var tweens = [];
268
+ for (var _i = 0; _i < arguments.length; _i++) {
269
+ tweens[_i] = arguments[_i];
270
+ }
271
+ for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
272
+ var tween = tweens_2[_a];
273
+ // @ts-expect-error library internal access
274
+ tween._group = undefined;
275
+ delete this._tweens[tween.getId()];
276
+ delete this._tweensAddedDuringUpdate[tween.getId()];
277
+ }
278
+ };
279
+ /** Return true if all tweens in the group are not paused or playing. */
280
+ Group.prototype.allStopped = function () {
281
+ return this.getAll().every(function (tween) { return !tween.isPlaying(); });
282
+ };
283
+ Group.prototype.update = function (time, preserve) {
284
+ if (time === void 0) { time = now(); }
285
+ if (preserve === void 0) { preserve = true; }
286
+ var tweenIds = Object.keys(this._tweens);
287
+ if (tweenIds.length === 0)
288
+ return;
289
+ // Tweens are updated in "batches". If you add a new tween during an
290
+ // update, then the new tween will be updated in the next batch.
291
+ // If you remove a tween during an update, it may or may not be updated.
292
+ // However, if the removed tween was added during the current batch,
293
+ // then it will not be updated.
294
+ while (tweenIds.length > 0) {
295
+ this._tweensAddedDuringUpdate = {};
296
+ for (var i = 0; i < tweenIds.length; i++) {
297
+ var tween = this._tweens[tweenIds[i]];
298
+ var autoStart = !preserve;
299
+ if (tween && tween.update(time, autoStart) === false && !preserve)
300
+ this.remove(tween);
301
+ }
302
+ tweenIds = Object.keys(this._tweensAddedDuringUpdate);
303
+ }
304
+ };
305
+ Group.prototype.onComplete = function (callback) {
306
+ var group = this.getAll();
307
+ group.forEach(function (tween) {
308
+ var prevCallback = tween.getCompleteCallback();
309
+ tween.onComplete(function () {
310
+ prevCallback === null || prevCallback === void 0 ? void 0 : prevCallback(tween);
311
+ // After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
312
+ var completedGroup = group.filter(function (tween) { return !tween.isPlaying(); });
313
+ if (completedGroup.length === group.length - 1)
314
+ callback(group);
315
+ });
316
+ });
317
+ };
318
+ return Group;
319
+ }());
320
+
321
+ /**
322
+ *
323
+ */
324
+ var Interpolation = {
325
+ Linear: function (v, k) {
326
+ var m = v.length - 1;
327
+ var f = m * k;
328
+ var i = Math.floor(f);
329
+ var fn = Interpolation.Utils.Linear;
330
+ if (k < 0) {
331
+ return fn(v[0], v[1], f);
332
+ }
333
+ if (k > 1) {
334
+ return fn(v[m], v[m - 1], m - f);
335
+ }
336
+ return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
337
+ },
338
+ Bezier: function (v, k) {
339
+ var b = 0;
340
+ var n = v.length - 1;
341
+ var pw = Math.pow;
342
+ var bn = Interpolation.Utils.Bernstein;
343
+ for (var i = 0; i <= n; i++) {
344
+ b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
345
+ }
346
+ return b;
347
+ },
348
+ CatmullRom: function (v, k) {
349
+ var m = v.length - 1;
350
+ var f = m * k;
351
+ var i = Math.floor(f);
352
+ var fn = Interpolation.Utils.CatmullRom;
353
+ if (v[0] === v[m]) {
354
+ if (k < 0) {
355
+ i = Math.floor((f = m * (1 + k)));
356
+ }
357
+ return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
358
+ }
359
+ else {
360
+ if (k < 0) {
361
+ return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
362
+ }
363
+ if (k > 1) {
364
+ return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
365
+ }
366
+ return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
367
+ }
368
+ },
369
+ Utils: {
370
+ Linear: function (p0, p1, t) {
371
+ return (p1 - p0) * t + p0;
372
+ },
373
+ Bernstein: function (n, i) {
374
+ var fc = Interpolation.Utils.Factorial;
375
+ return fc(n) / fc(i) / fc(n - i);
376
+ },
377
+ Factorial: (function () {
378
+ var a = [1];
379
+ return function (n) {
380
+ var s = 1;
381
+ if (a[n]) {
382
+ return a[n];
383
+ }
384
+ for (var i = n; i > 1; i--) {
385
+ s *= i;
386
+ }
387
+ a[n] = s;
388
+ return s;
389
+ };
390
+ })(),
391
+ CatmullRom: function (p0, p1, p2, p3, t) {
392
+ var v0 = (p2 - p0) * 0.5;
393
+ var v1 = (p3 - p1) * 0.5;
394
+ var t2 = t * t;
395
+ var t3 = t * t2;
396
+ return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
397
+ },
398
+ },
399
+ };
400
+
401
+ /**
402
+ * Utils
403
+ */
404
+ var Sequence = /** @class */ (function () {
405
+ function Sequence() {
406
+ }
407
+ Sequence.nextId = function () {
408
+ return Sequence._nextId++;
409
+ };
410
+ Sequence._nextId = 0;
411
+ return Sequence;
412
+ }());
413
+
414
+ var mainGroup = new Group();
415
+
416
+ /**
417
+ * Tween.js - Licensed under the MIT license
418
+ * https://github.com/tweenjs/tween.js
419
+ * ----------------------------------------------
420
+ *
421
+ * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
422
+ * Thank you all, you're awesome!
423
+ */
424
+ var Tween = /** @class */ (function () {
425
+ function Tween(object, group) {
426
+ this._isPaused = false;
427
+ this._pauseStart = 0;
428
+ this._valuesStart = {};
429
+ this._valuesEnd = {};
430
+ this._valuesStartRepeat = {};
431
+ this._duration = 0;
432
+ this._isDynamic = false;
433
+ this._initialRepeat = 0;
434
+ this._repeat = 0;
435
+ this._yoyo = false;
436
+ this._isPlaying = false;
437
+ this._reversed = false;
438
+ this._delayTime = 0;
439
+ this._startTime = 0;
440
+ this._easingFunction = Easing.Linear.None;
441
+ this._interpolationFunction = Interpolation.Linear;
442
+ // eslint-disable-next-line
443
+ this._chainedTweens = [];
444
+ this._onStartCallbackFired = false;
445
+ this._onEveryStartCallbackFired = false;
446
+ this._id = Sequence.nextId();
447
+ this._isChainStopped = false;
448
+ this._propertiesAreSetUp = false;
449
+ this._goToEnd = false;
450
+ this._object = object !== null && object !== void 0 ? object : {};
451
+ if (typeof group === 'object') {
452
+ this._group = group;
453
+ group.add(this);
454
+ }
455
+ // Use "true" to restore old behavior (will be removed in future release).
456
+ else if (group === true) {
457
+ this._group = mainGroup;
458
+ mainGroup.add(this);
459
+ }
460
+ }
461
+ Tween.prototype.getId = function () {
462
+ return this._id;
463
+ };
464
+ Tween.prototype.getCompleteCallback = function () {
465
+ return this._onCompleteCallback;
466
+ };
467
+ Tween.prototype.isPlaying = function () {
468
+ return this._isPlaying;
469
+ };
470
+ Tween.prototype.isPaused = function () {
471
+ return this._isPaused;
472
+ };
473
+ Tween.prototype.getDuration = function () {
474
+ return this._duration;
475
+ };
476
+ Tween.prototype.to = function (target, duration) {
477
+ if (this._isPlaying)
478
+ throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
479
+ this._valuesEnd = target;
480
+ this._propertiesAreSetUp = false;
481
+ if (duration !== undefined) {
482
+ this._duration = duration < 0 ? 0 : duration;
483
+ }
484
+ return this;
485
+ };
486
+ Tween.prototype.duration = function (duration) {
487
+ if (duration === void 0) { duration = 1000; }
488
+ this._duration = duration < 0 ? 0 : duration;
489
+ return this;
490
+ };
491
+ Tween.prototype.dynamic = function (dynamic) {
492
+ if (dynamic === void 0) { dynamic = false; }
493
+ this._isDynamic = dynamic;
494
+ return this;
495
+ };
496
+ Tween.prototype.start = function (time, overrideStartingValues) {
497
+ if (time === void 0) { time = now(); }
498
+ if (overrideStartingValues === void 0) { overrideStartingValues = false; }
499
+ if (this._isPlaying) {
500
+ return this;
501
+ }
502
+ this._repeat = this._initialRepeat;
503
+ if (this._reversed) {
504
+ // If we were reversed (f.e. using the yoyo feature) then we need to
505
+ // flip the tween direction back to forward.
506
+ this._reversed = false;
507
+ for (var property in this._valuesStartRepeat) {
508
+ this._swapEndStartRepeatValues(property);
509
+ this._valuesStart[property] = this._valuesStartRepeat[property];
510
+ }
511
+ }
512
+ this._isPlaying = true;
513
+ this._isPaused = false;
514
+ this._onStartCallbackFired = false;
515
+ this._onEveryStartCallbackFired = false;
516
+ this._isChainStopped = false;
517
+ this._startTime = time;
518
+ this._startTime += this._delayTime;
519
+ if (!this._propertiesAreSetUp || overrideStartingValues) {
520
+ this._propertiesAreSetUp = true;
521
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
522
+ if (!this._isDynamic) {
523
+ var tmp = {};
524
+ for (var prop in this._valuesEnd)
525
+ tmp[prop] = this._valuesEnd[prop];
526
+ this._valuesEnd = tmp;
527
+ }
528
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
529
+ }
530
+ return this;
531
+ };
532
+ Tween.prototype.startFromCurrentValues = function (time) {
533
+ return this.start(time, true);
534
+ };
535
+ Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
536
+ for (var property in _valuesEnd) {
537
+ var startValue = _object[property];
538
+ var startValueIsArray = Array.isArray(startValue);
539
+ var propType = startValueIsArray ? 'array' : typeof startValue;
540
+ var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
541
+ // If `to()` specifies a property that doesn't exist in the source object,
542
+ // we should not set that property in the object
543
+ if (propType === 'undefined' || propType === 'function') {
544
+ continue;
545
+ }
546
+ // Check if an Array was provided as property value
547
+ if (isInterpolationList) {
548
+ var endValues = _valuesEnd[property];
549
+ if (endValues.length === 0) {
550
+ continue;
551
+ }
552
+ // Handle an array of relative values.
553
+ // Creates a local copy of the Array with the start value at the front
554
+ var temp = [startValue];
555
+ for (var i = 0, l = endValues.length; i < l; i += 1) {
556
+ var value = this._handleRelativeValue(startValue, endValues[i]);
557
+ if (isNaN(value)) {
558
+ isInterpolationList = false;
559
+ console.warn('Found invalid interpolation list. Skipping.');
560
+ break;
561
+ }
562
+ temp.push(value);
563
+ }
564
+ if (isInterpolationList) {
565
+ // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
566
+ _valuesEnd[property] = temp;
567
+ // }
568
+ }
569
+ }
570
+ // handle the deepness of the values
571
+ if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
572
+ _valuesStart[property] = startValueIsArray ? [] : {};
573
+ var nestedObject = startValue;
574
+ for (var prop in nestedObject) {
575
+ _valuesStart[property][prop] = nestedObject[prop];
576
+ }
577
+ // TODO? repeat nested values? And yoyo? And array values?
578
+ _valuesStartRepeat[property] = startValueIsArray ? [] : {};
579
+ var endValues = _valuesEnd[property];
580
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
581
+ if (!this._isDynamic) {
582
+ var tmp = {};
583
+ for (var prop in endValues)
584
+ tmp[prop] = endValues[prop];
585
+ _valuesEnd[property] = endValues = tmp;
586
+ }
587
+ this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
588
+ }
589
+ else {
590
+ // Save the starting value, but only once unless override is requested.
591
+ if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
592
+ _valuesStart[property] = startValue;
593
+ }
594
+ if (!startValueIsArray) {
595
+ // eslint-disable-next-line
596
+ // @ts-ignore FIXME?
597
+ _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
598
+ }
599
+ if (isInterpolationList) {
600
+ // eslint-disable-next-line
601
+ // @ts-ignore FIXME?
602
+ _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
603
+ }
604
+ else {
605
+ _valuesStartRepeat[property] = _valuesStart[property] || 0;
606
+ }
607
+ }
608
+ }
609
+ };
610
+ Tween.prototype.stop = function () {
611
+ if (!this._isChainStopped) {
612
+ this._isChainStopped = true;
613
+ this.stopChainedTweens();
614
+ }
615
+ if (!this._isPlaying) {
616
+ return this;
617
+ }
618
+ this._isPlaying = false;
619
+ this._isPaused = false;
620
+ if (this._onStopCallback) {
621
+ this._onStopCallback(this._object);
622
+ }
623
+ return this;
624
+ };
625
+ Tween.prototype.end = function () {
626
+ this._goToEnd = true;
627
+ this.update(this._startTime + this._duration);
628
+ return this;
629
+ };
630
+ Tween.prototype.pause = function (time) {
631
+ if (time === void 0) { time = now(); }
632
+ if (this._isPaused || !this._isPlaying) {
633
+ return this;
634
+ }
635
+ this._isPaused = true;
636
+ this._pauseStart = time;
637
+ return this;
638
+ };
639
+ Tween.prototype.resume = function (time) {
640
+ if (time === void 0) { time = now(); }
641
+ if (!this._isPaused || !this._isPlaying) {
642
+ return this;
643
+ }
644
+ this._isPaused = false;
645
+ this._startTime += time - this._pauseStart;
646
+ this._pauseStart = 0;
647
+ return this;
648
+ };
649
+ Tween.prototype.stopChainedTweens = function () {
650
+ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
651
+ this._chainedTweens[i].stop();
652
+ }
653
+ return this;
654
+ };
655
+ Tween.prototype.group = function (group) {
656
+ if (!group) {
657
+ console.warn('tween.group() without args has been removed, use group.add(tween) instead.');
658
+ return this;
659
+ }
660
+ group.add(this);
661
+ return this;
662
+ };
663
+ /**
664
+ * Removes the tween from whichever group it is in.
665
+ */
666
+ Tween.prototype.remove = function () {
667
+ var _a;
668
+ (_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
669
+ return this;
670
+ };
671
+ Tween.prototype.delay = function (amount) {
672
+ if (amount === void 0) { amount = 0; }
673
+ this._delayTime = amount;
674
+ return this;
675
+ };
676
+ Tween.prototype.repeat = function (times) {
677
+ if (times === void 0) { times = 0; }
678
+ this._initialRepeat = times;
679
+ this._repeat = times;
680
+ return this;
681
+ };
682
+ Tween.prototype.repeatDelay = function (amount) {
683
+ this._repeatDelayTime = amount;
684
+ return this;
685
+ };
686
+ Tween.prototype.yoyo = function (yoyo) {
687
+ if (yoyo === void 0) { yoyo = false; }
688
+ this._yoyo = yoyo;
689
+ return this;
690
+ };
691
+ Tween.prototype.easing = function (easingFunction) {
692
+ if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
693
+ this._easingFunction = easingFunction;
694
+ return this;
695
+ };
696
+ Tween.prototype.interpolation = function (interpolationFunction) {
697
+ if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
698
+ this._interpolationFunction = interpolationFunction;
699
+ return this;
700
+ };
701
+ // eslint-disable-next-line
702
+ Tween.prototype.chain = function () {
703
+ var tweens = [];
704
+ for (var _i = 0; _i < arguments.length; _i++) {
705
+ tweens[_i] = arguments[_i];
706
+ }
707
+ this._chainedTweens = tweens;
708
+ return this;
709
+ };
710
+ Tween.prototype.onStart = function (callback) {
711
+ this._onStartCallback = callback;
712
+ return this;
713
+ };
714
+ Tween.prototype.onEveryStart = function (callback) {
715
+ this._onEveryStartCallback = callback;
716
+ return this;
717
+ };
718
+ Tween.prototype.onUpdate = function (callback) {
719
+ this._onUpdateCallback = callback;
720
+ return this;
721
+ };
722
+ Tween.prototype.onRepeat = function (callback) {
723
+ this._onRepeatCallback = callback;
724
+ return this;
725
+ };
726
+ Tween.prototype.onComplete = function (callback) {
727
+ this._onCompleteCallback = callback;
728
+ return this;
729
+ };
730
+ Tween.prototype.onStop = function (callback) {
731
+ this._onStopCallback = callback;
732
+ return this;
733
+ };
734
+ /**
735
+ * @returns true if the tween is still playing after the update, false
736
+ * otherwise (calling update on a paused tween still returns true because
737
+ * it is still playing, just paused).
738
+ *
739
+ * @param autoStart - When true, calling update will implicitly call start()
740
+ * as well. Note, if you stop() or end() the tween, but are still calling
741
+ * update(), it will start again!
742
+ */
743
+ Tween.prototype.update = function (time, autoStart) {
744
+ var _this = this;
745
+ var _a;
746
+ if (time === void 0) { time = now(); }
747
+ if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }
748
+ if (this._isPaused)
749
+ return true;
750
+ var property;
751
+ if (!this._goToEnd && !this._isPlaying) {
752
+ if (autoStart)
753
+ this.start(time, true);
754
+ else
755
+ return false;
756
+ }
757
+ this._goToEnd = false;
758
+ if (time < this._startTime) {
759
+ return true;
760
+ }
761
+ if (this._onStartCallbackFired === false) {
762
+ if (this._onStartCallback) {
763
+ this._onStartCallback(this._object);
764
+ }
765
+ this._onStartCallbackFired = true;
766
+ }
767
+ if (this._onEveryStartCallbackFired === false) {
768
+ if (this._onEveryStartCallback) {
769
+ this._onEveryStartCallback(this._object);
770
+ }
771
+ this._onEveryStartCallbackFired = true;
772
+ }
773
+ var elapsedTime = time - this._startTime;
774
+ var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
775
+ var totalTime = this._duration + this._repeat * durationAndDelay;
776
+ var calculateElapsedPortion = function () {
777
+ if (_this._duration === 0)
778
+ return 1;
779
+ if (elapsedTime > totalTime) {
780
+ return 1;
781
+ }
782
+ var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
783
+ var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
784
+ // TODO use %?
785
+ // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
786
+ var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
787
+ if (portion === 0 && elapsedTime === _this._duration) {
788
+ return 1;
789
+ }
790
+ return portion;
791
+ };
792
+ var elapsed = calculateElapsedPortion();
793
+ var value = this._easingFunction(elapsed);
794
+ // properties transformations
795
+ this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
796
+ if (this._onUpdateCallback) {
797
+ this._onUpdateCallback(this._object, elapsed);
798
+ }
799
+ if (this._duration === 0 || elapsedTime >= this._duration) {
800
+ if (this._repeat > 0) {
801
+ var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
802
+ if (isFinite(this._repeat)) {
803
+ this._repeat -= completeCount;
804
+ }
805
+ // Reassign starting values, restart by making startTime = now
806
+ for (property in this._valuesStartRepeat) {
807
+ if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
808
+ this._valuesStartRepeat[property] =
809
+ // eslint-disable-next-line
810
+ // @ts-ignore FIXME?
811
+ this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
812
+ }
813
+ if (this._yoyo) {
814
+ this._swapEndStartRepeatValues(property);
815
+ }
816
+ this._valuesStart[property] = this._valuesStartRepeat[property];
817
+ }
818
+ if (this._yoyo) {
819
+ this._reversed = !this._reversed;
820
+ }
821
+ this._startTime += durationAndDelay * completeCount;
822
+ if (this._onRepeatCallback) {
823
+ this._onRepeatCallback(this._object);
824
+ }
825
+ this._onEveryStartCallbackFired = false;
826
+ return true;
827
+ }
828
+ else {
829
+ if (this._onCompleteCallback) {
830
+ this._onCompleteCallback(this._object);
831
+ }
832
+ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
833
+ // Make the chained tweens start exactly at the time they should,
834
+ // even if the `update()` method was called way past the duration of the tween
835
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
836
+ }
837
+ this._isPlaying = false;
838
+ return false;
839
+ }
840
+ }
841
+ return true;
842
+ };
843
+ Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
844
+ for (var property in _valuesEnd) {
845
+ // Don't update properties that do not exist in the source object
846
+ if (_valuesStart[property] === undefined) {
847
+ continue;
848
+ }
849
+ var start = _valuesStart[property] || 0;
850
+ var end = _valuesEnd[property];
851
+ var startIsArray = Array.isArray(_object[property]);
852
+ var endIsArray = Array.isArray(end);
853
+ var isInterpolationList = !startIsArray && endIsArray;
854
+ if (isInterpolationList) {
855
+ _object[property] = this._interpolationFunction(end, value);
856
+ }
857
+ else if (typeof end === 'object' && end) {
858
+ // eslint-disable-next-line
859
+ // @ts-ignore FIXME?
860
+ this._updateProperties(_object[property], start, end, value);
861
+ }
862
+ else {
863
+ // Parses relative end values with start as base (e.g.: +10, -3)
864
+ end = this._handleRelativeValue(start, end);
865
+ // Protect against non numeric properties.
866
+ if (typeof end === 'number') {
867
+ // eslint-disable-next-line
868
+ // @ts-ignore FIXME?
869
+ _object[property] = start + (end - start) * value;
870
+ }
871
+ }
872
+ }
873
+ };
874
+ Tween.prototype._handleRelativeValue = function (start, end) {
875
+ if (typeof end !== 'string') {
876
+ return end;
877
+ }
878
+ if (end.charAt(0) === '+' || end.charAt(0) === '-') {
879
+ return start + parseFloat(end);
880
+ }
881
+ return parseFloat(end);
882
+ };
883
+ Tween.prototype._swapEndStartRepeatValues = function (property) {
884
+ var tmp = this._valuesStartRepeat[property];
885
+ var endValue = this._valuesEnd[property];
886
+ if (typeof endValue === 'string') {
887
+ this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
888
+ }
889
+ else {
890
+ this._valuesStartRepeat[property] = this._valuesEnd[property];
891
+ }
892
+ this._valuesEnd[property] = tmp;
893
+ };
894
+ Tween.autoStartOnUpdate = false;
895
+ Tween.Sequence = function () {
896
+ var tweens = [];
897
+ for (var _i = 0; _i < arguments.length; _i++) {
898
+ tweens[_i] = arguments[_i];
899
+ }
900
+ tweens.reduce(function (prev, next) {
901
+ prev === null || prev === void 0 ? void 0 : prev.chain(next);
902
+ return next;
903
+ });
904
+ return tweens[0];
905
+ };
906
+ return Tween;
907
+ }());
908
+
909
+ var VERSION = '25.0.0';
910
+
911
+ /**
912
+ * Tween.js - Licensed under the MIT license
913
+ * https://github.com/tweenjs/tween.js
914
+ * ----------------------------------------------
915
+ *
916
+ * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
917
+ * Thank you all, you're awesome!
918
+ */
919
+ var nextId = Sequence.nextId;
920
+ /**
921
+ * Controlling groups of tweens
922
+ *
923
+ * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
924
+ * In these cases, you may want to create your own smaller groups of tweens.
925
+ */
926
+ var TWEEN = mainGroup;
927
+ // This is the best way to export things in a way that's compatible with both ES
928
+ // Modules and CommonJS, without build hacks, and so as not to break the
929
+ // existing API.
930
+ // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
931
+ /**
932
+ * @deprecated The global TWEEN Group will be removed in a following major
933
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
934
+ * group.
935
+ *
936
+ * Old code:
937
+ *
938
+ * ```js
939
+ * import * as TWEEN from '@tweenjs/tween.js'
940
+ *
941
+ * //...
942
+ *
943
+ * const tween = new TWEEN.Tween(obj)
944
+ * const tween2 = new TWEEN.Tween(obj2)
945
+ *
946
+ * //...
947
+ *
948
+ * requestAnimationFrame(function loop(time) {
949
+ * TWEEN.update(time)
950
+ * requestAnimationFrame(loop)
951
+ * })
952
+ * ```
953
+ *
954
+ * New code:
955
+ *
956
+ * ```js
957
+ * import {Tween, Group} from '@tweenjs/tween.js'
958
+ *
959
+ * //...
960
+ *
961
+ * const tween = new Tween(obj)
962
+ * const tween2 = new TWEEN.Tween(obj2)
963
+ *
964
+ * //...
965
+ *
966
+ * const group = new Group()
967
+ * group.add(tween)
968
+ * group.add(tween2)
969
+ *
970
+ * //...
971
+ *
972
+ * requestAnimationFrame(function loop(time) {
973
+ * group.update(time)
974
+ * requestAnimationFrame(loop)
975
+ * })
976
+ * ```
977
+ */
978
+ var getAll = TWEEN.getAll.bind(TWEEN);
979
+ /**
980
+ * @deprecated The global TWEEN Group will be removed in a following major
981
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
982
+ * group.
983
+ *
984
+ * Old code:
985
+ *
986
+ * ```js
987
+ * import * as TWEEN from '@tweenjs/tween.js'
988
+ *
989
+ * //...
990
+ *
991
+ * const tween = new TWEEN.Tween(obj)
992
+ * const tween2 = new TWEEN.Tween(obj2)
993
+ *
994
+ * //...
995
+ *
996
+ * requestAnimationFrame(function loop(time) {
997
+ * TWEEN.update(time)
998
+ * requestAnimationFrame(loop)
999
+ * })
1000
+ * ```
1001
+ *
1002
+ * New code:
1003
+ *
1004
+ * ```js
1005
+ * import {Tween, Group} from '@tweenjs/tween.js'
1006
+ *
1007
+ * //...
1008
+ *
1009
+ * const tween = new Tween(obj)
1010
+ * const tween2 = new TWEEN.Tween(obj2)
1011
+ *
1012
+ * //...
1013
+ *
1014
+ * const group = new Group()
1015
+ * group.add(tween)
1016
+ * group.add(tween2)
1017
+ *
1018
+ * //...
1019
+ *
1020
+ * requestAnimationFrame(function loop(time) {
1021
+ * group.update(time)
1022
+ * requestAnimationFrame(loop)
1023
+ * })
1024
+ * ```
1025
+ */
1026
+ var removeAll = TWEEN.removeAll.bind(TWEEN);
1027
+ /**
1028
+ * @deprecated The global TWEEN Group will be removed in a following major
1029
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1030
+ * group.
1031
+ *
1032
+ * Old code:
1033
+ *
1034
+ * ```js
1035
+ * import * as TWEEN from '@tweenjs/tween.js'
1036
+ *
1037
+ * //...
1038
+ *
1039
+ * const tween = new TWEEN.Tween(obj)
1040
+ * const tween2 = new TWEEN.Tween(obj2)
1041
+ *
1042
+ * //...
1043
+ *
1044
+ * requestAnimationFrame(function loop(time) {
1045
+ * TWEEN.update(time)
1046
+ * requestAnimationFrame(loop)
1047
+ * })
1048
+ * ```
1049
+ *
1050
+ * New code:
1051
+ *
1052
+ * ```js
1053
+ * import {Tween, Group} from '@tweenjs/tween.js'
1054
+ *
1055
+ * //...
1056
+ *
1057
+ * const tween = new Tween(obj)
1058
+ * const tween2 = new TWEEN.Tween(obj2)
1059
+ *
1060
+ * //...
1061
+ *
1062
+ * const group = new Group()
1063
+ * group.add(tween)
1064
+ * group.add(tween2)
1065
+ *
1066
+ * //...
1067
+ *
1068
+ * requestAnimationFrame(function loop(time) {
1069
+ * group.update(time)
1070
+ * requestAnimationFrame(loop)
1071
+ * })
1072
+ * ```
1073
+ */
1074
+ var add = TWEEN.add.bind(TWEEN);
1075
+ /**
1076
+ * @deprecated The global TWEEN Group will be removed in a following major
1077
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1078
+ * group.
1079
+ *
1080
+ * Old code:
1081
+ *
1082
+ * ```js
1083
+ * import * as TWEEN from '@tweenjs/tween.js'
1084
+ *
1085
+ * //...
1086
+ *
1087
+ * const tween = new TWEEN.Tween(obj)
1088
+ * const tween2 = new TWEEN.Tween(obj2)
1089
+ *
1090
+ * //...
1091
+ *
1092
+ * requestAnimationFrame(function loop(time) {
1093
+ * TWEEN.update(time)
1094
+ * requestAnimationFrame(loop)
1095
+ * })
1096
+ * ```
1097
+ *
1098
+ * New code:
1099
+ *
1100
+ * ```js
1101
+ * import {Tween, Group} from '@tweenjs/tween.js'
1102
+ *
1103
+ * //...
1104
+ *
1105
+ * const tween = new Tween(obj)
1106
+ * const tween2 = new TWEEN.Tween(obj2)
1107
+ *
1108
+ * //...
1109
+ *
1110
+ * const group = new Group()
1111
+ * group.add(tween)
1112
+ * group.add(tween2)
1113
+ *
1114
+ * //...
1115
+ *
1116
+ * requestAnimationFrame(function loop(time) {
1117
+ * group.update(time)
1118
+ * requestAnimationFrame(loop)
1119
+ * })
1120
+ * ```
1121
+ */
1122
+ var remove = TWEEN.remove.bind(TWEEN);
1123
+ /**
1124
+ * @deprecated The global TWEEN Group will be removed in a following major
1125
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1126
+ * group.
1127
+ *
1128
+ * Old code:
1129
+ *
1130
+ * ```js
1131
+ * import * as TWEEN from '@tweenjs/tween.js'
1132
+ *
1133
+ * //...
1134
+ *
1135
+ * const tween = new TWEEN.Tween(obj)
1136
+ * const tween2 = new TWEEN.Tween(obj2)
1137
+ *
1138
+ * //...
1139
+ *
1140
+ * requestAnimationFrame(function loop(time) {
1141
+ * TWEEN.update(time)
1142
+ * requestAnimationFrame(loop)
1143
+ * })
1144
+ * ```
1145
+ *
1146
+ * New code:
1147
+ *
1148
+ * ```js
1149
+ * import {Tween, Group} from '@tweenjs/tween.js'
1150
+ *
1151
+ * //...
1152
+ *
1153
+ * const tween = new Tween(obj)
1154
+ * const tween2 = new TWEEN.Tween(obj2)
1155
+ *
1156
+ * //...
1157
+ *
1158
+ * const group = new Group()
1159
+ * group.add(tween)
1160
+ * group.add(tween2)
1161
+ *
1162
+ * //...
1163
+ *
1164
+ * requestAnimationFrame(function loop(time) {
1165
+ * group.update(time)
1166
+ * requestAnimationFrame(loop)
1167
+ * })
1168
+ * ```
1169
+ */
1170
+ var update = TWEEN.update.bind(TWEEN);
1171
+ var exports$1 = {
1172
+ Easing: Easing,
1173
+ Group: Group,
1174
+ Interpolation: Interpolation,
1175
+ now: now,
1176
+ setNow: setNow,
1177
+ Sequence: Sequence,
1178
+ nextId: nextId,
1179
+ Tween: Tween,
1180
+ VERSION: VERSION,
1181
+ /**
1182
+ * @deprecated The global TWEEN Group will be removed in a following major
1183
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1184
+ * group.
1185
+ *
1186
+ * Old code:
1187
+ *
1188
+ * ```js
1189
+ * import * as TWEEN from '@tweenjs/tween.js'
1190
+ *
1191
+ * //...
1192
+ *
1193
+ * const tween = new TWEEN.Tween(obj)
1194
+ * const tween2 = new TWEEN.Tween(obj2)
1195
+ *
1196
+ * //...
1197
+ *
1198
+ * requestAnimationFrame(function loop(time) {
1199
+ * TWEEN.update(time)
1200
+ * requestAnimationFrame(loop)
1201
+ * })
1202
+ * ```
1203
+ *
1204
+ * New code:
1205
+ *
1206
+ * ```js
1207
+ * import {Tween, Group} from '@tweenjs/tween.js'
1208
+ *
1209
+ * //...
1210
+ *
1211
+ * const tween = new Tween(obj)
1212
+ * const tween2 = new TWEEN.Tween(obj2)
1213
+ *
1214
+ * //...
1215
+ *
1216
+ * const group = new Group()
1217
+ * group.add(tween)
1218
+ * group.add(tween2)
1219
+ *
1220
+ * //...
1221
+ *
1222
+ * requestAnimationFrame(function loop(time) {
1223
+ * group.update(time)
1224
+ * requestAnimationFrame(loop)
1225
+ * })
1226
+ * ```
1227
+ */
1228
+ getAll: getAll,
1229
+ /**
1230
+ * @deprecated The global TWEEN Group will be removed in a following major
1231
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1232
+ * group.
1233
+ *
1234
+ * Old code:
1235
+ *
1236
+ * ```js
1237
+ * import * as TWEEN from '@tweenjs/tween.js'
1238
+ *
1239
+ * //...
1240
+ *
1241
+ * const tween = new TWEEN.Tween(obj)
1242
+ * const tween2 = new TWEEN.Tween(obj2)
1243
+ *
1244
+ * //...
1245
+ *
1246
+ * requestAnimationFrame(function loop(time) {
1247
+ * TWEEN.update(time)
1248
+ * requestAnimationFrame(loop)
1249
+ * })
1250
+ * ```
1251
+ *
1252
+ * New code:
1253
+ *
1254
+ * ```js
1255
+ * import {Tween, Group} from '@tweenjs/tween.js'
1256
+ *
1257
+ * //...
1258
+ *
1259
+ * const tween = new Tween(obj)
1260
+ * const tween2 = new TWEEN.Tween(obj2)
1261
+ *
1262
+ * //...
1263
+ *
1264
+ * const group = new Group()
1265
+ * group.add(tween)
1266
+ * group.add(tween2)
1267
+ *
1268
+ * //...
1269
+ *
1270
+ * requestAnimationFrame(function loop(time) {
1271
+ * group.update(time)
1272
+ * requestAnimationFrame(loop)
1273
+ * })
1274
+ * ```
1275
+ */
1276
+ removeAll: removeAll,
1277
+ /**
1278
+ * @deprecated The global TWEEN Group will be removed in a following major
1279
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1280
+ * group.
1281
+ *
1282
+ * Old code:
1283
+ *
1284
+ * ```js
1285
+ * import * as TWEEN from '@tweenjs/tween.js'
1286
+ *
1287
+ * //...
1288
+ *
1289
+ * const tween = new TWEEN.Tween(obj)
1290
+ * const tween2 = new TWEEN.Tween(obj2)
1291
+ *
1292
+ * //...
1293
+ *
1294
+ * requestAnimationFrame(function loop(time) {
1295
+ * TWEEN.update(time)
1296
+ * requestAnimationFrame(loop)
1297
+ * })
1298
+ * ```
1299
+ *
1300
+ * New code:
1301
+ *
1302
+ * ```js
1303
+ * import {Tween, Group} from '@tweenjs/tween.js'
1304
+ *
1305
+ * //...
1306
+ *
1307
+ * const tween = new Tween(obj)
1308
+ * const tween2 = new TWEEN.Tween(obj2)
1309
+ *
1310
+ * //...
1311
+ *
1312
+ * const group = new Group()
1313
+ * group.add(tween)
1314
+ * group.add(tween2)
1315
+ *
1316
+ * //...
1317
+ *
1318
+ * requestAnimationFrame(function loop(time) {
1319
+ * group.update(time)
1320
+ * requestAnimationFrame(loop)
1321
+ * })
1322
+ * ```
1323
+ */
1324
+ add: add,
1325
+ /**
1326
+ * @deprecated The global TWEEN Group will be removed in a following major
1327
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1328
+ * group.
1329
+ *
1330
+ * Old code:
1331
+ *
1332
+ * ```js
1333
+ * import * as TWEEN from '@tweenjs/tween.js'
1334
+ *
1335
+ * //...
1336
+ *
1337
+ * const tween = new TWEEN.Tween(obj)
1338
+ * const tween2 = new TWEEN.Tween(obj2)
1339
+ *
1340
+ * //...
1341
+ *
1342
+ * requestAnimationFrame(function loop(time) {
1343
+ * TWEEN.update(time)
1344
+ * requestAnimationFrame(loop)
1345
+ * })
1346
+ * ```
1347
+ *
1348
+ * New code:
1349
+ *
1350
+ * ```js
1351
+ * import {Tween, Group} from '@tweenjs/tween.js'
1352
+ *
1353
+ * //...
1354
+ *
1355
+ * const tween = new Tween(obj)
1356
+ * const tween2 = new TWEEN.Tween(obj2)
1357
+ *
1358
+ * //...
1359
+ *
1360
+ * const group = new Group()
1361
+ * group.add(tween)
1362
+ * group.add(tween2)
1363
+ *
1364
+ * //...
1365
+ *
1366
+ * requestAnimationFrame(function loop(time) {
1367
+ * group.update(time)
1368
+ * requestAnimationFrame(loop)
1369
+ * })
1370
+ * ```
1371
+ */
1372
+ remove: remove,
1373
+ /**
1374
+ * @deprecated The global TWEEN Group will be removed in a following major
1375
+ * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
1376
+ * group.
1377
+ *
1378
+ * Old code:
1379
+ *
1380
+ * ```js
1381
+ * import * as TWEEN from '@tweenjs/tween.js'
1382
+ *
1383
+ * //...
1384
+ *
1385
+ * const tween = new TWEEN.Tween(obj)
1386
+ * const tween2 = new TWEEN.Tween(obj2)
1387
+ *
1388
+ * //...
1389
+ *
1390
+ * requestAnimationFrame(function loop(time) {
1391
+ * TWEEN.update(time)
1392
+ * requestAnimationFrame(loop)
1393
+ * })
1394
+ * ```
1395
+ *
1396
+ * New code:
1397
+ *
1398
+ * ```js
1399
+ * import {Tween, Group} from '@tweenjs/tween.js'
1400
+ *
1401
+ * //...
1402
+ *
1403
+ * const tween = new Tween(obj)
1404
+ * const tween2 = new TWEEN.Tween(obj2)
1405
+ *
1406
+ * //...
1407
+ *
1408
+ * const group = new Group()
1409
+ * group.add(tween)
1410
+ * group.add(tween2)
1411
+ *
1412
+ * //...
1413
+ *
1414
+ * requestAnimationFrame(function loop(time) {
1415
+ * group.update(time)
1416
+ * requestAnimationFrame(loop)
1417
+ * })
1418
+ * ```
1419
+ */
1420
+ update: update,
1421
+ };
1422
+
1423
+ exports.Easing = Easing;
1424
+ exports.Group = Group;
1425
+ exports.Interpolation = Interpolation;
1426
+ exports.Sequence = Sequence;
1427
+ exports.Tween = Tween;
1428
+ exports.VERSION = VERSION;
1429
+ exports.add = add;
1430
+ exports.default = exports$1;
1431
+ exports.getAll = getAll;
1432
+ exports.nextId = nextId;
1433
+ exports.now = now;
1434
+ exports.remove = remove;
1435
+ exports.removeAll = removeAll;
1436
+ exports.setNow = setNow;
1437
+ exports.update = update;
1438
+
1439
+ Object.defineProperty(exports, '__esModule', { value: true });
1440
+
1441
+ }));