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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - draggable - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var draggable = require('./draggable.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.Draggable = draggable.Draggable;
|
|
15
|
+
exports.createDraggable = draggable.createDraggable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./draggable.js";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var helpers = require('../core/helpers.cjs');
|
|
11
|
+
var none = require('./none.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @import {
|
|
15
|
+
* EasingFunction,
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Cubic Bezier solver adapted from https://github.com/gre/bezier-easing
|
|
21
|
+
* (c) 2014 Gaëtan Renaudeau
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {Number} aT
|
|
26
|
+
* @param {Number} aA1
|
|
27
|
+
* @param {Number} aA2
|
|
28
|
+
* @return {Number}
|
|
29
|
+
*/
|
|
30
|
+
const calcBezier = (aT, aA1, aA2) => (((1 - 3 * aA2 + 3 * aA1) * aT + (3 * aA2 - 6 * aA1)) * aT + (3 * aA1)) * aT;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {Number} aX
|
|
34
|
+
* @param {Number} mX1
|
|
35
|
+
* @param {Number} mX2
|
|
36
|
+
* @return {Number}
|
|
37
|
+
*/
|
|
38
|
+
const binarySubdivide = (aX, mX1, mX2) => {
|
|
39
|
+
let aA = 0, aB = 1, currentX, currentT, i = 0;
|
|
40
|
+
do {
|
|
41
|
+
currentT = aA + (aB - aA) / 2;
|
|
42
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
43
|
+
if (currentX > 0) {
|
|
44
|
+
aB = currentT;
|
|
45
|
+
} else {
|
|
46
|
+
aA = currentT;
|
|
47
|
+
}
|
|
48
|
+
} while (helpers.abs(currentX) > .0000001 && ++i < 100);
|
|
49
|
+
return currentT;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {Number} [mX1] The x coordinate of the first point
|
|
54
|
+
* @param {Number} [mY1] The y coordinate of the first point
|
|
55
|
+
* @param {Number} [mX2] The x coordinate of the second point
|
|
56
|
+
* @param {Number} [mY2] The y coordinate of the second point
|
|
57
|
+
* @return {EasingFunction}
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
const cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none.none :
|
|
61
|
+
t => t === 0 || t === 1 ? t :
|
|
62
|
+
calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2);
|
|
63
|
+
|
|
64
|
+
exports.cubicBezier = cubicBezier;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { abs } from '../core/helpers.js';
|
|
9
|
+
import { none } from './none.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @import {
|
|
13
|
+
* EasingFunction,
|
|
14
|
+
* } from '../types/index.js'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Cubic Bezier solver adapted from https://github.com/gre/bezier-easing
|
|
19
|
+
* (c) 2014 Gaëtan Renaudeau
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {Number} aT
|
|
24
|
+
* @param {Number} aA1
|
|
25
|
+
* @param {Number} aA2
|
|
26
|
+
* @return {Number}
|
|
27
|
+
*/
|
|
28
|
+
const calcBezier = (aT, aA1, aA2) => (((1 - 3 * aA2 + 3 * aA1) * aT + (3 * aA2 - 6 * aA1)) * aT + (3 * aA1)) * aT;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {Number} aX
|
|
32
|
+
* @param {Number} mX1
|
|
33
|
+
* @param {Number} mX2
|
|
34
|
+
* @return {Number}
|
|
35
|
+
*/
|
|
36
|
+
const binarySubdivide = (aX, mX1, mX2) => {
|
|
37
|
+
let aA = 0, aB = 1, currentX, currentT, i = 0;
|
|
38
|
+
do {
|
|
39
|
+
currentT = aA + (aB - aA) / 2;
|
|
40
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
41
|
+
if (currentX > 0) {
|
|
42
|
+
aB = currentT;
|
|
43
|
+
} else {
|
|
44
|
+
aA = currentT;
|
|
45
|
+
}
|
|
46
|
+
} while (abs(currentX) > .0000001 && ++i < 100);
|
|
47
|
+
return currentT;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Number} [mX1] The x coordinate of the first point
|
|
52
|
+
* @param {Number} [mY1] The y coordinate of the first point
|
|
53
|
+
* @param {Number} [mX2] The x coordinate of the second point
|
|
54
|
+
* @param {Number} [mY2] The y coordinate of the second point
|
|
55
|
+
* @return {EasingFunction}
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
const cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none :
|
|
59
|
+
t => t === 0 || t === 1 ? t :
|
|
60
|
+
calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2);
|
|
61
|
+
|
|
62
|
+
export { cubicBezier };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - 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 = require('../core/helpers.cjs');
|
|
12
|
+
var parser = require('./parser.cjs');
|
|
13
|
+
var none = require('./none.cjs');
|
|
14
|
+
var cubicBezier = require('./cubic-bezier.cjs');
|
|
15
|
+
var steps = require('./steps.cjs');
|
|
16
|
+
var linear = require('./linear.cjs');
|
|
17
|
+
var irregular = require('./irregular.cjs');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @import {
|
|
21
|
+
* EasingFunction,
|
|
22
|
+
* EasingFunctionWithParams,
|
|
23
|
+
* EasingParam,
|
|
24
|
+
* BackEasing,
|
|
25
|
+
* ElasticEasing,
|
|
26
|
+
* PowerEasing,
|
|
27
|
+
* } from '../types/index.js'
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Easing functions adapted and simplified from https://robertpenner.com/easing/
|
|
32
|
+
* (c) 2001 Robert Penner
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const halfPI = helpers.PI / 2;
|
|
36
|
+
const doublePI = helpers.PI * 2;
|
|
37
|
+
|
|
38
|
+
/** @type {Record<String, EasingFunctionWithParams|EasingFunction>} */
|
|
39
|
+
const easeInFunctions = {
|
|
40
|
+
[consts.emptyString]: parser.easeInPower,
|
|
41
|
+
Quad: parser.easeInPower(2),
|
|
42
|
+
Cubic: parser.easeInPower(3),
|
|
43
|
+
Quart: parser.easeInPower(4),
|
|
44
|
+
Quint: parser.easeInPower(5),
|
|
45
|
+
/** @type {EasingFunction} */
|
|
46
|
+
Sine: t => 1 - helpers.cos(t * halfPI),
|
|
47
|
+
/** @type {EasingFunction} */
|
|
48
|
+
Circ: t => 1 - helpers.sqrt(1 - t * t),
|
|
49
|
+
/** @type {EasingFunction} */
|
|
50
|
+
Expo: t => t ? helpers.pow(2, 10 * t - 10) : 0,
|
|
51
|
+
/** @type {EasingFunction} */
|
|
52
|
+
Bounce: t => {
|
|
53
|
+
let pow2, b = 4;
|
|
54
|
+
while (t < ((pow2 = helpers.pow(2, --b)) - 1) / 11);
|
|
55
|
+
return 1 / helpers.pow(4, 3 - b) - 7.5625 * helpers.pow((pow2 * 3 - 2) / 22 - t, 2);
|
|
56
|
+
},
|
|
57
|
+
/** @type {BackEasing} */
|
|
58
|
+
Back: (overshoot = 1.70158) => t => (+overshoot + 1) * t * t * t - +overshoot * t * t,
|
|
59
|
+
/** @type {ElasticEasing} */
|
|
60
|
+
Elastic: (amplitude = 1, period = .3) => {
|
|
61
|
+
const a = helpers.clamp(+amplitude, 1, 10);
|
|
62
|
+
const p = helpers.clamp(+period, consts.minValue, 2);
|
|
63
|
+
const s = (p / doublePI) * helpers.asin(1 / a);
|
|
64
|
+
const e = doublePI / p;
|
|
65
|
+
return t => t === 0 || t === 1 ? t : -a * helpers.pow(2, -10 * (1 - t)) * helpers.sin(((1 - t) - s) * e);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @typedef {Object} EasesFunctions
|
|
71
|
+
* @property {typeof linear} linear
|
|
72
|
+
* @property {typeof irregular} irregular
|
|
73
|
+
* @property {typeof steps} steps
|
|
74
|
+
* @property {typeof cubicBezier} cubicBezier
|
|
75
|
+
* @property {PowerEasing} in
|
|
76
|
+
* @property {PowerEasing} out
|
|
77
|
+
* @property {PowerEasing} inOut
|
|
78
|
+
* @property {PowerEasing} outIn
|
|
79
|
+
* @property {EasingFunction} inQuad
|
|
80
|
+
* @property {EasingFunction} outQuad
|
|
81
|
+
* @property {EasingFunction} inOutQuad
|
|
82
|
+
* @property {EasingFunction} outInQuad
|
|
83
|
+
* @property {EasingFunction} inCubic
|
|
84
|
+
* @property {EasingFunction} outCubic
|
|
85
|
+
* @property {EasingFunction} inOutCubic
|
|
86
|
+
* @property {EasingFunction} outInCubic
|
|
87
|
+
* @property {EasingFunction} inQuart
|
|
88
|
+
* @property {EasingFunction} outQuart
|
|
89
|
+
* @property {EasingFunction} inOutQuart
|
|
90
|
+
* @property {EasingFunction} outInQuart
|
|
91
|
+
* @property {EasingFunction} inQuint
|
|
92
|
+
* @property {EasingFunction} outQuint
|
|
93
|
+
* @property {EasingFunction} inOutQuint
|
|
94
|
+
* @property {EasingFunction} outInQuint
|
|
95
|
+
* @property {EasingFunction} inSine
|
|
96
|
+
* @property {EasingFunction} outSine
|
|
97
|
+
* @property {EasingFunction} inOutSine
|
|
98
|
+
* @property {EasingFunction} outInSine
|
|
99
|
+
* @property {EasingFunction} inCirc
|
|
100
|
+
* @property {EasingFunction} outCirc
|
|
101
|
+
* @property {EasingFunction} inOutCirc
|
|
102
|
+
* @property {EasingFunction} outInCirc
|
|
103
|
+
* @property {EasingFunction} inExpo
|
|
104
|
+
* @property {EasingFunction} outExpo
|
|
105
|
+
* @property {EasingFunction} inOutExpo
|
|
106
|
+
* @property {EasingFunction} outInExpo
|
|
107
|
+
* @property {EasingFunction} inBounce
|
|
108
|
+
* @property {EasingFunction} outBounce
|
|
109
|
+
* @property {EasingFunction} inOutBounce
|
|
110
|
+
* @property {EasingFunction} outInBounce
|
|
111
|
+
* @property {BackEasing} inBack
|
|
112
|
+
* @property {BackEasing} outBack
|
|
113
|
+
* @property {BackEasing} inOutBack
|
|
114
|
+
* @property {BackEasing} outInBack
|
|
115
|
+
* @property {ElasticEasing} inElastic
|
|
116
|
+
* @property {ElasticEasing} outElastic
|
|
117
|
+
* @property {ElasticEasing} inOutElastic
|
|
118
|
+
* @property {ElasticEasing} outInElastic
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
const eases = (/*#__PURE__ */ (() => {
|
|
122
|
+
const list = { linear: linear.linear, irregular: irregular.irregular, steps: steps.steps, cubicBezier: cubicBezier.cubicBezier };
|
|
123
|
+
for (let type in parser.easeTypes) {
|
|
124
|
+
for (let name in easeInFunctions) {
|
|
125
|
+
const easeIn = easeInFunctions[name];
|
|
126
|
+
const easeType = parser.easeTypes[type];
|
|
127
|
+
list[type + name] = /** @type {EasingFunctionWithParams|EasingFunction} */(
|
|
128
|
+
name === consts.emptyString || name === 'Back' || name === 'Elastic' ?
|
|
129
|
+
(a, b) => easeType(/** @type {EasingFunctionWithParams} */(easeIn)(a, b)) :
|
|
130
|
+
easeType(/** @type {EasingFunction} */(easeIn))
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return /** @type {EasesFunctions} */(list);
|
|
135
|
+
})());
|
|
136
|
+
|
|
137
|
+
/** @type {Record<String, EasingFunction>} */
|
|
138
|
+
const JSEasesLookups = { linear: none.none };
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {EasingParam} ease
|
|
142
|
+
* @return {EasingFunction}
|
|
143
|
+
*/
|
|
144
|
+
const parseEase = ease => helpers.isFnc(ease) ? ease :
|
|
145
|
+
helpers.isStr(ease) ? parser.parseEaseString(/** @type {String} */(ease), eases, JSEasesLookups) :
|
|
146
|
+
none.none;
|
|
147
|
+
|
|
148
|
+
exports.eases = eases;
|
|
149
|
+
exports.parseEase = parseEase;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export namespace eases {
|
|
2
|
+
export let linear: typeof import("./linear.js").linear;
|
|
3
|
+
export let irregular: typeof import("./irregular.js").irregular;
|
|
4
|
+
export let steps: typeof import("./steps.js").steps;
|
|
5
|
+
export let cubicBezier: typeof import("./cubic-bezier.js").cubicBezier;
|
|
6
|
+
let _in: PowerEasing;
|
|
7
|
+
export { _in as in };
|
|
8
|
+
export let out: PowerEasing;
|
|
9
|
+
export let inOut: PowerEasing;
|
|
10
|
+
export let outIn: PowerEasing;
|
|
11
|
+
export let inQuad: EasingFunction;
|
|
12
|
+
export let outQuad: EasingFunction;
|
|
13
|
+
export let inOutQuad: EasingFunction;
|
|
14
|
+
export let outInQuad: EasingFunction;
|
|
15
|
+
export let inCubic: EasingFunction;
|
|
16
|
+
export let outCubic: EasingFunction;
|
|
17
|
+
export let inOutCubic: EasingFunction;
|
|
18
|
+
export let outInCubic: EasingFunction;
|
|
19
|
+
export let inQuart: EasingFunction;
|
|
20
|
+
export let outQuart: EasingFunction;
|
|
21
|
+
export let inOutQuart: EasingFunction;
|
|
22
|
+
export let outInQuart: EasingFunction;
|
|
23
|
+
export let inQuint: EasingFunction;
|
|
24
|
+
export let outQuint: EasingFunction;
|
|
25
|
+
export let inOutQuint: EasingFunction;
|
|
26
|
+
export let outInQuint: EasingFunction;
|
|
27
|
+
export let inSine: EasingFunction;
|
|
28
|
+
export let outSine: EasingFunction;
|
|
29
|
+
export let inOutSine: EasingFunction;
|
|
30
|
+
export let outInSine: EasingFunction;
|
|
31
|
+
export let inCirc: EasingFunction;
|
|
32
|
+
export let outCirc: EasingFunction;
|
|
33
|
+
export let inOutCirc: EasingFunction;
|
|
34
|
+
export let outInCirc: EasingFunction;
|
|
35
|
+
export let inExpo: EasingFunction;
|
|
36
|
+
export let outExpo: EasingFunction;
|
|
37
|
+
export let inOutExpo: EasingFunction;
|
|
38
|
+
export let outInExpo: EasingFunction;
|
|
39
|
+
export let inBounce: EasingFunction;
|
|
40
|
+
export let outBounce: EasingFunction;
|
|
41
|
+
export let inOutBounce: EasingFunction;
|
|
42
|
+
export let outInBounce: EasingFunction;
|
|
43
|
+
export let inBack: BackEasing;
|
|
44
|
+
export let outBack: BackEasing;
|
|
45
|
+
export let inOutBack: BackEasing;
|
|
46
|
+
export let outInBack: BackEasing;
|
|
47
|
+
export let inElastic: ElasticEasing;
|
|
48
|
+
export let outElastic: ElasticEasing;
|
|
49
|
+
export let inOutElastic: ElasticEasing;
|
|
50
|
+
export let outInElastic: ElasticEasing;
|
|
51
|
+
}
|
|
52
|
+
export function parseEase(ease: EasingParam): EasingFunction;
|
|
53
|
+
export type EasesFunctions = {
|
|
54
|
+
linear: typeof linear;
|
|
55
|
+
irregular: typeof irregular;
|
|
56
|
+
steps: typeof steps;
|
|
57
|
+
cubicBezier: typeof cubicBezier;
|
|
58
|
+
in: PowerEasing;
|
|
59
|
+
out: PowerEasing;
|
|
60
|
+
inOut: PowerEasing;
|
|
61
|
+
outIn: PowerEasing;
|
|
62
|
+
inQuad: EasingFunction;
|
|
63
|
+
outQuad: EasingFunction;
|
|
64
|
+
inOutQuad: EasingFunction;
|
|
65
|
+
outInQuad: EasingFunction;
|
|
66
|
+
inCubic: EasingFunction;
|
|
67
|
+
outCubic: EasingFunction;
|
|
68
|
+
inOutCubic: EasingFunction;
|
|
69
|
+
outInCubic: EasingFunction;
|
|
70
|
+
inQuart: EasingFunction;
|
|
71
|
+
outQuart: EasingFunction;
|
|
72
|
+
inOutQuart: EasingFunction;
|
|
73
|
+
outInQuart: EasingFunction;
|
|
74
|
+
inQuint: EasingFunction;
|
|
75
|
+
outQuint: EasingFunction;
|
|
76
|
+
inOutQuint: EasingFunction;
|
|
77
|
+
outInQuint: EasingFunction;
|
|
78
|
+
inSine: EasingFunction;
|
|
79
|
+
outSine: EasingFunction;
|
|
80
|
+
inOutSine: EasingFunction;
|
|
81
|
+
outInSine: EasingFunction;
|
|
82
|
+
inCirc: EasingFunction;
|
|
83
|
+
outCirc: EasingFunction;
|
|
84
|
+
inOutCirc: EasingFunction;
|
|
85
|
+
outInCirc: EasingFunction;
|
|
86
|
+
inExpo: EasingFunction;
|
|
87
|
+
outExpo: EasingFunction;
|
|
88
|
+
inOutExpo: EasingFunction;
|
|
89
|
+
outInExpo: EasingFunction;
|
|
90
|
+
inBounce: EasingFunction;
|
|
91
|
+
outBounce: EasingFunction;
|
|
92
|
+
inOutBounce: EasingFunction;
|
|
93
|
+
outInBounce: EasingFunction;
|
|
94
|
+
inBack: BackEasing;
|
|
95
|
+
outBack: BackEasing;
|
|
96
|
+
inOutBack: BackEasing;
|
|
97
|
+
outInBack: BackEasing;
|
|
98
|
+
inElastic: ElasticEasing;
|
|
99
|
+
outElastic: ElasticEasing;
|
|
100
|
+
inOutElastic: ElasticEasing;
|
|
101
|
+
outInElastic: ElasticEasing;
|
|
102
|
+
};
|
|
103
|
+
import type { PowerEasing } from '../types/index.js';
|
|
104
|
+
import type { EasingFunction } from '../types/index.js';
|
|
105
|
+
import type { BackEasing } from '../types/index.js';
|
|
106
|
+
import type { ElasticEasing } from '../types/index.js';
|
|
107
|
+
import type { EasingParam } from '../types/index.js';
|
|
108
|
+
import { linear as linear_1 } from './linear.js';
|
|
109
|
+
import { irregular as irregular_1 } from './irregular.js';
|
|
110
|
+
import { steps as steps_1 } from './steps.js';
|
|
111
|
+
import { cubicBezier as cubicBezier_1 } from './cubic-bezier.js';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { emptyString, minValue } from '../core/consts.js';
|
|
9
|
+
import { pow, sin, sqrt, cos, isFnc, isStr, clamp, asin, PI } from '../core/helpers.js';
|
|
10
|
+
import { easeTypes, easeInPower, parseEaseString } from './parser.js';
|
|
11
|
+
import { none } from './none.js';
|
|
12
|
+
import { cubicBezier } from './cubic-bezier.js';
|
|
13
|
+
import { steps } from './steps.js';
|
|
14
|
+
import { linear } from './linear.js';
|
|
15
|
+
import { irregular } from './irregular.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @import {
|
|
19
|
+
* EasingFunction,
|
|
20
|
+
* EasingFunctionWithParams,
|
|
21
|
+
* EasingParam,
|
|
22
|
+
* BackEasing,
|
|
23
|
+
* ElasticEasing,
|
|
24
|
+
* PowerEasing,
|
|
25
|
+
* } from '../types/index.js'
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Easing functions adapted and simplified from https://robertpenner.com/easing/
|
|
30
|
+
* (c) 2001 Robert Penner
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const halfPI = PI / 2;
|
|
34
|
+
const doublePI = PI * 2;
|
|
35
|
+
|
|
36
|
+
/** @type {Record<String, EasingFunctionWithParams|EasingFunction>} */
|
|
37
|
+
const easeInFunctions = {
|
|
38
|
+
[emptyString]: easeInPower,
|
|
39
|
+
Quad: easeInPower(2),
|
|
40
|
+
Cubic: easeInPower(3),
|
|
41
|
+
Quart: easeInPower(4),
|
|
42
|
+
Quint: easeInPower(5),
|
|
43
|
+
/** @type {EasingFunction} */
|
|
44
|
+
Sine: t => 1 - cos(t * halfPI),
|
|
45
|
+
/** @type {EasingFunction} */
|
|
46
|
+
Circ: t => 1 - sqrt(1 - t * t),
|
|
47
|
+
/** @type {EasingFunction} */
|
|
48
|
+
Expo: t => t ? pow(2, 10 * t - 10) : 0,
|
|
49
|
+
/** @type {EasingFunction} */
|
|
50
|
+
Bounce: t => {
|
|
51
|
+
let pow2, b = 4;
|
|
52
|
+
while (t < ((pow2 = pow(2, --b)) - 1) / 11);
|
|
53
|
+
return 1 / pow(4, 3 - b) - 7.5625 * pow((pow2 * 3 - 2) / 22 - t, 2);
|
|
54
|
+
},
|
|
55
|
+
/** @type {BackEasing} */
|
|
56
|
+
Back: (overshoot = 1.70158) => t => (+overshoot + 1) * t * t * t - +overshoot * t * t,
|
|
57
|
+
/** @type {ElasticEasing} */
|
|
58
|
+
Elastic: (amplitude = 1, period = .3) => {
|
|
59
|
+
const a = clamp(+amplitude, 1, 10);
|
|
60
|
+
const p = clamp(+period, minValue, 2);
|
|
61
|
+
const s = (p / doublePI) * asin(1 / a);
|
|
62
|
+
const e = doublePI / p;
|
|
63
|
+
return t => t === 0 || t === 1 ? t : -a * pow(2, -10 * (1 - t)) * sin(((1 - t) - s) * e);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {Object} EasesFunctions
|
|
69
|
+
* @property {typeof linear} linear
|
|
70
|
+
* @property {typeof irregular} irregular
|
|
71
|
+
* @property {typeof steps} steps
|
|
72
|
+
* @property {typeof cubicBezier} cubicBezier
|
|
73
|
+
* @property {PowerEasing} in
|
|
74
|
+
* @property {PowerEasing} out
|
|
75
|
+
* @property {PowerEasing} inOut
|
|
76
|
+
* @property {PowerEasing} outIn
|
|
77
|
+
* @property {EasingFunction} inQuad
|
|
78
|
+
* @property {EasingFunction} outQuad
|
|
79
|
+
* @property {EasingFunction} inOutQuad
|
|
80
|
+
* @property {EasingFunction} outInQuad
|
|
81
|
+
* @property {EasingFunction} inCubic
|
|
82
|
+
* @property {EasingFunction} outCubic
|
|
83
|
+
* @property {EasingFunction} inOutCubic
|
|
84
|
+
* @property {EasingFunction} outInCubic
|
|
85
|
+
* @property {EasingFunction} inQuart
|
|
86
|
+
* @property {EasingFunction} outQuart
|
|
87
|
+
* @property {EasingFunction} inOutQuart
|
|
88
|
+
* @property {EasingFunction} outInQuart
|
|
89
|
+
* @property {EasingFunction} inQuint
|
|
90
|
+
* @property {EasingFunction} outQuint
|
|
91
|
+
* @property {EasingFunction} inOutQuint
|
|
92
|
+
* @property {EasingFunction} outInQuint
|
|
93
|
+
* @property {EasingFunction} inSine
|
|
94
|
+
* @property {EasingFunction} outSine
|
|
95
|
+
* @property {EasingFunction} inOutSine
|
|
96
|
+
* @property {EasingFunction} outInSine
|
|
97
|
+
* @property {EasingFunction} inCirc
|
|
98
|
+
* @property {EasingFunction} outCirc
|
|
99
|
+
* @property {EasingFunction} inOutCirc
|
|
100
|
+
* @property {EasingFunction} outInCirc
|
|
101
|
+
* @property {EasingFunction} inExpo
|
|
102
|
+
* @property {EasingFunction} outExpo
|
|
103
|
+
* @property {EasingFunction} inOutExpo
|
|
104
|
+
* @property {EasingFunction} outInExpo
|
|
105
|
+
* @property {EasingFunction} inBounce
|
|
106
|
+
* @property {EasingFunction} outBounce
|
|
107
|
+
* @property {EasingFunction} inOutBounce
|
|
108
|
+
* @property {EasingFunction} outInBounce
|
|
109
|
+
* @property {BackEasing} inBack
|
|
110
|
+
* @property {BackEasing} outBack
|
|
111
|
+
* @property {BackEasing} inOutBack
|
|
112
|
+
* @property {BackEasing} outInBack
|
|
113
|
+
* @property {ElasticEasing} inElastic
|
|
114
|
+
* @property {ElasticEasing} outElastic
|
|
115
|
+
* @property {ElasticEasing} inOutElastic
|
|
116
|
+
* @property {ElasticEasing} outInElastic
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
const eases = (/*#__PURE__ */ (() => {
|
|
120
|
+
const list = { linear, irregular, steps, cubicBezier };
|
|
121
|
+
for (let type in easeTypes) {
|
|
122
|
+
for (let name in easeInFunctions) {
|
|
123
|
+
const easeIn = easeInFunctions[name];
|
|
124
|
+
const easeType = easeTypes[type];
|
|
125
|
+
list[type + name] = /** @type {EasingFunctionWithParams|EasingFunction} */(
|
|
126
|
+
name === emptyString || name === 'Back' || name === 'Elastic' ?
|
|
127
|
+
(a, b) => easeType(/** @type {EasingFunctionWithParams} */(easeIn)(a, b)) :
|
|
128
|
+
easeType(/** @type {EasingFunction} */(easeIn))
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return /** @type {EasesFunctions} */(list);
|
|
133
|
+
})());
|
|
134
|
+
|
|
135
|
+
/** @type {Record<String, EasingFunction>} */
|
|
136
|
+
const JSEasesLookups = { linear: none };
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param {EasingParam} ease
|
|
140
|
+
* @return {EasingFunction}
|
|
141
|
+
*/
|
|
142
|
+
const parseEase = ease => isFnc(ease) ? ease :
|
|
143
|
+
isStr(ease) ? parseEaseString(/** @type {String} */(ease), eases, JSEasesLookups) :
|
|
144
|
+
none;
|
|
145
|
+
|
|
146
|
+
export { eases, parseEase };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var none = require('./none.cjs');
|
|
11
|
+
var cubicBezier = require('./cubic-bezier.cjs');
|
|
12
|
+
var steps = require('./steps.cjs');
|
|
13
|
+
var linear = require('./linear.cjs');
|
|
14
|
+
var irregular = require('./irregular.cjs');
|
|
15
|
+
var eases = require('./eases.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.none = none.none;
|
|
20
|
+
exports.cubicBezier = cubicBezier.cubicBezier;
|
|
21
|
+
exports.steps = steps.steps;
|
|
22
|
+
exports.linear = linear.linear;
|
|
23
|
+
exports.irregular = irregular.irregular;
|
|
24
|
+
exports.eases = eases.eases;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { none } from './none.js';
|
|
9
|
+
export { cubicBezier } from './cubic-bezier.js';
|
|
10
|
+
export { steps } from './steps.js';
|
|
11
|
+
export { linear } from './linear.js';
|
|
12
|
+
export { irregular } from './irregular.js';
|
|
13
|
+
export { eases } from './eases.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - easings - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var helpers = require('../core/helpers.cjs');
|
|
11
|
+
var linear = require('./linear.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @import {
|
|
15
|
+
* EasingFunction,
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate random steps
|
|
21
|
+
* @param {Number} [length] - The number of steps
|
|
22
|
+
* @param {Number} [randomness] - How strong the randomness is
|
|
23
|
+
* @return {EasingFunction}
|
|
24
|
+
*/
|
|
25
|
+
const irregular = (length = 10, randomness = 1) => {
|
|
26
|
+
const values = [0];
|
|
27
|
+
const total = length - 1;
|
|
28
|
+
for (let i = 1; i < total; i++) {
|
|
29
|
+
const previousValue = values[i - 1];
|
|
30
|
+
const spacing = i / total;
|
|
31
|
+
const segmentEnd = (i + 1) / total;
|
|
32
|
+
const randomVariation = spacing + (segmentEnd - spacing) * Math.random();
|
|
33
|
+
// Mix the even spacing and random variation based on the randomness parameter
|
|
34
|
+
const randomValue = spacing * (1 - randomness) + randomVariation * randomness;
|
|
35
|
+
values.push(helpers.clamp(randomValue, previousValue, 1));
|
|
36
|
+
}
|
|
37
|
+
values.push(1);
|
|
38
|
+
return linear.linear(...values);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.irregular = irregular;
|