@tweenjs/tween.js 18.6.4 → 19.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -239,15 +239,13 @@ You need to install `npm` first--this comes with node.js, so install that one fi
239
239
  npm install
240
240
  ```
241
241
 
242
- if running the tests for the first time, to install additional dependencies for running tests, and then run
242
+ To run the tests run:
243
243
 
244
244
  ```bash
245
245
  npm test
246
246
  ```
247
247
 
248
- every time you want to run the tests.
249
-
250
- If you want to add any feature or change existing features, you _must_ run the tests to make sure you didn't break anything else. If you send a pull request (PR) to add something new and it doesn't have tests, or the tests don't pass, the PR won't be accepted. See [contributing](CONTRIBUTING.md) for more information.
248
+ If you want to add any feature or change existing features, you _must_ run the tests to make sure you didn't break anything else. Any pull request (PR) needs to have updated passing tests for feature changes (or new passing tests for new features) in `src/tests.ts`, otherwise the PR won't be accepted. See [contributing](CONTRIBUTING.md) for more information.
251
249
 
252
250
  ## People
253
251
 
package/dist/tween.amd.js CHANGED
@@ -3,13 +3,22 @@ define(['exports'], function (exports) { 'use strict';
3
3
  /**
4
4
  * The Ease class provides a collection of easing functions for use with tween.js.
5
5
  */
6
- var Easing = {
7
- Linear: {
6
+ var Easing = Object.freeze({
7
+ Linear: Object.freeze({
8
8
  None: function (amount) {
9
9
  return amount;
10
10
  },
11
- },
12
- Quadratic: {
11
+ In: function (amount) {
12
+ return this.None(amount);
13
+ },
14
+ Out: function (amount) {
15
+ return this.None(amount);
16
+ },
17
+ InOut: function (amount) {
18
+ return this.None(amount);
19
+ },
20
+ }),
21
+ Quadratic: Object.freeze({
13
22
  In: function (amount) {
14
23
  return amount * amount;
15
24
  },
@@ -22,8 +31,8 @@ define(['exports'], function (exports) { 'use strict';
22
31
  }
23
32
  return -0.5 * (--amount * (amount - 2) - 1);
24
33
  },
25
- },
26
- Cubic: {
34
+ }),
35
+ Cubic: Object.freeze({
27
36
  In: function (amount) {
28
37
  return amount * amount * amount;
29
38
  },
@@ -36,8 +45,8 @@ define(['exports'], function (exports) { 'use strict';
36
45
  }
37
46
  return 0.5 * ((amount -= 2) * amount * amount + 2);
38
47
  },
39
- },
40
- Quartic: {
48
+ }),
49
+ Quartic: Object.freeze({
41
50
  In: function (amount) {
42
51
  return amount * amount * amount * amount;
43
52
  },
@@ -50,8 +59,8 @@ define(['exports'], function (exports) { 'use strict';
50
59
  }
51
60
  return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
52
61
  },
53
- },
54
- Quintic: {
62
+ }),
63
+ Quintic: Object.freeze({
55
64
  In: function (amount) {
56
65
  return amount * amount * amount * amount * amount;
57
66
  },
@@ -64,19 +73,19 @@ define(['exports'], function (exports) { 'use strict';
64
73
  }
65
74
  return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
66
75
  },
67
- },
68
- Sinusoidal: {
76
+ }),
77
+ Sinusoidal: Object.freeze({
69
78
  In: function (amount) {
70
- return 1 - Math.cos((amount * Math.PI) / 2);
79
+ return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
71
80
  },
72
81
  Out: function (amount) {
73
82
  return Math.sin((amount * Math.PI) / 2);
74
83
  },
75
84
  InOut: function (amount) {
76
- return 0.5 * (1 - Math.cos(Math.PI * amount));
85
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
77
86
  },
78
- },
79
- Exponential: {
87
+ }),
88
+ Exponential: Object.freeze({
80
89
  In: function (amount) {
81
90
  return amount === 0 ? 0 : Math.pow(1024, amount - 1);
82
91
  },
@@ -95,8 +104,8 @@ define(['exports'], function (exports) { 'use strict';
95
104
  }
96
105
  return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
97
106
  },
98
- },
99
- Circular: {
107
+ }),
108
+ Circular: Object.freeze({
100
109
  In: function (amount) {
101
110
  return 1 - Math.sqrt(1 - amount * amount);
102
111
  },
@@ -109,8 +118,8 @@ define(['exports'], function (exports) { 'use strict';
109
118
  }
110
119
  return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
111
120
  },
112
- },
113
- Elastic: {
121
+ }),
122
+ Elastic: Object.freeze({
114
123
  In: function (amount) {
115
124
  if (amount === 0) {
116
125
  return 0;
@@ -142,15 +151,15 @@ define(['exports'], function (exports) { 'use strict';
142
151
  }
143
152
  return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
144
153
  },
145
- },
146
- Back: {
154
+ }),
155
+ Back: Object.freeze({
147
156
  In: function (amount) {
148
157
  var s = 1.70158;
149
- return amount * amount * ((s + 1) * amount - s);
158
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
150
159
  },
151
160
  Out: function (amount) {
152
161
  var s = 1.70158;
153
- return --amount * amount * ((s + 1) * amount + s) + 1;
162
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
154
163
  },
155
164
  InOut: function (amount) {
156
165
  var s = 1.70158 * 1.525;
@@ -159,8 +168,8 @@ define(['exports'], function (exports) { 'use strict';
159
168
  }
160
169
  return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
161
170
  },
162
- },
163
- Bounce: {
171
+ }),
172
+ Bounce: Object.freeze({
164
173
  In: function (amount) {
165
174
  return 1 - Easing.Bounce.Out(1 - amount);
166
175
  },
@@ -184,8 +193,27 @@ define(['exports'], function (exports) { 'use strict';
184
193
  }
185
194
  return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
186
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
+ };
187
215
  },
188
- };
216
+ });
189
217
 
190
218
  var now;
191
219
  // Include a performance.now polyfill.
@@ -398,8 +426,10 @@ define(['exports'], function (exports) { 'use strict';
398
426
  this._startTime = 0;
399
427
  this._easingFunction = Easing.Linear.None;
400
428
  this._interpolationFunction = Interpolation.Linear;
429
+ // eslint-disable-next-line
401
430
  this._chainedTweens = [];
402
431
  this._onStartCallbackFired = false;
432
+ this._onEveryStartCallbackFired = false;
403
433
  this._id = Sequence.nextId();
404
434
  this._isChainStopped = false;
405
435
  this._goToEnd = false;
@@ -425,10 +455,13 @@ define(['exports'], function (exports) { 'use strict';
425
455
  return this;
426
456
  };
427
457
  Tween.prototype.duration = function (d) {
458
+ if (d === void 0) { d = 1000; }
428
459
  this._duration = d;
429
460
  return this;
430
461
  };
431
- Tween.prototype.start = function (time) {
462
+ Tween.prototype.start = function (time, overrideStartingValues) {
463
+ if (time === void 0) { time = now$1(); }
464
+ if (overrideStartingValues === void 0) { overrideStartingValues = false; }
432
465
  if (this._isPlaying) {
433
466
  return this;
434
467
  }
@@ -447,13 +480,17 @@ define(['exports'], function (exports) { 'use strict';
447
480
  this._isPlaying = true;
448
481
  this._isPaused = false;
449
482
  this._onStartCallbackFired = false;
483
+ this._onEveryStartCallbackFired = false;
450
484
  this._isChainStopped = false;
451
- this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1();
485
+ this._startTime = time;
452
486
  this._startTime += this._delayTime;
453
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
487
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
454
488
  return this;
455
489
  };
456
- Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {
490
+ Tween.prototype.startFromCurrentValues = function (time) {
491
+ return this.start(time, true);
492
+ };
493
+ Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
457
494
  for (var property in _valuesEnd) {
458
495
  var startValue = _object[property];
459
496
  var startValueIsArray = Array.isArray(startValue);
@@ -473,7 +510,9 @@ define(['exports'], function (exports) { 'use strict';
473
510
  // handle an array of relative values
474
511
  endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
475
512
  // Create a local copy of the Array with the start value at the front
476
- _valuesEnd[property] = [startValue].concat(endValues);
513
+ if (_valuesStart[property] === undefined) {
514
+ _valuesEnd[property] = [startValue].concat(endValues);
515
+ }
477
516
  }
478
517
  // handle the deepness of the values
479
518
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
@@ -487,11 +526,11 @@ define(['exports'], function (exports) { 'use strict';
487
526
  _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
488
527
  // eslint-disable-next-line
489
528
  // @ts-ignore FIXME?
490
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
529
+ this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
491
530
  }
492
531
  else {
493
- // Save the starting value, but only once.
494
- if (typeof _valuesStart[property] === 'undefined') {
532
+ // Save the starting value, but only once unless override is requested.
533
+ if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
495
534
  _valuesStart[property] = startValue;
496
535
  }
497
536
  if (!startValueIsArray) {
@@ -562,14 +601,17 @@ define(['exports'], function (exports) { 'use strict';
562
601
  return this;
563
602
  };
564
603
  Tween.prototype.group = function (group) {
604
+ if (group === void 0) { group = mainGroup; }
565
605
  this._group = group;
566
606
  return this;
567
607
  };
568
608
  Tween.prototype.delay = function (amount) {
609
+ if (amount === void 0) { amount = 0; }
569
610
  this._delayTime = amount;
570
611
  return this;
571
612
  };
572
613
  Tween.prototype.repeat = function (times) {
614
+ if (times === void 0) { times = 0; }
573
615
  this._initialRepeat = times;
574
616
  this._repeat = times;
575
617
  return this;
@@ -579,17 +621,21 @@ define(['exports'], function (exports) { 'use strict';
579
621
  return this;
580
622
  };
581
623
  Tween.prototype.yoyo = function (yoyo) {
624
+ if (yoyo === void 0) { yoyo = false; }
582
625
  this._yoyo = yoyo;
583
626
  return this;
584
627
  };
585
628
  Tween.prototype.easing = function (easingFunction) {
629
+ if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
586
630
  this._easingFunction = easingFunction;
587
631
  return this;
588
632
  };
589
633
  Tween.prototype.interpolation = function (interpolationFunction) {
634
+ if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
590
635
  this._interpolationFunction = interpolationFunction;
591
636
  return this;
592
637
  };
638
+ // eslint-disable-next-line
593
639
  Tween.prototype.chain = function () {
594
640
  var tweens = [];
595
641
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -602,6 +648,10 @@ define(['exports'], function (exports) { 'use strict';
602
648
  this._onStartCallback = callback;
603
649
  return this;
604
650
  };
651
+ Tween.prototype.onEveryStart = function (callback) {
652
+ this._onEveryStartCallback = callback;
653
+ return this;
654
+ };
605
655
  Tween.prototype.onUpdate = function (callback) {
606
656
  this._onUpdateCallback = callback;
607
657
  return this;
@@ -635,7 +685,7 @@ define(['exports'], function (exports) { 'use strict';
635
685
  if (time > endTime)
636
686
  return false;
637
687
  if (autoStart)
638
- this.start(time);
688
+ this.start(time, true);
639
689
  }
640
690
  this._goToEnd = false;
641
691
  if (time < this._startTime) {
@@ -647,6 +697,12 @@ define(['exports'], function (exports) { 'use strict';
647
697
  }
648
698
  this._onStartCallbackFired = true;
649
699
  }
700
+ if (this._onEveryStartCallbackFired === false) {
701
+ if (this._onEveryStartCallback) {
702
+ this._onEveryStartCallback(this._object);
703
+ }
704
+ this._onEveryStartCallbackFired = true;
705
+ }
650
706
  elapsed = (time - this._startTime) / this._duration;
651
707
  elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
652
708
  var value = this._easingFunction(elapsed);
@@ -685,6 +741,7 @@ define(['exports'], function (exports) { 'use strict';
685
741
  if (this._onRepeatCallback) {
686
742
  this._onRepeatCallback(this._object);
687
743
  }
744
+ this._onEveryStartCallbackFired = false;
688
745
  return true;
689
746
  }
690
747
  else {
@@ -694,7 +751,7 @@ define(['exports'], function (exports) { 'use strict';
694
751
  for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
695
752
  // Make the chained tweens start exactly at the time they should,
696
753
  // even if the `update()` method was called way past the duration of the tween
697
- this._chainedTweens[i].start(this._startTime + this._duration);
754
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
698
755
  }
699
756
  this._isPlaying = false;
700
757
  return false;
@@ -758,7 +815,7 @@ define(['exports'], function (exports) { 'use strict';
758
815
  return Tween;
759
816
  }());
760
817
 
761
- var VERSION = '18.6.4';
818
+ var VERSION = '19.0.0';
762
819
 
763
820
  /**
764
821
  * Tween.js - Licensed under the MIT license
package/dist/tween.cjs.js CHANGED
@@ -5,13 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  /**
6
6
  * The Ease class provides a collection of easing functions for use with tween.js.
7
7
  */
8
- var Easing = {
9
- Linear: {
8
+ var Easing = Object.freeze({
9
+ Linear: Object.freeze({
10
10
  None: function (amount) {
11
11
  return amount;
12
12
  },
13
- },
14
- Quadratic: {
13
+ In: function (amount) {
14
+ return this.None(amount);
15
+ },
16
+ Out: function (amount) {
17
+ return this.None(amount);
18
+ },
19
+ InOut: function (amount) {
20
+ return this.None(amount);
21
+ },
22
+ }),
23
+ Quadratic: Object.freeze({
15
24
  In: function (amount) {
16
25
  return amount * amount;
17
26
  },
@@ -24,8 +33,8 @@ var Easing = {
24
33
  }
25
34
  return -0.5 * (--amount * (amount - 2) - 1);
26
35
  },
27
- },
28
- Cubic: {
36
+ }),
37
+ Cubic: Object.freeze({
29
38
  In: function (amount) {
30
39
  return amount * amount * amount;
31
40
  },
@@ -38,8 +47,8 @@ var Easing = {
38
47
  }
39
48
  return 0.5 * ((amount -= 2) * amount * amount + 2);
40
49
  },
41
- },
42
- Quartic: {
50
+ }),
51
+ Quartic: Object.freeze({
43
52
  In: function (amount) {
44
53
  return amount * amount * amount * amount;
45
54
  },
@@ -52,8 +61,8 @@ var Easing = {
52
61
  }
53
62
  return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
54
63
  },
55
- },
56
- Quintic: {
64
+ }),
65
+ Quintic: Object.freeze({
57
66
  In: function (amount) {
58
67
  return amount * amount * amount * amount * amount;
59
68
  },
@@ -66,19 +75,19 @@ var Easing = {
66
75
  }
67
76
  return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
68
77
  },
69
- },
70
- Sinusoidal: {
78
+ }),
79
+ Sinusoidal: Object.freeze({
71
80
  In: function (amount) {
72
- return 1 - Math.cos((amount * Math.PI) / 2);
81
+ return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);
73
82
  },
74
83
  Out: function (amount) {
75
84
  return Math.sin((amount * Math.PI) / 2);
76
85
  },
77
86
  InOut: function (amount) {
78
- return 0.5 * (1 - Math.cos(Math.PI * amount));
87
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
79
88
  },
80
- },
81
- Exponential: {
89
+ }),
90
+ Exponential: Object.freeze({
82
91
  In: function (amount) {
83
92
  return amount === 0 ? 0 : Math.pow(1024, amount - 1);
84
93
  },
@@ -97,8 +106,8 @@ var Easing = {
97
106
  }
98
107
  return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
99
108
  },
100
- },
101
- Circular: {
109
+ }),
110
+ Circular: Object.freeze({
102
111
  In: function (amount) {
103
112
  return 1 - Math.sqrt(1 - amount * amount);
104
113
  },
@@ -111,8 +120,8 @@ var Easing = {
111
120
  }
112
121
  return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
113
122
  },
114
- },
115
- Elastic: {
123
+ }),
124
+ Elastic: Object.freeze({
116
125
  In: function (amount) {
117
126
  if (amount === 0) {
118
127
  return 0;
@@ -144,15 +153,15 @@ var Easing = {
144
153
  }
145
154
  return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
146
155
  },
147
- },
148
- Back: {
156
+ }),
157
+ Back: Object.freeze({
149
158
  In: function (amount) {
150
159
  var s = 1.70158;
151
- return amount * amount * ((s + 1) * amount - s);
160
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
152
161
  },
153
162
  Out: function (amount) {
154
163
  var s = 1.70158;
155
- return --amount * amount * ((s + 1) * amount + s) + 1;
164
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
156
165
  },
157
166
  InOut: function (amount) {
158
167
  var s = 1.70158 * 1.525;
@@ -161,8 +170,8 @@ var Easing = {
161
170
  }
162
171
  return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
163
172
  },
164
- },
165
- Bounce: {
173
+ }),
174
+ Bounce: Object.freeze({
166
175
  In: function (amount) {
167
176
  return 1 - Easing.Bounce.Out(1 - amount);
168
177
  },
@@ -186,8 +195,27 @@ var Easing = {
186
195
  }
187
196
  return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
188
197
  },
198
+ }),
199
+ generatePow: function (power) {
200
+ if (power === void 0) { power = 4; }
201
+ power = power < Number.EPSILON ? Number.EPSILON : power;
202
+ power = power > 10000 ? 10000 : power;
203
+ return {
204
+ In: function (amount) {
205
+ return Math.pow(amount, power);
206
+ },
207
+ Out: function (amount) {
208
+ return 1 - Math.pow((1 - amount), power);
209
+ },
210
+ InOut: function (amount) {
211
+ if (amount < 0.5) {
212
+ return Math.pow((amount * 2), power) / 2;
213
+ }
214
+ return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;
215
+ },
216
+ };
189
217
  },
190
- };
218
+ });
191
219
 
192
220
  var now;
193
221
  // Include a performance.now polyfill.
@@ -400,8 +428,10 @@ var Tween = /** @class */ (function () {
400
428
  this._startTime = 0;
401
429
  this._easingFunction = Easing.Linear.None;
402
430
  this._interpolationFunction = Interpolation.Linear;
431
+ // eslint-disable-next-line
403
432
  this._chainedTweens = [];
404
433
  this._onStartCallbackFired = false;
434
+ this._onEveryStartCallbackFired = false;
405
435
  this._id = Sequence.nextId();
406
436
  this._isChainStopped = false;
407
437
  this._goToEnd = false;
@@ -427,10 +457,13 @@ var Tween = /** @class */ (function () {
427
457
  return this;
428
458
  };
429
459
  Tween.prototype.duration = function (d) {
460
+ if (d === void 0) { d = 1000; }
430
461
  this._duration = d;
431
462
  return this;
432
463
  };
433
- Tween.prototype.start = function (time) {
464
+ Tween.prototype.start = function (time, overrideStartingValues) {
465
+ if (time === void 0) { time = now$1(); }
466
+ if (overrideStartingValues === void 0) { overrideStartingValues = false; }
434
467
  if (this._isPlaying) {
435
468
  return this;
436
469
  }
@@ -449,13 +482,17 @@ var Tween = /** @class */ (function () {
449
482
  this._isPlaying = true;
450
483
  this._isPaused = false;
451
484
  this._onStartCallbackFired = false;
485
+ this._onEveryStartCallbackFired = false;
452
486
  this._isChainStopped = false;
453
- this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1();
487
+ this._startTime = time;
454
488
  this._startTime += this._delayTime;
455
- this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat);
489
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
456
490
  return this;
457
491
  };
458
- Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) {
492
+ Tween.prototype.startFromCurrentValues = function (time) {
493
+ return this.start(time, true);
494
+ };
495
+ Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
459
496
  for (var property in _valuesEnd) {
460
497
  var startValue = _object[property];
461
498
  var startValueIsArray = Array.isArray(startValue);
@@ -475,7 +512,9 @@ var Tween = /** @class */ (function () {
475
512
  // handle an array of relative values
476
513
  endValues = endValues.map(this._handleRelativeValue.bind(this, startValue));
477
514
  // Create a local copy of the Array with the start value at the front
478
- _valuesEnd[property] = [startValue].concat(endValues);
515
+ if (_valuesStart[property] === undefined) {
516
+ _valuesEnd[property] = [startValue].concat(endValues);
517
+ }
479
518
  }
480
519
  // handle the deepness of the values
481
520
  if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {
@@ -489,11 +528,11 @@ var Tween = /** @class */ (function () {
489
528
  _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values?
490
529
  // eslint-disable-next-line
491
530
  // @ts-ignore FIXME?
492
- this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]);
531
+ this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues);
493
532
  }
494
533
  else {
495
- // Save the starting value, but only once.
496
- if (typeof _valuesStart[property] === 'undefined') {
534
+ // Save the starting value, but only once unless override is requested.
535
+ if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {
497
536
  _valuesStart[property] = startValue;
498
537
  }
499
538
  if (!startValueIsArray) {
@@ -564,14 +603,17 @@ var Tween = /** @class */ (function () {
564
603
  return this;
565
604
  };
566
605
  Tween.prototype.group = function (group) {
606
+ if (group === void 0) { group = mainGroup; }
567
607
  this._group = group;
568
608
  return this;
569
609
  };
570
610
  Tween.prototype.delay = function (amount) {
611
+ if (amount === void 0) { amount = 0; }
571
612
  this._delayTime = amount;
572
613
  return this;
573
614
  };
574
615
  Tween.prototype.repeat = function (times) {
616
+ if (times === void 0) { times = 0; }
575
617
  this._initialRepeat = times;
576
618
  this._repeat = times;
577
619
  return this;
@@ -581,17 +623,21 @@ var Tween = /** @class */ (function () {
581
623
  return this;
582
624
  };
583
625
  Tween.prototype.yoyo = function (yoyo) {
626
+ if (yoyo === void 0) { yoyo = false; }
584
627
  this._yoyo = yoyo;
585
628
  return this;
586
629
  };
587
630
  Tween.prototype.easing = function (easingFunction) {
631
+ if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }
588
632
  this._easingFunction = easingFunction;
589
633
  return this;
590
634
  };
591
635
  Tween.prototype.interpolation = function (interpolationFunction) {
636
+ if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }
592
637
  this._interpolationFunction = interpolationFunction;
593
638
  return this;
594
639
  };
640
+ // eslint-disable-next-line
595
641
  Tween.prototype.chain = function () {
596
642
  var tweens = [];
597
643
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -604,6 +650,10 @@ var Tween = /** @class */ (function () {
604
650
  this._onStartCallback = callback;
605
651
  return this;
606
652
  };
653
+ Tween.prototype.onEveryStart = function (callback) {
654
+ this._onEveryStartCallback = callback;
655
+ return this;
656
+ };
607
657
  Tween.prototype.onUpdate = function (callback) {
608
658
  this._onUpdateCallback = callback;
609
659
  return this;
@@ -637,7 +687,7 @@ var Tween = /** @class */ (function () {
637
687
  if (time > endTime)
638
688
  return false;
639
689
  if (autoStart)
640
- this.start(time);
690
+ this.start(time, true);
641
691
  }
642
692
  this._goToEnd = false;
643
693
  if (time < this._startTime) {
@@ -649,6 +699,12 @@ var Tween = /** @class */ (function () {
649
699
  }
650
700
  this._onStartCallbackFired = true;
651
701
  }
702
+ if (this._onEveryStartCallbackFired === false) {
703
+ if (this._onEveryStartCallback) {
704
+ this._onEveryStartCallback(this._object);
705
+ }
706
+ this._onEveryStartCallbackFired = true;
707
+ }
652
708
  elapsed = (time - this._startTime) / this._duration;
653
709
  elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed;
654
710
  var value = this._easingFunction(elapsed);
@@ -687,6 +743,7 @@ var Tween = /** @class */ (function () {
687
743
  if (this._onRepeatCallback) {
688
744
  this._onRepeatCallback(this._object);
689
745
  }
746
+ this._onEveryStartCallbackFired = false;
690
747
  return true;
691
748
  }
692
749
  else {
@@ -696,7 +753,7 @@ var Tween = /** @class */ (function () {
696
753
  for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
697
754
  // Make the chained tweens start exactly at the time they should,
698
755
  // even if the `update()` method was called way past the duration of the tween
699
- this._chainedTweens[i].start(this._startTime + this._duration);
756
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
700
757
  }
701
758
  this._isPlaying = false;
702
759
  return false;
@@ -760,7 +817,7 @@ var Tween = /** @class */ (function () {
760
817
  return Tween;
761
818
  }());
762
819
 
763
- var VERSION = '18.6.4';
820
+ var VERSION = '19.0.0';
764
821
 
765
822
  /**
766
823
  * Tween.js - Licensed under the MIT license