animejs 4.4.0 → 4.5.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 (165) hide show
  1. package/README.md +4 -5
  2. package/dist/bundles/anime.esm.js +491 -272
  3. package/dist/bundles/anime.esm.min.js +2 -2
  4. package/dist/bundles/anime.umd.js +491 -272
  5. package/dist/bundles/anime.umd.min.js +2 -2
  6. package/dist/modules/adapters/index.cjs +14 -0
  7. package/dist/modules/adapters/index.d.ts +1 -0
  8. package/dist/modules/adapters/index.js +8 -0
  9. package/dist/modules/adapters/registry.cjs +149 -0
  10. package/dist/modules/adapters/registry.d.ts +65 -0
  11. package/dist/modules/adapters/registry.js +146 -0
  12. package/dist/modules/adapters/three/adapter.cjs +26 -0
  13. package/dist/modules/adapters/three/adapter.d.ts +15 -0
  14. package/dist/modules/adapters/three/adapter.js +24 -0
  15. package/dist/modules/adapters/three/helpers.cjs +297 -0
  16. package/dist/modules/adapters/three/helpers.d.ts +89 -0
  17. package/dist/modules/adapters/three/helpers.js +280 -0
  18. package/dist/modules/adapters/three/index.cjs +20 -0
  19. package/dist/modules/adapters/three/index.d.ts +2 -0
  20. package/dist/modules/adapters/three/index.js +12 -0
  21. package/dist/modules/adapters/three/instance.cjs +368 -0
  22. package/dist/modules/adapters/three/instance.d.ts +133 -0
  23. package/dist/modules/adapters/three/instance.js +365 -0
  24. package/dist/modules/adapters/three/object3d.cjs +214 -0
  25. package/dist/modules/adapters/three/object3d.d.ts +1 -0
  26. package/dist/modules/adapters/three/object3d.js +212 -0
  27. package/dist/modules/adapters/three/resolvers.cjs +105 -0
  28. package/dist/modules/adapters/three/resolvers.d.ts +1 -0
  29. package/dist/modules/adapters/three/resolvers.js +103 -0
  30. package/dist/modules/adapters/three/uniform.cjs +41 -0
  31. package/dist/modules/adapters/three/uniform.d.ts +1 -0
  32. package/dist/modules/adapters/three/uniform.js +39 -0
  33. package/dist/modules/animatable/animatable.cjs +2 -1
  34. package/dist/modules/animatable/animatable.d.ts +2 -1
  35. package/dist/modules/animatable/animatable.js +2 -1
  36. package/dist/modules/animatable/index.cjs +1 -1
  37. package/dist/modules/animatable/index.js +1 -1
  38. package/dist/modules/animation/additive.cjs +1 -1
  39. package/dist/modules/animation/additive.js +1 -1
  40. package/dist/modules/animation/animation.cjs +43 -16
  41. package/dist/modules/animation/animation.d.ts +5 -0
  42. package/dist/modules/animation/animation.js +45 -18
  43. package/dist/modules/animation/composition.cjs +38 -35
  44. package/dist/modules/animation/composition.js +38 -35
  45. package/dist/modules/animation/index.cjs +1 -1
  46. package/dist/modules/animation/index.js +1 -1
  47. package/dist/modules/core/clock.cjs +11 -15
  48. package/dist/modules/core/clock.d.ts +0 -2
  49. package/dist/modules/core/clock.js +11 -15
  50. package/dist/modules/core/colors.cjs +1 -1
  51. package/dist/modules/core/colors.js +1 -1
  52. package/dist/modules/core/consts.cjs +15 -1
  53. package/dist/modules/core/consts.d.ts +2 -0
  54. package/dist/modules/core/consts.js +14 -2
  55. package/dist/modules/core/globals.cjs +7 -4
  56. package/dist/modules/core/globals.d.ts +8 -2
  57. package/dist/modules/core/globals.js +8 -5
  58. package/dist/modules/core/helpers.cjs +2 -2
  59. package/dist/modules/core/helpers.js +3 -3
  60. package/dist/modules/core/render.cjs +93 -73
  61. package/dist/modules/core/render.js +96 -76
  62. package/dist/modules/core/styles.cjs +16 -2
  63. package/dist/modules/core/styles.js +16 -2
  64. package/dist/modules/core/targets.cjs +11 -13
  65. package/dist/modules/core/targets.js +11 -13
  66. package/dist/modules/core/transforms.cjs +1 -1
  67. package/dist/modules/core/transforms.js +1 -1
  68. package/dist/modules/core/units.cjs +1 -1
  69. package/dist/modules/core/units.js +1 -1
  70. package/dist/modules/core/values.cjs +73 -82
  71. package/dist/modules/core/values.d.ts +1 -2
  72. package/dist/modules/core/values.js +76 -84
  73. package/dist/modules/draggable/draggable.cjs +1 -1
  74. package/dist/modules/draggable/draggable.js +1 -1
  75. package/dist/modules/draggable/index.cjs +1 -1
  76. package/dist/modules/draggable/index.js +1 -1
  77. package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
  78. package/dist/modules/easings/cubic-bezier/index.js +1 -1
  79. package/dist/modules/easings/eases/index.cjs +1 -1
  80. package/dist/modules/easings/eases/index.js +1 -1
  81. package/dist/modules/easings/eases/parser.cjs +3 -3
  82. package/dist/modules/easings/eases/parser.d.ts +4 -5
  83. package/dist/modules/easings/eases/parser.js +3 -3
  84. package/dist/modules/easings/index.cjs +1 -1
  85. package/dist/modules/easings/index.js +1 -1
  86. package/dist/modules/easings/irregular/index.cjs +1 -1
  87. package/dist/modules/easings/irregular/index.js +1 -1
  88. package/dist/modules/easings/linear/index.cjs +1 -1
  89. package/dist/modules/easings/linear/index.js +1 -1
  90. package/dist/modules/easings/none.cjs +1 -1
  91. package/dist/modules/easings/none.js +1 -1
  92. package/dist/modules/easings/spring/index.cjs +1 -1
  93. package/dist/modules/easings/spring/index.js +1 -1
  94. package/dist/modules/easings/steps/index.cjs +1 -1
  95. package/dist/modules/easings/steps/index.js +1 -1
  96. package/dist/modules/engine/engine.cjs +4 -2
  97. package/dist/modules/engine/engine.js +4 -2
  98. package/dist/modules/engine/index.cjs +1 -1
  99. package/dist/modules/engine/index.js +1 -1
  100. package/dist/modules/events/index.cjs +1 -1
  101. package/dist/modules/events/index.js +1 -1
  102. package/dist/modules/events/scroll.cjs +3 -1
  103. package/dist/modules/events/scroll.js +3 -1
  104. package/dist/modules/index.cjs +1 -1
  105. package/dist/modules/index.js +1 -1
  106. package/dist/modules/layout/index.cjs +1 -1
  107. package/dist/modules/layout/index.js +1 -1
  108. package/dist/modules/layout/layout.cjs +1 -1
  109. package/dist/modules/layout/layout.js +1 -1
  110. package/dist/modules/scope/index.cjs +1 -1
  111. package/dist/modules/scope/index.js +1 -1
  112. package/dist/modules/scope/scope.cjs +1 -1
  113. package/dist/modules/scope/scope.js +1 -1
  114. package/dist/modules/svg/drawable.cjs +1 -1
  115. package/dist/modules/svg/drawable.js +1 -1
  116. package/dist/modules/svg/helpers.cjs +1 -1
  117. package/dist/modules/svg/helpers.js +1 -1
  118. package/dist/modules/svg/index.cjs +1 -1
  119. package/dist/modules/svg/index.js +1 -1
  120. package/dist/modules/svg/morphto.cjs +1 -1
  121. package/dist/modules/svg/morphto.js +1 -1
  122. package/dist/modules/svg/motionpath.cjs +1 -1
  123. package/dist/modules/svg/motionpath.js +1 -1
  124. package/dist/modules/text/index.cjs +1 -1
  125. package/dist/modules/text/index.js +1 -1
  126. package/dist/modules/text/scramble.cjs +12 -2
  127. package/dist/modules/text/scramble.d.ts +9 -1
  128. package/dist/modules/text/scramble.js +12 -2
  129. package/dist/modules/text/split.cjs +2 -1
  130. package/dist/modules/text/split.js +2 -1
  131. package/dist/modules/timeline/index.cjs +1 -1
  132. package/dist/modules/timeline/index.js +1 -1
  133. package/dist/modules/timeline/position.cjs +1 -1
  134. package/dist/modules/timeline/position.js +1 -1
  135. package/dist/modules/timeline/timeline.cjs +14 -5
  136. package/dist/modules/timeline/timeline.d.ts +3 -3
  137. package/dist/modules/timeline/timeline.js +14 -5
  138. package/dist/modules/timer/index.cjs +1 -1
  139. package/dist/modules/timer/index.js +1 -1
  140. package/dist/modules/timer/timer.cjs +1 -1
  141. package/dist/modules/timer/timer.js +1 -1
  142. package/dist/modules/types/index.d.ts +36 -11
  143. package/dist/modules/utils/chainable.cjs +1 -1
  144. package/dist/modules/utils/chainable.js +1 -1
  145. package/dist/modules/utils/index.cjs +1 -1
  146. package/dist/modules/utils/index.js +1 -1
  147. package/dist/modules/utils/number.cjs +1 -1
  148. package/dist/modules/utils/number.js +1 -1
  149. package/dist/modules/utils/random.cjs +4 -3
  150. package/dist/modules/utils/random.d.ts +1 -1
  151. package/dist/modules/utils/random.js +4 -3
  152. package/dist/modules/utils/stagger.cjs +67 -13
  153. package/dist/modules/utils/stagger.js +69 -15
  154. package/dist/modules/utils/target.cjs +4 -1
  155. package/dist/modules/utils/target.js +4 -1
  156. package/dist/modules/utils/time.cjs +6 -5
  157. package/dist/modules/utils/time.d.ts +1 -1
  158. package/dist/modules/utils/time.js +6 -5
  159. package/dist/modules/waapi/composition.cjs +1 -1
  160. package/dist/modules/waapi/composition.js +1 -1
  161. package/dist/modules/waapi/index.cjs +1 -1
  162. package/dist/modules/waapi/index.js +1 -1
  163. package/dist/modules/waapi/waapi.cjs +1 -1
  164. package/dist/modules/waapi/waapi.js +1 -1
  165. package/package.json +38 -5
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
7
7
 
8
8
  import { unitsExecRgx, emptyString } from '../core/consts.js';
9
- import { isUnd, parseNumber, isFnc, isNum, sqrt, abs, floor, max, round, isArr, isStr } from '../core/helpers.js';
9
+ import { isUnd, parseNumber, isFnc, isNum, sqrt, abs, floor, round, isArr, isStr } from '../core/helpers.js';
10
10
  import { parseEase } from '../easings/eases/parser.js';
11
11
  import { parseTimelinePosition } from '../timeline/position.js';
12
12
  import { getOriginalAnimatableValue } from '../core/values.js';
13
13
  import { registerTargets } from '../core/targets.js';
14
- import { shuffle } from './random.js';
14
+ import { createSeededRandom, random, shuffle } from './random.js';
15
15
 
16
16
  /**
17
17
  * @import {
@@ -64,6 +64,7 @@ const stagger = (val, params = {}) => {
64
64
  let values = [];
65
65
  let maxValue = 0;
66
66
  let cachedOffset;
67
+ let jitterSamples = null;
67
68
  const from = params.from;
68
69
  const reversed = params.reversed;
69
70
  const ease = params.ease;
@@ -85,27 +86,42 @@ const stagger = (val, params = {}) => {
85
86
  const val2 = isRange ? parseNumber(val[1]) : 0;
86
87
  const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);
87
88
  const start = params.start || 0 + (isRange ? val1 : 0);
89
+ const seed = params.seed;
90
+ const hasSeed = !isUnd(seed) && seed !== false;
91
+ const rng = hasSeed ? createSeededRandom(seed === true ? 0 : /** @type {Number} */(seed)) : random;
92
+ const jitter = params.jitter;
93
+ const hasJitter = !isUnd(jitter);
94
+ const jitterIsArr = isArr(jitter);
95
+ const jitterStart = jitterIsArr ? /** @type {[Number,Number]} */(jitter)[0] : /** @type {Number} */(jitter) || 0;
96
+ const jitterEnd = jitterIsArr ? /** @type {[Number,Number]} */(jitter)[1] : /** @type {Number} */(jitter) || 0;
88
97
  let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;
89
98
  return (target, i, t, _, tl) => {
90
99
  const [ registeredTarget ] = registerTargets(target);
91
100
  const total = isUnd(customTotal) ? t.length : customTotal;
92
101
  const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;
93
- const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;
102
+ const customIdx = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;
103
+ // Fall back to the natural index when the resolved value lands outside [0, total) so values[staggerIndex] never reads undefined.
104
+ const staggerIndex = customIdx >= 0 && customIdx < total ? customIdx : i;
94
105
  if (fromCenter) fromIndex = (total - 1) / 2;
95
106
  if (fromLast) fromIndex = total - 1;
96
107
  if (!values.length) {
97
108
  if (autoGrid) {
98
109
  let hasPositions = true;
110
+ let has3D = false;
99
111
  let minPosX = Infinity;
100
112
  let minPosY = Infinity;
113
+ let minPosZ = Infinity;
101
114
  let maxPosX = -Infinity;
102
115
  let maxPosY = -Infinity;
116
+ let maxPosZ = -Infinity;
103
117
  const pxArr = [];
104
118
  const pyArr = [];
119
+ const pzArr = [];
105
120
  for (let index = 0; index < total; index++) {
106
121
  const el = t[index];
107
122
  let px = 0;
108
123
  let py = 0;
124
+ let pz = 0;
109
125
  let found = false;
110
126
  if (el && isFnc(el.getBoundingClientRect)) {
111
127
  const rect = el.getBoundingClientRect();
@@ -117,6 +133,10 @@ const stagger = (val, params = {}) => {
117
133
  if (obj && isNum(obj.x) && isNum(obj.y)) {
118
134
  px = obj.x;
119
135
  py = obj.y;
136
+ if (isNum(obj.z)) {
137
+ pz = obj.z;
138
+ has3D = true;
139
+ }
120
140
  found = true;
121
141
  }
122
142
  }
@@ -126,42 +146,52 @@ const stagger = (val, params = {}) => {
126
146
  }
127
147
  pxArr.push(px);
128
148
  pyArr.push(py);
149
+ pzArr.push(pz);
129
150
  if (px < minPosX) minPosX = px;
130
151
  if (py < minPosY) minPosY = py;
152
+ if (pz < minPosZ) minPosZ = pz;
131
153
  if (px > maxPosX) maxPosX = px;
132
154
  if (py > maxPosY) maxPosY = py;
155
+ if (pz > maxPosZ) maxPosZ = pz;
133
156
  }
134
157
  if (hasPositions) {
135
158
  let fX = pxArr[0];
136
159
  let fY = pyArr[0];
160
+ let fZ = pzArr[0];
137
161
  if (fromArr) {
138
162
  fX = minPosX + from[0] * (maxPosX - minPosX);
139
163
  fY = minPosY + from[1] * (maxPosY - minPosY);
164
+ fZ = has3D ? minPosZ + (from.length >= 3 ? from[2] : 0.5) * (maxPosZ - minPosZ) : 0;
140
165
  } else if (fromCenter) {
141
166
  fX = (minPosX + maxPosX) / 2;
142
167
  fY = (minPosY + maxPosY) / 2;
168
+ fZ = (minPosZ + maxPosZ) / 2;
143
169
  } else if (fromLast) {
144
170
  fX = pxArr[total - 1];
145
171
  fY = pyArr[total - 1];
172
+ fZ = pzArr[total - 1];
146
173
  } else if (isNum(from)) {
147
174
  fX = pxArr[from];
148
175
  fY = pyArr[from];
176
+ fZ = pzArr[from];
149
177
  }
150
178
  for (let index = 0; index < total; index++) {
151
179
  const distanceX = fX - pxArr[index];
152
180
  const distanceY = fY - pyArr[index];
153
- let value = sqrt(distanceX * distanceX + distanceY * distanceY);
181
+ const distanceZ = fZ - pzArr[index];
182
+ let value = sqrt(distanceX * distanceX + distanceY * distanceY + (has3D ? distanceZ * distanceZ : 0));
154
183
  if (axis === 'x') value = -distanceX;
155
184
  if (axis === 'y') value = -distanceY;
185
+ if (axis === 'z') value = -distanceZ;
156
186
  values.push(value);
157
187
  }
158
188
  let minDist = Infinity;
159
- for (let index = 0, l = values.length; index < l; index++) {
189
+ for (let index = 0; index < total; index++) {
160
190
  const absVal = abs(values[index]);
161
191
  if (absVal > 0 && absVal < minDist) minDist = absVal;
162
192
  }
163
193
  if (minDist > 0 && minDist < Infinity) {
164
- for (let index = 0, l = values.length; index < l; index++) {
194
+ for (let index = 0; index < total; index++) {
165
195
  values[index] = values[index] / minDist;
166
196
  }
167
197
  }
@@ -175,32 +205,51 @@ const stagger = (val, params = {}) => {
175
205
  if (!grid) {
176
206
  values.push(abs(fromIndex - index));
177
207
  } else {
178
- let fromX, fromY;
208
+ const dims = grid.length;
209
+ const wh = grid[0] * grid[1];
210
+ let fromX, fromY, fromZ;
179
211
  if (fromArr) {
180
212
  fromX = from[0] * (grid[0] - 1);
181
213
  fromY = from[1] * (grid[1] - 1);
214
+ fromZ = dims === 3 ? (from.length >= 3 ? from[2] : 0.5) * (grid[2] - 1) : 0;
182
215
  } else if (fromCenter) {
183
216
  fromX = (grid[0] - 1) / 2;
184
217
  fromY = (grid[1] - 1) / 2;
218
+ fromZ = dims === 3 ? (grid[2] - 1) / 2 : 0;
185
219
  } else {
186
220
  fromX = fromIndex % grid[0];
187
- fromY = floor(fromIndex / grid[0]);
221
+ fromY = floor(fromIndex / grid[0]) % grid[1];
222
+ fromZ = dims === 3 ? floor(fromIndex / wh) : 0;
188
223
  }
189
224
  const toX = index % grid[0];
190
- const toY = floor(index / grid[0]);
225
+ const toY = floor(index / grid[0]) % grid[1];
226
+ const toZ = dims === 3 ? floor(index / wh) : 0;
191
227
  const distanceX = fromX - toX;
192
228
  const distanceY = fromY - toY;
193
- let value = sqrt(distanceX * distanceX + distanceY * distanceY);
229
+ const distanceZ = fromZ - toZ;
230
+ let value = sqrt(distanceX * distanceX + distanceY * distanceY + (dims === 3 ? distanceZ * distanceZ : 0));
194
231
  if (axis === 'x') value = -distanceX;
195
232
  if (axis === 'y') value = -distanceY;
233
+ if (axis === 'z') value = -distanceZ;
196
234
  values.push(value);
197
235
  }
198
236
  }
199
237
  }
200
- maxValue = max(...values);
201
- if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);
202
- if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));
203
- if (fromRandom) values = shuffle(values);
238
+ maxValue = values[0];
239
+ for (let k = 1; k < total; k++) if (values[k] > maxValue) maxValue = values[k];
240
+ if (staggerEase || reversed) {
241
+ for (let k = 0; k < total; k++) {
242
+ let v = values[k];
243
+ if (staggerEase) v = staggerEase(v / maxValue) * maxValue;
244
+ if (reversed) v = axis ? -v : abs(maxValue - v);
245
+ values[k] = v;
246
+ }
247
+ }
248
+ if (hasJitter) {
249
+ jitterSamples = new Array(total);
250
+ for (let k = 0; k < total; k++) jitterSamples[k] = rng(-1, 1, 4);
251
+ }
252
+ if (fromRandom) values = shuffle(values, rng);
204
253
  }
205
254
  const spacing = isRange ? (val2 - val1) / maxValue : val1;
206
255
  if (isUnd(cachedOffset)) {
@@ -208,6 +257,11 @@ const stagger = (val, params = {}) => {
208
257
  }
209
258
  /** @type {String|Number} */
210
259
  let output = cachedOffset + ((spacing * round(values[staggerIndex], 2)) || 0);
260
+ if (hasJitter) {
261
+ const progress = maxValue ? values[staggerIndex] / maxValue : 0;
262
+ const mag = jitterStart + (jitterEnd - jitterStart) * progress;
263
+ output = /** @type {Number} */(output) + jitterSamples[staggerIndex] * mag;
264
+ }
211
265
  if (params.modifier) output = params.modifier(/** @type {Number} */(output));
212
266
  if (unitMatch) output = `${output}${unitMatch[2]}`;
213
267
  return output;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -93,6 +93,9 @@ function get(targetSelector, propName, unit) {
93
93
  */
94
94
  const set = (targets, parameters) => {
95
95
  if (helpers.isUnd(parameters)) return;
96
+ if (globals.globals.editor && globals.globals.editor.addSet) {
97
+ return globals.globals.editor.addSet(targets, parameters);
98
+ }
96
99
  parameters.duration = consts.minValue;
97
100
  // Do not overrides currently active tweens by default
98
101
  parameters.composition = values.setValue(parameters.composition, consts.compositionTypes.none);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -92,6 +92,9 @@ function get(targetSelector, propName, unit) {
92
92
  */
93
93
  const set = (targets, parameters) => {
94
94
  if (isUnd(parameters)) return;
95
+ if (globals.editor && globals.editor.addSet) {
96
+ return globals.editor.addSet(targets, parameters);
97
+ }
95
98
  parameters.duration = minValue;
96
99
  // Do not overrides currently active tweens by default
97
100
  parameters.composition = setValue(parameters.composition, compositionTypes.none);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -28,13 +28,14 @@ const sync = (callback = consts.noop) => {
28
28
  };
29
29
 
30
30
  /**
31
- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor
32
- * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
31
+ * @template {Tickable | ((...args: any[]) => void) | void} T
32
+ * @param {(...args: any[]) => T} constructor
33
+ * @return {(...args: any[]) => T extends void ? () => void : T}
33
34
  */
34
35
  const keepTime = constructor => {
35
36
  /** @type {Tickable} */
36
37
  let tracked;
37
- return (...args) => {
38
+ return /** @type {(...args: any[]) => T extends void ? () => void : T} */(/** @type {*} */((...args) => {
38
39
  let currentIteration, currentIterationProgress, reversed, alternate, startTime;
39
40
  if (tracked) {
40
41
  currentIteration = tracked.currentIteration;
@@ -52,7 +53,7 @@ const keepTime = constructor => {
52
53
  /** @type {Tickable} */(tracked)._startTime = startTime;
53
54
  }
54
55
  return cleanup || consts.noop;
55
- }
56
+ }));
56
57
  };
57
58
 
58
59
  exports.keepTime = keepTime;
@@ -1,5 +1,5 @@
1
1
  export function sync(callback?: Callback<Timer>): Timer;
2
- export function keepTime(constructor: (...args: any[]) => Tickable | ((...args: any[]) => void) | void): (...args: any[]) => Tickable | ((...args: any[]) => void);
2
+ export function keepTime<T extends Tickable | ((...args: any[]) => void) | void>(constructor: (...args: any[]) => T): (...args: any[]) => T extends void ? () => void : T;
3
3
  import { Timer } from '../timer/timer.js';
4
4
  import type { Callback } from '../types/index.js';
5
5
  import type { Tickable } from '../types/index.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -26,13 +26,14 @@ const sync = (callback = noop) => {
26
26
  };
27
27
 
28
28
  /**
29
- * @param {(...args: any[]) => Tickable | ((...args: any[]) => void) | void} constructor
30
- * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
29
+ * @template {Tickable | ((...args: any[]) => void) | void} T
30
+ * @param {(...args: any[]) => T} constructor
31
+ * @return {(...args: any[]) => T extends void ? () => void : T}
31
32
  */
32
33
  const keepTime = constructor => {
33
34
  /** @type {Tickable} */
34
35
  let tracked;
35
- return (...args) => {
36
+ return /** @type {(...args: any[]) => T extends void ? () => void : T} */(/** @type {*} */((...args) => {
36
37
  let currentIteration, currentIterationProgress, reversed, alternate, startTime;
37
38
  if (tracked) {
38
39
  currentIteration = tracked.currentIteration;
@@ -50,7 +51,7 @@ const keepTime = constructor => {
50
51
  /** @type {Tickable} */(tracked)._startTime = startTime;
51
52
  }
52
53
  return cleanup || noop;
53
- }
54
+ }));
54
55
  };
55
56
 
56
57
  export { keepTime, sync };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.4.0
3
+ * @version v4.5.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - Julian Garnier
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "animejs",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "JavaScript animation engine",
5
5
  "homepage": "https://animejs.com",
6
6
  "author": "Julian Garnier <julian@animejs.com>",
@@ -36,12 +36,17 @@
36
36
  "SVG",
37
37
  "WAAPI",
38
38
  "Canvas",
39
- "WebGL"
39
+ "WebGL",
40
+ "treejs",
41
+ "tree.js"
40
42
  ],
41
43
  "files": [
42
44
  "dist"
43
45
  ],
44
- "sideEffects": false,
46
+ "sideEffects": [
47
+ "./dist/modules/adapters/**",
48
+ "./src/adapters/**"
49
+ ],
45
50
  "type": "module",
46
51
  "main": "./dist/modules/index.cjs",
47
52
  "module": "./dist/modules/index.js",
@@ -175,6 +180,30 @@
175
180
  "require": "./dist/modules/waapi/index.cjs",
176
181
  "import": "./dist/modules/waapi/index.js",
177
182
  "default": "./dist/modules/waapi/index.cjs"
183
+ },
184
+ "./adapters": {
185
+ "types": "./dist/modules/adapters/index.d.ts",
186
+ "require": "./dist/modules/adapters/index.cjs",
187
+ "import": "./dist/modules/adapters/index.js",
188
+ "default": "./dist/modules/adapters/index.cjs"
189
+ },
190
+ "./adapters/three": {
191
+ "types": "./dist/modules/adapters/three/index.d.ts",
192
+ "require": "./dist/modules/adapters/three/index.cjs",
193
+ "import": "./dist/modules/adapters/three/index.js",
194
+ "default": "./dist/modules/adapters/three/index.cjs"
195
+ }
196
+ },
197
+ "peerDependencies": {
198
+ "three": ">=0.150.0",
199
+ "@types/three": ">=0.150.0"
200
+ },
201
+ "peerDependenciesMeta": {
202
+ "three": {
203
+ "optional": true
204
+ },
205
+ "@types/three": {
206
+ "optional": true
178
207
  }
179
208
  },
180
209
  "devDependencies": {
@@ -186,7 +215,8 @@
186
215
  "mocha": "^10.2.0",
187
216
  "nodemon": "^3.1.10",
188
217
  "rollup": "^4.9.1",
189
- "three": "^0.160.0",
218
+ "three": "^0.184.0",
219
+ "@types/three": "^0.184.0",
190
220
  "tweaks": "^0.3.4",
191
221
  "typescript": "^5.9.2"
192
222
  },
@@ -196,6 +226,9 @@
196
226
  "build": "rm -rf dist && build=true rollup -c && tsc -p tsconfig.types.json && echo '\\n\\033[32m✓ build completed\\n\\033[0m'",
197
227
  "test:browser": "browser-sync start --startPath tests/index.html --server --files 'dist/modules/**/*.js' 'tests/suites/**/*.js' --no-notify --directory",
198
228
  "test:node": "node --allow-natives-syntax \"node_modules/.bin/mocha\" -u tdd --timeout 20000 \"./tests/suites/node.test.js\"",
199
- "open:examples": "browser-sync start --startPath examples --server --no-notify --directory --files '**/*.js'"
229
+ "open:examples": "browser-sync start --startPath examples --server --no-notify --directory --files '**/*.js'",
230
+ "typecheck": "tsc -p . && tsc -p tests && tsc -p examples",
231
+ "typecheck:examples": "tsc -p examples",
232
+ "typecheck:tests": "tsc -p tests"
200
233
  }
201
234
  }