animejs 4.1.4 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -8
- package/{lib → dist/bundles}/anime.esm.js +6476 -6106
- package/dist/bundles/anime.esm.min.js +7 -0
- package/dist/bundles/anime.umd.js +8809 -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 +667 -0
- package/dist/modules/animation/animation.d.ts +45 -0
- package/dist/modules/animation/animation.js +664 -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 +159 -0
- package/dist/modules/core/consts.d.ts +61 -0
- package/dist/modules/core/consts.js +124 -0
- package/dist/modules/core/globals.cjs +78 -0
- package/dist/modules/core/globals.d.ts +29 -0
- package/dist/modules/core/globals.js +73 -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 +391 -0
- package/dist/modules/core/render.d.ts +4 -0
- package/dist/modules/core/render.js +388 -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 +226 -0
- package/dist/modules/core/values.d.ts +14 -0
- package/dist/modules/core/values.js +216 -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/index.cjs +64 -0
- package/dist/modules/easings/cubic-bezier/index.d.ts +2 -0
- package/dist/modules/easings/cubic-bezier/index.js +62 -0
- package/dist/modules/easings/eases/index.cjs +14 -0
- package/dist/modules/easings/eases/index.d.ts +1 -0
- package/dist/modules/easings/eases/index.js +8 -0
- package/dist/modules/easings/eases/parser.cjs +191 -0
- package/dist/modules/easings/eases/parser.d.ts +125 -0
- package/dist/modules/easings/eases/parser.js +185 -0
- package/dist/modules/easings/index.cjs +26 -0
- package/dist/modules/easings/index.d.ts +6 -0
- package/dist/modules/easings/index.js +13 -0
- package/dist/modules/easings/irregular/index.cjs +41 -0
- package/dist/modules/easings/irregular/index.d.ts +2 -0
- package/dist/modules/easings/irregular/index.js +39 -0
- package/dist/modules/easings/linear/index.cjs +59 -0
- package/dist/modules/easings/linear/index.d.ts +2 -0
- package/dist/modules/easings/linear/index.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/spring/index.cjs +255 -0
- package/dist/modules/easings/spring/index.d.ts +53 -0
- package/dist/modules/easings/spring/index.js +251 -0
- package/dist/modules/easings/steps/index.cjs +30 -0
- package/dist/modules/easings/steps/index.d.ts +2 -0
- package/dist/modules/easings/steps/index.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 +940 -0
- package/dist/modules/events/scroll.d.ts +191 -0
- package/dist/modules/events/scroll.js +936 -0
- package/dist/modules/index.cjs +102 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +41 -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/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 +404 -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 +95 -0
- package/dist/modules/waapi/composition.d.ts +4 -0
- package/dist/modules/waapi/composition.js +92 -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 +492 -0
- package/dist/modules/waapi/waapi.d.ts +116 -0
- package/dist/modules/waapi/waapi.js +489 -0
- package/package.json +166 -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 -1127
- package/types/index.js +0 -7395
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - svg - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { morphPointsSymbol } from '../core/consts.js';
|
|
9
|
+
import { round } from '../core/helpers.js';
|
|
10
|
+
import { getPath } from './helpers.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {
|
|
14
|
+
* TargetsParam,
|
|
15
|
+
* FunctionValue
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {TargetsParam} path2
|
|
21
|
+
* @param {Number} [precision]
|
|
22
|
+
* @return {FunctionValue}
|
|
23
|
+
*/
|
|
24
|
+
const morphTo = (path2, precision = .33) => ($path1) => {
|
|
25
|
+
const $path2 = /** @type {SVGGeometryElement} */(getPath(path2));
|
|
26
|
+
if (!$path2) return;
|
|
27
|
+
const isPath = $path1.tagName === 'path';
|
|
28
|
+
const separator = isPath ? ' ' : ',';
|
|
29
|
+
const previousPoints = $path1[morphPointsSymbol];
|
|
30
|
+
if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);
|
|
31
|
+
|
|
32
|
+
let v1 = '', v2 = '';
|
|
33
|
+
|
|
34
|
+
if (!precision) {
|
|
35
|
+
v1 = $path1.getAttribute(isPath ? 'd' : 'points');
|
|
36
|
+
v2 = $path2.getAttribute(isPath ? 'd' : 'points');
|
|
37
|
+
} else {
|
|
38
|
+
const length1 = /** @type {SVGGeometryElement} */($path1).getTotalLength();
|
|
39
|
+
const length2 = $path2.getTotalLength();
|
|
40
|
+
const maxPoints = Math.max(Math.ceil(length1 * precision), Math.ceil(length2 * precision));
|
|
41
|
+
for (let i = 0; i < maxPoints; i++) {
|
|
42
|
+
const t = i / (maxPoints - 1);
|
|
43
|
+
const pointOnPath1 = /** @type {SVGGeometryElement} */($path1).getPointAtLength(length1 * t);
|
|
44
|
+
const pointOnPath2 = $path2.getPointAtLength(length2 * t);
|
|
45
|
+
const prefix = isPath ? (i === 0 ? 'M' : 'L') : '';
|
|
46
|
+
v1 += prefix + round(pointOnPath1.x, 3) + separator + pointOnPath1.y + ' ';
|
|
47
|
+
v2 += prefix + round(pointOnPath2.x, 3) + separator + pointOnPath2.y + ' ';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
$path1[morphPointsSymbol] = v2;
|
|
52
|
+
|
|
53
|
+
return [v1, v2];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { morphTo };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - svg - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var consts = require('../core/consts.cjs');
|
|
11
|
+
var helpers$1 = require('../core/helpers.cjs');
|
|
12
|
+
var helpers = require('./helpers.cjs');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @import {
|
|
16
|
+
* TargetsParam,
|
|
17
|
+
* FunctionValue,
|
|
18
|
+
* TweenObjectValue,
|
|
19
|
+
* TweenModifier,
|
|
20
|
+
* } from '../types/index.js'
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// Motion path animation
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {SVGGeometryElement} $path
|
|
27
|
+
* @param {Number} progress
|
|
28
|
+
* @param {Number}lookup
|
|
29
|
+
* @return {DOMPoint}
|
|
30
|
+
*/
|
|
31
|
+
const getPathPoint = ($path, progress, lookup = 0) => {
|
|
32
|
+
return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {SVGGeometryElement} $path
|
|
37
|
+
* @param {String} pathProperty
|
|
38
|
+
* @return {FunctionValue}
|
|
39
|
+
*/
|
|
40
|
+
const getPathProgess = ($path, pathProperty) => {
|
|
41
|
+
return $el => {
|
|
42
|
+
const totalLength = +($path.getTotalLength());
|
|
43
|
+
const inSvg = $el[consts.isSvgSymbol];
|
|
44
|
+
const ctm = $path.getCTM();
|
|
45
|
+
/** @type {TweenObjectValue} */
|
|
46
|
+
return {
|
|
47
|
+
from: 0,
|
|
48
|
+
to: totalLength,
|
|
49
|
+
/** @type {TweenModifier} */
|
|
50
|
+
modifier: progress => {
|
|
51
|
+
if (pathProperty === 'a') {
|
|
52
|
+
const p0 = getPathPoint($path, progress, -1);
|
|
53
|
+
const p1 = getPathPoint($path, progress, 1);
|
|
54
|
+
return helpers$1.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / helpers$1.PI;
|
|
55
|
+
} else {
|
|
56
|
+
const p = getPathPoint($path, progress, 0);
|
|
57
|
+
return pathProperty === 'x' ?
|
|
58
|
+
inSvg || !ctm ? p.x : p.x * ctm.a + p.y * ctm.c + ctm.e :
|
|
59
|
+
inSvg || !ctm ? p.y : p.x * ctm.b + p.y * ctm.d + ctm.f
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {TargetsParam} path
|
|
68
|
+
*/
|
|
69
|
+
const createMotionPath = path => {
|
|
70
|
+
const $path = helpers.getPath(path);
|
|
71
|
+
if (!$path) return;
|
|
72
|
+
return {
|
|
73
|
+
translateX: getPathProgess($path, 'x'),
|
|
74
|
+
translateY: getPathProgess($path, 'y'),
|
|
75
|
+
rotate: getPathProgess($path, 'a'),
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.createMotionPath = createMotionPath;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - svg - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { isSvgSymbol } from '../core/consts.js';
|
|
9
|
+
import { atan2, PI } from '../core/helpers.js';
|
|
10
|
+
import { getPath } from './helpers.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {
|
|
14
|
+
* TargetsParam,
|
|
15
|
+
* FunctionValue,
|
|
16
|
+
* TweenObjectValue,
|
|
17
|
+
* TweenModifier,
|
|
18
|
+
* } from '../types/index.js'
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// Motion path animation
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {SVGGeometryElement} $path
|
|
25
|
+
* @param {Number} progress
|
|
26
|
+
* @param {Number}lookup
|
|
27
|
+
* @return {DOMPoint}
|
|
28
|
+
*/
|
|
29
|
+
const getPathPoint = ($path, progress, lookup = 0) => {
|
|
30
|
+
return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {SVGGeometryElement} $path
|
|
35
|
+
* @param {String} pathProperty
|
|
36
|
+
* @return {FunctionValue}
|
|
37
|
+
*/
|
|
38
|
+
const getPathProgess = ($path, pathProperty) => {
|
|
39
|
+
return $el => {
|
|
40
|
+
const totalLength = +($path.getTotalLength());
|
|
41
|
+
const inSvg = $el[isSvgSymbol];
|
|
42
|
+
const ctm = $path.getCTM();
|
|
43
|
+
/** @type {TweenObjectValue} */
|
|
44
|
+
return {
|
|
45
|
+
from: 0,
|
|
46
|
+
to: totalLength,
|
|
47
|
+
/** @type {TweenModifier} */
|
|
48
|
+
modifier: progress => {
|
|
49
|
+
if (pathProperty === 'a') {
|
|
50
|
+
const p0 = getPathPoint($path, progress, -1);
|
|
51
|
+
const p1 = getPathPoint($path, progress, 1);
|
|
52
|
+
return atan2(p1.y - p0.y, p1.x - p0.x) * 180 / PI;
|
|
53
|
+
} else {
|
|
54
|
+
const p = getPathPoint($path, progress, 0);
|
|
55
|
+
return pathProperty === 'x' ?
|
|
56
|
+
inSvg || !ctm ? p.x : p.x * ctm.a + p.y * ctm.c + ctm.e :
|
|
57
|
+
inSvg || !ctm ? p.y : p.x * ctm.b + p.y * ctm.d + ctm.f
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {TargetsParam} path
|
|
66
|
+
*/
|
|
67
|
+
const createMotionPath = path => {
|
|
68
|
+
const $path = getPath(path);
|
|
69
|
+
if (!$path) return;
|
|
70
|
+
return {
|
|
71
|
+
translateX: getPathProgess($path, 'x'),
|
|
72
|
+
translateY: getPathProgess($path, 'y'),
|
|
73
|
+
rotate: getPathProgess($path, 'a'),
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { createMotionPath };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - text - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var split = require('./split.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.TextSplitter = split.TextSplitter;
|
|
15
|
+
exports.split = split.split;
|
|
16
|
+
exports.splitText = split.splitText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./split.js";
|