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.
- package/dist/bundles/anime.esm.js +98 -47
- package/dist/bundles/anime.esm.min.js +2 -2
- package/dist/bundles/anime.umd.js +98 -47
- package/dist/bundles/anime.umd.min.js +2 -2
- package/dist/modules/animatable/animatable.cjs +2 -2
- package/dist/modules/animatable/animatable.js +2 -2
- 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 +7 -3
- package/dist/modules/animation/animation.d.ts +8 -3
- package/dist/modules/animation/animation.js +7 -3
- package/dist/modules/animation/composition.cjs +1 -1
- package/dist/modules/animation/composition.js +1 -1
- package/dist/modules/animation/index.cjs +1 -1
- package/dist/modules/animation/index.js +1 -1
- package/dist/modules/core/clock.cjs +1 -1
- package/dist/modules/core/clock.js +1 -1
- package/dist/modules/core/colors.cjs +1 -1
- package/dist/modules/core/colors.js +1 -1
- package/dist/modules/core/consts.cjs +1 -1
- package/dist/modules/core/consts.js +1 -1
- package/dist/modules/core/globals.cjs +2 -2
- package/dist/modules/core/globals.js +2 -2
- package/dist/modules/core/helpers.cjs +1 -1
- package/dist/modules/core/helpers.js +1 -1
- package/dist/modules/core/render.cjs +1 -1
- package/dist/modules/core/render.js +1 -1
- package/dist/modules/core/styles.cjs +1 -1
- package/dist/modules/core/styles.js +1 -1
- package/dist/modules/core/targets.cjs +1 -1
- package/dist/modules/core/targets.js +1 -1
- 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 +1 -1
- package/dist/modules/core/values.js +1 -1
- package/dist/modules/draggable/draggable.cjs +17 -4
- package/dist/modules/draggable/draggable.d.ts +2 -0
- package/dist/modules/draggable/draggable.js +18 -5
- 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 +1 -1
- package/dist/modules/easings/eases/parser.js +1 -1
- 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 +1 -1
- package/dist/modules/engine/engine.js +1 -1
- 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 +7 -3
- package/dist/modules/events/scroll.d.ts +2 -0
- package/dist/modules/events/scroll.js +7 -3
- package/dist/modules/index.cjs +1 -1
- package/dist/modules/index.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 +12 -2
- package/dist/modules/svg/morphto.js +12 -2
- package/dist/modules/svg/motionpath.cjs +18 -11
- package/dist/modules/svg/motionpath.d.ts +1 -1
- package/dist/modules/svg/motionpath.js +18 -11
- package/dist/modules/text/index.cjs +1 -1
- package/dist/modules/text/index.js +1 -1
- package/dist/modules/text/split.cjs +1 -1
- package/dist/modules/text/split.js +1 -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 +9 -5
- package/dist/modules/timeline/timeline.d.ts +8 -3
- package/dist/modules/timeline/timeline.js +9 -5
- package/dist/modules/timer/index.cjs +1 -1
- package/dist/modules/timer/index.js +1 -1
- package/dist/modules/timer/timer.cjs +17 -14
- package/dist/modules/timer/timer.d.ts +12 -7
- package/dist/modules/timer/timer.js +17 -14
- package/dist/modules/types/index.d.ts +7 -3
- 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 +1 -1
- package/dist/modules/utils/random.js +1 -1
- package/dist/modules/utils/stagger.cjs +1 -1
- package/dist/modules/utils/stagger.js +1 -1
- package/dist/modules/utils/target.cjs +1 -1
- package/dist/modules/utils/target.js +1 -1
- package/dist/modules/utils/time.cjs +1 -1
- package/dist/modules/utils/time.js +1 -1
- 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 +8 -5
- package/dist/modules/waapi/waapi.d.ts +8 -5
- package/dist/modules/waapi/waapi.js +8 -5
- package/package.json +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.2.
|
|
3
|
+
* @version v4.2.1
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -65,7 +65,7 @@ const globals = {
|
|
|
65
65
|
tickThreshold: 200,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
const globalVersions = { version: '4.2.
|
|
68
|
+
const globalVersions = { version: '4.2.1', engine: null };
|
|
69
69
|
|
|
70
70
|
if (consts.isBrowser) {
|
|
71
71
|
if (!consts.win.AnimeJS) consts.win.AnimeJS = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - ESM
|
|
3
|
-
* @version v4.2.
|
|
3
|
+
* @version v4.2.1
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -63,7 +63,7 @@ const globals = {
|
|
|
63
63
|
tickThreshold: 200,
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const globalVersions = { version: '4.2.
|
|
66
|
+
const globalVersions = { version: '4.2.1', engine: null };
|
|
67
67
|
|
|
68
68
|
if (isBrowser) {
|
|
69
69
|
if (!win.AnimeJS) win.AnimeJS = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - draggable - CJS
|
|
3
|
-
* @version v4.2.
|
|
3
|
+
* @version v4.2.1
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -26,6 +26,7 @@ var target = require('../utils/target.cjs');
|
|
|
26
26
|
* DOMTarget,
|
|
27
27
|
* DOMTargetSelector,
|
|
28
28
|
* DraggableCursorParams,
|
|
29
|
+
* DraggableDragThresholdParams,
|
|
29
30
|
* TargetsParam,
|
|
30
31
|
* DraggableParams,
|
|
31
32
|
* EasingFunction,
|
|
@@ -156,7 +157,7 @@ class Transforms {
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
/**
|
|
159
|
-
* @template {Array<Number>|DOMTargetSelector|String|Number|Boolean|Function|DraggableCursorParams} T
|
|
160
|
+
* @template {Array<Number>|DOMTargetSelector|String|Number|Boolean|Function|DraggableCursorParams|DraggableDragThresholdParams} T
|
|
160
161
|
* @param {T | ((draggable: Draggable) => T)} value
|
|
161
162
|
* @param {Draggable} draggable
|
|
162
163
|
* @return {T}
|
|
@@ -210,6 +211,8 @@ class Draggable {
|
|
|
210
211
|
/** @type {Number} */
|
|
211
212
|
this.dragSpeed = 0;
|
|
212
213
|
/** @type {Number} */
|
|
214
|
+
this.dragThreshold = 3;
|
|
215
|
+
/** @type {Number} */
|
|
213
216
|
this.maxVelocity = 0;
|
|
214
217
|
/** @type {Number} */
|
|
215
218
|
this.minVelocity = 0;
|
|
@@ -627,6 +630,16 @@ class Draggable {
|
|
|
627
630
|
if (onHover) cursorStyles.onHover = onHover;
|
|
628
631
|
if (onGrab) cursorStyles.onGrab = onGrab;
|
|
629
632
|
}
|
|
633
|
+
const parsedDragThreshold = parseDraggableFunctionParameter(params.dragThreshold, this);
|
|
634
|
+
const dragThreshold = { mouse: 3, touch: 7 };
|
|
635
|
+
if (helpers.isNum(parsedDragThreshold)) {
|
|
636
|
+
dragThreshold.mouse = parsedDragThreshold;
|
|
637
|
+
dragThreshold.touch = parsedDragThreshold;
|
|
638
|
+
} else if (parsedDragThreshold) {
|
|
639
|
+
const { mouse, touch } = parsedDragThreshold;
|
|
640
|
+
if (!helpers.isUnd(mouse)) dragThreshold.mouse = mouse;
|
|
641
|
+
if (!helpers.isUnd(touch)) dragThreshold.touch = touch;
|
|
642
|
+
}
|
|
630
643
|
this.containerArray = helpers.isArr(container) ? container : null;
|
|
631
644
|
this.$container = /** @type {HTMLElement} */(container && !this.containerArray ? targets.parseTargets(/** @type {DOMTarget} */(container))[0] : consts.doc.body);
|
|
632
645
|
this.useWin = this.$container === consts.doc.body;
|
|
@@ -641,6 +654,7 @@ class Draggable {
|
|
|
641
654
|
this.scrollSpeed = values.setValue(parseDraggableFunctionParameter(params.scrollSpeed, this), 1.5);
|
|
642
655
|
this.scrollThreshold = values.setValue(parseDraggableFunctionParameter(params.scrollThreshold, this), 20);
|
|
643
656
|
this.dragSpeed = values.setValue(parseDraggableFunctionParameter(params.dragSpeed, this), 1);
|
|
657
|
+
this.dragThreshold = this.isFinePointer ? dragThreshold.mouse : dragThreshold.touch;
|
|
644
658
|
this.minVelocity = values.setValue(parseDraggableFunctionParameter(params.minVelocity, this), 0);
|
|
645
659
|
this.maxVelocity = values.setValue(parseDraggableFunctionParameter(params.maxVelocity, this), 50);
|
|
646
660
|
this.velocityMultiplier = values.setValue(parseDraggableFunctionParameter(params.velocityMultiplier, this), 1);
|
|
@@ -942,8 +956,7 @@ class Draggable {
|
|
|
942
956
|
this.$trigger.addEventListener('touchend', preventDefault);
|
|
943
957
|
|
|
944
958
|
// Don't check for a miminim distance move if already dragging
|
|
945
|
-
if (this.dragged || (!this.disabled[0] && helpers.abs(movedX) >
|
|
946
|
-
|
|
959
|
+
if (this.dragged || (!this.disabled[0] && helpers.abs(movedX) > this.dragThreshold) || (!this.disabled[1] && helpers.abs(movedY) > this.dragThreshold)) {
|
|
947
960
|
this.updateTicker.resume();
|
|
948
961
|
this.pointer[2] = this.pointer[0];
|
|
949
962
|
this.pointer[3] = this.pointer[1];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - draggable - ESM
|
|
3
|
-
* @version v4.2.
|
|
3
|
+
* @version v4.2.1
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { globals, scope } from '../core/globals.js';
|
|
9
9
|
import { doc, win, noop, maxValue, compositionTypes } from '../core/consts.js';
|
|
10
10
|
import { parseTargets } from '../core/targets.js';
|
|
11
|
-
import { isUnd, isObj, isArr, now, atan2, round, max, snap, clamp, abs, sqrt, cos, sin, isFnc } from '../core/helpers.js';
|
|
11
|
+
import { isUnd, isObj, isArr, now, atan2, round, max, snap, clamp, isNum, abs, sqrt, cos, sin, isFnc } from '../core/helpers.js';
|
|
12
12
|
import { setValue } from '../core/values.js';
|
|
13
13
|
import { mapRange } from '../utils/number.js';
|
|
14
14
|
import { Timer } from '../timer/timer.js';
|
|
@@ -24,6 +24,7 @@ import { get, set } from '../utils/target.js';
|
|
|
24
24
|
* DOMTarget,
|
|
25
25
|
* DOMTargetSelector,
|
|
26
26
|
* DraggableCursorParams,
|
|
27
|
+
* DraggableDragThresholdParams,
|
|
27
28
|
* TargetsParam,
|
|
28
29
|
* DraggableParams,
|
|
29
30
|
* EasingFunction,
|
|
@@ -154,7 +155,7 @@ class Transforms {
|
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
|
-
* @template {Array<Number>|DOMTargetSelector|String|Number|Boolean|Function|DraggableCursorParams} T
|
|
158
|
+
* @template {Array<Number>|DOMTargetSelector|String|Number|Boolean|Function|DraggableCursorParams|DraggableDragThresholdParams} T
|
|
158
159
|
* @param {T | ((draggable: Draggable) => T)} value
|
|
159
160
|
* @param {Draggable} draggable
|
|
160
161
|
* @return {T}
|
|
@@ -208,6 +209,8 @@ class Draggable {
|
|
|
208
209
|
/** @type {Number} */
|
|
209
210
|
this.dragSpeed = 0;
|
|
210
211
|
/** @type {Number} */
|
|
212
|
+
this.dragThreshold = 3;
|
|
213
|
+
/** @type {Number} */
|
|
211
214
|
this.maxVelocity = 0;
|
|
212
215
|
/** @type {Number} */
|
|
213
216
|
this.minVelocity = 0;
|
|
@@ -625,6 +628,16 @@ class Draggable {
|
|
|
625
628
|
if (onHover) cursorStyles.onHover = onHover;
|
|
626
629
|
if (onGrab) cursorStyles.onGrab = onGrab;
|
|
627
630
|
}
|
|
631
|
+
const parsedDragThreshold = parseDraggableFunctionParameter(params.dragThreshold, this);
|
|
632
|
+
const dragThreshold = { mouse: 3, touch: 7 };
|
|
633
|
+
if (isNum(parsedDragThreshold)) {
|
|
634
|
+
dragThreshold.mouse = parsedDragThreshold;
|
|
635
|
+
dragThreshold.touch = parsedDragThreshold;
|
|
636
|
+
} else if (parsedDragThreshold) {
|
|
637
|
+
const { mouse, touch } = parsedDragThreshold;
|
|
638
|
+
if (!isUnd(mouse)) dragThreshold.mouse = mouse;
|
|
639
|
+
if (!isUnd(touch)) dragThreshold.touch = touch;
|
|
640
|
+
}
|
|
628
641
|
this.containerArray = isArr(container) ? container : null;
|
|
629
642
|
this.$container = /** @type {HTMLElement} */(container && !this.containerArray ? parseTargets(/** @type {DOMTarget} */(container))[0] : doc.body);
|
|
630
643
|
this.useWin = this.$container === doc.body;
|
|
@@ -639,6 +652,7 @@ class Draggable {
|
|
|
639
652
|
this.scrollSpeed = setValue(parseDraggableFunctionParameter(params.scrollSpeed, this), 1.5);
|
|
640
653
|
this.scrollThreshold = setValue(parseDraggableFunctionParameter(params.scrollThreshold, this), 20);
|
|
641
654
|
this.dragSpeed = setValue(parseDraggableFunctionParameter(params.dragSpeed, this), 1);
|
|
655
|
+
this.dragThreshold = this.isFinePointer ? dragThreshold.mouse : dragThreshold.touch;
|
|
642
656
|
this.minVelocity = setValue(parseDraggableFunctionParameter(params.minVelocity, this), 0);
|
|
643
657
|
this.maxVelocity = setValue(parseDraggableFunctionParameter(params.maxVelocity, this), 50);
|
|
644
658
|
this.velocityMultiplier = setValue(parseDraggableFunctionParameter(params.velocityMultiplier, this), 1);
|
|
@@ -940,8 +954,7 @@ class Draggable {
|
|
|
940
954
|
this.$trigger.addEventListener('touchend', preventDefault);
|
|
941
955
|
|
|
942
956
|
// Don't check for a miminim distance move if already dragging
|
|
943
|
-
if (this.dragged || (!this.disabled[0] && abs(movedX) >
|
|
944
|
-
|
|
957
|
+
if (this.dragged || (!this.disabled[0] && abs(movedX) > this.dragThreshold) || (!this.disabled[1] && abs(movedY) > this.dragThreshold)) {
|
|
945
958
|
this.updateTicker.resume();
|
|
946
959
|
this.pointer[2] = this.pointer[0];
|
|
947
960
|
this.pointer[3] = this.pointer[1];
|