animejs 4.2.0 → 4.2.1

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 (127) hide show
  1. package/dist/bundles/anime.esm.js +98 -47
  2. package/dist/bundles/anime.esm.min.js +2 -2
  3. package/dist/bundles/anime.umd.js +98 -47
  4. package/dist/bundles/anime.umd.min.js +2 -2
  5. package/dist/modules/animatable/animatable.cjs +2 -2
  6. package/dist/modules/animatable/animatable.js +2 -2
  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 +7 -3
  12. package/dist/modules/animation/animation.d.ts +8 -3
  13. package/dist/modules/animation/animation.js +7 -3
  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 +1 -1
  19. package/dist/modules/core/clock.js +1 -1
  20. package/dist/modules/core/colors.cjs +1 -1
  21. package/dist/modules/core/colors.js +1 -1
  22. package/dist/modules/core/consts.cjs +1 -1
  23. package/dist/modules/core/consts.js +1 -1
  24. package/dist/modules/core/globals.cjs +2 -2
  25. package/dist/modules/core/globals.js +2 -2
  26. package/dist/modules/core/helpers.cjs +1 -1
  27. package/dist/modules/core/helpers.js +1 -1
  28. package/dist/modules/core/render.cjs +1 -1
  29. package/dist/modules/core/render.js +1 -1
  30. package/dist/modules/core/styles.cjs +1 -1
  31. package/dist/modules/core/styles.js +1 -1
  32. package/dist/modules/core/targets.cjs +1 -1
  33. package/dist/modules/core/targets.js +1 -1
  34. package/dist/modules/core/transforms.cjs +1 -1
  35. package/dist/modules/core/transforms.js +1 -1
  36. package/dist/modules/core/units.cjs +1 -1
  37. package/dist/modules/core/units.js +1 -1
  38. package/dist/modules/core/values.cjs +1 -1
  39. package/dist/modules/core/values.js +1 -1
  40. package/dist/modules/draggable/draggable.cjs +17 -4
  41. package/dist/modules/draggable/draggable.d.ts +2 -0
  42. package/dist/modules/draggable/draggable.js +18 -5
  43. package/dist/modules/draggable/index.cjs +1 -1
  44. package/dist/modules/draggable/index.js +1 -1
  45. package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
  46. package/dist/modules/easings/cubic-bezier/index.js +1 -1
  47. package/dist/modules/easings/eases/index.cjs +1 -1
  48. package/dist/modules/easings/eases/index.js +1 -1
  49. package/dist/modules/easings/eases/parser.cjs +1 -1
  50. package/dist/modules/easings/eases/parser.js +1 -1
  51. package/dist/modules/easings/index.cjs +1 -1
  52. package/dist/modules/easings/index.js +1 -1
  53. package/dist/modules/easings/irregular/index.cjs +1 -1
  54. package/dist/modules/easings/irregular/index.js +1 -1
  55. package/dist/modules/easings/linear/index.cjs +1 -1
  56. package/dist/modules/easings/linear/index.js +1 -1
  57. package/dist/modules/easings/none.cjs +1 -1
  58. package/dist/modules/easings/none.js +1 -1
  59. package/dist/modules/easings/spring/index.cjs +1 -1
  60. package/dist/modules/easings/spring/index.js +1 -1
  61. package/dist/modules/easings/steps/index.cjs +1 -1
  62. package/dist/modules/easings/steps/index.js +1 -1
  63. package/dist/modules/engine/engine.cjs +1 -1
  64. package/dist/modules/engine/engine.js +1 -1
  65. package/dist/modules/engine/index.cjs +1 -1
  66. package/dist/modules/engine/index.js +1 -1
  67. package/dist/modules/events/index.cjs +1 -1
  68. package/dist/modules/events/index.js +1 -1
  69. package/dist/modules/events/scroll.cjs +7 -3
  70. package/dist/modules/events/scroll.d.ts +2 -0
  71. package/dist/modules/events/scroll.js +7 -3
  72. package/dist/modules/index.cjs +1 -1
  73. package/dist/modules/index.js +1 -1
  74. package/dist/modules/scope/index.cjs +1 -1
  75. package/dist/modules/scope/index.js +1 -1
  76. package/dist/modules/scope/scope.cjs +1 -1
  77. package/dist/modules/scope/scope.js +1 -1
  78. package/dist/modules/svg/drawable.cjs +1 -1
  79. package/dist/modules/svg/drawable.js +1 -1
  80. package/dist/modules/svg/helpers.cjs +1 -1
  81. package/dist/modules/svg/helpers.js +1 -1
  82. package/dist/modules/svg/index.cjs +1 -1
  83. package/dist/modules/svg/index.js +1 -1
  84. package/dist/modules/svg/morphto.cjs +12 -2
  85. package/dist/modules/svg/morphto.js +12 -2
  86. package/dist/modules/svg/motionpath.cjs +18 -11
  87. package/dist/modules/svg/motionpath.d.ts +1 -1
  88. package/dist/modules/svg/motionpath.js +18 -11
  89. package/dist/modules/text/index.cjs +1 -1
  90. package/dist/modules/text/index.js +1 -1
  91. package/dist/modules/text/split.cjs +1 -1
  92. package/dist/modules/text/split.js +1 -1
  93. package/dist/modules/timeline/index.cjs +1 -1
  94. package/dist/modules/timeline/index.js +1 -1
  95. package/dist/modules/timeline/position.cjs +1 -1
  96. package/dist/modules/timeline/position.js +1 -1
  97. package/dist/modules/timeline/timeline.cjs +9 -5
  98. package/dist/modules/timeline/timeline.d.ts +8 -3
  99. package/dist/modules/timeline/timeline.js +9 -5
  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 +17 -14
  103. package/dist/modules/timer/timer.d.ts +12 -7
  104. package/dist/modules/timer/timer.js +17 -14
  105. package/dist/modules/types/index.d.ts +7 -3
  106. package/dist/modules/utils/chainable.cjs +1 -1
  107. package/dist/modules/utils/chainable.js +1 -1
  108. package/dist/modules/utils/index.cjs +1 -1
  109. package/dist/modules/utils/index.js +1 -1
  110. package/dist/modules/utils/number.cjs +1 -1
  111. package/dist/modules/utils/number.js +1 -1
  112. package/dist/modules/utils/random.cjs +1 -1
  113. package/dist/modules/utils/random.js +1 -1
  114. package/dist/modules/utils/stagger.cjs +1 -1
  115. package/dist/modules/utils/stagger.js +1 -1
  116. package/dist/modules/utils/target.cjs +1 -1
  117. package/dist/modules/utils/target.js +1 -1
  118. package/dist/modules/utils/time.cjs +1 -1
  119. package/dist/modules/utils/time.js +1 -1
  120. package/dist/modules/waapi/composition.cjs +1 -1
  121. package/dist/modules/waapi/composition.js +1 -1
  122. package/dist/modules/waapi/index.cjs +1 -1
  123. package/dist/modules/waapi/index.js +1 -1
  124. package/dist/modules/waapi/waapi.cjs +8 -5
  125. package/dist/modules/waapi/waapi.d.ts +8 -5
  126. package/dist/modules/waapi/waapi.js +8 -5
  127. package/package.json +3 -4
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - events - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -95,6 +95,8 @@ class ScrollContainer {
95
95
  /** @type {Number} */
96
96
  this.top = 0;
97
97
  /** @type {Number} */
98
+ this.scale = 1;
99
+ /** @type {Number} */
98
100
  this.zIndex = 0;
99
101
  /** @type {Number} */
100
102
  this.scrollX = 0;
@@ -206,6 +208,7 @@ class ScrollContainer {
206
208
  height = $el.clientHeight;
207
209
  this.top = elRect.top;
208
210
  this.left = elRect.left;
211
+ this.scale = elRect.width ? width / elRect.width : (elRect.height ? height / elRect.height : 1);
209
212
  }
210
213
  this.width = width;
211
214
  this.height = height;
@@ -731,8 +734,9 @@ class ScrollObserver {
731
734
  }
732
735
  }
733
736
  const rect = $target.getBoundingClientRect();
734
- const offset = isHori ? rect.left + container.scrollX - container.left : rect.top + container.scrollY - container.top;
735
- const targetSize = isHori ? rect.width : rect.height;
737
+ const scale = container.scale;
738
+ const offset = (isHori ? rect.left + container.scrollX - container.left : rect.top + container.scrollY - container.top) * scale;
739
+ const targetSize = (isHori ? rect.width : rect.height) * scale;
736
740
  const containerSize = isHori ? container.width : container.height;
737
741
  const scrollSize = isHori ? container.scrollWidth : container.scrollHeight;
738
742
  const maxScroll = scrollSize - containerSize;
@@ -134,6 +134,8 @@ declare class ScrollContainer {
134
134
  /** @type {Number} */
135
135
  top: number;
136
136
  /** @type {Number} */
137
+ scale: number;
138
+ /** @type {Number} */
137
139
  zIndex: number;
138
140
  /** @type {Number} */
139
141
  scrollX: number;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - events - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -93,6 +93,8 @@ class ScrollContainer {
93
93
  /** @type {Number} */
94
94
  this.top = 0;
95
95
  /** @type {Number} */
96
+ this.scale = 1;
97
+ /** @type {Number} */
96
98
  this.zIndex = 0;
97
99
  /** @type {Number} */
98
100
  this.scrollX = 0;
@@ -204,6 +206,7 @@ class ScrollContainer {
204
206
  height = $el.clientHeight;
205
207
  this.top = elRect.top;
206
208
  this.left = elRect.left;
209
+ this.scale = elRect.width ? width / elRect.width : (elRect.height ? height / elRect.height : 1);
207
210
  }
208
211
  this.width = width;
209
212
  this.height = height;
@@ -729,8 +732,9 @@ class ScrollObserver {
729
732
  }
730
733
  }
731
734
  const rect = $target.getBoundingClientRect();
732
- const offset = isHori ? rect.left + container.scrollX - container.left : rect.top + container.scrollY - container.top;
733
- const targetSize = isHori ? rect.width : rect.height;
735
+ const scale = container.scale;
736
+ const offset = (isHori ? rect.left + container.scrollX - container.left : rect.top + container.scrollY - container.top) * scale;
737
+ const targetSize = (isHori ? rect.width : rect.height) * scale;
734
738
  const containerSize = isHori ? container.width : container.height;
735
739
  const scrollSize = isHori ? container.scrollWidth : container.scrollHeight;
736
740
  const maxScroll = scrollSize - containerSize;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - scope - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - scope - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - scope - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - scope - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -24,8 +24,18 @@ var helpers = require('./helpers.cjs');
24
24
  * @return {FunctionValue}
25
25
  */
26
26
  const morphTo = (path2, precision = .33) => ($path1) => {
27
+ const tagName1 = ($path1.tagName || '').toLowerCase();
28
+ if (!tagName1.match(/^(path|polygon|polyline)$/)) {
29
+ throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);
30
+ }
27
31
  const $path2 = /** @type {SVGGeometryElement} */(helpers.getPath(path2));
28
- if (!$path2) return;
32
+ if (!$path2) {
33
+ throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");
34
+ }
35
+ const tagName2 = ($path2.tagName || '').toLowerCase();
36
+ if (!tagName2.match(/^(path|polygon|polyline)$/)) {
37
+ throw new Error(`Can't morph a <${$path2.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);
38
+ }
29
39
  const isPath = $path1.tagName === 'path';
30
40
  const separator = isPath ? ' ' : ',';
31
41
  const previousPoints = $path1[consts.morphPointsSymbol];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -22,8 +22,18 @@ import { getPath } from './helpers.js';
22
22
  * @return {FunctionValue}
23
23
  */
24
24
  const morphTo = (path2, precision = .33) => ($path1) => {
25
+ const tagName1 = ($path1.tagName || '').toLowerCase();
26
+ if (!tagName1.match(/^(path|polygon|polyline)$/)) {
27
+ throw new Error(`Can't morph a <${$path1.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);
28
+ }
25
29
  const $path2 = /** @type {SVGGeometryElement} */(getPath(path2));
26
- if (!$path2) return;
30
+ if (!$path2) {
31
+ throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");
32
+ }
33
+ const tagName2 = ($path2.tagName || '').toLowerCase();
34
+ if (!tagName2.match(/^(path|polygon|polyline)$/)) {
35
+ throw new Error(`Can't morph a <${$path2.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);
36
+ }
27
37
  const isPath = $path1.tagName === 'path';
28
38
  const separator = isPath ? ' ' : ',';
29
39
  const previousPoints = $path1[morphPointsSymbol];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -24,20 +24,24 @@ var helpers = require('./helpers.cjs');
24
24
 
25
25
  /**
26
26
  * @param {SVGGeometryElement} $path
27
+ * @param {Number} totalLength
27
28
  * @param {Number} progress
28
29
  * @param {Number}lookup
29
30
  * @return {DOMPoint}
30
31
  */
31
- const getPathPoint = ($path, progress, lookup = 0) => {
32
- return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
32
+ const getPathPoint = ($path, totalLength, progress, lookup = 0) => {
33
+ const point = progress + lookup;
34
+ const pointOnPath = (point % totalLength + totalLength) % totalLength;
35
+ return $path.getPointAtLength(pointOnPath);
33
36
  };
34
37
 
35
38
  /**
36
39
  * @param {SVGGeometryElement} $path
37
40
  * @param {String} pathProperty
41
+ * @param {Number} [offset=0]
38
42
  * @return {FunctionValue}
39
43
  */
40
- const getPathProgess = ($path, pathProperty) => {
44
+ const getPathProgess = ($path, pathProperty, offset = 0) => {
41
45
  return $el => {
42
46
  const totalLength = +($path.getTotalLength());
43
47
  const inSvg = $el[consts.isSvgSymbol];
@@ -48,12 +52,14 @@ const getPathProgess = ($path, pathProperty) => {
48
52
  to: totalLength,
49
53
  /** @type {TweenModifier} */
50
54
  modifier: progress => {
55
+ const offsetLength = offset * totalLength;
56
+ const newProgress = progress + offsetLength;
51
57
  if (pathProperty === 'a') {
52
- const p0 = getPathPoint($path, progress, -1);
53
- const p1 = getPathPoint($path, progress, 1);
58
+ const p0 = getPathPoint($path, totalLength, newProgress, -1);
59
+ const p1 = getPathPoint($path, totalLength, newProgress, 1);
54
60
  return helpers$1.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / helpers$1.PI;
55
61
  } else {
56
- const p = getPathPoint($path, progress, 0);
62
+ const p = getPathPoint($path, totalLength, newProgress, 0);
57
63
  return pathProperty === 'x' ?
58
64
  inSvg || !ctm ? p.x : p.x * ctm.a + p.y * ctm.c + ctm.e :
59
65
  inSvg || !ctm ? p.y : p.x * ctm.b + p.y * ctm.d + ctm.f
@@ -65,14 +71,15 @@ const getPathProgess = ($path, pathProperty) => {
65
71
 
66
72
  /**
67
73
  * @param {TargetsParam} path
74
+ * @param {Number} [offset=0]
68
75
  */
69
- const createMotionPath = path => {
76
+ const createMotionPath = (path, offset = 0) => {
70
77
  const $path = helpers.getPath(path);
71
78
  if (!$path) return;
72
79
  return {
73
- translateX: getPathProgess($path, 'x'),
74
- translateY: getPathProgess($path, 'y'),
75
- rotate: getPathProgess($path, 'a'),
80
+ translateX: getPathProgess($path, 'x', offset),
81
+ translateY: getPathProgess($path, 'y', offset),
82
+ rotate: getPathProgess($path, 'a', offset),
76
83
  }
77
84
  };
78
85
 
@@ -1,4 +1,4 @@
1
- export function createMotionPath(path: TargetsParam): {
1
+ export function createMotionPath(path: TargetsParam, offset?: number): {
2
2
  translateX: FunctionValue;
3
3
  translateY: FunctionValue;
4
4
  rotate: FunctionValue;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - svg - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -22,20 +22,24 @@ import { getPath } from './helpers.js';
22
22
 
23
23
  /**
24
24
  * @param {SVGGeometryElement} $path
25
+ * @param {Number} totalLength
25
26
  * @param {Number} progress
26
27
  * @param {Number}lookup
27
28
  * @return {DOMPoint}
28
29
  */
29
- const getPathPoint = ($path, progress, lookup = 0) => {
30
- return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
30
+ const getPathPoint = ($path, totalLength, progress, lookup = 0) => {
31
+ const point = progress + lookup;
32
+ const pointOnPath = (point % totalLength + totalLength) % totalLength;
33
+ return $path.getPointAtLength(pointOnPath);
31
34
  };
32
35
 
33
36
  /**
34
37
  * @param {SVGGeometryElement} $path
35
38
  * @param {String} pathProperty
39
+ * @param {Number} [offset=0]
36
40
  * @return {FunctionValue}
37
41
  */
38
- const getPathProgess = ($path, pathProperty) => {
42
+ const getPathProgess = ($path, pathProperty, offset = 0) => {
39
43
  return $el => {
40
44
  const totalLength = +($path.getTotalLength());
41
45
  const inSvg = $el[isSvgSymbol];
@@ -46,12 +50,14 @@ const getPathProgess = ($path, pathProperty) => {
46
50
  to: totalLength,
47
51
  /** @type {TweenModifier} */
48
52
  modifier: progress => {
53
+ const offsetLength = offset * totalLength;
54
+ const newProgress = progress + offsetLength;
49
55
  if (pathProperty === 'a') {
50
- const p0 = getPathPoint($path, progress, -1);
51
- const p1 = getPathPoint($path, progress, 1);
56
+ const p0 = getPathPoint($path, totalLength, newProgress, -1);
57
+ const p1 = getPathPoint($path, totalLength, newProgress, 1);
52
58
  return atan2(p1.y - p0.y, p1.x - p0.x) * 180 / PI;
53
59
  } else {
54
- const p = getPathPoint($path, progress, 0);
60
+ const p = getPathPoint($path, totalLength, newProgress, 0);
55
61
  return pathProperty === 'x' ?
56
62
  inSvg || !ctm ? p.x : p.x * ctm.a + p.y * ctm.c + ctm.e :
57
63
  inSvg || !ctm ? p.y : p.x * ctm.b + p.y * ctm.d + ctm.f
@@ -63,14 +69,15 @@ const getPathProgess = ($path, pathProperty) => {
63
69
 
64
70
  /**
65
71
  * @param {TargetsParam} path
72
+ * @param {Number} [offset=0]
66
73
  */
67
- const createMotionPath = path => {
74
+ const createMotionPath = (path, offset = 0) => {
68
75
  const $path = getPath(path);
69
76
  if (!$path) return;
70
77
  return {
71
- translateX: getPathProgess($path, 'x'),
72
- translateY: getPathProgess($path, 'y'),
73
- rotate: getPathProgess($path, 'a'),
78
+ translateX: getPathProgess($path, 'x', offset),
79
+ translateY: getPathProgess($path, 'y', offset),
80
+ rotate: getPathProgess($path, 'a', offset),
74
81
  }
75
82
  };
76
83
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - text - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - text - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - text - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - text - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -81,7 +81,7 @@ function addTlChild(childParams, tl, timePosition, targets, index, length) {
81
81
  const tlChild = targets ?
82
82
  new animation.JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :
83
83
  new timer.Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);
84
- tlChild.init(1);
84
+ tlChild.init(true);
85
85
  // TODO: Might be better to insert at a position relative to startTime?
86
86
  helpers.addChild(tl, tlChild);
87
87
  helpers.forEachChildren(tl, (/** @type {Renderable} */child) => {
@@ -185,7 +185,7 @@ class Timeline extends timer.Timer {
185
185
  position.parseTimelinePosition(this,a2),
186
186
  );
187
187
  }
188
- return this.init(1); // 1 = internalRender
188
+ return this.init(true);
189
189
  }
190
190
  }
191
191
 
@@ -294,8 +294,12 @@ class Timeline extends timer.Timer {
294
294
  }
295
295
 
296
296
  /**
297
- * @param {Callback<this>} [callback]
298
- * @return {Promise}
297
+ * @typedef {this & {then: null}} ResolvedTimeline
298
+ */
299
+
300
+ /**
301
+ * @param {Callback<ResolvedTimeline>} [callback]
302
+ * @return Promise<this>
299
303
  */
300
304
  then(callback) {
301
305
  return super.then(callback);
@@ -144,10 +144,15 @@ export class Timeline extends Timer {
144
144
  */
145
145
  revert(): this;
146
146
  /**
147
- * @param {Callback<this>} [callback]
148
- * @return {Promise}
147
+ * @typedef {this & {then: null}} ResolvedTimeline
149
148
  */
150
- then(callback?: Callback<this>): Promise<any>;
149
+ /**
150
+ * @param {Callback<ResolvedTimeline>} [callback]
151
+ * @return Promise<this>
152
+ */
153
+ then(callback?: Callback<this & {
154
+ then: null;
155
+ }>): Promise<any>;
151
156
  }
152
157
  export function createTimeline(parameters?: TimelineParams): Timeline;
153
158
  import { Timer } from '../timer/timer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timeline - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -79,7 +79,7 @@ function addTlChild(childParams, tl, timePosition, targets, index, length) {
79
79
  const tlChild = targets ?
80
80
  new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :
81
81
  new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);
82
- tlChild.init(1);
82
+ tlChild.init(true);
83
83
  // TODO: Might be better to insert at a position relative to startTime?
84
84
  addChild(tl, tlChild);
85
85
  forEachChildren(tl, (/** @type {Renderable} */child) => {
@@ -183,7 +183,7 @@ class Timeline extends Timer {
183
183
  parseTimelinePosition(this,a2),
184
184
  );
185
185
  }
186
- return this.init(1); // 1 = internalRender
186
+ return this.init(true);
187
187
  }
188
188
  }
189
189
 
@@ -292,8 +292,12 @@ class Timeline extends Timer {
292
292
  }
293
293
 
294
294
  /**
295
- * @param {Callback<this>} [callback]
296
- * @return {Promise}
295
+ * @typedef {this & {then: null}} ResolvedTimeline
296
+ */
297
+
298
+ /**
299
+ * @param {Callback<ResolvedTimeline>} [callback]
300
+ * @return Promise<this>
297
301
  */
298
302
  then(callback) {
299
303
  return super.then(callback);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timer - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timer - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.1
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */