animejs 4.1.4 → 4.2.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 (188) hide show
  1. package/README.md +17 -8
  2. package/{lib → dist/bundles}/anime.esm.js +6476 -6106
  3. package/dist/bundles/anime.esm.min.js +7 -0
  4. package/dist/bundles/anime.umd.js +8809 -0
  5. package/dist/bundles/anime.umd.min.js +7 -0
  6. package/dist/modules/animatable/animatable.cjs +150 -0
  7. package/dist/modules/animatable/animatable.d.ts +28 -0
  8. package/dist/modules/animatable/animatable.js +147 -0
  9. package/dist/modules/animatable/index.cjs +15 -0
  10. package/dist/modules/animatable/index.d.ts +1 -0
  11. package/dist/modules/animatable/index.js +8 -0
  12. package/dist/modules/animation/additive.cjs +82 -0
  13. package/dist/modules/animation/additive.d.ts +15 -0
  14. package/dist/modules/animation/additive.js +79 -0
  15. package/dist/modules/animation/animation.cjs +667 -0
  16. package/dist/modules/animation/animation.d.ts +45 -0
  17. package/dist/modules/animation/animation.js +664 -0
  18. package/dist/modules/animation/composition.cjs +383 -0
  19. package/dist/modules/animation/composition.d.ts +10 -0
  20. package/dist/modules/animation/composition.js +377 -0
  21. package/dist/modules/animation/index.cjs +15 -0
  22. package/dist/modules/animation/index.d.ts +1 -0
  23. package/dist/modules/animation/index.js +8 -0
  24. package/dist/modules/core/clock.cjs +110 -0
  25. package/dist/modules/core/clock.d.ts +51 -0
  26. package/dist/modules/core/clock.js +108 -0
  27. package/dist/modules/core/colors.cjs +102 -0
  28. package/dist/modules/core/colors.d.ts +2 -0
  29. package/dist/modules/core/colors.js +100 -0
  30. package/dist/modules/core/consts.cjs +159 -0
  31. package/dist/modules/core/consts.d.ts +61 -0
  32. package/dist/modules/core/consts.js +124 -0
  33. package/dist/modules/core/globals.cjs +78 -0
  34. package/dist/modules/core/globals.d.ts +29 -0
  35. package/dist/modules/core/globals.js +73 -0
  36. package/dist/modules/core/helpers.cjs +304 -0
  37. package/dist/modules/core/helpers.d.ts +43 -0
  38. package/dist/modules/core/helpers.js +261 -0
  39. package/dist/modules/core/render.cjs +391 -0
  40. package/dist/modules/core/render.d.ts +4 -0
  41. package/dist/modules/core/render.js +388 -0
  42. package/dist/modules/core/styles.cjs +116 -0
  43. package/dist/modules/core/styles.d.ts +5 -0
  44. package/dist/modules/core/styles.js +113 -0
  45. package/dist/modules/core/targets.cjs +136 -0
  46. package/dist/modules/core/targets.d.ts +118 -0
  47. package/dist/modules/core/targets.js +132 -0
  48. package/dist/modules/core/transforms.cjs +49 -0
  49. package/dist/modules/core/transforms.d.ts +2 -0
  50. package/dist/modules/core/transforms.js +47 -0
  51. package/dist/modules/core/units.cjs +67 -0
  52. package/dist/modules/core/units.d.ts +3 -0
  53. package/dist/modules/core/units.js +65 -0
  54. package/dist/modules/core/values.cjs +226 -0
  55. package/dist/modules/core/values.d.ts +14 -0
  56. package/dist/modules/core/values.js +216 -0
  57. package/dist/modules/draggable/draggable.cjs +1226 -0
  58. package/dist/modules/draggable/draggable.d.ts +272 -0
  59. package/dist/modules/draggable/draggable.js +1223 -0
  60. package/dist/modules/draggable/index.cjs +15 -0
  61. package/dist/modules/draggable/index.d.ts +1 -0
  62. package/dist/modules/draggable/index.js +8 -0
  63. package/dist/modules/easings/cubic-bezier/index.cjs +64 -0
  64. package/dist/modules/easings/cubic-bezier/index.d.ts +2 -0
  65. package/dist/modules/easings/cubic-bezier/index.js +62 -0
  66. package/dist/modules/easings/eases/index.cjs +14 -0
  67. package/dist/modules/easings/eases/index.d.ts +1 -0
  68. package/dist/modules/easings/eases/index.js +8 -0
  69. package/dist/modules/easings/eases/parser.cjs +191 -0
  70. package/dist/modules/easings/eases/parser.d.ts +125 -0
  71. package/dist/modules/easings/eases/parser.js +185 -0
  72. package/dist/modules/easings/index.cjs +26 -0
  73. package/dist/modules/easings/index.d.ts +6 -0
  74. package/dist/modules/easings/index.js +13 -0
  75. package/dist/modules/easings/irregular/index.cjs +41 -0
  76. package/dist/modules/easings/irregular/index.d.ts +2 -0
  77. package/dist/modules/easings/irregular/index.js +39 -0
  78. package/dist/modules/easings/linear/index.cjs +59 -0
  79. package/dist/modules/easings/linear/index.d.ts +2 -0
  80. package/dist/modules/easings/linear/index.js +57 -0
  81. package/dist/modules/easings/none.cjs +19 -0
  82. package/dist/modules/easings/none.d.ts +8 -0
  83. package/dist/modules/easings/none.js +17 -0
  84. package/dist/modules/easings/spring/index.cjs +255 -0
  85. package/dist/modules/easings/spring/index.d.ts +53 -0
  86. package/dist/modules/easings/spring/index.js +251 -0
  87. package/dist/modules/easings/steps/index.cjs +30 -0
  88. package/dist/modules/easings/steps/index.d.ts +2 -0
  89. package/dist/modules/easings/steps/index.js +28 -0
  90. package/dist/modules/engine/engine.cjs +168 -0
  91. package/dist/modules/engine/engine.d.ts +21 -0
  92. package/dist/modules/engine/engine.js +166 -0
  93. package/dist/modules/engine/index.cjs +14 -0
  94. package/dist/modules/engine/index.d.ts +1 -0
  95. package/dist/modules/engine/index.js +8 -0
  96. package/dist/modules/events/index.cjs +16 -0
  97. package/dist/modules/events/index.d.ts +1 -0
  98. package/dist/modules/events/index.js +8 -0
  99. package/dist/modules/events/scroll.cjs +940 -0
  100. package/dist/modules/events/scroll.d.ts +191 -0
  101. package/dist/modules/events/scroll.js +936 -0
  102. package/dist/modules/index.cjs +102 -0
  103. package/dist/modules/index.d.ts +18 -0
  104. package/dist/modules/index.js +41 -0
  105. package/dist/modules/scope/index.cjs +15 -0
  106. package/dist/modules/scope/index.d.ts +1 -0
  107. package/dist/modules/scope/index.js +8 -0
  108. package/dist/modules/scope/scope.cjs +254 -0
  109. package/dist/modules/scope/scope.d.ts +115 -0
  110. package/dist/modules/scope/scope.js +251 -0
  111. package/dist/modules/svg/drawable.cjs +119 -0
  112. package/dist/modules/svg/drawable.d.ts +3 -0
  113. package/dist/modules/svg/drawable.js +117 -0
  114. package/dist/modules/svg/helpers.cjs +30 -0
  115. package/dist/modules/svg/helpers.d.ts +2 -0
  116. package/dist/modules/svg/helpers.js +28 -0
  117. package/dist/modules/svg/index.cjs +18 -0
  118. package/dist/modules/svg/index.d.ts +3 -0
  119. package/dist/modules/svg/index.js +10 -0
  120. package/dist/modules/svg/morphto.cjs +58 -0
  121. package/dist/modules/svg/morphto.d.ts +3 -0
  122. package/dist/modules/svg/morphto.js +56 -0
  123. package/dist/modules/svg/motionpath.cjs +79 -0
  124. package/dist/modules/svg/motionpath.d.ts +7 -0
  125. package/dist/modules/svg/motionpath.js +77 -0
  126. package/dist/modules/text/index.cjs +16 -0
  127. package/dist/modules/text/index.d.ts +1 -0
  128. package/dist/modules/text/index.js +8 -0
  129. package/dist/modules/text/split.cjs +488 -0
  130. package/dist/modules/text/split.d.ts +62 -0
  131. package/dist/modules/text/split.js +484 -0
  132. package/dist/modules/timeline/index.cjs +15 -0
  133. package/dist/modules/timeline/index.d.ts +1 -0
  134. package/dist/modules/timeline/index.js +8 -0
  135. package/dist/modules/timeline/position.cjs +72 -0
  136. package/dist/modules/timeline/position.d.ts +3 -0
  137. package/dist/modules/timeline/position.js +70 -0
  138. package/dist/modules/timeline/timeline.cjs +312 -0
  139. package/dist/modules/timeline/timeline.d.ts +163 -0
  140. package/dist/modules/timeline/timeline.js +309 -0
  141. package/dist/modules/timer/index.cjs +15 -0
  142. package/dist/modules/timer/index.d.ts +1 -0
  143. package/dist/modules/timer/index.js +8 -0
  144. package/dist/modules/timer/timer.cjs +491 -0
  145. package/dist/modules/timer/timer.d.ts +141 -0
  146. package/dist/modules/timer/timer.js +488 -0
  147. package/dist/modules/types/index.d.ts +404 -0
  148. package/dist/modules/utils/chainable.cjs +190 -0
  149. package/dist/modules/utils/chainable.d.ts +135 -0
  150. package/dist/modules/utils/chainable.js +177 -0
  151. package/dist/modules/utils/index.cjs +43 -0
  152. package/dist/modules/utils/index.d.ts +5 -0
  153. package/dist/modules/utils/index.js +14 -0
  154. package/dist/modules/utils/number.cjs +97 -0
  155. package/dist/modules/utils/number.d.ts +9 -0
  156. package/dist/modules/utils/number.js +85 -0
  157. package/dist/modules/utils/random.cjs +77 -0
  158. package/dist/modules/utils/random.d.ts +22 -0
  159. package/dist/modules/utils/random.js +72 -0
  160. package/dist/modules/utils/stagger.cjs +122 -0
  161. package/dist/modules/utils/stagger.d.ts +30 -0
  162. package/dist/modules/utils/stagger.js +120 -0
  163. package/dist/modules/utils/target.cjs +130 -0
  164. package/dist/modules/utils/target.d.ts +126 -0
  165. package/dist/modules/utils/target.js +125 -0
  166. package/dist/modules/utils/time.cjs +57 -0
  167. package/dist/modules/utils/time.d.ts +5 -0
  168. package/dist/modules/utils/time.js +54 -0
  169. package/dist/modules/waapi/composition.cjs +95 -0
  170. package/dist/modules/waapi/composition.d.ts +4 -0
  171. package/dist/modules/waapi/composition.js +92 -0
  172. package/dist/modules/waapi/index.cjs +15 -0
  173. package/dist/modules/waapi/index.d.ts +1 -0
  174. package/dist/modules/waapi/index.js +8 -0
  175. package/dist/modules/waapi/waapi.cjs +492 -0
  176. package/dist/modules/waapi/waapi.d.ts +116 -0
  177. package/dist/modules/waapi/waapi.js +489 -0
  178. package/package.json +166 -33
  179. package/lib/anime.cjs +0 -9
  180. package/lib/anime.esm.min.js +0 -9
  181. package/lib/anime.iife.js +0 -9
  182. package/lib/anime.iife.min.js +0 -9
  183. package/lib/anime.min.cjs +0 -9
  184. package/lib/anime.umd.js +0 -9
  185. package/lib/anime.umd.min.js +0 -9
  186. package/lib/gui/index.js +0 -6341
  187. package/types/index.d.ts +0 -1127
  188. package/types/index.js +0 -7395
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Anime.js - draggable - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var draggable = require('./draggable.cjs');
11
+
12
+
13
+
14
+ exports.Draggable = draggable.Draggable;
15
+ exports.createDraggable = draggable.createDraggable;
@@ -0,0 +1 @@
1
+ export * from "./draggable.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Anime.js - draggable - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ export { Draggable, createDraggable } from './draggable.js';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Anime.js - easings - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var helpers = require('../../core/helpers.cjs');
11
+ var none = require('../none.cjs');
12
+
13
+ /**
14
+ * @import {
15
+ * EasingFunction,
16
+ * } from '../../types/index.js'
17
+ */
18
+
19
+ /**
20
+ * Cubic Bezier solver adapted from https://github.com/gre/bezier-easing
21
+ * (c) 2014 Gaëtan Renaudeau
22
+ */
23
+
24
+ /**
25
+ * @param {Number} aT
26
+ * @param {Number} aA1
27
+ * @param {Number} aA2
28
+ * @return {Number}
29
+ */
30
+ const calcBezier = (aT, aA1, aA2) => (((1 - 3 * aA2 + 3 * aA1) * aT + (3 * aA2 - 6 * aA1)) * aT + (3 * aA1)) * aT;
31
+
32
+ /**
33
+ * @param {Number} aX
34
+ * @param {Number} mX1
35
+ * @param {Number} mX2
36
+ * @return {Number}
37
+ */
38
+ const binarySubdivide = (aX, mX1, mX2) => {
39
+ let aA = 0, aB = 1, currentX, currentT, i = 0;
40
+ do {
41
+ currentT = aA + (aB - aA) / 2;
42
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
43
+ if (currentX > 0) {
44
+ aB = currentT;
45
+ } else {
46
+ aA = currentT;
47
+ }
48
+ } while (helpers.abs(currentX) > .0000001 && ++i < 100);
49
+ return currentT;
50
+ };
51
+
52
+ /**
53
+ * @param {Number} [mX1] The x coordinate of the first point
54
+ * @param {Number} [mY1] The y coordinate of the first point
55
+ * @param {Number} [mX2] The x coordinate of the second point
56
+ * @param {Number} [mY2] The y coordinate of the second point
57
+ * @return {EasingFunction}
58
+ */
59
+
60
+ const cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none.none :
61
+ t => t === 0 || t === 1 ? t :
62
+ calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2);
63
+
64
+ exports.cubicBezier = cubicBezier;
@@ -0,0 +1,2 @@
1
+ export function cubicBezier(mX1?: number, mY1?: number, mX2?: number, mY2?: number): EasingFunction;
2
+ import type { EasingFunction } from '../../types/index.js';
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Anime.js - easings - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { abs } from '../../core/helpers.js';
9
+ import { none } from '../none.js';
10
+
11
+ /**
12
+ * @import {
13
+ * EasingFunction,
14
+ * } from '../../types/index.js'
15
+ */
16
+
17
+ /**
18
+ * Cubic Bezier solver adapted from https://github.com/gre/bezier-easing
19
+ * (c) 2014 Gaëtan Renaudeau
20
+ */
21
+
22
+ /**
23
+ * @param {Number} aT
24
+ * @param {Number} aA1
25
+ * @param {Number} aA2
26
+ * @return {Number}
27
+ */
28
+ const calcBezier = (aT, aA1, aA2) => (((1 - 3 * aA2 + 3 * aA1) * aT + (3 * aA2 - 6 * aA1)) * aT + (3 * aA1)) * aT;
29
+
30
+ /**
31
+ * @param {Number} aX
32
+ * @param {Number} mX1
33
+ * @param {Number} mX2
34
+ * @return {Number}
35
+ */
36
+ const binarySubdivide = (aX, mX1, mX2) => {
37
+ let aA = 0, aB = 1, currentX, currentT, i = 0;
38
+ do {
39
+ currentT = aA + (aB - aA) / 2;
40
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
41
+ if (currentX > 0) {
42
+ aB = currentT;
43
+ } else {
44
+ aA = currentT;
45
+ }
46
+ } while (abs(currentX) > .0000001 && ++i < 100);
47
+ return currentT;
48
+ };
49
+
50
+ /**
51
+ * @param {Number} [mX1] The x coordinate of the first point
52
+ * @param {Number} [mY1] The y coordinate of the first point
53
+ * @param {Number} [mX2] The x coordinate of the second point
54
+ * @param {Number} [mY2] The y coordinate of the second point
55
+ * @return {EasingFunction}
56
+ */
57
+
58
+ const cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none :
59
+ t => t === 0 || t === 1 ? t :
60
+ calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2);
61
+
62
+ export { cubicBezier };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Anime.js - easings - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var parser = require('./parser.cjs');
11
+
12
+
13
+
14
+ exports.eases = parser.eases;
@@ -0,0 +1 @@
1
+ export { eases } from "./parser.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Anime.js - easings - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ export { eases } from './parser.js';
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Anime.js - easings - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var consts = require('../../core/consts.cjs');
11
+ var helpers = require('../../core/helpers.cjs');
12
+ var none = require('../none.cjs');
13
+
14
+ /**
15
+ * @import {
16
+ * EasingFunction,
17
+ * EasingFunctionWithParams,
18
+ * EasingParam,
19
+ * BackEasing,
20
+ * ElasticEasing,
21
+ * PowerEasing,
22
+ * } from '../../types/index.js'
23
+ */
24
+
25
+
26
+ /** @type {PowerEasing} */
27
+ const easeInPower = (p = 1.68) => t => helpers.pow(t, +p);
28
+
29
+ /**
30
+ * @callback EaseType
31
+ * @param {EasingFunction} Ease
32
+ * @return {EasingFunction}
33
+ */
34
+
35
+ /** @type {Record<String, EaseType>} */
36
+ const easeTypes = {
37
+ in: easeIn => t => easeIn(t),
38
+ out: easeIn => t => 1 - easeIn(1 - t),
39
+ inOut: easeIn => t => t < .5 ? easeIn(t * 2) / 2 : 1 - easeIn(t * -2 + 2) / 2,
40
+ outIn: easeIn => t => t < .5 ? (1 - easeIn(1 - t * 2)) / 2 : (easeIn(t * 2 - 1) + 1) / 2,
41
+ };
42
+
43
+ /**
44
+ * Easing functions adapted and simplified from https://robertpenner.com/easing/
45
+ * (c) 2001 Robert Penner
46
+ */
47
+
48
+ const halfPI = helpers.PI / 2;
49
+ const doublePI = helpers.PI * 2;
50
+
51
+ /** @type {Record<String, EasingFunctionWithParams|EasingFunction>} */
52
+ const easeInFunctions = {
53
+ [consts.emptyString]: easeInPower,
54
+ Quad: easeInPower(2),
55
+ Cubic: easeInPower(3),
56
+ Quart: easeInPower(4),
57
+ Quint: easeInPower(5),
58
+ /** @type {EasingFunction} */
59
+ Sine: t => 1 - helpers.cos(t * halfPI),
60
+ /** @type {EasingFunction} */
61
+ Circ: t => 1 - helpers.sqrt(1 - t * t),
62
+ /** @type {EasingFunction} */
63
+ Expo: t => t ? helpers.pow(2, 10 * t - 10) : 0,
64
+ /** @type {EasingFunction} */
65
+ Bounce: t => {
66
+ let pow2, b = 4;
67
+ while (t < ((pow2 = helpers.pow(2, --b)) - 1) / 11);
68
+ return 1 / helpers.pow(4, 3 - b) - 7.5625 * helpers.pow((pow2 * 3 - 2) / 22 - t, 2);
69
+ },
70
+ /** @type {BackEasing} */
71
+ Back: (overshoot = 1.7) => t => (+overshoot + 1) * t * t * t - +overshoot * t * t,
72
+ /** @type {ElasticEasing} */
73
+ Elastic: (amplitude = 1, period = .3) => {
74
+ const a = helpers.clamp(+amplitude, 1, 10);
75
+ const p = helpers.clamp(+period, consts.minValue, 2);
76
+ const s = (p / doublePI) * helpers.asin(1 / a);
77
+ const e = doublePI / p;
78
+ return t => t === 0 || t === 1 ? t : -a * helpers.pow(2, -10 * (1 - t)) * helpers.sin(((1 - t) - s) * e);
79
+ }
80
+ };
81
+
82
+ /**
83
+ * @typedef {Object} EasesFunctions
84
+ * @property {typeof none} linear
85
+ * @property {typeof none} none
86
+ * @property {PowerEasing} in
87
+ * @property {PowerEasing} out
88
+ * @property {PowerEasing} inOut
89
+ * @property {PowerEasing} outIn
90
+ * @property {EasingFunction} inQuad
91
+ * @property {EasingFunction} outQuad
92
+ * @property {EasingFunction} inOutQuad
93
+ * @property {EasingFunction} outInQuad
94
+ * @property {EasingFunction} inCubic
95
+ * @property {EasingFunction} outCubic
96
+ * @property {EasingFunction} inOutCubic
97
+ * @property {EasingFunction} outInCubic
98
+ * @property {EasingFunction} inQuart
99
+ * @property {EasingFunction} outQuart
100
+ * @property {EasingFunction} inOutQuart
101
+ * @property {EasingFunction} outInQuart
102
+ * @property {EasingFunction} inQuint
103
+ * @property {EasingFunction} outQuint
104
+ * @property {EasingFunction} inOutQuint
105
+ * @property {EasingFunction} outInQuint
106
+ * @property {EasingFunction} inSine
107
+ * @property {EasingFunction} outSine
108
+ * @property {EasingFunction} inOutSine
109
+ * @property {EasingFunction} outInSine
110
+ * @property {EasingFunction} inCirc
111
+ * @property {EasingFunction} outCirc
112
+ * @property {EasingFunction} inOutCirc
113
+ * @property {EasingFunction} outInCirc
114
+ * @property {EasingFunction} inExpo
115
+ * @property {EasingFunction} outExpo
116
+ * @property {EasingFunction} inOutExpo
117
+ * @property {EasingFunction} outInExpo
118
+ * @property {EasingFunction} inBounce
119
+ * @property {EasingFunction} outBounce
120
+ * @property {EasingFunction} inOutBounce
121
+ * @property {EasingFunction} outInBounce
122
+ * @property {BackEasing} inBack
123
+ * @property {BackEasing} outBack
124
+ * @property {BackEasing} inOutBack
125
+ * @property {BackEasing} outInBack
126
+ * @property {ElasticEasing} inElastic
127
+ * @property {ElasticEasing} outElastic
128
+ * @property {ElasticEasing} inOutElastic
129
+ * @property {ElasticEasing} outInElastic
130
+ */
131
+
132
+ const eases = (/*#__PURE__ */ (() => {
133
+ const list = { linear: none.none, none: none.none };
134
+ for (let type in easeTypes) {
135
+ for (let name in easeInFunctions) {
136
+ const easeIn = easeInFunctions[name];
137
+ const easeType = easeTypes[type];
138
+ list[type + name] = /** @type {EasingFunctionWithParams|EasingFunction} */(
139
+ name === consts.emptyString || name === 'Back' || name === 'Elastic' ?
140
+ (a, b) => easeType(/** @type {EasingFunctionWithParams} */(easeIn)(a, b)) :
141
+ easeType(/** @type {EasingFunction} */(easeIn))
142
+ );
143
+ }
144
+ }
145
+ return /** @type {EasesFunctions} */(list);
146
+ })());
147
+
148
+ /** @type {Record<String, EasingFunction>} */
149
+ const easesLookups = { linear: none.none, none: none.none };
150
+
151
+ /**
152
+ * @param {String} string
153
+ * @return {EasingFunction}
154
+ */
155
+ const parseEaseString = (string) => {
156
+ if (easesLookups[string]) return easesLookups[string];
157
+ if (string.indexOf('(') <= -1) {
158
+ const hasParams = easeTypes[string] || string.includes('Back') || string.includes('Elastic');
159
+ const parsedFn = /** @type {EasingFunction} */(hasParams ? /** @type {EasingFunctionWithParams} */(eases[string])() : eases[string]);
160
+ return parsedFn ? easesLookups[string] = parsedFn : none.none;
161
+ } else {
162
+ const split = string.slice(0, -1).split('(');
163
+ const parsedFn = /** @type {EasingFunctionWithParams} */(eases[split[0]]);
164
+ return parsedFn ? easesLookups[string] = parsedFn(...split[1].split(',')) : none.none;
165
+ }
166
+ };
167
+
168
+ const deprecated = ['steps(', 'irregular(', 'linear(', 'cubicBezier('];
169
+
170
+ /**
171
+ * @param {EasingParam} ease
172
+ * @return {EasingFunction}
173
+ */
174
+ const parseEase = ease => {
175
+ if (helpers.isStr(ease)) {
176
+ for (let i = 0, l = deprecated.length; i < l; i++) {
177
+ if (helpers.stringStartsWith(ease, deprecated[i])) {
178
+ console.warn(`String syntax for \`ease: "${ease}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${ease}\``);
179
+ return none.none;
180
+ }
181
+ }
182
+ }
183
+ const easeFunc = helpers.isFnc(ease) ? ease : helpers.isStr(ease) ? parseEaseString(/** @type {String} */(ease)) : none.none;
184
+ return easeFunc;
185
+ };
186
+
187
+ exports.easeInPower = easeInPower;
188
+ exports.easeTypes = easeTypes;
189
+ exports.eases = eases;
190
+ exports.parseEase = parseEase;
191
+ exports.parseEaseString = parseEaseString;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @import {
3
+ * EasingFunction,
4
+ * EasingFunctionWithParams,
5
+ * EasingParam,
6
+ * BackEasing,
7
+ * ElasticEasing,
8
+ * PowerEasing,
9
+ * } from '../../types/index.js'
10
+ */
11
+ /** @type {PowerEasing} */
12
+ export const easeInPower: PowerEasing;
13
+ /**
14
+ * @callback EaseType
15
+ * @param {EasingFunction} Ease
16
+ * @return {EasingFunction}
17
+ */
18
+ /** @type {Record<String, EaseType>} */
19
+ export const easeTypes: Record<string, EaseType>;
20
+ export namespace eases {
21
+ export let linear: typeof import("../none.js").none;
22
+ export let none: typeof import("../none.js").none;
23
+ let _in: PowerEasing;
24
+ export { _in as in };
25
+ export let out: PowerEasing;
26
+ export let inOut: PowerEasing;
27
+ export let outIn: PowerEasing;
28
+ export let inQuad: EasingFunction;
29
+ export let outQuad: EasingFunction;
30
+ export let inOutQuad: EasingFunction;
31
+ export let outInQuad: EasingFunction;
32
+ export let inCubic: EasingFunction;
33
+ export let outCubic: EasingFunction;
34
+ export let inOutCubic: EasingFunction;
35
+ export let outInCubic: EasingFunction;
36
+ export let inQuart: EasingFunction;
37
+ export let outQuart: EasingFunction;
38
+ export let inOutQuart: EasingFunction;
39
+ export let outInQuart: EasingFunction;
40
+ export let inQuint: EasingFunction;
41
+ export let outQuint: EasingFunction;
42
+ export let inOutQuint: EasingFunction;
43
+ export let outInQuint: EasingFunction;
44
+ export let inSine: EasingFunction;
45
+ export let outSine: EasingFunction;
46
+ export let inOutSine: EasingFunction;
47
+ export let outInSine: EasingFunction;
48
+ export let inCirc: EasingFunction;
49
+ export let outCirc: EasingFunction;
50
+ export let inOutCirc: EasingFunction;
51
+ export let outInCirc: EasingFunction;
52
+ export let inExpo: EasingFunction;
53
+ export let outExpo: EasingFunction;
54
+ export let inOutExpo: EasingFunction;
55
+ export let outInExpo: EasingFunction;
56
+ export let inBounce: EasingFunction;
57
+ export let outBounce: EasingFunction;
58
+ export let inOutBounce: EasingFunction;
59
+ export let outInBounce: EasingFunction;
60
+ export let inBack: BackEasing;
61
+ export let outBack: BackEasing;
62
+ export let inOutBack: BackEasing;
63
+ export let outInBack: BackEasing;
64
+ export let inElastic: ElasticEasing;
65
+ export let outElastic: ElasticEasing;
66
+ export let inOutElastic: ElasticEasing;
67
+ export let outInElastic: ElasticEasing;
68
+ }
69
+ export function parseEaseString(string: string): EasingFunction;
70
+ export function parseEase(ease: EasingParam): EasingFunction;
71
+ export type EaseType = (Ease: EasingFunction) => EasingFunction;
72
+ export type EasesFunctions = {
73
+ linear: typeof none;
74
+ none: typeof none;
75
+ in: PowerEasing;
76
+ out: PowerEasing;
77
+ inOut: PowerEasing;
78
+ outIn: PowerEasing;
79
+ inQuad: EasingFunction;
80
+ outQuad: EasingFunction;
81
+ inOutQuad: EasingFunction;
82
+ outInQuad: EasingFunction;
83
+ inCubic: EasingFunction;
84
+ outCubic: EasingFunction;
85
+ inOutCubic: EasingFunction;
86
+ outInCubic: EasingFunction;
87
+ inQuart: EasingFunction;
88
+ outQuart: EasingFunction;
89
+ inOutQuart: EasingFunction;
90
+ outInQuart: EasingFunction;
91
+ inQuint: EasingFunction;
92
+ outQuint: EasingFunction;
93
+ inOutQuint: EasingFunction;
94
+ outInQuint: EasingFunction;
95
+ inSine: EasingFunction;
96
+ outSine: EasingFunction;
97
+ inOutSine: EasingFunction;
98
+ outInSine: EasingFunction;
99
+ inCirc: EasingFunction;
100
+ outCirc: EasingFunction;
101
+ inOutCirc: EasingFunction;
102
+ outInCirc: EasingFunction;
103
+ inExpo: EasingFunction;
104
+ outExpo: EasingFunction;
105
+ inOutExpo: EasingFunction;
106
+ outInExpo: EasingFunction;
107
+ inBounce: EasingFunction;
108
+ outBounce: EasingFunction;
109
+ inOutBounce: EasingFunction;
110
+ outInBounce: EasingFunction;
111
+ inBack: BackEasing;
112
+ outBack: BackEasing;
113
+ inOutBack: BackEasing;
114
+ outInBack: BackEasing;
115
+ inElastic: ElasticEasing;
116
+ outElastic: ElasticEasing;
117
+ inOutElastic: ElasticEasing;
118
+ outInElastic: ElasticEasing;
119
+ };
120
+ import type { PowerEasing } from '../../types/index.js';
121
+ import type { EasingFunction } from '../../types/index.js';
122
+ import type { BackEasing } from '../../types/index.js';
123
+ import type { ElasticEasing } from '../../types/index.js';
124
+ import type { EasingParam } from '../../types/index.js';
125
+ import { none as none_1 } from '../none.js';
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Anime.js - easings - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { emptyString, minValue } from '../../core/consts.js';
9
+ import { pow, sin, sqrt, cos, isStr, stringStartsWith, isFnc, clamp, asin, PI } from '../../core/helpers.js';
10
+ import { none } from '../none.js';
11
+
12
+ /**
13
+ * @import {
14
+ * EasingFunction,
15
+ * EasingFunctionWithParams,
16
+ * EasingParam,
17
+ * BackEasing,
18
+ * ElasticEasing,
19
+ * PowerEasing,
20
+ * } from '../../types/index.js'
21
+ */
22
+
23
+
24
+ /** @type {PowerEasing} */
25
+ const easeInPower = (p = 1.68) => t => pow(t, +p);
26
+
27
+ /**
28
+ * @callback EaseType
29
+ * @param {EasingFunction} Ease
30
+ * @return {EasingFunction}
31
+ */
32
+
33
+ /** @type {Record<String, EaseType>} */
34
+ const easeTypes = {
35
+ in: easeIn => t => easeIn(t),
36
+ out: easeIn => t => 1 - easeIn(1 - t),
37
+ inOut: easeIn => t => t < .5 ? easeIn(t * 2) / 2 : 1 - easeIn(t * -2 + 2) / 2,
38
+ outIn: easeIn => t => t < .5 ? (1 - easeIn(1 - t * 2)) / 2 : (easeIn(t * 2 - 1) + 1) / 2,
39
+ };
40
+
41
+ /**
42
+ * Easing functions adapted and simplified from https://robertpenner.com/easing/
43
+ * (c) 2001 Robert Penner
44
+ */
45
+
46
+ const halfPI = PI / 2;
47
+ const doublePI = PI * 2;
48
+
49
+ /** @type {Record<String, EasingFunctionWithParams|EasingFunction>} */
50
+ const easeInFunctions = {
51
+ [emptyString]: easeInPower,
52
+ Quad: easeInPower(2),
53
+ Cubic: easeInPower(3),
54
+ Quart: easeInPower(4),
55
+ Quint: easeInPower(5),
56
+ /** @type {EasingFunction} */
57
+ Sine: t => 1 - cos(t * halfPI),
58
+ /** @type {EasingFunction} */
59
+ Circ: t => 1 - sqrt(1 - t * t),
60
+ /** @type {EasingFunction} */
61
+ Expo: t => t ? pow(2, 10 * t - 10) : 0,
62
+ /** @type {EasingFunction} */
63
+ Bounce: t => {
64
+ let pow2, b = 4;
65
+ while (t < ((pow2 = pow(2, --b)) - 1) / 11);
66
+ return 1 / pow(4, 3 - b) - 7.5625 * pow((pow2 * 3 - 2) / 22 - t, 2);
67
+ },
68
+ /** @type {BackEasing} */
69
+ Back: (overshoot = 1.7) => t => (+overshoot + 1) * t * t * t - +overshoot * t * t,
70
+ /** @type {ElasticEasing} */
71
+ Elastic: (amplitude = 1, period = .3) => {
72
+ const a = clamp(+amplitude, 1, 10);
73
+ const p = clamp(+period, minValue, 2);
74
+ const s = (p / doublePI) * asin(1 / a);
75
+ const e = doublePI / p;
76
+ return t => t === 0 || t === 1 ? t : -a * pow(2, -10 * (1 - t)) * sin(((1 - t) - s) * e);
77
+ }
78
+ };
79
+
80
+ /**
81
+ * @typedef {Object} EasesFunctions
82
+ * @property {typeof none} linear
83
+ * @property {typeof none} none
84
+ * @property {PowerEasing} in
85
+ * @property {PowerEasing} out
86
+ * @property {PowerEasing} inOut
87
+ * @property {PowerEasing} outIn
88
+ * @property {EasingFunction} inQuad
89
+ * @property {EasingFunction} outQuad
90
+ * @property {EasingFunction} inOutQuad
91
+ * @property {EasingFunction} outInQuad
92
+ * @property {EasingFunction} inCubic
93
+ * @property {EasingFunction} outCubic
94
+ * @property {EasingFunction} inOutCubic
95
+ * @property {EasingFunction} outInCubic
96
+ * @property {EasingFunction} inQuart
97
+ * @property {EasingFunction} outQuart
98
+ * @property {EasingFunction} inOutQuart
99
+ * @property {EasingFunction} outInQuart
100
+ * @property {EasingFunction} inQuint
101
+ * @property {EasingFunction} outQuint
102
+ * @property {EasingFunction} inOutQuint
103
+ * @property {EasingFunction} outInQuint
104
+ * @property {EasingFunction} inSine
105
+ * @property {EasingFunction} outSine
106
+ * @property {EasingFunction} inOutSine
107
+ * @property {EasingFunction} outInSine
108
+ * @property {EasingFunction} inCirc
109
+ * @property {EasingFunction} outCirc
110
+ * @property {EasingFunction} inOutCirc
111
+ * @property {EasingFunction} outInCirc
112
+ * @property {EasingFunction} inExpo
113
+ * @property {EasingFunction} outExpo
114
+ * @property {EasingFunction} inOutExpo
115
+ * @property {EasingFunction} outInExpo
116
+ * @property {EasingFunction} inBounce
117
+ * @property {EasingFunction} outBounce
118
+ * @property {EasingFunction} inOutBounce
119
+ * @property {EasingFunction} outInBounce
120
+ * @property {BackEasing} inBack
121
+ * @property {BackEasing} outBack
122
+ * @property {BackEasing} inOutBack
123
+ * @property {BackEasing} outInBack
124
+ * @property {ElasticEasing} inElastic
125
+ * @property {ElasticEasing} outElastic
126
+ * @property {ElasticEasing} inOutElastic
127
+ * @property {ElasticEasing} outInElastic
128
+ */
129
+
130
+ const eases = (/*#__PURE__ */ (() => {
131
+ const list = { linear: none, none: none };
132
+ for (let type in easeTypes) {
133
+ for (let name in easeInFunctions) {
134
+ const easeIn = easeInFunctions[name];
135
+ const easeType = easeTypes[type];
136
+ list[type + name] = /** @type {EasingFunctionWithParams|EasingFunction} */(
137
+ name === emptyString || name === 'Back' || name === 'Elastic' ?
138
+ (a, b) => easeType(/** @type {EasingFunctionWithParams} */(easeIn)(a, b)) :
139
+ easeType(/** @type {EasingFunction} */(easeIn))
140
+ );
141
+ }
142
+ }
143
+ return /** @type {EasesFunctions} */(list);
144
+ })());
145
+
146
+ /** @type {Record<String, EasingFunction>} */
147
+ const easesLookups = { linear: none, none: none };
148
+
149
+ /**
150
+ * @param {String} string
151
+ * @return {EasingFunction}
152
+ */
153
+ const parseEaseString = (string) => {
154
+ if (easesLookups[string]) return easesLookups[string];
155
+ if (string.indexOf('(') <= -1) {
156
+ const hasParams = easeTypes[string] || string.includes('Back') || string.includes('Elastic');
157
+ const parsedFn = /** @type {EasingFunction} */(hasParams ? /** @type {EasingFunctionWithParams} */(eases[string])() : eases[string]);
158
+ return parsedFn ? easesLookups[string] = parsedFn : none;
159
+ } else {
160
+ const split = string.slice(0, -1).split('(');
161
+ const parsedFn = /** @type {EasingFunctionWithParams} */(eases[split[0]]);
162
+ return parsedFn ? easesLookups[string] = parsedFn(...split[1].split(',')) : none;
163
+ }
164
+ };
165
+
166
+ const deprecated = ['steps(', 'irregular(', 'linear(', 'cubicBezier('];
167
+
168
+ /**
169
+ * @param {EasingParam} ease
170
+ * @return {EasingFunction}
171
+ */
172
+ const parseEase = ease => {
173
+ if (isStr(ease)) {
174
+ for (let i = 0, l = deprecated.length; i < l; i++) {
175
+ if (stringStartsWith(ease, deprecated[i])) {
176
+ console.warn(`String syntax for \`ease: "${ease}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${ease}\``);
177
+ return none;
178
+ }
179
+ }
180
+ }
181
+ const easeFunc = isFnc(ease) ? ease : isStr(ease) ? parseEaseString(/** @type {String} */(ease)) : none;
182
+ return easeFunc;
183
+ };
184
+
185
+ export { easeInPower, easeTypes, eases, parseEase, parseEaseString };