@tweenjs/tween.js 18.6.3 → 19.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.esm.js CHANGED
@@ -1,13 +1,22 @@
1
1
  /**
2
2
  * The Ease class provides a collection of easing functions for use with tween.js.
3
3
  */
4
- var Easing = {
5
- Linear: {
4
+ var Easing = Object.freeze({
5
+ Linear: Object.freeze({
6
6
  None: function (amount) {
7
7
  return amount;
8
8
  },
9
- },
10
- Quadratic: {
9
+ In: function (amount) {
10
+ return this.None(amount);
11
+ },
12
+ Out: function (amount) {
13
+ return this.None(amount);
14
+ },
15
+ InOut: function (amount) {
16
+ return this.None(amount);
17
+ },
18
+ }),
19
+ Quadratic: Object.freeze({
11
20
  In: function (amount) {
12
21
  return amount * amount;
13
22
  },
@@ -20,8 +29,8 @@ var Easing = {
20
29
  }
21
30
  return -0.5 * (--amount * (amount - 2) - 1);
22
31
  },
23
- },
24
- Cubic: {
32
+ }),
33
+ Cubic: Object.freeze({
25
34
  In: function (amount) {
26
35
  return amount * amount * amount;
27
36
  },
@@ -34,8 +43,8 @@ var Easing = {
34
43
  }
35
44
  return 0.5 * ((amount -= 2) * amount * amount + 2);
36
45
  },
37
- },
38
- Quartic: {
46
+ }),
47
+ Quartic: Object.freeze({
39
48
  In: function (amount) {
40
49
  return amount * amount * amount * amount;
41
50
  },
@@ -48,8 +57,8 @@ var Easing = {
48
57
  }
49
58
  return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
50
59
  },
51
- },
52
- Quintic: {
60
+ }),
61
+ Quintic: Object.freeze({
53
62
  In: function (amount) {
54
63
  return amount * amount * amount * amount * amount;
55
64
  },
@@ -62,19 +71,19 @@ var Easing = {
62
71
  }
63
72
  return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
64
73
  },
65
- },
66
- Sinusoidal: {
74
+ }),
75
+ Sinusoidal: Object.freeze({
67
76
  In: function (amount) {
68
- return 1 - Math.cos((amount * Math.PI) / 2);
77
+ return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
69
78
  },
70
79
  Out: function (amount) {
71
80
  return Math.sin((amount * Math.PI) / 2);
72
81
  },
73
82
  InOut: function (amount) {
74
- return 0.5 * (1 - Math.cos(Math.PI * amount));
83
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
75
84
  },
76
- },
77
- Exponential: {
85
+ }),
86
+ Exponential: Object.freeze({
78
87
  In: function (amount) {
79
88
  return amount === 0 ? 0 : Math.pow(1024, amount - 1);
80
89
  },
@@ -93,8 +102,8 @@ var Easing = {
93
102
  }
94
103
  return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
95
104
  },
96
- },
97
- Circular: {
105
+ }),
106
+ Circular: Object.freeze({
98
107
  In: function (amount) {
99
108
  return 1 - Math.sqrt(1 - amount * amount);
100
109
  },
@@ -107,8 +116,8 @@ var Easing = {
107
116
  }
108
117
  return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
109
118
  },
110
- },
111
- Elastic: {
119
+ }),
120
+ Elastic: Object.freeze({
112
121
  In: function (amount) {
113
122
  if (amount === 0) {
114
123
  return 0;
@@ -140,15 +149,15 @@ var Easing = {
140
149
  }
141
150
  return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
142
151
  },
143
- },
144
- Back: {
152
+ }),
153
+ Back: Object.freeze({
145
154
  In: function (amount) {
146
155
  var s = 1.70158;
147
- return amount * amount * ((s + 1) * amount - s);
156
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
148
157
  },
149
158
  Out: function (amount) {
150
159
  var s = 1.70158;
151
- return --amount * amount * ((s + 1) * amount + s) + 1;
160
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
152
161
  },
153
162
  InOut: function (amount) {
154
163
  var s = 1.70158 * 1.525;
@@ -157,8 +166,8 @@ var Easing = {
157
166
  }
158
167
  return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
159
168
  },
160
- },
161
- Bounce: {
169
+ }),
170
+ Bounce: Object.freeze({
162
171
  In: function (amount) {
163
172
  return 1 - Easing.Bounce.Out(1 - amount);
164
173
  },
@@ -182,8 +191,27 @@ var Easing = {
182
191
  }
183
192
  return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
184
193
  },
194
+ }),
195
+ generatePow: function (power) {
196
+ if (power === void 0) { power = 4; }
197
+ power = power < Number.EPSILON ? Number.EPSILON : power;
198
+ power = power > 10000 ? 10000 : power;
199
+ return {
200
+ In: function (amount) {
201
+ return Math.pow(amount, power);
202
+ },
203
+ Out: function (amount) {
204
+ return 1 - Math.pow((1 - amount), power);
205
+ },
206
+ InOut: function (amount) {
207
+ if (amount < 0.5) {
208
+ return Math.pow((amount * 2), power) / 2;
209
+ }
210
+ return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
211
+ },
212
+ };
185
213
  },
186
- };
214
+ });
187
215
 
188
216
  var now;
189
217
  // Include a performance.now polyfill.
@@ -396,8 +424,10 @@ var Tween = /** @class */ (function () {
396
424
  this._startTime = 0;
397
425
  this._easingFunction = Easing.Linear.None;
398
426
  this._interpolationFunction = Interpolation.Linear;
427
+ // eslint-disable-next-line
399
428
  this._chainedTweens = [];
400
429
  this._onStartCallbackFired = false;
430
+ this._onEveryStartCallbackFired = false;
401
431
  this._id = Sequence.nextId();
402
432
  this._isChainStopped = false;
403
433
  this._goToEnd = false;
@@ -423,10 +453,13 @@ var Tween = /** @class */ (function () {
423
453
  return this;
424
454
  };
425
455
  Tween.prototype.duration = function (d) {
456
+ if (d === void 0) { d = 1000; }
426
457
  this._duration = d;
427
458
  return this;
428
459
  };
429
- Tween.prototype.start = function (time) {
460
+ Tween.prototype.start = function (time, overrideStartingValues) {
461
+ if (time === void 0) { time = now$1(); }
462
+ if (overrideStartingValues === void 0) { overrideStartingValues = false; }
430
463
  if (this._isPlaying) {
431
464
  return this;
432
465
  }
@@ -445,13 +478,17 @@ var Tween = /** @class */ (function () {
445
478
  this._isPlaying = true;
446
479
  this._isPaused = false;
447
480
  this._onStartCallbackFired = false;
481
+ this._onEveryStartCallbackFired = false;
448
482
  this._isChainStopped = false;
449
- this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1();
483
+ this._startTime = time;
450
484
  this._startTime += this._delayTime;
451
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
485
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
452
486
  return this;
453
487
  };
454
- Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {
488
+ Tween.prototype.startFromCurrentValues = function (time) {
489
+ return this.start(time, true);
490
+ };
491
+ Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
455
492
  for (var property in _valuesEnd) {
456
493
  var startValue = _object[property];
457
494
  var startValueIsArray = Array.isArray(startValue);
@@ -471,7 +508,9 @@ var Tween = /** @class */ (function () {
471
508
  // handle an array of relative values
472
509
  endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
473
510
  // Create a local copy of the Array with the start value at the front
474
- _valuesEnd[property] = [startValue].concat(endValues);
511
+ if (_valuesStart[property] === undefined) {
512
+ _valuesEnd[property] = [startValue].concat(endValues);
513
+ }
475
514
  }
476
515
  // handle the deepness of the values
477
516
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
@@ -485,11 +524,11 @@ var Tween = /** @class */ (function () {
485
524
  _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
486
525
  // eslint-disable-next-line
487
526
  // @ts-ignore FIXME?
488
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
527
+ this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
489
528
  }
490
529
  else {
491
- // Save the starting value, but only once.
492
- if (typeof _valuesStart[property] === 'undefined') {
530
+ // Save the starting value, but only once unless override is requested.
531
+ if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
493
532
  _valuesStart[property] = startValue;
494
533
  }
495
534
  if (!startValueIsArray) {
@@ -560,14 +599,17 @@ var Tween = /** @class */ (function () {
560
599
  return this;
561
600
  };
562
601
  Tween.prototype.group = function (group) {
602
+ if (group === void 0) { group = mainGroup; }
563
603
  this._group = group;
564
604
  return this;
565
605
  };
566
606
  Tween.prototype.delay = function (amount) {
607
+ if (amount === void 0) { amount = 0; }
567
608
  this._delayTime = amount;
568
609
  return this;
569
610
  };
570
611
  Tween.prototype.repeat = function (times) {
612
+ if (times === void 0) { times = 0; }
571
613
  this._initialRepeat = times;
572
614
  this._repeat = times;
573
615
  return this;
@@ -577,17 +619,21 @@ var Tween = /** @class */ (function () {
577
619
  return this;
578
620
  };
579
621
  Tween.prototype.yoyo = function (yoyo) {
622
+ if (yoyo === void 0) { yoyo = false; }
580
623
  this._yoyo = yoyo;
581
624
  return this;
582
625
  };
583
626
  Tween.prototype.easing = function (easingFunction) {
627
+ if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
584
628
  this._easingFunction = easingFunction;
585
629
  return this;
586
630
  };
587
631
  Tween.prototype.interpolation = function (interpolationFunction) {
632
+ if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
588
633
  this._interpolationFunction = interpolationFunction;
589
634
  return this;
590
635
  };
636
+ // eslint-disable-next-line
591
637
  Tween.prototype.chain = function () {
592
638
  var tweens = [];
593
639
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -600,6 +646,10 @@ var Tween = /** @class */ (function () {
600
646
  this._onStartCallback = callback;
601
647
  return this;
602
648
  };
649
+ Tween.prototype.onEveryStart = function (callback) {
650
+ this._onEveryStartCallback = callback;
651
+ return this;
652
+ };
603
653
  Tween.prototype.onUpdate = function (callback) {
604
654
  this._onUpdateCallback = callback;
605
655
  return this;
@@ -633,7 +683,7 @@ var Tween = /** @class */ (function () {
633
683
  if (time > endTime)
634
684
  return false;
635
685
  if (autoStart)
636
- this.start(time);
686
+ this.start(time, true);
637
687
  }
638
688
  this._goToEnd = false;
639
689
  if (time < this._startTime) {
@@ -645,6 +695,12 @@ var Tween = /** @class */ (function () {
645
695
  }
646
696
  this._onStartCallbackFired = true;
647
697
  }
698
+ if (this._onEveryStartCallbackFired === false) {
699
+ if (this._onEveryStartCallback) {
700
+ this._onEveryStartCallback(this._object);
701
+ }
702
+ this._onEveryStartCallbackFired = true;
703
+ }
648
704
  elapsed = (time - this._startTime) / this._duration;
649
705
  elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
650
706
  var value = this._easingFunction(elapsed);
@@ -683,6 +739,7 @@ var Tween = /** @class */ (function () {
683
739
  if (this._onRepeatCallback) {
684
740
  this._onRepeatCallback(this._object);
685
741
  }
742
+ this._onEveryStartCallbackFired = false;
686
743
  return true;
687
744
  }
688
745
  else {
@@ -692,7 +749,7 @@ var Tween = /** @class */ (function () {
692
749
  for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
693
750
  // Make the chained tweens start exactly at the time they should,
694
751
  // even if the `update()` method was called way past the duration of the tween
695
- this._chainedTweens[i].start(this._startTime + this._duration);
752
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
696
753
  }
697
754
  this._isPlaying = false;
698
755
  return false;
@@ -744,10 +801,9 @@ var Tween = /** @class */ (function () {
744
801
  };
745
802
  Tween.prototype._swapEndStartRepeatValues = function (property) {
746
803
  var tmp = this._valuesStartRepeat[property];
747
- if (typeof this._valuesEnd[property] === 'string') {
748
- // eslint-disable-next-line
749
- // @ts-ignore FIXME?
750
- this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
804
+ var endValue = this._valuesEnd[property];
805
+ if (typeof endValue === 'string') {
806
+ this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
751
807
  }
752
808
  else {
753
809
  this._valuesStartRepeat[property] = this._valuesEnd[property];
@@ -757,7 +813,7 @@ var Tween = /** @class */ (function () {
757
813
  return Tween;
758
814
  }());
759
815
 
760
- var VERSION = '18.6.3';
816
+ var VERSION = '19.0.0';
761
817
 
762
818
  /**
763
819
  * Tween.js - Licensed under the MIT license
package/dist/tween.umd.js CHANGED
@@ -7,13 +7,22 @@
7
7
  /**
8
8
  * The Ease class provides a collection of easing functions for use with tween.js.
9
9
  */
10
- var Easing = {
11
- Linear: {
10
+ var Easing = Object.freeze({
11
+ Linear: Object.freeze({
12
12
  None: function (amount) {
13
13
  return amount;
14
14
  },
15
- },
16
- Quadratic: {
15
+ In: function (amount) {
16
+ return this.None(amount);
17
+ },
18
+ Out: function (amount) {
19
+ return this.None(amount);
20
+ },
21
+ InOut: function (amount) {
22
+ return this.None(amount);
23
+ },
24
+ }),
25
+ Quadratic: Object.freeze({
17
26
  In: function (amount) {
18
27
  return amount * amount;
19
28
  },
@@ -26,8 +35,8 @@
26
35
  }
27
36
  return -0.5 * (--amount * (amount - 2) - 1);
28
37
  },
29
- },
30
- Cubic: {
38
+ }),
39
+ Cubic: Object.freeze({
31
40
  In: function (amount) {
32
41
  return amount * amount * amount;
33
42
  },
@@ -40,8 +49,8 @@
40
49
  }
41
50
  return 0.5 * ((amount -= 2) * amount * amount + 2);
42
51
  },
43
- },
44
- Quartic: {
52
+ }),
53
+ Quartic: Object.freeze({
45
54
  In: function (amount) {
46
55
  return amount * amount * amount * amount;
47
56
  },
@@ -54,8 +63,8 @@
54
63
  }
55
64
  return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
56
65
  },
57
- },
58
- Quintic: {
66
+ }),
67
+ Quintic: Object.freeze({
59
68
  In: function (amount) {
60
69
  return amount * amount * amount * amount * amount;
61
70
  },
@@ -68,19 +77,19 @@
68
77
  }
69
78
  return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
70
79
  },
71
- },
72
- Sinusoidal: {
80
+ }),
81
+ Sinusoidal: Object.freeze({
73
82
  In: function (amount) {
74
- return 1 - Math.cos((amount * Math.PI) / 2);
83
+ return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
75
84
  },
76
85
  Out: function (amount) {
77
86
  return Math.sin((amount * Math.PI) / 2);
78
87
  },
79
88
  InOut: function (amount) {
80
- return 0.5 * (1 - Math.cos(Math.PI * amount));
89
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
81
90
  },
82
- },
83
- Exponential: {
91
+ }),
92
+ Exponential: Object.freeze({
84
93
  In: function (amount) {
85
94
  return amount === 0 ? 0 : Math.pow(1024, amount - 1);
86
95
  },
@@ -99,8 +108,8 @@
99
108
  }
100
109
  return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
101
110
  },
102
- },
103
- Circular: {
111
+ }),
112
+ Circular: Object.freeze({
104
113
  In: function (amount) {
105
114
  return 1 - Math.sqrt(1 - amount * amount);
106
115
  },
@@ -113,8 +122,8 @@
113
122
  }
114
123
  return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
115
124
  },
116
- },
117
- Elastic: {
125
+ }),
126
+ Elastic: Object.freeze({
118
127
  In: function (amount) {
119
128
  if (amount === 0) {
120
129
  return 0;
@@ -146,15 +155,15 @@
146
155
  }
147
156
  return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
148
157
  },
149
- },
150
- Back: {
158
+ }),
159
+ Back: Object.freeze({
151
160
  In: function (amount) {
152
161
  var s = 1.70158;
153
- return amount * amount * ((s + 1) * amount - s);
162
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
154
163
  },
155
164
  Out: function (amount) {
156
165
  var s = 1.70158;
157
- return --amount * amount * ((s + 1) * amount + s) + 1;
166
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
158
167
  },
159
168
  InOut: function (amount) {
160
169
  var s = 1.70158 * 1.525;
@@ -163,8 +172,8 @@
163
172
  }
164
173
  return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
165
174
  },
166
- },
167
- Bounce: {
175
+ }),
176
+ Bounce: Object.freeze({
168
177
  In: function (amount) {
169
178
  return 1 - Easing.Bounce.Out(1 - amount);
170
179
  },
@@ -188,8 +197,27 @@
188
197
  }
189
198
  return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
190
199
  },
200
+ }),
201
+ generatePow: function (power) {
202
+ if (power === void 0) { power = 4; }
203
+ power = power < Number.EPSILON ? Number.EPSILON : power;
204
+ power = power > 10000 ? 10000 : power;
205
+ return {
206
+ In: function (amount) {
207
+ return Math.pow(amount, power);
208
+ },
209
+ Out: function (amount) {
210
+ return 1 - Math.pow((1 - amount), power);
211
+ },
212
+ InOut: function (amount) {
213
+ if (amount < 0.5) {
214
+ return Math.pow((amount * 2), power) / 2;
215
+ }
216
+ return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
217
+ },
218
+ };
191
219
  },
192
- };
220
+ });
193
221
 
194
222
  var now;
195
223
  // Include a performance.now polyfill.
@@ -402,8 +430,10 @@
402
430
  this._startTime = 0;
403
431
  this._easingFunction = Easing.Linear.None;
404
432
  this._interpolationFunction = Interpolation.Linear;
433
+ // eslint-disable-next-line
405
434
  this._chainedTweens = [];
406
435
  this._onStartCallbackFired = false;
436
+ this._onEveryStartCallbackFired = false;
407
437
  this._id = Sequence.nextId();
408
438
  this._isChainStopped = false;
409
439
  this._goToEnd = false;
@@ -429,10 +459,13 @@
429
459
  return this;
430
460
  };
431
461
  Tween.prototype.duration = function (d) {
462
+ if (d === void 0) { d = 1000; }
432
463
  this._duration = d;
433
464
  return this;
434
465
  };
435
- Tween.prototype.start = function (time) {
466
+ Tween.prototype.start = function (time, overrideStartingValues) {
467
+ if (time === void 0) { time = now$1(); }
468
+ if (overrideStartingValues === void 0) { overrideStartingValues = false; }
436
469
  if (this._isPlaying) {
437
470
  return this;
438
471
  }
@@ -451,13 +484,17 @@
451
484
  this._isPlaying = true;
452
485
  this._isPaused = false;
453
486
  this._onStartCallbackFired = false;
487
+ this._onEveryStartCallbackFired = false;
454
488
  this._isChainStopped = false;
455
- this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1();
489
+ this._startTime = time;
456
490
  this._startTime += this._delayTime;
457
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
491
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
458
492
  return this;
459
493
  };
460
- Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {
494
+ Tween.prototype.startFromCurrentValues = function (time) {
495
+ return this.start(time, true);
496
+ };
497
+ Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
461
498
  for (var property in _valuesEnd) {
462
499
  var startValue = _object[property];
463
500
  var startValueIsArray = Array.isArray(startValue);
@@ -477,7 +514,9 @@
477
514
  // handle an array of relative values
478
515
  endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
479
516
  // Create a local copy of the Array with the start value at the front
480
- _valuesEnd[property] = [startValue].concat(endValues);
517
+ if (_valuesStart[property] === undefined) {
518
+ _valuesEnd[property] = [startValue].concat(endValues);
519
+ }
481
520
  }
482
521
  // handle the deepness of the values
483
522
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
@@ -491,11 +530,11 @@
491
530
  _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
492
531
  // eslint-disable-next-line
493
532
  // @ts-ignore FIXME?
494
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
533
+ this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
495
534
  }
496
535
  else {
497
- // Save the starting value, but only once.
498
- if (typeof _valuesStart[property] === 'undefined') {
536
+ // Save the starting value, but only once unless override is requested.
537
+ if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
499
538
  _valuesStart[property] = startValue;
500
539
  }
501
540
  if (!startValueIsArray) {
@@ -566,14 +605,17 @@
566
605
  return this;
567
606
  };
568
607
  Tween.prototype.group = function (group) {
608
+ if (group === void 0) { group = mainGroup; }
569
609
  this._group = group;
570
610
  return this;
571
611
  };
572
612
  Tween.prototype.delay = function (amount) {
613
+ if (amount === void 0) { amount = 0; }
573
614
  this._delayTime = amount;
574
615
  return this;
575
616
  };
576
617
  Tween.prototype.repeat = function (times) {
618
+ if (times === void 0) { times = 0; }
577
619
  this._initialRepeat = times;
578
620
  this._repeat = times;
579
621
  return this;
@@ -583,17 +625,21 @@
583
625
  return this;
584
626
  };
585
627
  Tween.prototype.yoyo = function (yoyo) {
628
+ if (yoyo === void 0) { yoyo = false; }
586
629
  this._yoyo = yoyo;
587
630
  return this;
588
631
  };
589
632
  Tween.prototype.easing = function (easingFunction) {
633
+ if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
590
634
  this._easingFunction = easingFunction;
591
635
  return this;
592
636
  };
593
637
  Tween.prototype.interpolation = function (interpolationFunction) {
638
+ if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
594
639
  this._interpolationFunction = interpolationFunction;
595
640
  return this;
596
641
  };
642
+ // eslint-disable-next-line
597
643
  Tween.prototype.chain = function () {
598
644
  var tweens = [];
599
645
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -606,6 +652,10 @@
606
652
  this._onStartCallback = callback;
607
653
  return this;
608
654
  };
655
+ Tween.prototype.onEveryStart = function (callback) {
656
+ this._onEveryStartCallback = callback;
657
+ return this;
658
+ };
609
659
  Tween.prototype.onUpdate = function (callback) {
610
660
  this._onUpdateCallback = callback;
611
661
  return this;
@@ -639,7 +689,7 @@
639
689
  if (time > endTime)
640
690
  return false;
641
691
  if (autoStart)
642
- this.start(time);
692
+ this.start(time, true);
643
693
  }
644
694
  this._goToEnd = false;
645
695
  if (time < this._startTime) {
@@ -651,6 +701,12 @@
651
701
  }
652
702
  this._onStartCallbackFired = true;
653
703
  }
704
+ if (this._onEveryStartCallbackFired === false) {
705
+ if (this._onEveryStartCallback) {
706
+ this._onEveryStartCallback(this._object);
707
+ }
708
+ this._onEveryStartCallbackFired = true;
709
+ }
654
710
  elapsed = (time - this._startTime) / this._duration;
655
711
  elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
656
712
  var value = this._easingFunction(elapsed);
@@ -689,6 +745,7 @@
689
745
  if (this._onRepeatCallback) {
690
746
  this._onRepeatCallback(this._object);
691
747
  }
748
+ this._onEveryStartCallbackFired = false;
692
749
  return true;
693
750
  }
694
751
  else {
@@ -698,7 +755,7 @@
698
755
  for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
699
756
  // Make the chained tweens start exactly at the time they should,
700
757
  // even if the `update()` method was called way past the duration of the tween
701
- this._chainedTweens[i].start(this._startTime + this._duration);
758
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
702
759
  }
703
760
  this._isPlaying = false;
704
761
  return false;
@@ -750,10 +807,9 @@
750
807
  };
751
808
  Tween.prototype._swapEndStartRepeatValues = function (property) {
752
809
  var tmp = this._valuesStartRepeat[property];
753
- if (typeof this._valuesEnd[property] === 'string') {
754
- // eslint-disable-next-line
755
- // @ts-ignore FIXME?
756
- this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
810
+ var endValue = this._valuesEnd[property];
811
+ if (typeof endValue === 'string') {
812
+ this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
757
813
  }
758
814
  else {
759
815
  this._valuesStartRepeat[property] = this._valuesEnd[property];
@@ -763,7 +819,7 @@
763
819
  return Tween;
764
820
  }());
765
821
 
766
- var VERSION = '18.6.3';
822
+ var VERSION = '19.0.0';
767
823
 
768
824
  /**
769
825
  * Tween.js - Licensed under the MIT license