animejs 4.1.3 → 4.2.0-beta.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 +12 -8
- package/{lib → dist/bundles}/anime.esm.js +5237 -5049
- package/dist/bundles/anime.esm.min.js +7 -0
- package/dist/bundles/anime.umd.js +8621 -0
- package/dist/bundles/anime.umd.min.js +7 -0
- package/dist/modules/animatable/animatable.cjs +150 -0
- package/dist/modules/animatable/animatable.d.ts +28 -0
- package/dist/modules/animatable/animatable.js +147 -0
- package/dist/modules/animatable/index.cjs +15 -0
- package/dist/modules/animatable/index.d.ts +1 -0
- package/dist/modules/animatable/index.js +8 -0
- package/dist/modules/animation/additive.cjs +82 -0
- package/dist/modules/animation/additive.d.ts +15 -0
- package/dist/modules/animation/additive.js +79 -0
- package/dist/modules/animation/animation.cjs +660 -0
- package/dist/modules/animation/animation.d.ts +47 -0
- package/dist/modules/animation/animation.js +657 -0
- package/dist/modules/animation/composition.cjs +383 -0
- package/dist/modules/animation/composition.d.ts +10 -0
- package/dist/modules/animation/composition.js +377 -0
- package/dist/modules/animation/index.cjs +15 -0
- package/dist/modules/animation/index.d.ts +1 -0
- package/dist/modules/animation/index.js +8 -0
- package/dist/modules/core/clock.cjs +110 -0
- package/dist/modules/core/clock.d.ts +51 -0
- package/dist/modules/core/clock.js +108 -0
- package/dist/modules/core/colors.cjs +102 -0
- package/dist/modules/core/colors.d.ts +2 -0
- package/dist/modules/core/colors.js +100 -0
- package/dist/modules/core/consts.cjs +154 -0
- package/dist/modules/core/consts.d.ts +59 -0
- package/dist/modules/core/consts.js +121 -0
- package/dist/modules/core/globals.cjs +77 -0
- package/dist/modules/core/globals.d.ts +29 -0
- package/dist/modules/core/globals.js +72 -0
- package/dist/modules/core/helpers.cjs +304 -0
- package/dist/modules/core/helpers.d.ts +43 -0
- package/dist/modules/core/helpers.js +261 -0
- package/dist/modules/core/render.cjs +389 -0
- package/dist/modules/core/render.d.ts +4 -0
- package/dist/modules/core/render.js +386 -0
- package/dist/modules/core/styles.cjs +116 -0
- package/dist/modules/core/styles.d.ts +5 -0
- package/dist/modules/core/styles.js +113 -0
- package/dist/modules/core/targets.cjs +136 -0
- package/dist/modules/core/targets.d.ts +118 -0
- package/dist/modules/core/targets.js +132 -0
- package/dist/modules/core/transforms.cjs +49 -0
- package/dist/modules/core/transforms.d.ts +2 -0
- package/dist/modules/core/transforms.js +47 -0
- package/dist/modules/core/units.cjs +67 -0
- package/dist/modules/core/units.d.ts +3 -0
- package/dist/modules/core/units.js +65 -0
- package/dist/modules/core/values.cjs +215 -0
- package/dist/modules/core/values.d.ts +14 -0
- package/dist/modules/core/values.js +205 -0
- package/dist/modules/draggable/draggable.cjs +1226 -0
- package/dist/modules/draggable/draggable.d.ts +272 -0
- package/dist/modules/draggable/draggable.js +1223 -0
- package/dist/modules/draggable/index.cjs +15 -0
- package/dist/modules/draggable/index.d.ts +1 -0
- package/dist/modules/draggable/index.js +8 -0
- package/dist/modules/easings/cubic-bezier.cjs +64 -0
- package/dist/modules/easings/cubic-bezier.d.ts +2 -0
- package/dist/modules/easings/cubic-bezier.js +62 -0
- package/dist/modules/easings/eases.cjs +149 -0
- package/dist/modules/easings/eases.d.ts +111 -0
- package/dist/modules/easings/eases.js +146 -0
- package/dist/modules/easings/index.cjs +24 -0
- package/dist/modules/easings/index.d.ts +6 -0
- package/dist/modules/easings/index.js +13 -0
- package/dist/modules/easings/irregular.cjs +41 -0
- package/dist/modules/easings/irregular.d.ts +2 -0
- package/dist/modules/easings/irregular.js +39 -0
- package/dist/modules/easings/linear.cjs +59 -0
- package/dist/modules/easings/linear.d.ts +2 -0
- package/dist/modules/easings/linear.js +57 -0
- package/dist/modules/easings/none.cjs +19 -0
- package/dist/modules/easings/none.d.ts +8 -0
- package/dist/modules/easings/none.js +17 -0
- package/dist/modules/easings/parser.cjs +59 -0
- package/dist/modules/easings/parser.d.ts +21 -0
- package/dist/modules/easings/parser.js +55 -0
- package/dist/modules/easings/steps.cjs +30 -0
- package/dist/modules/easings/steps.d.ts +2 -0
- package/dist/modules/easings/steps.js +28 -0
- package/dist/modules/engine/engine.cjs +168 -0
- package/dist/modules/engine/engine.d.ts +21 -0
- package/dist/modules/engine/engine.js +166 -0
- package/dist/modules/engine/index.cjs +14 -0
- package/dist/modules/engine/index.d.ts +1 -0
- package/dist/modules/engine/index.js +8 -0
- package/dist/modules/events/index.cjs +16 -0
- package/dist/modules/events/index.d.ts +1 -0
- package/dist/modules/events/index.js +8 -0
- package/dist/modules/events/scroll.cjs +936 -0
- package/dist/modules/events/scroll.d.ts +189 -0
- package/dist/modules/events/scroll.js +932 -0
- package/dist/modules/index.cjs +103 -0
- package/dist/modules/index.d.ts +19 -0
- package/dist/modules/index.js +42 -0
- package/dist/modules/scope/index.cjs +15 -0
- package/dist/modules/scope/index.d.ts +1 -0
- package/dist/modules/scope/index.js +8 -0
- package/dist/modules/scope/scope.cjs +254 -0
- package/dist/modules/scope/scope.d.ts +115 -0
- package/dist/modules/scope/scope.js +251 -0
- package/dist/modules/spring/index.cjs +15 -0
- package/dist/modules/spring/index.d.ts +1 -0
- package/dist/modules/spring/index.js +8 -0
- package/dist/modules/spring/spring.cjs +133 -0
- package/dist/modules/spring/spring.d.ts +37 -0
- package/dist/modules/spring/spring.js +130 -0
- package/dist/modules/svg/drawable.cjs +119 -0
- package/dist/modules/svg/drawable.d.ts +3 -0
- package/dist/modules/svg/drawable.js +117 -0
- package/dist/modules/svg/helpers.cjs +30 -0
- package/dist/modules/svg/helpers.d.ts +2 -0
- package/dist/modules/svg/helpers.js +28 -0
- package/dist/modules/svg/index.cjs +18 -0
- package/dist/modules/svg/index.d.ts +3 -0
- package/dist/modules/svg/index.js +10 -0
- package/dist/modules/svg/morphto.cjs +58 -0
- package/dist/modules/svg/morphto.d.ts +3 -0
- package/dist/modules/svg/morphto.js +56 -0
- package/dist/modules/svg/motionpath.cjs +79 -0
- package/dist/modules/svg/motionpath.d.ts +7 -0
- package/dist/modules/svg/motionpath.js +77 -0
- package/dist/modules/text/index.cjs +16 -0
- package/dist/modules/text/index.d.ts +1 -0
- package/dist/modules/text/index.js +8 -0
- package/dist/modules/text/split.cjs +488 -0
- package/dist/modules/text/split.d.ts +62 -0
- package/dist/modules/text/split.js +484 -0
- package/dist/modules/timeline/index.cjs +15 -0
- package/dist/modules/timeline/index.d.ts +1 -0
- package/dist/modules/timeline/index.js +8 -0
- package/dist/modules/timeline/position.cjs +72 -0
- package/dist/modules/timeline/position.d.ts +3 -0
- package/dist/modules/timeline/position.js +70 -0
- package/dist/modules/timeline/timeline.cjs +312 -0
- package/dist/modules/timeline/timeline.d.ts +163 -0
- package/dist/modules/timeline/timeline.js +309 -0
- package/dist/modules/timer/index.cjs +15 -0
- package/dist/modules/timer/index.d.ts +1 -0
- package/dist/modules/timer/index.js +8 -0
- package/dist/modules/timer/timer.cjs +491 -0
- package/dist/modules/timer/timer.d.ts +141 -0
- package/dist/modules/timer/timer.js +488 -0
- package/dist/modules/types/index.d.ts +387 -0
- package/dist/modules/utils/chainable.cjs +190 -0
- package/dist/modules/utils/chainable.d.ts +135 -0
- package/dist/modules/utils/chainable.js +177 -0
- package/dist/modules/utils/index.cjs +43 -0
- package/dist/modules/utils/index.d.ts +5 -0
- package/dist/modules/utils/index.js +14 -0
- package/dist/modules/utils/number.cjs +97 -0
- package/dist/modules/utils/number.d.ts +9 -0
- package/dist/modules/utils/number.js +85 -0
- package/dist/modules/utils/random.cjs +77 -0
- package/dist/modules/utils/random.d.ts +22 -0
- package/dist/modules/utils/random.js +72 -0
- package/dist/modules/utils/stagger.cjs +122 -0
- package/dist/modules/utils/stagger.d.ts +30 -0
- package/dist/modules/utils/stagger.js +120 -0
- package/dist/modules/utils/target.cjs +130 -0
- package/dist/modules/utils/target.d.ts +126 -0
- package/dist/modules/utils/target.js +125 -0
- package/dist/modules/utils/time.cjs +57 -0
- package/dist/modules/utils/time.d.ts +5 -0
- package/dist/modules/utils/time.js +54 -0
- package/dist/modules/waapi/composition.cjs +89 -0
- package/dist/modules/waapi/composition.d.ts +4 -0
- package/dist/modules/waapi/composition.js +86 -0
- package/dist/modules/waapi/index.cjs +15 -0
- package/dist/modules/waapi/index.d.ts +1 -0
- package/dist/modules/waapi/index.js +8 -0
- package/dist/modules/waapi/waapi.cjs +473 -0
- package/dist/modules/waapi/waapi.d.ts +114 -0
- package/dist/modules/waapi/waapi.js +470 -0
- package/package.json +130 -33
- package/lib/anime.cjs +0 -9
- package/lib/anime.esm.min.js +0 -9
- package/lib/anime.iife.js +0 -9
- package/lib/anime.iife.min.js +0 -9
- package/lib/anime.min.cjs +0 -9
- package/lib/anime.umd.js +0 -9
- package/lib/anime.umd.min.js +0 -9
- package/lib/gui/index.js +0 -6341
- package/types/index.d.ts +0 -1126
- package/types/index.js +0 -7388
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var consts = require('./consts.cjs');
|
|
11
|
+
var helpers = require('./helpers.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @import {
|
|
15
|
+
* ColorArray,
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* RGB / RGBA Color value string -> RGBA values array
|
|
21
|
+
* @param {String} rgbValue
|
|
22
|
+
* @return {ColorArray}
|
|
23
|
+
*/
|
|
24
|
+
const rgbToRgba = rgbValue => {
|
|
25
|
+
const rgba = consts.rgbExecRgx.exec(rgbValue) || consts.rgbaExecRgx.exec(rgbValue);
|
|
26
|
+
const a = !helpers.isUnd(rgba[4]) ? +rgba[4] : 1;
|
|
27
|
+
return [
|
|
28
|
+
+rgba[1],
|
|
29
|
+
+rgba[2],
|
|
30
|
+
+rgba[3],
|
|
31
|
+
a
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* HEX3 / HEX3A / HEX6 / HEX6A Color value string -> RGBA values array
|
|
37
|
+
* @param {String} hexValue
|
|
38
|
+
* @return {ColorArray}
|
|
39
|
+
*/
|
|
40
|
+
const hexToRgba = hexValue => {
|
|
41
|
+
const hexLength = hexValue.length;
|
|
42
|
+
const isShort = hexLength === 4 || hexLength === 5;
|
|
43
|
+
return [
|
|
44
|
+
+('0x' + hexValue[1] + hexValue[isShort ? 1 : 2]),
|
|
45
|
+
+('0x' + hexValue[isShort ? 2 : 3] + hexValue[isShort ? 2 : 4]),
|
|
46
|
+
+('0x' + hexValue[isShort ? 3 : 5] + hexValue[isShort ? 3 : 6]),
|
|
47
|
+
((hexLength === 5 || hexLength === 9) ? +(+('0x' + hexValue[isShort ? 4 : 7] + hexValue[isShort ? 4 : 8]) / 255).toFixed(3) : 1)
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {Number} p
|
|
53
|
+
* @param {Number} q
|
|
54
|
+
* @param {Number} t
|
|
55
|
+
* @return {Number}
|
|
56
|
+
*/
|
|
57
|
+
const hue2rgb = (p, q, t) => {
|
|
58
|
+
if (t < 0) t += 1;
|
|
59
|
+
if (t > 1) t -= 1;
|
|
60
|
+
return t < 1 / 6 ? p + (q - p) * 6 * t :
|
|
61
|
+
t < 1 / 2 ? q :
|
|
62
|
+
t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 :
|
|
63
|
+
p;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* HSL / HSLA Color value string -> RGBA values array
|
|
68
|
+
* @param {String} hslValue
|
|
69
|
+
* @return {ColorArray}
|
|
70
|
+
*/
|
|
71
|
+
const hslToRgba = hslValue => {
|
|
72
|
+
const hsla = consts.hslExecRgx.exec(hslValue) || consts.hslaExecRgx.exec(hslValue);
|
|
73
|
+
const h = +hsla[1] / 360;
|
|
74
|
+
const s = +hsla[2] / 100;
|
|
75
|
+
const l = +hsla[3] / 100;
|
|
76
|
+
const a = !helpers.isUnd(hsla[4]) ? +hsla[4] : 1;
|
|
77
|
+
let r, g, b;
|
|
78
|
+
if (s === 0) {
|
|
79
|
+
r = g = b = l;
|
|
80
|
+
} else {
|
|
81
|
+
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
82
|
+
const p = 2 * l - q;
|
|
83
|
+
r = helpers.round(hue2rgb(p, q, h + 1 / 3) * 255, 0);
|
|
84
|
+
g = helpers.round(hue2rgb(p, q, h) * 255, 0);
|
|
85
|
+
b = helpers.round(hue2rgb(p, q, h - 1 / 3) * 255, 0);
|
|
86
|
+
}
|
|
87
|
+
return [r, g, b, a];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* All in one color converter that converts a color string value into an array of RGBA values
|
|
92
|
+
* @param {String} colorString
|
|
93
|
+
* @return {ColorArray}
|
|
94
|
+
*/
|
|
95
|
+
const convertColorStringValuesToRgbaArray = colorString => {
|
|
96
|
+
return helpers.isRgb(colorString) ? rgbToRgba(colorString) :
|
|
97
|
+
helpers.isHex(colorString) ? hexToRgba(colorString) :
|
|
98
|
+
helpers.isHsl(colorString) ? hslToRgba(colorString) :
|
|
99
|
+
[0, 0, 0, 1];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.convertColorStringValuesToRgbaArray = convertColorStringValuesToRgbaArray;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { rgbExecRgx, rgbaExecRgx, hslExecRgx, hslaExecRgx } from './consts.js';
|
|
9
|
+
import { isRgb, isHex, isHsl, isUnd, round } from './helpers.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @import {
|
|
13
|
+
* ColorArray,
|
|
14
|
+
* } from '../types/index.js'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* RGB / RGBA Color value string -> RGBA values array
|
|
19
|
+
* @param {String} rgbValue
|
|
20
|
+
* @return {ColorArray}
|
|
21
|
+
*/
|
|
22
|
+
const rgbToRgba = rgbValue => {
|
|
23
|
+
const rgba = rgbExecRgx.exec(rgbValue) || rgbaExecRgx.exec(rgbValue);
|
|
24
|
+
const a = !isUnd(rgba[4]) ? +rgba[4] : 1;
|
|
25
|
+
return [
|
|
26
|
+
+rgba[1],
|
|
27
|
+
+rgba[2],
|
|
28
|
+
+rgba[3],
|
|
29
|
+
a
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* HEX3 / HEX3A / HEX6 / HEX6A Color value string -> RGBA values array
|
|
35
|
+
* @param {String} hexValue
|
|
36
|
+
* @return {ColorArray}
|
|
37
|
+
*/
|
|
38
|
+
const hexToRgba = hexValue => {
|
|
39
|
+
const hexLength = hexValue.length;
|
|
40
|
+
const isShort = hexLength === 4 || hexLength === 5;
|
|
41
|
+
return [
|
|
42
|
+
+('0x' + hexValue[1] + hexValue[isShort ? 1 : 2]),
|
|
43
|
+
+('0x' + hexValue[isShort ? 2 : 3] + hexValue[isShort ? 2 : 4]),
|
|
44
|
+
+('0x' + hexValue[isShort ? 3 : 5] + hexValue[isShort ? 3 : 6]),
|
|
45
|
+
((hexLength === 5 || hexLength === 9) ? +(+('0x' + hexValue[isShort ? 4 : 7] + hexValue[isShort ? 4 : 8]) / 255).toFixed(3) : 1)
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {Number} p
|
|
51
|
+
* @param {Number} q
|
|
52
|
+
* @param {Number} t
|
|
53
|
+
* @return {Number}
|
|
54
|
+
*/
|
|
55
|
+
const hue2rgb = (p, q, t) => {
|
|
56
|
+
if (t < 0) t += 1;
|
|
57
|
+
if (t > 1) t -= 1;
|
|
58
|
+
return t < 1 / 6 ? p + (q - p) * 6 * t :
|
|
59
|
+
t < 1 / 2 ? q :
|
|
60
|
+
t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 :
|
|
61
|
+
p;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* HSL / HSLA Color value string -> RGBA values array
|
|
66
|
+
* @param {String} hslValue
|
|
67
|
+
* @return {ColorArray}
|
|
68
|
+
*/
|
|
69
|
+
const hslToRgba = hslValue => {
|
|
70
|
+
const hsla = hslExecRgx.exec(hslValue) || hslaExecRgx.exec(hslValue);
|
|
71
|
+
const h = +hsla[1] / 360;
|
|
72
|
+
const s = +hsla[2] / 100;
|
|
73
|
+
const l = +hsla[3] / 100;
|
|
74
|
+
const a = !isUnd(hsla[4]) ? +hsla[4] : 1;
|
|
75
|
+
let r, g, b;
|
|
76
|
+
if (s === 0) {
|
|
77
|
+
r = g = b = l;
|
|
78
|
+
} else {
|
|
79
|
+
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
80
|
+
const p = 2 * l - q;
|
|
81
|
+
r = round(hue2rgb(p, q, h + 1 / 3) * 255, 0);
|
|
82
|
+
g = round(hue2rgb(p, q, h) * 255, 0);
|
|
83
|
+
b = round(hue2rgb(p, q, h - 1 / 3) * 255, 0);
|
|
84
|
+
}
|
|
85
|
+
return [r, g, b, a];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* All in one color converter that converts a color string value into an array of RGBA values
|
|
90
|
+
* @param {String} colorString
|
|
91
|
+
* @return {ColorArray}
|
|
92
|
+
*/
|
|
93
|
+
const convertColorStringValuesToRgbaArray = colorString => {
|
|
94
|
+
return isRgb(colorString) ? rgbToRgba(colorString) :
|
|
95
|
+
isHex(colorString) ? hexToRgba(colorString) :
|
|
96
|
+
isHsl(colorString) ? hslToRgba(colorString) :
|
|
97
|
+
[0, 0, 0, 1];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { convertColorStringValuesToRgbaArray };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
// Environments
|
|
11
|
+
|
|
12
|
+
// TODO: Do we need to check if we're running inside a worker ?
|
|
13
|
+
const isBrowser = typeof window !== 'undefined';
|
|
14
|
+
|
|
15
|
+
/** @type {Window & {AnimeJS: Array}|null} */
|
|
16
|
+
const win = isBrowser ? /** @type {Window & {AnimeJS: Array}} */(/** @type {unknown} */(window)) : null;
|
|
17
|
+
|
|
18
|
+
/** @type {Document|null} */
|
|
19
|
+
const doc = isBrowser ? document : null;
|
|
20
|
+
|
|
21
|
+
// Enums
|
|
22
|
+
|
|
23
|
+
/** @enum {Number} */
|
|
24
|
+
const tweenTypes = {
|
|
25
|
+
OBJECT: 0,
|
|
26
|
+
ATTRIBUTE: 1,
|
|
27
|
+
CSS: 2,
|
|
28
|
+
TRANSFORM: 3,
|
|
29
|
+
CSS_VAR: 4,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @enum {Number} */
|
|
33
|
+
const valueTypes = {
|
|
34
|
+
NUMBER: 0,
|
|
35
|
+
UNIT: 1,
|
|
36
|
+
COLOR: 2,
|
|
37
|
+
COMPLEX: 3,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @enum {Number} */
|
|
41
|
+
const tickModes = {
|
|
42
|
+
NONE: 0,
|
|
43
|
+
AUTO: 1,
|
|
44
|
+
FORCE: 2,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** @enum {Number} */
|
|
48
|
+
const compositionTypes = {
|
|
49
|
+
replace: 0,
|
|
50
|
+
none: 1,
|
|
51
|
+
blend: 2,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Cache symbols
|
|
55
|
+
|
|
56
|
+
const isRegisteredTargetSymbol = Symbol();
|
|
57
|
+
const isDomSymbol = Symbol();
|
|
58
|
+
const isSvgSymbol = Symbol();
|
|
59
|
+
const transformsSymbol = Symbol();
|
|
60
|
+
const morphPointsSymbol = Symbol();
|
|
61
|
+
const proxyTargetSymbol = Symbol();
|
|
62
|
+
|
|
63
|
+
// Numbers
|
|
64
|
+
|
|
65
|
+
const minValue = 1e-11;
|
|
66
|
+
const maxValue = 1e12;
|
|
67
|
+
const K = 1e3;
|
|
68
|
+
const maxFps = 120;
|
|
69
|
+
|
|
70
|
+
// Strings
|
|
71
|
+
|
|
72
|
+
const emptyString = '';
|
|
73
|
+
const shortTransforms = /*#__PURE__*/ (() => {
|
|
74
|
+
const map = new Map();
|
|
75
|
+
map.set('x', 'translateX');
|
|
76
|
+
map.set('y', 'translateY');
|
|
77
|
+
map.set('z', 'translateZ');
|
|
78
|
+
return map;
|
|
79
|
+
})();
|
|
80
|
+
|
|
81
|
+
const validTransforms = [
|
|
82
|
+
'translateX',
|
|
83
|
+
'translateY',
|
|
84
|
+
'translateZ',
|
|
85
|
+
'rotate',
|
|
86
|
+
'rotateX',
|
|
87
|
+
'rotateY',
|
|
88
|
+
'rotateZ',
|
|
89
|
+
'scale',
|
|
90
|
+
'scaleX',
|
|
91
|
+
'scaleY',
|
|
92
|
+
'scaleZ',
|
|
93
|
+
'skew',
|
|
94
|
+
'skewX',
|
|
95
|
+
'skewY',
|
|
96
|
+
'perspective',
|
|
97
|
+
'matrix',
|
|
98
|
+
'matrix3d',
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
|
|
102
|
+
|
|
103
|
+
// Functions
|
|
104
|
+
|
|
105
|
+
/** @return {void} */
|
|
106
|
+
const noop = () => {};
|
|
107
|
+
|
|
108
|
+
// Regex
|
|
109
|
+
|
|
110
|
+
const hexTestRgx = /(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;
|
|
111
|
+
const rgbExecRgx = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;
|
|
112
|
+
const rgbaExecRgx = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
|
|
113
|
+
const hslExecRgx = /hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;
|
|
114
|
+
const hslaExecRgx = /hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
|
|
115
|
+
// export const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g;
|
|
116
|
+
const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;
|
|
117
|
+
// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;
|
|
118
|
+
const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;
|
|
119
|
+
const lowerCaseRgx = /([a-z])([A-Z])/g;
|
|
120
|
+
const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()
|
|
121
|
+
const relativeValuesExecRgx = /(\*=|\+=|-=)/;
|
|
122
|
+
|
|
123
|
+
exports.K = K;
|
|
124
|
+
exports.compositionTypes = compositionTypes;
|
|
125
|
+
exports.digitWithExponentRgx = digitWithExponentRgx;
|
|
126
|
+
exports.doc = doc;
|
|
127
|
+
exports.emptyString = emptyString;
|
|
128
|
+
exports.hexTestRgx = hexTestRgx;
|
|
129
|
+
exports.hslExecRgx = hslExecRgx;
|
|
130
|
+
exports.hslaExecRgx = hslaExecRgx;
|
|
131
|
+
exports.isBrowser = isBrowser;
|
|
132
|
+
exports.isDomSymbol = isDomSymbol;
|
|
133
|
+
exports.isRegisteredTargetSymbol = isRegisteredTargetSymbol;
|
|
134
|
+
exports.isSvgSymbol = isSvgSymbol;
|
|
135
|
+
exports.lowerCaseRgx = lowerCaseRgx;
|
|
136
|
+
exports.maxFps = maxFps;
|
|
137
|
+
exports.maxValue = maxValue;
|
|
138
|
+
exports.minValue = minValue;
|
|
139
|
+
exports.morphPointsSymbol = morphPointsSymbol;
|
|
140
|
+
exports.noop = noop;
|
|
141
|
+
exports.proxyTargetSymbol = proxyTargetSymbol;
|
|
142
|
+
exports.relativeValuesExecRgx = relativeValuesExecRgx;
|
|
143
|
+
exports.rgbExecRgx = rgbExecRgx;
|
|
144
|
+
exports.rgbaExecRgx = rgbaExecRgx;
|
|
145
|
+
exports.shortTransforms = shortTransforms;
|
|
146
|
+
exports.tickModes = tickModes;
|
|
147
|
+
exports.transformsExecRgx = transformsExecRgx;
|
|
148
|
+
exports.transformsFragmentStrings = transformsFragmentStrings;
|
|
149
|
+
exports.transformsSymbol = transformsSymbol;
|
|
150
|
+
exports.tweenTypes = tweenTypes;
|
|
151
|
+
exports.unitsExecRgx = unitsExecRgx;
|
|
152
|
+
exports.validTransforms = validTransforms;
|
|
153
|
+
exports.valueTypes = valueTypes;
|
|
154
|
+
exports.win = win;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const isBrowser: boolean;
|
|
2
|
+
/** @type {Window & {AnimeJS: Array}|null} */
|
|
3
|
+
export const win: (Window & {
|
|
4
|
+
AnimeJS: any[];
|
|
5
|
+
}) | null;
|
|
6
|
+
/** @type {Document|null} */
|
|
7
|
+
export const doc: Document | null;
|
|
8
|
+
export type tweenTypes = number;
|
|
9
|
+
export namespace tweenTypes {
|
|
10
|
+
let OBJECT: number;
|
|
11
|
+
let ATTRIBUTE: number;
|
|
12
|
+
let CSS: number;
|
|
13
|
+
let TRANSFORM: number;
|
|
14
|
+
let CSS_VAR: number;
|
|
15
|
+
}
|
|
16
|
+
export type valueTypes = number;
|
|
17
|
+
export namespace valueTypes {
|
|
18
|
+
let NUMBER: number;
|
|
19
|
+
let UNIT: number;
|
|
20
|
+
let COLOR: number;
|
|
21
|
+
let COMPLEX: number;
|
|
22
|
+
}
|
|
23
|
+
export type tickModes = number;
|
|
24
|
+
export namespace tickModes {
|
|
25
|
+
let NONE: number;
|
|
26
|
+
let AUTO: number;
|
|
27
|
+
let FORCE: number;
|
|
28
|
+
}
|
|
29
|
+
export type compositionTypes = number;
|
|
30
|
+
export namespace compositionTypes {
|
|
31
|
+
let replace: number;
|
|
32
|
+
let none: number;
|
|
33
|
+
let blend: number;
|
|
34
|
+
}
|
|
35
|
+
export const isRegisteredTargetSymbol: unique symbol;
|
|
36
|
+
export const isDomSymbol: unique symbol;
|
|
37
|
+
export const isSvgSymbol: unique symbol;
|
|
38
|
+
export const transformsSymbol: unique symbol;
|
|
39
|
+
export const morphPointsSymbol: unique symbol;
|
|
40
|
+
export const proxyTargetSymbol: unique symbol;
|
|
41
|
+
export const minValue: 1e-11;
|
|
42
|
+
export const maxValue: 1000000000000;
|
|
43
|
+
export const K: 1000;
|
|
44
|
+
export const maxFps: 120;
|
|
45
|
+
export const emptyString: "";
|
|
46
|
+
export const shortTransforms: Map<any, any>;
|
|
47
|
+
export const validTransforms: string[];
|
|
48
|
+
export const transformsFragmentStrings: {};
|
|
49
|
+
export function noop(): void;
|
|
50
|
+
export const hexTestRgx: RegExp;
|
|
51
|
+
export const rgbExecRgx: RegExp;
|
|
52
|
+
export const rgbaExecRgx: RegExp;
|
|
53
|
+
export const hslExecRgx: RegExp;
|
|
54
|
+
export const hslaExecRgx: RegExp;
|
|
55
|
+
export const digitWithExponentRgx: RegExp;
|
|
56
|
+
export const unitsExecRgx: RegExp;
|
|
57
|
+
export const lowerCaseRgx: RegExp;
|
|
58
|
+
export const transformsExecRgx: RegExp;
|
|
59
|
+
export const relativeValuesExecRgx: RegExp;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Environments
|
|
9
|
+
|
|
10
|
+
// TODO: Do we need to check if we're running inside a worker ?
|
|
11
|
+
const isBrowser = typeof window !== 'undefined';
|
|
12
|
+
|
|
13
|
+
/** @type {Window & {AnimeJS: Array}|null} */
|
|
14
|
+
const win = isBrowser ? /** @type {Window & {AnimeJS: Array}} */(/** @type {unknown} */(window)) : null;
|
|
15
|
+
|
|
16
|
+
/** @type {Document|null} */
|
|
17
|
+
const doc = isBrowser ? document : null;
|
|
18
|
+
|
|
19
|
+
// Enums
|
|
20
|
+
|
|
21
|
+
/** @enum {Number} */
|
|
22
|
+
const tweenTypes = {
|
|
23
|
+
OBJECT: 0,
|
|
24
|
+
ATTRIBUTE: 1,
|
|
25
|
+
CSS: 2,
|
|
26
|
+
TRANSFORM: 3,
|
|
27
|
+
CSS_VAR: 4,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @enum {Number} */
|
|
31
|
+
const valueTypes = {
|
|
32
|
+
NUMBER: 0,
|
|
33
|
+
UNIT: 1,
|
|
34
|
+
COLOR: 2,
|
|
35
|
+
COMPLEX: 3,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @enum {Number} */
|
|
39
|
+
const tickModes = {
|
|
40
|
+
NONE: 0,
|
|
41
|
+
AUTO: 1,
|
|
42
|
+
FORCE: 2,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @enum {Number} */
|
|
46
|
+
const compositionTypes = {
|
|
47
|
+
replace: 0,
|
|
48
|
+
none: 1,
|
|
49
|
+
blend: 2,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Cache symbols
|
|
53
|
+
|
|
54
|
+
const isRegisteredTargetSymbol = Symbol();
|
|
55
|
+
const isDomSymbol = Symbol();
|
|
56
|
+
const isSvgSymbol = Symbol();
|
|
57
|
+
const transformsSymbol = Symbol();
|
|
58
|
+
const morphPointsSymbol = Symbol();
|
|
59
|
+
const proxyTargetSymbol = Symbol();
|
|
60
|
+
|
|
61
|
+
// Numbers
|
|
62
|
+
|
|
63
|
+
const minValue = 1e-11;
|
|
64
|
+
const maxValue = 1e12;
|
|
65
|
+
const K = 1e3;
|
|
66
|
+
const maxFps = 120;
|
|
67
|
+
|
|
68
|
+
// Strings
|
|
69
|
+
|
|
70
|
+
const emptyString = '';
|
|
71
|
+
const shortTransforms = /*#__PURE__*/ (() => {
|
|
72
|
+
const map = new Map();
|
|
73
|
+
map.set('x', 'translateX');
|
|
74
|
+
map.set('y', 'translateY');
|
|
75
|
+
map.set('z', 'translateZ');
|
|
76
|
+
return map;
|
|
77
|
+
})();
|
|
78
|
+
|
|
79
|
+
const validTransforms = [
|
|
80
|
+
'translateX',
|
|
81
|
+
'translateY',
|
|
82
|
+
'translateZ',
|
|
83
|
+
'rotate',
|
|
84
|
+
'rotateX',
|
|
85
|
+
'rotateY',
|
|
86
|
+
'rotateZ',
|
|
87
|
+
'scale',
|
|
88
|
+
'scaleX',
|
|
89
|
+
'scaleY',
|
|
90
|
+
'scaleZ',
|
|
91
|
+
'skew',
|
|
92
|
+
'skewX',
|
|
93
|
+
'skewY',
|
|
94
|
+
'perspective',
|
|
95
|
+
'matrix',
|
|
96
|
+
'matrix3d',
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
|
|
100
|
+
|
|
101
|
+
// Functions
|
|
102
|
+
|
|
103
|
+
/** @return {void} */
|
|
104
|
+
const noop = () => {};
|
|
105
|
+
|
|
106
|
+
// Regex
|
|
107
|
+
|
|
108
|
+
const hexTestRgx = /(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;
|
|
109
|
+
const rgbExecRgx = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;
|
|
110
|
+
const rgbaExecRgx = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
|
|
111
|
+
const hslExecRgx = /hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;
|
|
112
|
+
const hslaExecRgx = /hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
|
|
113
|
+
// export const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g;
|
|
114
|
+
const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;
|
|
115
|
+
// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;
|
|
116
|
+
const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;
|
|
117
|
+
const lowerCaseRgx = /([a-z])([A-Z])/g;
|
|
118
|
+
const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()
|
|
119
|
+
const relativeValuesExecRgx = /(\*=|\+=|-=)/;
|
|
120
|
+
|
|
121
|
+
export { K, compositionTypes, digitWithExponentRgx, doc, emptyString, hexTestRgx, hslExecRgx, hslaExecRgx, isBrowser, isDomSymbol, isRegisteredTargetSymbol, isSvgSymbol, lowerCaseRgx, maxFps, maxValue, minValue, morphPointsSymbol, noop, proxyTargetSymbol, relativeValuesExecRgx, rgbExecRgx, rgbaExecRgx, shortTransforms, tickModes, transformsExecRgx, transformsFragmentStrings, transformsSymbol, tweenTypes, unitsExecRgx, validTransforms, valueTypes, win };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var consts = require('./consts.cjs');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {
|
|
14
|
+
* DefaultsParams,
|
|
15
|
+
* DOMTarget,
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*
|
|
18
|
+
* @import {
|
|
19
|
+
* Scope,
|
|
20
|
+
* } from '../scope/index.js'
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** @type {DefaultsParams} */
|
|
24
|
+
const defaults = {
|
|
25
|
+
id: null,
|
|
26
|
+
keyframes: null,
|
|
27
|
+
playbackEase: null,
|
|
28
|
+
playbackRate: 1,
|
|
29
|
+
frameRate: consts.maxFps,
|
|
30
|
+
loop: 0,
|
|
31
|
+
reversed: false,
|
|
32
|
+
alternate: false,
|
|
33
|
+
autoplay: true,
|
|
34
|
+
duration: consts.K,
|
|
35
|
+
delay: 0,
|
|
36
|
+
loopDelay: 0,
|
|
37
|
+
ease: 'out(2)',
|
|
38
|
+
composition: consts.compositionTypes.replace,
|
|
39
|
+
modifier: v => v,
|
|
40
|
+
onBegin: consts.noop,
|
|
41
|
+
onBeforeUpdate: consts.noop,
|
|
42
|
+
onUpdate: consts.noop,
|
|
43
|
+
onLoop: consts.noop,
|
|
44
|
+
onPause: consts.noop,
|
|
45
|
+
onComplete: consts.noop,
|
|
46
|
+
onRender: consts.noop,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const scope = {
|
|
50
|
+
/** @type {Scope} */
|
|
51
|
+
current: null,
|
|
52
|
+
/** @type {Document|DOMTarget} */
|
|
53
|
+
root: consts.doc,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const globals = {
|
|
57
|
+
/** @type {DefaultsParams} */
|
|
58
|
+
defaults,
|
|
59
|
+
/** @type {Number} */
|
|
60
|
+
precision: 4,
|
|
61
|
+
/** @type {Number} equals 1 in ms mode, 0.001 in s mode */
|
|
62
|
+
timeScale: 1,
|
|
63
|
+
/** @type {Number} */
|
|
64
|
+
tickThreshold: 200,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const globalVersions = { version: '4.2.0', engine: null };
|
|
68
|
+
|
|
69
|
+
if (consts.isBrowser) {
|
|
70
|
+
if (!consts.win.AnimeJS) consts.win.AnimeJS = [];
|
|
71
|
+
consts.win.AnimeJS.push(globalVersions);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.defaults = defaults;
|
|
75
|
+
exports.globalVersions = globalVersions;
|
|
76
|
+
exports.globals = globals;
|
|
77
|
+
exports.scope = scope;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {
|
|
3
|
+
* DefaultsParams,
|
|
4
|
+
* DOMTarget,
|
|
5
|
+
* } from '../types/index.js'
|
|
6
|
+
*
|
|
7
|
+
* @import {
|
|
8
|
+
* Scope,
|
|
9
|
+
* } from '../scope/index.js'
|
|
10
|
+
*/
|
|
11
|
+
/** @type {DefaultsParams} */
|
|
12
|
+
export const defaults: DefaultsParams;
|
|
13
|
+
export namespace scope {
|
|
14
|
+
export let current: Scope;
|
|
15
|
+
export { doc as root };
|
|
16
|
+
}
|
|
17
|
+
export namespace globals {
|
|
18
|
+
export { defaults };
|
|
19
|
+
export let precision: number;
|
|
20
|
+
export let timeScale: number;
|
|
21
|
+
export let tickThreshold: number;
|
|
22
|
+
}
|
|
23
|
+
export namespace globalVersions {
|
|
24
|
+
let version: string;
|
|
25
|
+
let engine: any;
|
|
26
|
+
}
|
|
27
|
+
import type { DefaultsParams } from '../types/index.js';
|
|
28
|
+
import type { Scope } from '../scope/index.js';
|
|
29
|
+
import { doc } from './consts.js';
|