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.
- package/README.md +4 -5
- package/dist/bundles/anime.esm.js +491 -272
- package/dist/bundles/anime.esm.min.js +2 -2
- package/dist/bundles/anime.umd.js +491 -272
- package/dist/bundles/anime.umd.min.js +2 -2
- package/dist/modules/adapters/index.cjs +14 -0
- package/dist/modules/adapters/index.d.ts +1 -0
- package/dist/modules/adapters/index.js +8 -0
- package/dist/modules/adapters/registry.cjs +149 -0
- package/dist/modules/adapters/registry.d.ts +65 -0
- package/dist/modules/adapters/registry.js +146 -0
- package/dist/modules/adapters/three/adapter.cjs +26 -0
- package/dist/modules/adapters/three/adapter.d.ts +15 -0
- package/dist/modules/adapters/three/adapter.js +24 -0
- package/dist/modules/adapters/three/helpers.cjs +297 -0
- package/dist/modules/adapters/three/helpers.d.ts +89 -0
- package/dist/modules/adapters/three/helpers.js +280 -0
- package/dist/modules/adapters/three/index.cjs +20 -0
- package/dist/modules/adapters/three/index.d.ts +2 -0
- package/dist/modules/adapters/three/index.js +12 -0
- package/dist/modules/adapters/three/instance.cjs +368 -0
- package/dist/modules/adapters/three/instance.d.ts +133 -0
- package/dist/modules/adapters/three/instance.js +365 -0
- package/dist/modules/adapters/three/object3d.cjs +214 -0
- package/dist/modules/adapters/three/object3d.d.ts +1 -0
- package/dist/modules/adapters/three/object3d.js +212 -0
- package/dist/modules/adapters/three/resolvers.cjs +105 -0
- package/dist/modules/adapters/three/resolvers.d.ts +1 -0
- package/dist/modules/adapters/three/resolvers.js +103 -0
- package/dist/modules/adapters/three/uniform.cjs +41 -0
- package/dist/modules/adapters/three/uniform.d.ts +1 -0
- package/dist/modules/adapters/three/uniform.js +39 -0
- package/dist/modules/animatable/animatable.cjs +2 -1
- package/dist/modules/animatable/animatable.d.ts +2 -1
- package/dist/modules/animatable/animatable.js +2 -1
- package/dist/modules/animatable/index.cjs +1 -1
- package/dist/modules/animatable/index.js +1 -1
- package/dist/modules/animation/additive.cjs +1 -1
- package/dist/modules/animation/additive.js +1 -1
- package/dist/modules/animation/animation.cjs +43 -16
- package/dist/modules/animation/animation.d.ts +5 -0
- package/dist/modules/animation/animation.js +45 -18
- package/dist/modules/animation/composition.cjs +38 -35
- package/dist/modules/animation/composition.js +38 -35
- package/dist/modules/animation/index.cjs +1 -1
- package/dist/modules/animation/index.js +1 -1
- package/dist/modules/core/clock.cjs +11 -15
- package/dist/modules/core/clock.d.ts +0 -2
- package/dist/modules/core/clock.js +11 -15
- package/dist/modules/core/colors.cjs +1 -1
- package/dist/modules/core/colors.js +1 -1
- package/dist/modules/core/consts.cjs +15 -1
- package/dist/modules/core/consts.d.ts +2 -0
- package/dist/modules/core/consts.js +14 -2
- package/dist/modules/core/globals.cjs +7 -4
- package/dist/modules/core/globals.d.ts +8 -2
- package/dist/modules/core/globals.js +8 -5
- package/dist/modules/core/helpers.cjs +2 -2
- package/dist/modules/core/helpers.js +3 -3
- package/dist/modules/core/render.cjs +93 -73
- package/dist/modules/core/render.js +96 -76
- package/dist/modules/core/styles.cjs +16 -2
- package/dist/modules/core/styles.js +16 -2
- package/dist/modules/core/targets.cjs +11 -13
- package/dist/modules/core/targets.js +11 -13
- package/dist/modules/core/transforms.cjs +1 -1
- package/dist/modules/core/transforms.js +1 -1
- package/dist/modules/core/units.cjs +1 -1
- package/dist/modules/core/units.js +1 -1
- package/dist/modules/core/values.cjs +73 -82
- package/dist/modules/core/values.d.ts +1 -2
- package/dist/modules/core/values.js +76 -84
- package/dist/modules/draggable/draggable.cjs +1 -1
- package/dist/modules/draggable/draggable.js +1 -1
- package/dist/modules/draggable/index.cjs +1 -1
- package/dist/modules/draggable/index.js +1 -1
- package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
- package/dist/modules/easings/cubic-bezier/index.js +1 -1
- package/dist/modules/easings/eases/index.cjs +1 -1
- package/dist/modules/easings/eases/index.js +1 -1
- package/dist/modules/easings/eases/parser.cjs +3 -3
- package/dist/modules/easings/eases/parser.d.ts +4 -5
- package/dist/modules/easings/eases/parser.js +3 -3
- package/dist/modules/easings/index.cjs +1 -1
- package/dist/modules/easings/index.js +1 -1
- package/dist/modules/easings/irregular/index.cjs +1 -1
- package/dist/modules/easings/irregular/index.js +1 -1
- package/dist/modules/easings/linear/index.cjs +1 -1
- package/dist/modules/easings/linear/index.js +1 -1
- package/dist/modules/easings/none.cjs +1 -1
- package/dist/modules/easings/none.js +1 -1
- package/dist/modules/easings/spring/index.cjs +1 -1
- package/dist/modules/easings/spring/index.js +1 -1
- package/dist/modules/easings/steps/index.cjs +1 -1
- package/dist/modules/easings/steps/index.js +1 -1
- package/dist/modules/engine/engine.cjs +4 -2
- package/dist/modules/engine/engine.js +4 -2
- package/dist/modules/engine/index.cjs +1 -1
- package/dist/modules/engine/index.js +1 -1
- package/dist/modules/events/index.cjs +1 -1
- package/dist/modules/events/index.js +1 -1
- package/dist/modules/events/scroll.cjs +3 -1
- package/dist/modules/events/scroll.js +3 -1
- package/dist/modules/index.cjs +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/layout/index.cjs +1 -1
- package/dist/modules/layout/index.js +1 -1
- package/dist/modules/layout/layout.cjs +1 -1
- package/dist/modules/layout/layout.js +1 -1
- package/dist/modules/scope/index.cjs +1 -1
- package/dist/modules/scope/index.js +1 -1
- package/dist/modules/scope/scope.cjs +1 -1
- package/dist/modules/scope/scope.js +1 -1
- package/dist/modules/svg/drawable.cjs +1 -1
- package/dist/modules/svg/drawable.js +1 -1
- package/dist/modules/svg/helpers.cjs +1 -1
- package/dist/modules/svg/helpers.js +1 -1
- package/dist/modules/svg/index.cjs +1 -1
- package/dist/modules/svg/index.js +1 -1
- package/dist/modules/svg/morphto.cjs +1 -1
- package/dist/modules/svg/morphto.js +1 -1
- package/dist/modules/svg/motionpath.cjs +1 -1
- package/dist/modules/svg/motionpath.js +1 -1
- package/dist/modules/text/index.cjs +1 -1
- package/dist/modules/text/index.js +1 -1
- package/dist/modules/text/scramble.cjs +12 -2
- package/dist/modules/text/scramble.d.ts +9 -1
- package/dist/modules/text/scramble.js +12 -2
- package/dist/modules/text/split.cjs +2 -1
- package/dist/modules/text/split.js +2 -1
- package/dist/modules/timeline/index.cjs +1 -1
- package/dist/modules/timeline/index.js +1 -1
- package/dist/modules/timeline/position.cjs +1 -1
- package/dist/modules/timeline/position.js +1 -1
- package/dist/modules/timeline/timeline.cjs +14 -5
- package/dist/modules/timeline/timeline.d.ts +3 -3
- package/dist/modules/timeline/timeline.js +14 -5
- package/dist/modules/timer/index.cjs +1 -1
- package/dist/modules/timer/index.js +1 -1
- package/dist/modules/timer/timer.cjs +1 -1
- package/dist/modules/timer/timer.js +1 -1
- package/dist/modules/types/index.d.ts +36 -11
- package/dist/modules/utils/chainable.cjs +1 -1
- package/dist/modules/utils/chainable.js +1 -1
- package/dist/modules/utils/index.cjs +1 -1
- package/dist/modules/utils/index.js +1 -1
- package/dist/modules/utils/number.cjs +1 -1
- package/dist/modules/utils/number.js +1 -1
- package/dist/modules/utils/random.cjs +4 -3
- package/dist/modules/utils/random.d.ts +1 -1
- package/dist/modules/utils/random.js +4 -3
- package/dist/modules/utils/stagger.cjs +67 -13
- package/dist/modules/utils/stagger.js +69 -15
- package/dist/modules/utils/target.cjs +4 -1
- package/dist/modules/utils/target.js +4 -1
- package/dist/modules/utils/time.cjs +6 -5
- package/dist/modules/utils/time.d.ts +1 -1
- package/dist/modules/utils/time.js +6 -5
- package/dist/modules/waapi/composition.cjs +1 -1
- package/dist/modules/waapi/composition.js +1 -1
- package/dist/modules/waapi/index.cjs +1 -1
- package/dist/modules/waapi/index.js +1 -1
- package/dist/modules/waapi/waapi.cjs +1 -1
- package/dist/modules/waapi/waapi.js +1 -1
- package/package.json +38 -5
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - utils - ESM
|
|
3
|
-
* @version v4.
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
* @
|
|
32
|
-
* @
|
|
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
|
|
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.
|
|
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
|
-
* @
|
|
30
|
-
* @
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "animejs",
|
|
3
|
-
"version": "4.
|
|
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":
|
|
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.
|
|
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
|
}
|