@tweenjs/tween.js 19.0.0 → 20.0.1

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/dist/tween.amd.js CHANGED
@@ -1,4 +1,4 @@
1
- define(['exports'], function (exports) { 'use strict';
1
+ define(['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * The Ease class provides a collection of easing functions for use with tween.js.
@@ -215,37 +215,7 @@ define(['exports'], function (exports) { 'use strict';
215
215
  },
216
216
  });
217
217
 
218
- var now;
219
- // Include a performance.now polyfill.
220
- // In node.js, use process.hrtime.
221
- // eslint-disable-next-line
222
- // @ts-ignore
223
- if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
224
- now = function () {
225
- // eslint-disable-next-line
226
- // @ts-ignore
227
- var time = process.hrtime();
228
- // Convert [seconds, nanoseconds] to milliseconds.
229
- return time[0] * 1000 + time[1] / 1000000;
230
- };
231
- }
232
- // In a browser, use self.performance.now if it is available.
233
- else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
234
- // This must be bound, because directly assigning this function
235
- // leads to an invocation exception in Chrome.
236
- now = self.performance.now.bind(self.performance);
237
- }
238
- // Use Date.now if it is available.
239
- else if (Date.now !== undefined) {
240
- now = Date.now;
241
- }
242
- // Otherwise, use 'new Date().getTime()'.
243
- else {
244
- now = function () {
245
- return new Date().getTime();
246
- };
247
- }
248
- var now$1 = now;
218
+ var now = function () { return performance.now(); };
249
219
 
250
220
  /**
251
221
  * Controlling groups of tweens
@@ -276,7 +246,7 @@ define(['exports'], function (exports) { 'use strict';
276
246
  delete this._tweensAddedDuringUpdate[tween.getId()];
277
247
  };
278
248
  Group.prototype.update = function (time, preserve) {
279
- if (time === void 0) { time = now$1(); }
249
+ if (time === void 0) { time = now(); }
280
250
  if (preserve === void 0) { preserve = false; }
281
251
  var tweenIds = Object.keys(this._tweens);
282
252
  if (tweenIds.length === 0) {
@@ -417,6 +387,7 @@ define(['exports'], function (exports) { 'use strict';
417
387
  this._valuesEnd = {};
418
388
  this._valuesStartRepeat = {};
419
389
  this._duration = 1000;
390
+ this._isDynamic = false;
420
391
  this._initialRepeat = 0;
421
392
  this._repeat = 0;
422
393
  this._yoyo = false;
@@ -432,6 +403,7 @@ define(['exports'], function (exports) { 'use strict';
432
403
  this._onEveryStartCallbackFired = false;
433
404
  this._id = Sequence.nextId();
434
405
  this._isChainStopped = false;
406
+ this._propertiesAreSetUp = false;
435
407
  this._goToEnd = false;
436
408
  }
437
409
  Tween.prototype.getId = function () {
@@ -443,24 +415,27 @@ define(['exports'], function (exports) { 'use strict';
443
415
  Tween.prototype.isPaused = function () {
444
416
  return this._isPaused;
445
417
  };
446
- Tween.prototype.to = function (properties, duration) {
447
- // TODO? restore this, then update the 07_dynamic_to example to set fox
448
- // tween's to on each update. That way the behavior is opt-in (there's
449
- // currently no opt-out).
450
- // for (const prop in properties) this._valuesEnd[prop] = properties[prop]
451
- this._valuesEnd = Object.create(properties);
452
- if (duration !== undefined) {
453
- this._duration = duration;
454
- }
418
+ Tween.prototype.to = function (target, duration) {
419
+ if (duration === void 0) { duration = 1000; }
420
+ if (this._isPlaying)
421
+ throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
422
+ this._valuesEnd = target;
423
+ this._propertiesAreSetUp = false;
424
+ this._duration = duration;
455
425
  return this;
456
426
  };
457
- Tween.prototype.duration = function (d) {
458
- if (d === void 0) { d = 1000; }
459
- this._duration = d;
427
+ Tween.prototype.duration = function (duration) {
428
+ if (duration === void 0) { duration = 1000; }
429
+ this._duration = duration;
430
+ return this;
431
+ };
432
+ Tween.prototype.dynamic = function (dynamic) {
433
+ if (dynamic === void 0) { dynamic = false; }
434
+ this._isDynamic = dynamic;
460
435
  return this;
461
436
  };
462
437
  Tween.prototype.start = function (time, overrideStartingValues) {
463
- if (time === void 0) { time = now$1(); }
438
+ if (time === void 0) { time = now(); }
464
439
  if (overrideStartingValues === void 0) { overrideStartingValues = false; }
465
440
  if (this._isPlaying) {
466
441
  return this;
@@ -484,7 +459,17 @@ define(['exports'], function (exports) { 'use strict';
484
459
  this._isChainStopped = false;
485
460
  this._startTime = time;
486
461
  this._startTime += this._delayTime;
487
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
462
+ if (!this._propertiesAreSetUp || overrideStartingValues) {
463
+ this._propertiesAreSetUp = true;
464
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
465
+ if (!this._isDynamic) {
466
+ var tmp = {};
467
+ for (var prop in this._valuesEnd)
468
+ tmp[prop] = this._valuesEnd[prop];
469
+ this._valuesEnd = tmp;
470
+ }
471
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
472
+ }
488
473
  return this;
489
474
  };
490
475
  Tween.prototype.startFromCurrentValues = function (time) {
@@ -507,26 +492,42 @@ define(['exports'], function (exports) { 'use strict';
507
492
  if (endValues.length === 0) {
508
493
  continue;
509
494
  }
510
- // handle an array of relative values
511
- endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
512
- // Create a local copy of the Array with the start value at the front
513
- if (_valuesStart[property] === undefined) {
514
- _valuesEnd[property] = [startValue].concat(endValues);
495
+ // Handle an array of relative values.
496
+ // Creates a local copy of the Array with the start value at the front
497
+ var temp = [startValue];
498
+ for (var i = 0, l = endValues.length; i < l; i += 1) {
499
+ var value = this._handleRelativeValue(startValue, endValues[i]);
500
+ if (isNaN(value)) {
501
+ isInterpolationList = false;
502
+ console.warn('Found invalid interpolation list. Skipping.');
503
+ break;
504
+ }
505
+ temp.push(value);
506
+ }
507
+ if (isInterpolationList) {
508
+ // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
509
+ _valuesEnd[property] = temp;
510
+ // }
515
511
  }
516
512
  }
517
513
  // handle the deepness of the values
518
514
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
519
515
  _valuesStart[property] = startValueIsArray ? [] : {};
520
- // eslint-disable-next-line
521
- for (var prop in startValue) {
522
- // eslint-disable-next-line
523
- // @ts-ignore FIXME?
524
- _valuesStart[property][prop] = startValue[prop];
516
+ var nestedObject = startValue;
517
+ for (var prop in nestedObject) {
518
+ _valuesStart[property][prop] = nestedObject[prop];
525
519
  }
526
- _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
527
- // eslint-disable-next-line
528
- // @ts-ignore FIXME?
529
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
520
+ // TODO? repeat nested values? And yoyo? And array values?
521
+ _valuesStartRepeat[property] = startValueIsArray ? [] : {};
522
+ var endValues = _valuesEnd[property];
523
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
524
+ if (!this._isDynamic) {
525
+ var tmp = {};
526
+ for (var prop in endValues)
527
+ tmp[prop] = endValues[prop];
528
+ _valuesEnd[property] = endValues = tmp;
529
+ }
530
+ this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
530
531
  }
531
532
  else {
532
533
  // Save the starting value, but only once unless override is requested.
@@ -572,7 +573,7 @@ define(['exports'], function (exports) { 'use strict';
572
573
  return this;
573
574
  };
574
575
  Tween.prototype.pause = function (time) {
575
- if (time === void 0) { time = now$1(); }
576
+ if (time === void 0) { time = now(); }
576
577
  if (this._isPaused || !this._isPlaying) {
577
578
  return this;
578
579
  }
@@ -583,7 +584,7 @@ define(['exports'], function (exports) { 'use strict';
583
584
  return this;
584
585
  };
585
586
  Tween.prototype.resume = function (time) {
586
- if (time === void 0) { time = now$1(); }
587
+ if (time === void 0) { time = now(); }
587
588
  if (!this._isPaused || !this._isPlaying) {
588
589
  return this;
589
590
  }
@@ -674,7 +675,7 @@ define(['exports'], function (exports) { 'use strict';
674
675
  * it is still playing, just paused).
675
676
  */
676
677
  Tween.prototype.update = function (time, autoStart) {
677
- if (time === void 0) { time = now$1(); }
678
+ if (time === void 0) { time = now(); }
678
679
  if (autoStart === void 0) { autoStart = true; }
679
680
  if (this._isPaused)
680
681
  return true;
@@ -797,9 +798,7 @@ define(['exports'], function (exports) { 'use strict';
797
798
  if (end.charAt(0) === '+' || end.charAt(0) === '-') {
798
799
  return start + parseFloat(end);
799
800
  }
800
- else {
801
- return parseFloat(end);
802
- }
801
+ return parseFloat(end);
803
802
  };
804
803
  Tween.prototype._swapEndStartRepeatValues = function (property) {
805
804
  var tmp = this._valuesStartRepeat[property];
@@ -815,7 +814,7 @@ define(['exports'], function (exports) { 'use strict';
815
814
  return Tween;
816
815
  }());
817
816
 
818
- var VERSION = '19.0.0';
817
+ var VERSION = '20.0.1';
819
818
 
820
819
  /**
821
820
  * Tween.js - Licensed under the MIT license
@@ -846,7 +845,7 @@ define(['exports'], function (exports) { 'use strict';
846
845
  Easing: Easing,
847
846
  Group: Group,
848
847
  Interpolation: Interpolation,
849
- now: now$1,
848
+ now: now,
850
849
  Sequence: Sequence,
851
850
  nextId: nextId,
852
851
  Tween: Tween,
@@ -868,11 +867,11 @@ define(['exports'], function (exports) { 'use strict';
868
867
  exports.default = exports$1;
869
868
  exports.getAll = getAll;
870
869
  exports.nextId = nextId;
871
- exports.now = now$1;
870
+ exports.now = now;
872
871
  exports.remove = remove;
873
872
  exports.removeAll = removeAll;
874
873
  exports.update = update;
875
874
 
876
875
  Object.defineProperty(exports, '__esModule', { value: true });
877
876
 
878
- });
877
+ }));
package/dist/tween.cjs.js CHANGED
@@ -217,37 +217,7 @@ var Easing = Object.freeze({
217
217
  },
218
218
  });
219
219
 
220
- var now;
221
- // Include a performance.now polyfill.
222
- // In node.js, use process.hrtime.
223
- // eslint-disable-next-line
224
- // @ts-ignore
225
- if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
226
- now = function () {
227
- // eslint-disable-next-line
228
- // @ts-ignore
229
- var time = process.hrtime();
230
- // Convert [seconds, nanoseconds] to milliseconds.
231
- return time[0] * 1000 + time[1] / 1000000;
232
- };
233
- }
234
- // In a browser, use self.performance.now if it is available.
235
- else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
236
- // This must be bound, because directly assigning this function
237
- // leads to an invocation exception in Chrome.
238
- now = self.performance.now.bind(self.performance);
239
- }
240
- // Use Date.now if it is available.
241
- else if (Date.now !== undefined) {
242
- now = Date.now;
243
- }
244
- // Otherwise, use 'new Date().getTime()'.
245
- else {
246
- now = function () {
247
- return new Date().getTime();
248
- };
249
- }
250
- var now$1 = now;
220
+ var now = function () { return performance.now(); };
251
221
 
252
222
  /**
253
223
  * Controlling groups of tweens
@@ -278,7 +248,7 @@ var Group = /** @class */ (function () {
278
248
  delete this._tweensAddedDuringUpdate[tween.getId()];
279
249
  };
280
250
  Group.prototype.update = function (time, preserve) {
281
- if (time === void 0) { time = now$1(); }
251
+ if (time === void 0) { time = now(); }
282
252
  if (preserve === void 0) { preserve = false; }
283
253
  var tweenIds = Object.keys(this._tweens);
284
254
  if (tweenIds.length === 0) {
@@ -419,6 +389,7 @@ var Tween = /** @class */ (function () {
419
389
  this._valuesEnd = {};
420
390
  this._valuesStartRepeat = {};
421
391
  this._duration = 1000;
392
+ this._isDynamic = false;
422
393
  this._initialRepeat = 0;
423
394
  this._repeat = 0;
424
395
  this._yoyo = false;
@@ -434,6 +405,7 @@ var Tween = /** @class */ (function () {
434
405
  this._onEveryStartCallbackFired = false;
435
406
  this._id = Sequence.nextId();
436
407
  this._isChainStopped = false;
408
+ this._propertiesAreSetUp = false;
437
409
  this._goToEnd = false;
438
410
  }
439
411
  Tween.prototype.getId = function () {
@@ -445,24 +417,27 @@ var Tween = /** @class */ (function () {
445
417
  Tween.prototype.isPaused = function () {
446
418
  return this._isPaused;
447
419
  };
448
- Tween.prototype.to = function (properties, duration) {
449
- // TODO? restore this, then update the 07_dynamic_to example to set fox
450
- // tween's to on each update. That way the behavior is opt-in (there's
451
- // currently no opt-out).
452
- // for (const prop in properties) this._valuesEnd[prop] = properties[prop]
453
- this._valuesEnd = Object.create(properties);
454
- if (duration !== undefined) {
455
- this._duration = duration;
456
- }
420
+ Tween.prototype.to = function (target, duration) {
421
+ if (duration === void 0) { duration = 1000; }
422
+ if (this._isPlaying)
423
+ throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
424
+ this._valuesEnd = target;
425
+ this._propertiesAreSetUp = false;
426
+ this._duration = duration;
457
427
  return this;
458
428
  };
459
- Tween.prototype.duration = function (d) {
460
- if (d === void 0) { d = 1000; }
461
- this._duration = d;
429
+ Tween.prototype.duration = function (duration) {
430
+ if (duration === void 0) { duration = 1000; }
431
+ this._duration = duration;
432
+ return this;
433
+ };
434
+ Tween.prototype.dynamic = function (dynamic) {
435
+ if (dynamic === void 0) { dynamic = false; }
436
+ this._isDynamic = dynamic;
462
437
  return this;
463
438
  };
464
439
  Tween.prototype.start = function (time, overrideStartingValues) {
465
- if (time === void 0) { time = now$1(); }
440
+ if (time === void 0) { time = now(); }
466
441
  if (overrideStartingValues === void 0) { overrideStartingValues = false; }
467
442
  if (this._isPlaying) {
468
443
  return this;
@@ -486,7 +461,17 @@ var Tween = /** @class */ (function () {
486
461
  this._isChainStopped = false;
487
462
  this._startTime = time;
488
463
  this._startTime += this._delayTime;
489
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
464
+ if (!this._propertiesAreSetUp || overrideStartingValues) {
465
+ this._propertiesAreSetUp = true;
466
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
467
+ if (!this._isDynamic) {
468
+ var tmp = {};
469
+ for (var prop in this._valuesEnd)
470
+ tmp[prop] = this._valuesEnd[prop];
471
+ this._valuesEnd = tmp;
472
+ }
473
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
474
+ }
490
475
  return this;
491
476
  };
492
477
  Tween.prototype.startFromCurrentValues = function (time) {
@@ -509,26 +494,42 @@ var Tween = /** @class */ (function () {
509
494
  if (endValues.length === 0) {
510
495
  continue;
511
496
  }
512
- // handle an array of relative values
513
- endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
514
- // Create a local copy of the Array with the start value at the front
515
- if (_valuesStart[property] === undefined) {
516
- _valuesEnd[property] = [startValue].concat(endValues);
497
+ // Handle an array of relative values.
498
+ // Creates a local copy of the Array with the start value at the front
499
+ var temp = [startValue];
500
+ for (var i = 0, l = endValues.length; i < l; i += 1) {
501
+ var value = this._handleRelativeValue(startValue, endValues[i]);
502
+ if (isNaN(value)) {
503
+ isInterpolationList = false;
504
+ console.warn('Found invalid interpolation list. Skipping.');
505
+ break;
506
+ }
507
+ temp.push(value);
508
+ }
509
+ if (isInterpolationList) {
510
+ // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
511
+ _valuesEnd[property] = temp;
512
+ // }
517
513
  }
518
514
  }
519
515
  // handle the deepness of the values
520
516
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
521
517
  _valuesStart[property] = startValueIsArray ? [] : {};
522
- // eslint-disable-next-line
523
- for (var prop in startValue) {
524
- // eslint-disable-next-line
525
- // @ts-ignore FIXME?
526
- _valuesStart[property][prop] = startValue[prop];
518
+ var nestedObject = startValue;
519
+ for (var prop in nestedObject) {
520
+ _valuesStart[property][prop] = nestedObject[prop];
527
521
  }
528
- _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
529
- // eslint-disable-next-line
530
- // @ts-ignore FIXME?
531
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
522
+ // TODO? repeat nested values? And yoyo? And array values?
523
+ _valuesStartRepeat[property] = startValueIsArray ? [] : {};
524
+ var endValues = _valuesEnd[property];
525
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
526
+ if (!this._isDynamic) {
527
+ var tmp = {};
528
+ for (var prop in endValues)
529
+ tmp[prop] = endValues[prop];
530
+ _valuesEnd[property] = endValues = tmp;
531
+ }
532
+ this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
532
533
  }
533
534
  else {
534
535
  // Save the starting value, but only once unless override is requested.
@@ -574,7 +575,7 @@ var Tween = /** @class */ (function () {
574
575
  return this;
575
576
  };
576
577
  Tween.prototype.pause = function (time) {
577
- if (time === void 0) { time = now$1(); }
578
+ if (time === void 0) { time = now(); }
578
579
  if (this._isPaused || !this._isPlaying) {
579
580
  return this;
580
581
  }
@@ -585,7 +586,7 @@ var Tween = /** @class */ (function () {
585
586
  return this;
586
587
  };
587
588
  Tween.prototype.resume = function (time) {
588
- if (time === void 0) { time = now$1(); }
589
+ if (time === void 0) { time = now(); }
589
590
  if (!this._isPaused || !this._isPlaying) {
590
591
  return this;
591
592
  }
@@ -676,7 +677,7 @@ var Tween = /** @class */ (function () {
676
677
  * it is still playing, just paused).
677
678
  */
678
679
  Tween.prototype.update = function (time, autoStart) {
679
- if (time === void 0) { time = now$1(); }
680
+ if (time === void 0) { time = now(); }
680
681
  if (autoStart === void 0) { autoStart = true; }
681
682
  if (this._isPaused)
682
683
  return true;
@@ -799,9 +800,7 @@ var Tween = /** @class */ (function () {
799
800
  if (end.charAt(0) === '+' || end.charAt(0) === '-') {
800
801
  return start + parseFloat(end);
801
802
  }
802
- else {
803
- return parseFloat(end);
804
- }
803
+ return parseFloat(end);
805
804
  };
806
805
  Tween.prototype._swapEndStartRepeatValues = function (property) {
807
806
  var tmp = this._valuesStartRepeat[property];
@@ -817,7 +816,7 @@ var Tween = /** @class */ (function () {
817
816
  return Tween;
818
817
  }());
819
818
 
820
- var VERSION = '19.0.0';
819
+ var VERSION = '20.0.1';
821
820
 
822
821
  /**
823
822
  * Tween.js - Licensed under the MIT license
@@ -848,7 +847,7 @@ var exports$1 = {
848
847
  Easing: Easing,
849
848
  Group: Group,
850
849
  Interpolation: Interpolation,
851
- now: now$1,
850
+ now: now,
852
851
  Sequence: Sequence,
853
852
  nextId: nextId,
854
853
  Tween: Tween,
@@ -870,7 +869,7 @@ exports.add = add;
870
869
  exports.default = exports$1;
871
870
  exports.getAll = getAll;
872
871
  exports.nextId = nextId;
873
- exports.now = now$1;
872
+ exports.now = now;
874
873
  exports.remove = remove;
875
874
  exports.removeAll = removeAll;
876
875
  exports.update = update;
package/dist/tween.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare type EasingFunction = (amount: number) => number;
2
- declare type EasingFunctionGroup = {
1
+ type EasingFunction = (amount: number) => number;
2
+ type EasingFunctionGroup = {
3
3
  In: EasingFunction;
4
4
  Out: EasingFunction;
5
5
  InOut: EasingFunction;
@@ -27,7 +27,7 @@ declare const Easing: Readonly<{
27
27
  /**
28
28
  *
29
29
  */
30
- declare type InterpolationFunction = (v: number[], k: number) => number;
30
+ type InterpolationFunction = (v: number[], k: number) => number;
31
31
  /**
32
32
  *
33
33
  */
@@ -43,6 +43,31 @@ declare const Interpolation: {
43
43
  };
44
44
  };
45
45
 
46
+ /**
47
+ * Controlling groups of tweens
48
+ *
49
+ * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
50
+ * In these cases, you may want to create your own smaller groups of tween
51
+ */
52
+ declare class Group {
53
+ private _tweens;
54
+ private _tweensAddedDuringUpdate;
55
+ getAll(): Array<Tween<UnknownProps>>;
56
+ removeAll(): void;
57
+ add(tween: Tween<UnknownProps>): void;
58
+ remove(tween: Tween<UnknownProps>): void;
59
+ update(time?: number, preserve?: boolean): boolean;
60
+ }
61
+
62
+ /**
63
+ * Tween.js - Licensed under the MIT license
64
+ * https://github.com/tweenjs/tween.js
65
+ * ----------------------------------------------
66
+ *
67
+ * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
68
+ * Thank you all, you're awesome!
69
+ */
70
+
46
71
  declare class Tween<T extends UnknownProps> {
47
72
  private _object;
48
73
  private _group;
@@ -52,6 +77,7 @@ declare class Tween<T extends UnknownProps> {
52
77
  private _valuesEnd;
53
78
  private _valuesStartRepeat;
54
79
  private _duration;
80
+ private _isDynamic;
55
81
  private _initialRepeat;
56
82
  private _repeat;
57
83
  private _repeatDelayTime?;
@@ -73,12 +99,14 @@ declare class Tween<T extends UnknownProps> {
73
99
  private _onStopCallback?;
74
100
  private _id;
75
101
  private _isChainStopped;
102
+ private _propertiesAreSetUp;
76
103
  constructor(_object: T, _group?: Group | false);
77
104
  getId(): number;
78
105
  isPlaying(): boolean;
79
106
  isPaused(): boolean;
80
- to(properties: UnknownProps, duration?: number): this;
81
- duration(d?: number): this;
107
+ to(target: UnknownProps, duration?: number): this;
108
+ duration(duration?: number): this;
109
+ dynamic(dynamic?: boolean): this;
82
110
  start(time?: number, overrideStartingValues?: boolean): this;
83
111
  startFromCurrentValues(time?: number): this;
84
112
  private _setupProperties;
@@ -112,25 +140,9 @@ declare class Tween<T extends UnknownProps> {
112
140
  private _handleRelativeValue;
113
141
  private _swapEndStartRepeatValues;
114
142
  }
115
- declare type UnknownProps = Record<string, any>;
116
-
117
- /**
118
- * Controlling groups of tweens
119
- *
120
- * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
121
- * In these cases, you may want to create your own smaller groups of tween
122
- */
123
- declare class Group {
124
- private _tweens;
125
- private _tweensAddedDuringUpdate;
126
- getAll(): Array<Tween<UnknownProps>>;
127
- removeAll(): void;
128
- add(tween: Tween<UnknownProps>): void;
129
- remove(tween: Tween<UnknownProps>): void;
130
- update(time?: number, preserve?: boolean): boolean;
131
- }
143
+ type UnknownProps = Record<string, any>;
132
144
 
133
- declare let now: () => number;
145
+ declare const now: () => number;
134
146
 
135
147
  /**
136
148
  * Utils
@@ -140,14 +152,15 @@ declare class Sequence {
140
152
  static nextId(): number;
141
153
  }
142
154
 
143
- declare const VERSION = "19.0.0";
155
+ declare const VERSION = "20.0.1";
144
156
 
145
157
  declare const nextId: typeof Sequence.nextId;
146
- declare const getAll: () => Tween<Record<string, any>>[];
158
+ declare const getAll: () => Tween<UnknownProps>[];
147
159
  declare const removeAll: () => void;
148
- declare const add: (tween: Tween<Record<string, any>>) => void;
149
- declare const remove: (tween: Tween<Record<string, any>>) => void;
160
+ declare const add: (tween: Tween<UnknownProps>) => void;
161
+ declare const remove: (tween: Tween<UnknownProps>) => void;
150
162
  declare const update: (time?: number, preserve?: boolean) => boolean;
163
+
151
164
  declare const exports: {
152
165
  Easing: Readonly<{
153
166
  Linear: Readonly<EasingFunctionGroup & {
@@ -182,12 +195,11 @@ declare const exports: {
182
195
  nextId: typeof Sequence.nextId;
183
196
  Tween: typeof Tween;
184
197
  VERSION: string;
185
- getAll: () => Tween<Record<string, any>>[];
198
+ getAll: () => Tween<UnknownProps>[];
186
199
  removeAll: () => void;
187
- add: (tween: Tween<Record<string, any>>) => void;
188
- remove: (tween: Tween<Record<string, any>>) => void;
200
+ add: (tween: Tween<UnknownProps>) => void;
201
+ remove: (tween: Tween<UnknownProps>) => void;
189
202
  update: (time?: number, preserve?: boolean) => boolean;
190
203
  };
191
204
 
192
- export default exports;
193
- export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, getAll, nextId, now, remove, removeAll, update };
205
+ export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };