animejs 4.3.2 → 4.3.3

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.
Files changed (125) hide show
  1. package/dist/bundles/anime.esm.js +36 -17
  2. package/dist/bundles/anime.esm.min.js +2 -2
  3. package/dist/bundles/anime.umd.js +36 -17
  4. package/dist/bundles/anime.umd.min.js +2 -2
  5. package/dist/modules/animatable/animatable.cjs +1 -1
  6. package/dist/modules/animatable/animatable.js +1 -1
  7. package/dist/modules/animatable/index.cjs +1 -1
  8. package/dist/modules/animatable/index.js +1 -1
  9. package/dist/modules/animation/additive.cjs +1 -1
  10. package/dist/modules/animation/additive.js +1 -1
  11. package/dist/modules/animation/animation.cjs +29 -15
  12. package/dist/modules/animation/animation.js +30 -16
  13. package/dist/modules/animation/composition.cjs +1 -1
  14. package/dist/modules/animation/composition.js +1 -1
  15. package/dist/modules/animation/index.cjs +1 -1
  16. package/dist/modules/animation/index.js +1 -1
  17. package/dist/modules/core/clock.cjs +1 -1
  18. package/dist/modules/core/clock.js +1 -1
  19. package/dist/modules/core/colors.cjs +1 -1
  20. package/dist/modules/core/colors.js +1 -1
  21. package/dist/modules/core/consts.cjs +1 -1
  22. package/dist/modules/core/consts.js +1 -1
  23. package/dist/modules/core/globals.cjs +2 -2
  24. package/dist/modules/core/globals.js +2 -2
  25. package/dist/modules/core/helpers.cjs +1 -1
  26. package/dist/modules/core/helpers.js +1 -1
  27. package/dist/modules/core/render.cjs +1 -1
  28. package/dist/modules/core/render.js +1 -1
  29. package/dist/modules/core/styles.cjs +1 -1
  30. package/dist/modules/core/styles.js +1 -1
  31. package/dist/modules/core/targets.cjs +1 -1
  32. package/dist/modules/core/targets.js +1 -1
  33. package/dist/modules/core/transforms.cjs +1 -1
  34. package/dist/modules/core/transforms.js +1 -1
  35. package/dist/modules/core/units.cjs +1 -1
  36. package/dist/modules/core/units.js +1 -1
  37. package/dist/modules/core/values.cjs +1 -1
  38. package/dist/modules/core/values.js +1 -1
  39. package/dist/modules/draggable/draggable.cjs +1 -1
  40. package/dist/modules/draggable/draggable.js +1 -1
  41. package/dist/modules/draggable/index.cjs +1 -1
  42. package/dist/modules/draggable/index.js +1 -1
  43. package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
  44. package/dist/modules/easings/cubic-bezier/index.js +1 -1
  45. package/dist/modules/easings/eases/index.cjs +1 -1
  46. package/dist/modules/easings/eases/index.js +1 -1
  47. package/dist/modules/easings/eases/parser.cjs +1 -1
  48. package/dist/modules/easings/eases/parser.js +1 -1
  49. package/dist/modules/easings/index.cjs +1 -1
  50. package/dist/modules/easings/index.js +1 -1
  51. package/dist/modules/easings/irregular/index.cjs +1 -1
  52. package/dist/modules/easings/irregular/index.js +1 -1
  53. package/dist/modules/easings/linear/index.cjs +1 -1
  54. package/dist/modules/easings/linear/index.js +1 -1
  55. package/dist/modules/easings/none.cjs +1 -1
  56. package/dist/modules/easings/none.js +1 -1
  57. package/dist/modules/easings/spring/index.cjs +1 -1
  58. package/dist/modules/easings/spring/index.js +1 -1
  59. package/dist/modules/easings/steps/index.cjs +1 -1
  60. package/dist/modules/easings/steps/index.js +1 -1
  61. package/dist/modules/engine/engine.cjs +1 -1
  62. package/dist/modules/engine/engine.js +1 -1
  63. package/dist/modules/engine/index.cjs +1 -1
  64. package/dist/modules/engine/index.js +1 -1
  65. package/dist/modules/events/index.cjs +1 -1
  66. package/dist/modules/events/index.js +1 -1
  67. package/dist/modules/events/scroll.cjs +4 -1
  68. package/dist/modules/events/scroll.d.ts +2 -0
  69. package/dist/modules/events/scroll.js +4 -1
  70. package/dist/modules/index.cjs +1 -1
  71. package/dist/modules/index.js +1 -1
  72. package/dist/modules/layout/index.cjs +1 -1
  73. package/dist/modules/layout/index.js +1 -1
  74. package/dist/modules/layout/layout.cjs +1 -1
  75. package/dist/modules/layout/layout.js +1 -1
  76. package/dist/modules/scope/index.cjs +1 -1
  77. package/dist/modules/scope/index.js +1 -1
  78. package/dist/modules/scope/scope.cjs +1 -1
  79. package/dist/modules/scope/scope.js +1 -1
  80. package/dist/modules/svg/drawable.cjs +1 -1
  81. package/dist/modules/svg/drawable.js +1 -1
  82. package/dist/modules/svg/helpers.cjs +1 -1
  83. package/dist/modules/svg/helpers.js +1 -1
  84. package/dist/modules/svg/index.cjs +1 -1
  85. package/dist/modules/svg/index.js +1 -1
  86. package/dist/modules/svg/morphto.cjs +1 -1
  87. package/dist/modules/svg/morphto.js +1 -1
  88. package/dist/modules/svg/motionpath.cjs +1 -1
  89. package/dist/modules/svg/motionpath.js +1 -1
  90. package/dist/modules/text/index.cjs +1 -1
  91. package/dist/modules/text/index.js +1 -1
  92. package/dist/modules/text/split.cjs +1 -1
  93. package/dist/modules/text/split.js +1 -1
  94. package/dist/modules/timeline/index.cjs +1 -1
  95. package/dist/modules/timeline/index.js +1 -1
  96. package/dist/modules/timeline/position.cjs +1 -1
  97. package/dist/modules/timeline/position.js +1 -1
  98. package/dist/modules/timeline/timeline.cjs +1 -1
  99. package/dist/modules/timeline/timeline.js +1 -1
  100. package/dist/modules/timer/index.cjs +1 -1
  101. package/dist/modules/timer/index.js +1 -1
  102. package/dist/modules/timer/timer.cjs +1 -1
  103. package/dist/modules/timer/timer.js +1 -1
  104. package/dist/modules/types/index.d.ts +3 -1
  105. package/dist/modules/utils/chainable.cjs +1 -1
  106. package/dist/modules/utils/chainable.js +1 -1
  107. package/dist/modules/utils/index.cjs +1 -1
  108. package/dist/modules/utils/index.js +1 -1
  109. package/dist/modules/utils/number.cjs +1 -1
  110. package/dist/modules/utils/number.js +1 -1
  111. package/dist/modules/utils/random.cjs +1 -1
  112. package/dist/modules/utils/random.js +1 -1
  113. package/dist/modules/utils/stagger.cjs +1 -1
  114. package/dist/modules/utils/stagger.js +1 -1
  115. package/dist/modules/utils/target.cjs +1 -1
  116. package/dist/modules/utils/target.js +1 -1
  117. package/dist/modules/utils/time.cjs +1 -1
  118. package/dist/modules/utils/time.js +1 -1
  119. package/dist/modules/waapi/composition.cjs +1 -1
  120. package/dist/modules/waapi/composition.js +1 -1
  121. package/dist/modules/waapi/index.cjs +1 -1
  122. package/dist/modules/waapi/index.js +1 -1
  123. package/dist/modules/waapi/waapi.cjs +1 -1
  124. package/dist/modules/waapi/waapi.js +1 -1
  125. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - ESM bundle
3
- * @version v4.3.2
3
+ * @version v4.3.3
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -205,7 +205,8 @@
205
205
  * @property {String} property
206
206
  * @property {Target} target
207
207
  * @property {String|Number} _value
208
- * @property {Function|null} _func
208
+ * @property {Function|null} _toFunc
209
+ * @property {Function|null} _fromFunc
209
210
  * @property {EasingFunction} _ease
210
211
  * @property {Array.<Number>} _fromNumbers
211
212
  * @property {Array.<Number>} _toNumbers
@@ -536,6 +537,7 @@
536
537
  * @property {Callback<ScrollObserver>} [onEnterBackward]
537
538
  * @property {Callback<ScrollObserver>} [onLeaveBackward]
538
539
  * @property {Callback<ScrollObserver>} [onUpdate]
540
+ * @property {Callback<ScrollObserver>} [onResize]
539
541
  * @property {Callback<ScrollObserver>} [onSyncComplete]
540
542
  */
541
543
 
@@ -801,7 +803,7 @@ const globals = {
801
803
 
802
804
  const devTools = isBrowser && win.AnimeJSDevTools;
803
805
 
804
- const globalVersions = { version: '4.3.2', engine: null };
806
+ const globalVersions = { version: '4.3.3', engine: null };
805
807
 
806
808
  if (isBrowser) {
807
809
  if (!win.AnimeJS) win.AnimeJS = [];
@@ -3271,6 +3273,7 @@ const fromTargetObject = createDecomposedValueTargetObject();
3271
3273
  const toTargetObject = createDecomposedValueTargetObject();
3272
3274
  const inlineStylesStore = {};
3273
3275
  const toFunctionStore = { func: null };
3276
+ const fromFunctionStore = { func: null };
3274
3277
  const keyframesTargetArray = [null];
3275
3278
  const fastSetValuesArray = [null, null];
3276
3279
  /** @type {TweenKeyValue} */
@@ -3512,6 +3515,7 @@ class JSAnimation extends Timer {
3512
3515
  }
3513
3516
 
3514
3517
  toFunctionStore.func = null;
3518
+ fromFunctionStore.func = null;
3515
3519
 
3516
3520
  const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);
3517
3521
 
@@ -3572,7 +3576,7 @@ class JSAnimation extends Timer {
3572
3576
 
3573
3577
  // Decompose values
3574
3578
  if (isFromToValue) {
3575
- decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl) : tweenFromValue, fromTargetObject);
3579
+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl, fromFunctionStore) : tweenFromValue, fromTargetObject);
3576
3580
  decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);
3577
3581
  // Needed to force an inline style registration
3578
3582
  const originalValue = getOriginalAnimatableValue(target, propName, tweenType, inlineStylesStore);
@@ -3689,7 +3693,8 @@ class JSAnimation extends Timer {
3689
3693
  property: propName,
3690
3694
  target: target,
3691
3695
  _value: null,
3692
- _func: toFunctionStore.func,
3696
+ _toFunc: toFunctionStore.func,
3697
+ _fromFunc: fromFunctionStore.func,
3693
3698
  _ease: parseEase(tweenEasing),
3694
3699
  _fromNumbers: cloneArray(fromTargetObject.d),
3695
3700
  _toNumbers: cloneArray(toTargetObject.d),
@@ -3847,18 +3852,29 @@ class JSAnimation extends Timer {
3847
3852
  */
3848
3853
  refresh() {
3849
3854
  forEachChildren(this, (/** @type {Tween} */tween) => {
3850
- const tweenFunc = tween._func;
3851
- if (tweenFunc) {
3852
- const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
3853
- decomposeRawValue(ogValue, decomposedOriginalValue);
3854
- // TODO: Check for from / to Array based values here,
3855
- decomposeRawValue(tweenFunc(), toTargetObject);
3856
- tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
3857
- tween._fromNumber = decomposedOriginalValue.n;
3858
- tween._toNumbers = cloneArray(toTargetObject.d);
3859
- tween._strings = cloneArray(toTargetObject.s);
3860
- // Make sure to apply relative operators https://github.com/juliangarnier/anime/issues/1025
3861
- tween._toNumber = toTargetObject.o ? getRelativeValue(decomposedOriginalValue.n, toTargetObject.n, toTargetObject.o) : toTargetObject.n;
3855
+ const toFunc = tween._toFunc;
3856
+ const fromFunc = tween._fromFunc;
3857
+ if (toFunc || fromFunc) {
3858
+ if (fromFunc) {
3859
+ decomposeRawValue(fromFunc(), fromTargetObject);
3860
+ if (fromTargetObject.u !== tween._unit && tween.target[isDomSymbol]) {
3861
+ convertValueUnit(/** @type {DOMTarget} */(tween.target), fromTargetObject, tween._unit, true);
3862
+ }
3863
+ tween._fromNumbers = cloneArray(fromTargetObject.d);
3864
+ tween._fromNumber = fromTargetObject.n;
3865
+ } else if (toFunc) {
3866
+ // When only toFunc exists, get from value from target
3867
+ decomposeRawValue(getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType), decomposedOriginalValue);
3868
+ tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
3869
+ tween._fromNumber = decomposedOriginalValue.n;
3870
+ }
3871
+ if (toFunc) {
3872
+ decomposeRawValue(toFunc(), toTargetObject);
3873
+ tween._toNumbers = cloneArray(toTargetObject.d);
3874
+ tween._strings = cloneArray(toTargetObject.s);
3875
+ // Make sure to apply relative operators https://github.com/juliangarnier/anime/issues/1025
3876
+ tween._toNumber = toTargetObject.o ? getRelativeValue(tween._fromNumber, toTargetObject.n, toTargetObject.o) : toTargetObject.n;
3877
+ }
3862
3878
  }
3863
3879
  });
3864
3880
  // This forces setter animations to render once
@@ -6465,6 +6481,7 @@ class ScrollContainer {
6465
6481
  this.updateBounds();
6466
6482
  forEachChildren(this, (/** @type {ScrollObserver} */child) => {
6467
6483
  child.refresh();
6484
+ child.onResize(child);
6468
6485
  if (child._debug) {
6469
6486
  child.debug();
6470
6487
  }
@@ -6676,6 +6693,8 @@ class ScrollObserver {
6676
6693
  /** @type {Callback<ScrollObserver>} */
6677
6694
  this.onUpdate = parameters.onUpdate || noop;
6678
6695
  /** @type {Callback<ScrollObserver>} */
6696
+ this.onResize = parameters.onResize || noop;
6697
+ /** @type {Callback<ScrollObserver>} */
6679
6698
  this.onSyncComplete = parameters.onSyncComplete || noop;
6680
6699
  /** @type {Boolean} */
6681
6700
  this.reverted = false;