@tweenjs/tween.js 19.0.0 → 20.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/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.0';
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.0";
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 };
package/dist/tween.esm.js CHANGED
@@ -213,37 +213,7 @@ var Easing = Object.freeze({
213
213
  },
214
214
  });
215
215
 
216
- var now;
217
- // Include a performance.now polyfill.
218
- // In node.js, use process.hrtime.
219
- // eslint-disable-next-line
220
- // @ts-ignore
221
- if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) {
222
- now = function () {
223
- // eslint-disable-next-line
224
- // @ts-ignore
225
- var time = process.hrtime();
226
- // Convert [seconds, nanoseconds] to milliseconds.
227
- return time[0] * 1000 + time[1] / 1000000;
228
- };
229
- }
230
- // In a browser, use self.performance.now if it is available.
231
- else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) {
232
- // This must be bound, because directly assigning this function
233
- // leads to an invocation exception in Chrome.
234
- now = self.performance.now.bind(self.performance);
235
- }
236
- // Use Date.now if it is available.
237
- else if (Date.now !== undefined) {
238
- now = Date.now;
239
- }
240
- // Otherwise, use 'new Date().getTime()'.
241
- else {
242
- now = function () {
243
- return new Date().getTime();
244
- };
245
- }
246
- var now$1 = now;
216
+ var now = function () { return performance.now(); };
247
217
 
248
218
  /**
249
219
  * Controlling groups of tweens
@@ -274,7 +244,7 @@ var Group = /** @class */ (function () {
274
244
  delete this._tweensAddedDuringUpdate[tween.getId()];
275
245
  };
276
246
  Group.prototype.update = function (time, preserve) {
277
- if (time === void 0) { time = now$1(); }
247
+ if (time === void 0) { time = now(); }
278
248
  if (preserve === void 0) { preserve = false; }
279
249
  var tweenIds = Object.keys(this._tweens);
280
250
  if (tweenIds.length === 0) {
@@ -415,6 +385,7 @@ var Tween = /** @class */ (function () {
415
385
  this._valuesEnd = {};
416
386
  this._valuesStartRepeat = {};
417
387
  this._duration = 1000;
388
+ this._isDynamic = false;
418
389
  this._initialRepeat = 0;
419
390
  this._repeat = 0;
420
391
  this._yoyo = false;
@@ -430,6 +401,7 @@ var Tween = /** @class */ (function () {
430
401
  this._onEveryStartCallbackFired = false;
431
402
  this._id = Sequence.nextId();
432
403
  this._isChainStopped = false;
404
+ this._propertiesAreSetUp = false;
433
405
  this._goToEnd = false;
434
406
  }
435
407
  Tween.prototype.getId = function () {
@@ -441,24 +413,27 @@ var Tween = /** @class */ (function () {
441
413
  Tween.prototype.isPaused = function () {
442
414
  return this._isPaused;
443
415
  };
444
- Tween.prototype.to = function (properties, duration) {
445
- // TODO? restore this, then update the 07_dynamic_to example to set fox
446
- // tween's to on each update. That way the behavior is opt-in (there's
447
- // currently no opt-out).
448
- // for (const prop in properties) this._valuesEnd[prop] = properties[prop]
449
- this._valuesEnd = Object.create(properties);
450
- if (duration !== undefined) {
451
- this._duration = duration;
452
- }
416
+ Tween.prototype.to = function (target, duration) {
417
+ if (duration === void 0) { duration = 1000; }
418
+ if (this._isPlaying)
419
+ throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');
420
+ this._valuesEnd = target;
421
+ this._propertiesAreSetUp = false;
422
+ this._duration = duration;
453
423
  return this;
454
424
  };
455
- Tween.prototype.duration = function (d) {
456
- if (d === void 0) { d = 1000; }
457
- this._duration = d;
425
+ Tween.prototype.duration = function (duration) {
426
+ if (duration === void 0) { duration = 1000; }
427
+ this._duration = duration;
428
+ return this;
429
+ };
430
+ Tween.prototype.dynamic = function (dynamic) {
431
+ if (dynamic === void 0) { dynamic = false; }
432
+ this._isDynamic = dynamic;
458
433
  return this;
459
434
  };
460
435
  Tween.prototype.start = function (time, overrideStartingValues) {
461
- if (time === void 0) { time = now$1(); }
436
+ if (time === void 0) { time = now(); }
462
437
  if (overrideStartingValues === void 0) { overrideStartingValues = false; }
463
438
  if (this._isPlaying) {
464
439
  return this;
@@ -482,7 +457,17 @@ var Tween = /** @class */ (function () {
482
457
  this._isChainStopped = false;
483
458
  this._startTime = time;
484
459
  this._startTime += this._delayTime;
485
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
460
+ if (!this._propertiesAreSetUp || overrideStartingValues) {
461
+ this._propertiesAreSetUp = true;
462
+ // If dynamic is not enabled, clone the end values instead of using the passed-in end values.
463
+ if (!this._isDynamic) {
464
+ var tmp = {};
465
+ for (var prop in this._valuesEnd)
466
+ tmp[prop] = this._valuesEnd[prop];
467
+ this._valuesEnd = tmp;
468
+ }
469
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
470
+ }
486
471
  return this;
487
472
  };
488
473
  Tween.prototype.startFromCurrentValues = function (time) {
@@ -505,26 +490,42 @@ var Tween = /** @class */ (function () {
505
490
  if (endValues.length === 0) {
506
491
  continue;
507
492
  }
508
- // handle an array of relative values
509
- endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
510
- // Create a local copy of the Array with the start value at the front
511
- if (_valuesStart[property] === undefined) {
512
- _valuesEnd[property] = [startValue].concat(endValues);
493
+ // Handle an array of relative values.
494
+ // Creates a local copy of the Array with the start value at the front
495
+ var temp = [startValue];
496
+ for (var i = 0, l = endValues.length; i < l; i += 1) {
497
+ var value = this._handleRelativeValue(startValue, endValues[i]);
498
+ if (isNaN(value)) {
499
+ isInterpolationList = false;
500
+ console.warn('Found invalid interpolation list. Skipping.');
501
+ break;
502
+ }
503
+ temp.push(value);
504
+ }
505
+ if (isInterpolationList) {
506
+ // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.
507
+ _valuesEnd[property] = temp;
508
+ // }
513
509
  }
514
510
  }
515
511
  // handle the deepness of the values
516
512
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
517
513
  _valuesStart[property] = startValueIsArray ? [] : {};
518
- // eslint-disable-next-line
519
- for (var prop in startValue) {
520
- // eslint-disable-next-line
521
- // @ts-ignore FIXME?
522
- _valuesStart[property][prop] = startValue[prop];
514
+ var nestedObject = startValue;
515
+ for (var prop in nestedObject) {
516
+ _valuesStart[property][prop] = nestedObject[prop];
523
517
  }
524
- _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
525
- // eslint-disable-next-line
526
- // @ts-ignore FIXME?
527
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
518
+ // TODO? repeat nested values? And yoyo? And array values?
519
+ _valuesStartRepeat[property] = startValueIsArray ? [] : {};
520
+ var endValues = _valuesEnd[property];
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 endValues)
525
+ tmp[prop] = endValues[prop];
526
+ _valuesEnd[property] = endValues = tmp;
527
+ }
528
+ this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
528
529
  }
529
530
  else {
530
531
  // Save the starting value, but only once unless override is requested.
@@ -570,7 +571,7 @@ var Tween = /** @class */ (function () {
570
571
  return this;
571
572
  };
572
573
  Tween.prototype.pause = function (time) {
573
- if (time === void 0) { time = now$1(); }
574
+ if (time === void 0) { time = now(); }
574
575
  if (this._isPaused || !this._isPlaying) {
575
576
  return this;
576
577
  }
@@ -581,7 +582,7 @@ var Tween = /** @class */ (function () {
581
582
  return this;
582
583
  };
583
584
  Tween.prototype.resume = function (time) {
584
- if (time === void 0) { time = now$1(); }
585
+ if (time === void 0) { time = now(); }
585
586
  if (!this._isPaused || !this._isPlaying) {
586
587
  return this;
587
588
  }
@@ -672,7 +673,7 @@ var Tween = /** @class */ (function () {
672
673
  * it is still playing, just paused).
673
674
  */
674
675
  Tween.prototype.update = function (time, autoStart) {
675
- if (time === void 0) { time = now$1(); }
676
+ if (time === void 0) { time = now(); }
676
677
  if (autoStart === void 0) { autoStart = true; }
677
678
  if (this._isPaused)
678
679
  return true;
@@ -795,9 +796,7 @@ var Tween = /** @class */ (function () {
795
796
  if (end.charAt(0) === '+' || end.charAt(0) === '-') {
796
797
  return start + parseFloat(end);
797
798
  }
798
- else {
799
- return parseFloat(end);
800
- }
799
+ return parseFloat(end);
801
800
  };
802
801
  Tween.prototype._swapEndStartRepeatValues = function (property) {
803
802
  var tmp = this._valuesStartRepeat[property];
@@ -813,7 +812,7 @@ var Tween = /** @class */ (function () {
813
812
  return Tween;
814
813
  }());
815
814
 
816
- var VERSION = '19.0.0';
815
+ var VERSION = '20.0.0';
817
816
 
818
817
  /**
819
818
  * Tween.js - Licensed under the MIT license
@@ -844,7 +843,7 @@ var exports = {
844
843
  Easing: Easing,
845
844
  Group: Group,
846
845
  Interpolation: Interpolation,
847
- now: now$1,
846
+ now: now,
848
847
  Sequence: Sequence,
849
848
  nextId: nextId,
850
849
  Tween: Tween,
@@ -856,5 +855,4 @@ var exports = {
856
855
  update: update,
857
856
  };
858
857
 
859
- export default exports;
860
- export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, getAll, nextId, now$1 as now, remove, removeAll, update };
858
+ export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };