animejs 4.2.2 → 4.3.0-beta.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.
Files changed (133) hide show
  1. package/README.md +82 -28
  2. package/dist/bundles/anime.esm.js +2705 -1303
  3. package/dist/bundles/anime.esm.min.js +2 -2
  4. package/dist/bundles/anime.umd.js +2710 -1306
  5. package/dist/bundles/anime.umd.min.js +2 -2
  6. package/dist/modules/animatable/animatable.cjs +1 -1
  7. package/dist/modules/animatable/animatable.js +1 -1
  8. package/dist/modules/animatable/index.cjs +1 -1
  9. package/dist/modules/animatable/index.js +1 -1
  10. package/dist/modules/animation/additive.cjs +1 -1
  11. package/dist/modules/animation/additive.js +1 -1
  12. package/dist/modules/animation/animation.cjs +18 -9
  13. package/dist/modules/animation/animation.js +19 -10
  14. package/dist/modules/animation/composition.cjs +1 -1
  15. package/dist/modules/animation/composition.js +1 -1
  16. package/dist/modules/animation/index.cjs +1 -1
  17. package/dist/modules/animation/index.js +1 -1
  18. package/dist/modules/core/clock.cjs +10 -10
  19. package/dist/modules/core/clock.d.ts +1 -1
  20. package/dist/modules/core/clock.js +10 -10
  21. package/dist/modules/core/colors.cjs +1 -1
  22. package/dist/modules/core/colors.js +1 -1
  23. package/dist/modules/core/consts.cjs +6 -4
  24. package/dist/modules/core/consts.d.ts +13 -5
  25. package/dist/modules/core/consts.js +6 -4
  26. package/dist/modules/core/globals.cjs +5 -2
  27. package/dist/modules/core/globals.d.ts +1 -0
  28. package/dist/modules/core/globals.js +5 -3
  29. package/dist/modules/core/helpers.cjs +1 -1
  30. package/dist/modules/core/helpers.js +1 -1
  31. package/dist/modules/core/render.cjs +1 -1
  32. package/dist/modules/core/render.js +1 -1
  33. package/dist/modules/core/styles.cjs +1 -1
  34. package/dist/modules/core/styles.js +1 -1
  35. package/dist/modules/core/targets.cjs +1 -1
  36. package/dist/modules/core/targets.js +1 -1
  37. package/dist/modules/core/transforms.cjs +1 -1
  38. package/dist/modules/core/transforms.js +1 -1
  39. package/dist/modules/core/units.cjs +1 -1
  40. package/dist/modules/core/units.js +1 -1
  41. package/dist/modules/core/values.cjs +1 -1
  42. package/dist/modules/core/values.js +1 -1
  43. package/dist/modules/draggable/draggable.cjs +1 -1
  44. package/dist/modules/draggable/draggable.js +1 -1
  45. package/dist/modules/draggable/index.cjs +1 -1
  46. package/dist/modules/draggable/index.js +1 -1
  47. package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
  48. package/dist/modules/easings/cubic-bezier/index.js +1 -1
  49. package/dist/modules/easings/eases/index.cjs +1 -1
  50. package/dist/modules/easings/eases/index.js +1 -1
  51. package/dist/modules/easings/eases/parser.cjs +1 -1
  52. package/dist/modules/easings/eases/parser.js +1 -1
  53. package/dist/modules/easings/index.cjs +1 -1
  54. package/dist/modules/easings/index.js +1 -1
  55. package/dist/modules/easings/irregular/index.cjs +1 -1
  56. package/dist/modules/easings/irregular/index.js +1 -1
  57. package/dist/modules/easings/linear/index.cjs +1 -1
  58. package/dist/modules/easings/linear/index.js +1 -1
  59. package/dist/modules/easings/none.cjs +1 -1
  60. package/dist/modules/easings/none.js +1 -1
  61. package/dist/modules/easings/spring/index.cjs +1 -1
  62. package/dist/modules/easings/spring/index.js +1 -1
  63. package/dist/modules/easings/steps/index.cjs +1 -1
  64. package/dist/modules/easings/steps/index.js +1 -1
  65. package/dist/modules/engine/engine.cjs +2 -2
  66. package/dist/modules/engine/engine.js +2 -2
  67. package/dist/modules/engine/index.cjs +1 -1
  68. package/dist/modules/engine/index.js +1 -1
  69. package/dist/modules/events/index.cjs +1 -1
  70. package/dist/modules/events/index.js +1 -1
  71. package/dist/modules/events/scroll.cjs +1 -1
  72. package/dist/modules/events/scroll.js +1 -1
  73. package/dist/modules/index.cjs +4 -1
  74. package/dist/modules/index.d.ts +1 -0
  75. package/dist/modules/index.js +2 -1
  76. package/dist/modules/layout/index.cjs +15 -0
  77. package/dist/modules/layout/index.d.ts +1 -0
  78. package/dist/modules/layout/index.js +8 -0
  79. package/dist/modules/layout/layout.cjs +1384 -0
  80. package/dist/modules/layout/layout.d.ts +211 -0
  81. package/dist/modules/layout/layout.js +1381 -0
  82. package/dist/modules/scope/index.cjs +1 -1
  83. package/dist/modules/scope/index.js +1 -1
  84. package/dist/modules/scope/scope.cjs +1 -1
  85. package/dist/modules/scope/scope.js +1 -1
  86. package/dist/modules/svg/drawable.cjs +1 -1
  87. package/dist/modules/svg/drawable.js +1 -1
  88. package/dist/modules/svg/helpers.cjs +1 -1
  89. package/dist/modules/svg/helpers.js +1 -1
  90. package/dist/modules/svg/index.cjs +1 -1
  91. package/dist/modules/svg/index.js +1 -1
  92. package/dist/modules/svg/morphto.cjs +1 -1
  93. package/dist/modules/svg/morphto.js +1 -1
  94. package/dist/modules/svg/motionpath.cjs +1 -1
  95. package/dist/modules/svg/motionpath.js +1 -1
  96. package/dist/modules/text/index.cjs +1 -1
  97. package/dist/modules/text/index.js +1 -1
  98. package/dist/modules/text/split.cjs +23 -9
  99. package/dist/modules/text/split.js +23 -9
  100. package/dist/modules/timeline/index.cjs +1 -1
  101. package/dist/modules/timeline/index.js +1 -1
  102. package/dist/modules/timeline/position.cjs +1 -1
  103. package/dist/modules/timeline/position.js +1 -1
  104. package/dist/modules/timeline/timeline.cjs +14 -6
  105. package/dist/modules/timeline/timeline.d.ts +2 -0
  106. package/dist/modules/timeline/timeline.js +15 -7
  107. package/dist/modules/timer/index.cjs +1 -1
  108. package/dist/modules/timer/index.js +1 -1
  109. package/dist/modules/timer/timer.cjs +26 -13
  110. package/dist/modules/timer/timer.d.ts +1 -0
  111. package/dist/modules/timer/timer.js +27 -14
  112. package/dist/modules/types/index.d.ts +3 -1
  113. package/dist/modules/utils/chainable.cjs +1 -1
  114. package/dist/modules/utils/chainable.js +1 -1
  115. package/dist/modules/utils/index.cjs +1 -1
  116. package/dist/modules/utils/index.js +1 -1
  117. package/dist/modules/utils/number.cjs +1 -1
  118. package/dist/modules/utils/number.js +1 -1
  119. package/dist/modules/utils/random.cjs +1 -1
  120. package/dist/modules/utils/random.js +1 -1
  121. package/dist/modules/utils/stagger.cjs +1 -1
  122. package/dist/modules/utils/stagger.js +1 -1
  123. package/dist/modules/utils/target.cjs +1 -1
  124. package/dist/modules/utils/target.js +1 -1
  125. package/dist/modules/utils/time.cjs +1 -1
  126. package/dist/modules/utils/time.js +1 -1
  127. package/dist/modules/waapi/composition.cjs +1 -1
  128. package/dist/modules/waapi/composition.js +1 -1
  129. package/dist/modules/waapi/index.cjs +1 -1
  130. package/dist/modules/waapi/index.js +1 -1
  131. package/dist/modules/waapi/waapi.cjs +15 -7
  132. package/dist/modules/waapi/waapi.js +16 -8
  133. package/package.json +8 -2
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Anime.js - timer - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
7
7
 
8
8
  import { minValue, noop, maxValue, compositionTypes, tickModes } from '../core/consts.js';
9
9
  import { isFnc, isUnd, now, clampInfinity, clamp, round, forEachChildren, addChild, normalizeTime, floor } from '../core/helpers.js';
10
- import { globals, scope } from '../core/globals.js';
10
+ import { globals, devTools, scope } from '../core/globals.js';
11
11
  import { setValue } from '../core/values.js';
12
12
  import { tick } from '../core/render.js';
13
13
  import { removeTweenSliblings, composeTween, getTweenSiblings } from '../animation/composition.js';
@@ -80,6 +80,8 @@ class Timer extends Clock {
80
80
 
81
81
  super(0);
82
82
 
83
+ ++timerId;
84
+
83
85
  const {
84
86
  id,
85
87
  delay,
@@ -101,31 +103,42 @@ class Timer extends Clock {
101
103
 
102
104
  if (scope.current) scope.current.register(this);
103
105
 
104
- const timerInitTime = parent ? 0 : engine._elapsedTime;
106
+ const timerInitTime = parent ? 0 : engine._lastTickTime;
105
107
  const timerDefaults = parent ? parent.defaults : globals.defaults;
106
108
  const timerDelay = /** @type {Number} */(isFnc(delay) || isUnd(delay) ? timerDefaults.delay : +delay);
107
109
  const timerDuration = isFnc(duration) || isUnd(duration) ? Infinity : +duration;
108
110
  const timerLoop = setValue(loop, timerDefaults.loop);
109
111
  const timerLoopDelay = setValue(loopDelay, timerDefaults.loopDelay);
110
- const timerIterationCount = timerLoop === true ||
111
- timerLoop === Infinity ||
112
- /** @type {Number} */(timerLoop) < 0 ? Infinity :
113
- /** @type {Number} */(timerLoop) + 1;
112
+ let timerIterationCount = timerLoop === true ||
113
+ timerLoop === Infinity ||
114
+ /** @type {Number} */(timerLoop) < 0 ? Infinity :
115
+ /** @type {Number} */(timerLoop) + 1;
116
+
117
+ if (devTools) {
118
+ const isInfinite = timerIterationCount === Infinity;
119
+ const registered = devTools.register(this, parameters, isInfinite);
120
+ if (registered && isInfinite) {
121
+ const minIterations = alternate ? 2 : 1;
122
+ const iterations = parent ? devTools.maxNestedInfiniteLoops : devTools.maxInfiniteLoops;
123
+ timerIterationCount = Math.max(iterations, minIterations);
124
+ }
125
+ }
114
126
 
115
127
  let offsetPosition = 0;
116
128
 
117
129
  if (parent) {
118
130
  offsetPosition = parentPosition;
119
131
  } else {
120
- // Make sure to tick the engine once if not currently running to get up to date engine._elapsedTime
132
+ // Make sure to tick the engine once if not currently running to get up to date engine._lastTickTime
121
133
  // to avoid big gaps with the following offsetPosition calculation
122
134
  if (!engine.reqId) engine.requestTick(now());
123
135
  // Make sure to scale the offset position with globals.timeScale to properly handle seconds unit
124
- offsetPosition = (engine._elapsedTime - engine._startTime) * globals.timeScale;
136
+ offsetPosition = (engine._lastTickTime - engine._startTime) * globals.timeScale;
125
137
  }
126
138
 
127
139
  // Timer's parameters
128
- this.id = !isUnd(id) ? id : ++timerId;
140
+ /** @type {String|Number} */
141
+ this.id = !isUnd(id) ? id : timerId;
129
142
  /** @type {Timeline} */
130
143
  this.parent = parent;
131
144
  // Total duration of the timer
@@ -185,7 +198,7 @@ class Timer extends Clock {
185
198
 
186
199
  // Clock's parameters
187
200
  /** @type {Number} */
188
- this._elapsedTime = timerInitTime;
201
+ this._lastTickTime = timerInitTime;
189
202
  /** @type {Number} */
190
203
  this._startTime = timerInitTime;
191
204
  /** @type {Number} */
@@ -216,7 +229,7 @@ class Timer extends Clock {
216
229
  }
217
230
 
218
231
  get iterationCurrentTime() {
219
- return round(this._iterationTime, globals.precision);
232
+ return clamp(round(this._iterationTime, globals.precision), 0, this.iterationDuration);
220
233
  }
221
234
 
222
235
  set iterationCurrentTime(time) {
@@ -314,9 +327,9 @@ class Timer extends Clock {
314
327
  /** @return {this} */
315
328
  resetTime() {
316
329
  const timeScale = 1 / (this._speed * engine._speed);
317
- // TODO: See if we can safely use engine._elapsedTime here
330
+ // TODO: See if we can safely use engine._lastTickTime here
318
331
  // if (!engine.reqId) engine.requestTick(now())
319
- // this._startTime = engine._elapsedTime - (this._currentTime + this._delay) * timeScale;
332
+ // this._startTime = engine._lastTickTime - (this._currentTime + this._delay) * timeScale;
320
333
  this._startTime = now() - (this._currentTime + this._delay) * timeScale;
321
334
  return this;
322
335
  }
@@ -26,7 +26,7 @@ export type DefaultsParams = {
26
26
  export type Renderable = JSAnimation | Timeline;
27
27
  export type Tickable = Timer | Renderable;
28
28
  export type CallbackArgument = Timer & JSAnimation & Timeline;
29
- export type Revertible = Animatable | Tickable | WAAPIAnimation | Draggable | ScrollObserver | TextSplitter | Scope;
29
+ export type Revertible = Animatable | Tickable | WAAPIAnimation | Draggable | ScrollObserver | TextSplitter | Scope | AutoLayout;
30
30
  export type StaggerFunction<T> = (target?: Target, index?: number, length?: number, tl?: Timeline) => T;
31
31
  export type StaggerParams = {
32
32
  start?: number | string;
@@ -249,6 +249,7 @@ export type TimelineAnimationPosition = TimelinePosition | StaggerFunction<numbe
249
249
  export type TimelineOptions = {
250
250
  defaults?: DefaultsParams;
251
251
  playbackEase?: EasingParam;
252
+ composition?: boolean;
252
253
  };
253
254
  export type TimelineParams = TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>;
254
255
  export type WAAPITweenValue = string | number | Array<string> | Array<number>;
@@ -403,6 +404,7 @@ import type { WAAPIAnimation } from '../waapi/waapi.js';
403
404
  import type { Draggable } from '../draggable/draggable.js';
404
405
  import type { TextSplitter } from '../text/split.js';
405
406
  import type { Scope } from '../scope/scope.js';
407
+ import type { AutoLayout } from '../layout/layout.js';
406
408
  import type { Spring } from '../easings/spring/index.js';
407
409
  import type { tweenTypes } from '../core/consts.js';
408
410
  import type { valueTypes } from '../core/consts.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -333,9 +333,10 @@ class WAAPIAnimation {
333
333
  * @return {this}
334
334
  */
335
335
  forEach(callback) {
336
- const cb = helpers.isStr(callback) ? (/** @type {globalThis.Animation} */a) => a[callback]() : callback;
337
- this.animations.forEach(cb);
338
- return this;
336
+ try {
337
+ const cb = helpers.isStr(callback) ? (/** @type {globalThis.Animation} */a) => a[callback]() : callback;
338
+ this.animations.forEach(cb);
339
+ } catch {} return this;
339
340
  }
340
341
 
341
342
  get speed() {
@@ -431,14 +432,21 @@ class WAAPIAnimation {
431
432
 
432
433
  cancel() {
433
434
  this.muteCallbacks = true; // This prevents triggering the onComplete callback and resolving the Promise
434
- return this.commitStyles().forEach('cancel');
435
+ this.commitStyles().forEach('cancel');
436
+ this.animations.length = 0; // Needed to release all animations from memory
437
+ requestAnimationFrame(() => {
438
+ this.targets.forEach(($el) => { // Needed to avoid unecessary inline transorms
439
+ if ($el.style.transform === 'none') $el.style.removeProperty('transform');
440
+ });
441
+ });
442
+ return this;
435
443
  }
436
444
 
437
445
  revert() {
438
446
  // NOTE: We need a better way to revert the transforms, since right now the entire transform property value is reverted,
439
447
  // This means if you have multiple animations animating different transforms on the same target,
440
448
  // reverting one of them will also override the transform property of the other animations.
441
- // A better approach would be to store the original custom property values is they exist instead of the entire transform value,
449
+ // A better approach would be to store the original custom property values if they exist instead of the entire transform value,
442
450
  // and update the CSS variables with the orignal value
443
451
  this.cancel().targets.forEach(($el, i) => {
444
452
  const targetStyle = $el.style;
@@ -448,7 +456,7 @@ class WAAPIAnimation {
448
456
  if (helpers.isUnd(originalInlinedValue) || originalInlinedValue === consts.emptyString) {
449
457
  targetStyle.removeProperty(helpers.toLowerCase(name));
450
458
  } else {
451
- targetStyle[name] = originalInlinedValue;
459
+ $el.style[name] = originalInlinedValue;
452
460
  }
453
461
  }
454
462
  // Remove style attribute if empty
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.2
3
+ * @version v4.3.0-beta.0
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
7
7
 
8
- import { isNil, isUnd, stringStartsWith, isKey, isObj, isArr, toLowerCase, round, isStr, isFnc, isNum } from '../core/helpers.js';
8
+ import { isNil, isUnd, stringStartsWith, isKey, isObj, isArr, isStr, toLowerCase, round, isFnc, isNum } from '../core/helpers.js';
9
9
  import { scope, globals } from '../core/globals.js';
10
10
  import { registerTargets } from '../core/targets.js';
11
11
  import { setValue, getFunctionValue } from '../core/values.js';
@@ -331,9 +331,10 @@ class WAAPIAnimation {
331
331
  * @return {this}
332
332
  */
333
333
  forEach(callback) {
334
- const cb = isStr(callback) ? (/** @type {globalThis.Animation} */a) => a[callback]() : callback;
335
- this.animations.forEach(cb);
336
- return this;
334
+ try {
335
+ const cb = isStr(callback) ? (/** @type {globalThis.Animation} */a) => a[callback]() : callback;
336
+ this.animations.forEach(cb);
337
+ } catch {} return this;
337
338
  }
338
339
 
339
340
  get speed() {
@@ -429,14 +430,21 @@ class WAAPIAnimation {
429
430
 
430
431
  cancel() {
431
432
  this.muteCallbacks = true; // This prevents triggering the onComplete callback and resolving the Promise
432
- return this.commitStyles().forEach('cancel');
433
+ this.commitStyles().forEach('cancel');
434
+ this.animations.length = 0; // Needed to release all animations from memory
435
+ requestAnimationFrame(() => {
436
+ this.targets.forEach(($el) => { // Needed to avoid unecessary inline transorms
437
+ if ($el.style.transform === 'none') $el.style.removeProperty('transform');
438
+ });
439
+ });
440
+ return this;
433
441
  }
434
442
 
435
443
  revert() {
436
444
  // NOTE: We need a better way to revert the transforms, since right now the entire transform property value is reverted,
437
445
  // This means if you have multiple animations animating different transforms on the same target,
438
446
  // reverting one of them will also override the transform property of the other animations.
439
- // A better approach would be to store the original custom property values is they exist instead of the entire transform value,
447
+ // A better approach would be to store the original custom property values if they exist instead of the entire transform value,
440
448
  // and update the CSS variables with the orignal value
441
449
  this.cancel().targets.forEach(($el, i) => {
442
450
  const targetStyle = $el.style;
@@ -446,7 +454,7 @@ class WAAPIAnimation {
446
454
  if (isUnd(originalInlinedValue) || originalInlinedValue === emptyString) {
447
455
  targetStyle.removeProperty(toLowerCase(name));
448
456
  } else {
449
- targetStyle[name] = originalInlinedValue;
457
+ $el.style[name] = originalInlinedValue;
450
458
  }
451
459
  }
452
460
  // Remove style attribute if empty
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "animejs",
3
- "version": "4.2.2",
4
- "homepage": "https://animejs.com",
3
+ "version": "4.3.0-beta.0",
5
4
  "description": "JavaScript animation engine",
5
+ "homepage": "https://animejs.com",
6
6
  "author": "Julian Garnier <julian@animejs.com>",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -104,6 +104,12 @@
104
104
  "import": "./dist/modules/events/index.js",
105
105
  "default": "./dist/modules/events/index.cjs"
106
106
  },
107
+ "./layout": {
108
+ "types": "./dist/modules/layout/index.d.ts",
109
+ "require": "./dist/modules/layout/index.cjs",
110
+ "import": "./dist/modules/layout/index.js",
111
+ "default": "./dist/modules/layout/index.cjs"
112
+ },
107
113
  "./easings": {
108
114
  "types": "./dist/modules/easings/index.d.ts",
109
115
  "require": "./dist/modules/easings/index.cjs",