animejs 4.4.1 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/bundles/anime.esm.js +462 -213
- package/dist/bundles/anime.esm.min.js +2 -2
- package/dist/bundles/anime.umd.js +462 -213
- package/dist/bundles/anime.umd.min.js +2 -2
- package/dist/modules/adapters/index.cjs +14 -0
- package/dist/modules/adapters/index.d.ts +1 -0
- package/dist/modules/adapters/index.js +8 -0
- package/dist/modules/adapters/registry.cjs +149 -0
- package/dist/modules/adapters/registry.d.ts +65 -0
- package/dist/modules/adapters/registry.js +146 -0
- package/dist/modules/adapters/three/adapter.cjs +26 -0
- package/dist/modules/adapters/three/adapter.d.ts +15 -0
- package/dist/modules/adapters/three/adapter.js +24 -0
- package/dist/modules/adapters/three/helpers.cjs +297 -0
- package/dist/modules/adapters/three/helpers.d.ts +89 -0
- package/dist/modules/adapters/three/helpers.js +280 -0
- package/dist/modules/adapters/three/index.cjs +20 -0
- package/dist/modules/adapters/three/index.d.ts +2 -0
- package/dist/modules/adapters/three/index.js +12 -0
- package/dist/modules/adapters/three/instance.cjs +368 -0
- package/dist/modules/adapters/three/instance.d.ts +133 -0
- package/dist/modules/adapters/three/instance.js +365 -0
- package/dist/modules/adapters/three/object3d.cjs +214 -0
- package/dist/modules/adapters/three/object3d.d.ts +1 -0
- package/dist/modules/adapters/three/object3d.js +212 -0
- package/dist/modules/adapters/three/resolvers.cjs +105 -0
- package/dist/modules/adapters/three/resolvers.d.ts +1 -0
- package/dist/modules/adapters/three/resolvers.js +103 -0
- package/dist/modules/adapters/three/uniform.cjs +41 -0
- package/dist/modules/adapters/three/uniform.d.ts +1 -0
- package/dist/modules/adapters/three/uniform.js +39 -0
- package/dist/modules/animatable/animatable.cjs +2 -1
- package/dist/modules/animatable/animatable.d.ts +2 -1
- package/dist/modules/animatable/animatable.js +2 -1
- package/dist/modules/animatable/index.cjs +1 -1
- package/dist/modules/animatable/index.js +1 -1
- package/dist/modules/animation/additive.cjs +1 -1
- package/dist/modules/animation/additive.js +1 -1
- package/dist/modules/animation/animation.cjs +43 -16
- package/dist/modules/animation/animation.d.ts +5 -0
- package/dist/modules/animation/animation.js +45 -18
- package/dist/modules/animation/composition.cjs +38 -35
- package/dist/modules/animation/composition.js +38 -35
- package/dist/modules/animation/index.cjs +1 -1
- package/dist/modules/animation/index.js +1 -1
- package/dist/modules/core/clock.cjs +11 -15
- package/dist/modules/core/clock.d.ts +0 -2
- package/dist/modules/core/clock.js +11 -15
- package/dist/modules/core/colors.cjs +1 -1
- package/dist/modules/core/colors.js +1 -1
- package/dist/modules/core/consts.cjs +15 -1
- package/dist/modules/core/consts.d.ts +2 -0
- package/dist/modules/core/consts.js +14 -2
- package/dist/modules/core/globals.cjs +7 -4
- package/dist/modules/core/globals.d.ts +8 -2
- package/dist/modules/core/globals.js +8 -5
- package/dist/modules/core/helpers.cjs +2 -2
- package/dist/modules/core/helpers.js +3 -3
- package/dist/modules/core/render.cjs +64 -14
- package/dist/modules/core/render.js +65 -15
- package/dist/modules/core/styles.cjs +16 -2
- package/dist/modules/core/styles.js +16 -2
- package/dist/modules/core/targets.cjs +11 -13
- package/dist/modules/core/targets.js +11 -13
- package/dist/modules/core/transforms.cjs +1 -1
- package/dist/modules/core/transforms.js +1 -1
- package/dist/modules/core/units.cjs +1 -1
- package/dist/modules/core/units.js +1 -1
- package/dist/modules/core/values.cjs +73 -82
- package/dist/modules/core/values.d.ts +1 -2
- package/dist/modules/core/values.js +76 -84
- package/dist/modules/draggable/draggable.cjs +1 -1
- package/dist/modules/draggable/draggable.js +1 -1
- package/dist/modules/draggable/index.cjs +1 -1
- package/dist/modules/draggable/index.js +1 -1
- package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
- package/dist/modules/easings/cubic-bezier/index.js +1 -1
- package/dist/modules/easings/eases/index.cjs +1 -1
- package/dist/modules/easings/eases/index.js +1 -1
- package/dist/modules/easings/eases/parser.cjs +3 -3
- package/dist/modules/easings/eases/parser.d.ts +4 -5
- package/dist/modules/easings/eases/parser.js +3 -3
- package/dist/modules/easings/index.cjs +1 -1
- package/dist/modules/easings/index.js +1 -1
- package/dist/modules/easings/irregular/index.cjs +1 -1
- package/dist/modules/easings/irregular/index.js +1 -1
- package/dist/modules/easings/linear/index.cjs +1 -1
- package/dist/modules/easings/linear/index.js +1 -1
- package/dist/modules/easings/none.cjs +1 -1
- package/dist/modules/easings/none.js +1 -1
- package/dist/modules/easings/spring/index.cjs +1 -1
- package/dist/modules/easings/spring/index.js +1 -1
- package/dist/modules/easings/steps/index.cjs +1 -1
- package/dist/modules/easings/steps/index.js +1 -1
- package/dist/modules/engine/engine.cjs +4 -2
- package/dist/modules/engine/engine.js +4 -2
- package/dist/modules/engine/index.cjs +1 -1
- package/dist/modules/engine/index.js +1 -1
- package/dist/modules/events/index.cjs +1 -1
- package/dist/modules/events/index.js +1 -1
- package/dist/modules/events/scroll.cjs +3 -1
- package/dist/modules/events/scroll.js +3 -1
- package/dist/modules/index.cjs +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/layout/index.cjs +1 -1
- package/dist/modules/layout/index.js +1 -1
- package/dist/modules/layout/layout.cjs +1 -1
- package/dist/modules/layout/layout.js +1 -1
- package/dist/modules/scope/index.cjs +1 -1
- package/dist/modules/scope/index.js +1 -1
- package/dist/modules/scope/scope.cjs +1 -1
- package/dist/modules/scope/scope.js +1 -1
- package/dist/modules/svg/drawable.cjs +1 -1
- package/dist/modules/svg/drawable.js +1 -1
- package/dist/modules/svg/helpers.cjs +1 -1
- package/dist/modules/svg/helpers.js +1 -1
- package/dist/modules/svg/index.cjs +1 -1
- package/dist/modules/svg/index.js +1 -1
- package/dist/modules/svg/morphto.cjs +1 -1
- package/dist/modules/svg/morphto.js +1 -1
- package/dist/modules/svg/motionpath.cjs +1 -1
- package/dist/modules/svg/motionpath.js +1 -1
- package/dist/modules/text/index.cjs +1 -1
- package/dist/modules/text/index.js +1 -1
- package/dist/modules/text/scramble.cjs +12 -2
- package/dist/modules/text/scramble.d.ts +9 -1
- package/dist/modules/text/scramble.js +12 -2
- package/dist/modules/text/split.cjs +2 -1
- package/dist/modules/text/split.js +2 -1
- package/dist/modules/timeline/index.cjs +1 -1
- package/dist/modules/timeline/index.js +1 -1
- package/dist/modules/timeline/position.cjs +1 -1
- package/dist/modules/timeline/position.js +1 -1
- package/dist/modules/timeline/timeline.cjs +14 -5
- package/dist/modules/timeline/timeline.d.ts +3 -3
- package/dist/modules/timeline/timeline.js +14 -5
- package/dist/modules/timer/index.cjs +1 -1
- package/dist/modules/timer/index.js +1 -1
- package/dist/modules/timer/timer.cjs +1 -1
- package/dist/modules/timer/timer.js +1 -1
- package/dist/modules/types/index.d.ts +36 -11
- package/dist/modules/utils/chainable.cjs +1 -1
- package/dist/modules/utils/chainable.js +1 -1
- package/dist/modules/utils/index.cjs +1 -1
- package/dist/modules/utils/index.js +1 -1
- package/dist/modules/utils/number.cjs +1 -1
- package/dist/modules/utils/number.js +1 -1
- package/dist/modules/utils/random.cjs +4 -3
- package/dist/modules/utils/random.d.ts +1 -1
- package/dist/modules/utils/random.js +4 -3
- package/dist/modules/utils/stagger.cjs +67 -13
- package/dist/modules/utils/stagger.js +69 -15
- package/dist/modules/utils/target.cjs +4 -1
- package/dist/modules/utils/target.js +4 -1
- package/dist/modules/utils/time.cjs +6 -5
- package/dist/modules/utils/time.d.ts +1 -1
- package/dist/modules/utils/time.js +6 -5
- package/dist/modules/waapi/composition.cjs +1 -1
- package/dist/modules/waapi/composition.js +1 -1
- package/dist/modules/waapi/index.cjs +1 -1
- package/dist/modules/waapi/index.js +1 -1
- package/dist/modules/waapi/waapi.cjs +1 -1
- package/dist/modules/waapi/waapi.js +1 -1
- package/package.json +38 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -36,8 +36,6 @@ class Clock {
|
|
|
36
36
|
/** @type {Number} */
|
|
37
37
|
this._lastTime = initTime;
|
|
38
38
|
/** @type {Number} */
|
|
39
|
-
this._scheduledTime = 0;
|
|
40
|
-
/** @type {Number} */
|
|
41
39
|
this._frameDuration = consts.K / consts.maxFps;
|
|
42
40
|
/** @type {Number} */
|
|
43
41
|
this._fps = consts.maxFps;
|
|
@@ -56,14 +54,12 @@ class Clock {
|
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
set fps(frameRate) {
|
|
59
|
-
const previousFrameDuration = this._frameDuration;
|
|
60
57
|
const fr = +frameRate;
|
|
61
58
|
const fps = fr < consts.minValue ? consts.minValue : fr;
|
|
62
59
|
const frameDuration = consts.K / fps;
|
|
63
60
|
if (fps > globals.defaults.frameRate) globals.defaults.frameRate = fps;
|
|
64
61
|
this._fps = fps;
|
|
65
62
|
this._frameDuration = frameDuration;
|
|
66
|
-
this._scheduledTime += frameDuration - previousFrameDuration;
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
get speed() {
|
|
@@ -80,17 +76,17 @@ class Clock {
|
|
|
80
76
|
* @return {tickModes}
|
|
81
77
|
*/
|
|
82
78
|
requestTick(time) {
|
|
83
|
-
const scheduledTime = this._scheduledTime;
|
|
84
|
-
this._lastTickTime = time;
|
|
85
|
-
// If the current time is lower than the scheduled time
|
|
86
|
-
// this means not enough time has passed to hit one frameDuration
|
|
87
|
-
// so skip that frame
|
|
88
|
-
if (time < scheduledTime) return consts.tickModes.NONE;
|
|
89
79
|
const frameDuration = this._frameDuration;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
const elapsed = time - this._lastTickTime;
|
|
81
|
+
const scaled = frameDuration * .25;
|
|
82
|
+
const tolerance = scaled < 4 ? scaled : 4;
|
|
83
|
+
// Tolerance prevents dropping frames that arrive a bit early due to RAF jitter
|
|
84
|
+
// typically <= ~25% of frame duration and capped at 4ms so it doesn't dominate at high fps.
|
|
85
|
+
// e.g. at 60fps (frameDuration=16.667ms) a frame arriving after 15ms:
|
|
86
|
+
// - without tolerance: 15 < 16.667 -> skip
|
|
87
|
+
// - with tolerance: 15 + 4 >= 16.667 -> tick
|
|
88
|
+
if (elapsed + tolerance < frameDuration) return consts.tickModes.NONE;
|
|
89
|
+
this._lastTickTime = elapsed >= frameDuration ? time - (elapsed % frameDuration) : time;
|
|
94
90
|
return consts.tickModes.AUTO;
|
|
95
91
|
}
|
|
96
92
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -34,8 +34,6 @@ class Clock {
|
|
|
34
34
|
/** @type {Number} */
|
|
35
35
|
this._lastTime = initTime;
|
|
36
36
|
/** @type {Number} */
|
|
37
|
-
this._scheduledTime = 0;
|
|
38
|
-
/** @type {Number} */
|
|
39
37
|
this._frameDuration = K / maxFps;
|
|
40
38
|
/** @type {Number} */
|
|
41
39
|
this._fps = maxFps;
|
|
@@ -54,14 +52,12 @@ class Clock {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
set fps(frameRate) {
|
|
57
|
-
const previousFrameDuration = this._frameDuration;
|
|
58
55
|
const fr = +frameRate;
|
|
59
56
|
const fps = fr < minValue ? minValue : fr;
|
|
60
57
|
const frameDuration = K / fps;
|
|
61
58
|
if (fps > defaults.frameRate) defaults.frameRate = fps;
|
|
62
59
|
this._fps = fps;
|
|
63
60
|
this._frameDuration = frameDuration;
|
|
64
|
-
this._scheduledTime += frameDuration - previousFrameDuration;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
get speed() {
|
|
@@ -78,17 +74,17 @@ class Clock {
|
|
|
78
74
|
* @return {tickModes}
|
|
79
75
|
*/
|
|
80
76
|
requestTick(time) {
|
|
81
|
-
const scheduledTime = this._scheduledTime;
|
|
82
|
-
this._lastTickTime = time;
|
|
83
|
-
// If the current time is lower than the scheduled time
|
|
84
|
-
// this means not enough time has passed to hit one frameDuration
|
|
85
|
-
// so skip that frame
|
|
86
|
-
if (time < scheduledTime) return tickModes.NONE;
|
|
87
77
|
const frameDuration = this._frameDuration;
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
78
|
+
const elapsed = time - this._lastTickTime;
|
|
79
|
+
const scaled = frameDuration * .25;
|
|
80
|
+
const tolerance = scaled < 4 ? scaled : 4;
|
|
81
|
+
// Tolerance prevents dropping frames that arrive a bit early due to RAF jitter
|
|
82
|
+
// typically <= ~25% of frame duration and capped at 4ms so it doesn't dominate at high fps.
|
|
83
|
+
// e.g. at 60fps (frameDuration=16.667ms) a frame arriving after 15ms:
|
|
84
|
+
// - without tolerance: 15 < 16.667 -> skip
|
|
85
|
+
// - with tolerance: 15 + 4 >= 16.667 -> tick
|
|
86
|
+
if (elapsed + tolerance < frameDuration) return tickModes.NONE;
|
|
87
|
+
this._lastTickTime = elapsed >= frameDuration ? time - (elapsed % frameDuration) : time;
|
|
92
88
|
return tickModes.AUTO;
|
|
93
89
|
}
|
|
94
90
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -73,6 +73,11 @@ const maxFps = 240;
|
|
|
73
73
|
const emptyString = '';
|
|
74
74
|
const cssVarPrefix = 'var(';
|
|
75
75
|
|
|
76
|
+
// Arrays
|
|
77
|
+
|
|
78
|
+
// Shared sentinel for tween slots that don't hold array data. Never mutated, only read; COMPLEX and COLOR tweens always replace the slot before writing.
|
|
79
|
+
const emptyArray = [];
|
|
80
|
+
|
|
76
81
|
const shortTransforms = /*#__PURE__*/ (() => {
|
|
77
82
|
const map = new Map();
|
|
78
83
|
map.set('x', 'translateX');
|
|
@@ -106,6 +111,13 @@ const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) =>
|
|
|
106
111
|
/** @return {void} */
|
|
107
112
|
const noop = () => {};
|
|
108
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @template T
|
|
116
|
+
* @param {T} v
|
|
117
|
+
* @return {T}
|
|
118
|
+
*/
|
|
119
|
+
const noopModifier = v => v;
|
|
120
|
+
|
|
109
121
|
// Regex
|
|
110
122
|
|
|
111
123
|
const validRgbHslRgx = /\)\s*[-.\d]/;
|
|
@@ -128,6 +140,7 @@ exports.cssVarPrefix = cssVarPrefix;
|
|
|
128
140
|
exports.cssVariableMatchRgx = cssVariableMatchRgx;
|
|
129
141
|
exports.digitWithExponentRgx = digitWithExponentRgx;
|
|
130
142
|
exports.doc = doc;
|
|
143
|
+
exports.emptyArray = emptyArray;
|
|
131
144
|
exports.emptyString = emptyString;
|
|
132
145
|
exports.hexTestRgx = hexTestRgx;
|
|
133
146
|
exports.hslExecRgx = hslExecRgx;
|
|
@@ -141,6 +154,7 @@ exports.maxFps = maxFps;
|
|
|
141
154
|
exports.maxValue = maxValue;
|
|
142
155
|
exports.minValue = minValue;
|
|
143
156
|
exports.noop = noop;
|
|
157
|
+
exports.noopModifier = noopModifier;
|
|
144
158
|
exports.proxyTargetSymbol = proxyTargetSymbol;
|
|
145
159
|
exports.relativeValuesExecRgx = relativeValuesExecRgx;
|
|
146
160
|
exports.rgbExecRgx = rgbExecRgx;
|
|
@@ -43,10 +43,12 @@ export const K: 1000;
|
|
|
43
43
|
export const maxFps: 240;
|
|
44
44
|
export const emptyString: "";
|
|
45
45
|
export const cssVarPrefix: "var(";
|
|
46
|
+
export const emptyArray: any[];
|
|
46
47
|
export const shortTransforms: Map<any, any>;
|
|
47
48
|
export const validTransforms: string[];
|
|
48
49
|
export const transformsFragmentStrings: {};
|
|
49
50
|
export function noop(): void;
|
|
51
|
+
export function noopModifier<T>(v: T): T;
|
|
50
52
|
export const validRgbHslRgx: RegExp;
|
|
51
53
|
export const hexTestRgx: RegExp;
|
|
52
54
|
export const rgbExecRgx: RegExp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -71,6 +71,11 @@ const maxFps = 240;
|
|
|
71
71
|
const emptyString = '';
|
|
72
72
|
const cssVarPrefix = 'var(';
|
|
73
73
|
|
|
74
|
+
// Arrays
|
|
75
|
+
|
|
76
|
+
// Shared sentinel for tween slots that don't hold array data. Never mutated, only read; COMPLEX and COLOR tweens always replace the slot before writing.
|
|
77
|
+
const emptyArray = [];
|
|
78
|
+
|
|
74
79
|
const shortTransforms = /*#__PURE__*/ (() => {
|
|
75
80
|
const map = new Map();
|
|
76
81
|
map.set('x', 'translateX');
|
|
@@ -104,6 +109,13 @@ const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) =>
|
|
|
104
109
|
/** @return {void} */
|
|
105
110
|
const noop = () => {};
|
|
106
111
|
|
|
112
|
+
/**
|
|
113
|
+
* @template T
|
|
114
|
+
* @param {T} v
|
|
115
|
+
* @return {T}
|
|
116
|
+
*/
|
|
117
|
+
const noopModifier = v => v;
|
|
118
|
+
|
|
107
119
|
// Regex
|
|
108
120
|
|
|
109
121
|
const validRgbHslRgx = /\)\s*[-.\d]/;
|
|
@@ -120,4 +132,4 @@ const lowerCaseRgx = /([a-z])([A-Z])/g;
|
|
|
120
132
|
const relativeValuesExecRgx = /(\*=|\+=|-=)/;
|
|
121
133
|
const cssVariableMatchRgx = /var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/;
|
|
122
134
|
|
|
123
|
-
export { K, compositionTypes, cssVarPrefix, cssVariableMatchRgx, digitWithExponentRgx, doc, emptyString, hexTestRgx, hslExecRgx, hslaExecRgx, isBrowser, isDomSymbol, isRegisteredTargetSymbol, isSvgSymbol, lowerCaseRgx, maxFps, maxValue, minValue, noop, proxyTargetSymbol, relativeValuesExecRgx, rgbExecRgx, rgbaExecRgx, shortTransforms, tickModes, transformsFragmentStrings, transformsSymbol, tweenTypes, unitsExecRgx, validRgbHslRgx, validTransforms, valueTypes, win };
|
|
135
|
+
export { K, compositionTypes, cssVarPrefix, cssVariableMatchRgx, digitWithExponentRgx, doc, emptyArray, emptyString, hexTestRgx, hslExecRgx, hslaExecRgx, isBrowser, isDomSymbol, isRegisteredTargetSymbol, isSvgSymbol, lowerCaseRgx, maxFps, maxValue, minValue, noop, noopModifier, proxyTargetSymbol, relativeValuesExecRgx, rgbExecRgx, rgbaExecRgx, shortTransforms, tickModes, transformsFragmentStrings, transformsSymbol, tweenTypes, unitsExecRgx, validRgbHslRgx, validTransforms, valueTypes, win };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -23,10 +23,13 @@ var consts = require('./consts.cjs');
|
|
|
23
23
|
/**
|
|
24
24
|
* @typedef {Object} EditorGlobals
|
|
25
25
|
* @property {boolean} showPanel
|
|
26
|
-
* @property {boolean} synced
|
|
27
26
|
* @property {Function} addAnimation
|
|
27
|
+
* @property {Function} addSet
|
|
28
28
|
* @property {Function} addTimeline
|
|
29
29
|
* @property {Function} addTimelineChild
|
|
30
|
+
* @property {Function} addTimelineLabel
|
|
31
|
+
* @property {Function} addTimelineCall
|
|
32
|
+
* @property {Function} addTimelineSync
|
|
30
33
|
* @property {Function} resolveStagger
|
|
31
34
|
* @property {Object|null} _head
|
|
32
35
|
* @property {Object|null} _tail
|
|
@@ -49,7 +52,7 @@ const defaults = {
|
|
|
49
52
|
loopDelay: 0,
|
|
50
53
|
ease: 'out(2)',
|
|
51
54
|
composition: consts.compositionTypes.replace,
|
|
52
|
-
modifier:
|
|
55
|
+
modifier: consts.noopModifier,
|
|
53
56
|
onBegin: consts.noop,
|
|
54
57
|
onBeforeUpdate: consts.noop,
|
|
55
58
|
onUpdate: consts.noop,
|
|
@@ -79,7 +82,7 @@ const globals = {
|
|
|
79
82
|
editor: null,
|
|
80
83
|
};
|
|
81
84
|
|
|
82
|
-
const globalVersions = { version: '4.
|
|
85
|
+
const globalVersions = { version: '4.5.0', engine: null };
|
|
83
86
|
|
|
84
87
|
if (consts.isBrowser) {
|
|
85
88
|
if (!consts.win.AnimeJS) consts.win.AnimeJS = [];
|
|
@@ -11,10 +11,13 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {Object} EditorGlobals
|
|
13
13
|
* @property {boolean} showPanel
|
|
14
|
-
* @property {boolean} synced
|
|
15
14
|
* @property {Function} addAnimation
|
|
15
|
+
* @property {Function} addSet
|
|
16
16
|
* @property {Function} addTimeline
|
|
17
17
|
* @property {Function} addTimelineChild
|
|
18
|
+
* @property {Function} addTimelineLabel
|
|
19
|
+
* @property {Function} addTimelineCall
|
|
20
|
+
* @property {Function} addTimelineSync
|
|
18
21
|
* @property {Function} resolveStagger
|
|
19
22
|
* @property {Object|null} _head
|
|
20
23
|
* @property {Object|null} _tail
|
|
@@ -38,10 +41,13 @@ export namespace globalVersions {
|
|
|
38
41
|
}
|
|
39
42
|
export type EditorGlobals = {
|
|
40
43
|
showPanel: boolean;
|
|
41
|
-
synced: boolean;
|
|
42
44
|
addAnimation: Function;
|
|
45
|
+
addSet: Function;
|
|
43
46
|
addTimeline: Function;
|
|
44
47
|
addTimelineChild: Function;
|
|
48
|
+
addTimelineLabel: Function;
|
|
49
|
+
addTimelineCall: Function;
|
|
50
|
+
addTimelineSync: Function;
|
|
45
51
|
resolveStagger: Function;
|
|
46
52
|
_head: any | null;
|
|
47
53
|
_tail: any | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { isBrowser, win, noop, compositionTypes, K, maxFps, doc } from './consts.js';
|
|
8
|
+
import { isBrowser, win, noop, noopModifier, compositionTypes, K, maxFps, doc } from './consts.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @import {
|
|
@@ -21,10 +21,13 @@ import { isBrowser, win, noop, compositionTypes, K, maxFps, doc } from './consts
|
|
|
21
21
|
/**
|
|
22
22
|
* @typedef {Object} EditorGlobals
|
|
23
23
|
* @property {boolean} showPanel
|
|
24
|
-
* @property {boolean} synced
|
|
25
24
|
* @property {Function} addAnimation
|
|
25
|
+
* @property {Function} addSet
|
|
26
26
|
* @property {Function} addTimeline
|
|
27
27
|
* @property {Function} addTimelineChild
|
|
28
|
+
* @property {Function} addTimelineLabel
|
|
29
|
+
* @property {Function} addTimelineCall
|
|
30
|
+
* @property {Function} addTimelineSync
|
|
28
31
|
* @property {Function} resolveStagger
|
|
29
32
|
* @property {Object|null} _head
|
|
30
33
|
* @property {Object|null} _tail
|
|
@@ -47,7 +50,7 @@ const defaults = {
|
|
|
47
50
|
loopDelay: 0,
|
|
48
51
|
ease: 'out(2)',
|
|
49
52
|
composition: compositionTypes.replace,
|
|
50
|
-
modifier:
|
|
53
|
+
modifier: noopModifier,
|
|
51
54
|
onBegin: noop,
|
|
52
55
|
onBeforeUpdate: noop,
|
|
53
56
|
onUpdate: noop,
|
|
@@ -77,7 +80,7 @@ const globals = {
|
|
|
77
80
|
editor: null,
|
|
78
81
|
};
|
|
79
82
|
|
|
80
|
-
const globalVersions = { version: '4.
|
|
83
|
+
const globalVersions = { version: '4.5.0', engine: null };
|
|
81
84
|
|
|
82
85
|
if (isBrowser) {
|
|
83
86
|
if (!win.AnimeJS) win.AnimeJS = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -155,7 +155,7 @@ const snap = (v, increment) => isArr(increment) ? increment.reduce((closest, cv)
|
|
|
155
155
|
* @param {Number} factor - Interpolation factor in the range [0, 1]
|
|
156
156
|
* @return {Number} The interpolated value
|
|
157
157
|
*/
|
|
158
|
-
const lerp = (start, end, factor) => start + (end - start) * factor;
|
|
158
|
+
const lerp = (start, end, factor) => factor === 1 ? end : factor === 0 ? start : start + (end - start) * factor;
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Replaces infinity with maximum safe value
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { isBrowser, maxValue, minValue,
|
|
8
|
+
import { isBrowser, maxValue, minValue, hexTestRgx, lowerCaseRgx, validRgbHslRgx } from './consts.js';
|
|
9
9
|
import { globals } from './globals.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -153,7 +153,7 @@ const snap = (v, increment) => isArr(increment) ? increment.reduce((closest, cv)
|
|
|
153
153
|
* @param {Number} factor - Interpolation factor in the range [0, 1]
|
|
154
154
|
* @return {Number} The interpolated value
|
|
155
155
|
*/
|
|
156
|
-
const lerp = (start, end, factor) => start + (end - start) * factor;
|
|
156
|
+
const lerp = (start, end, factor) => factor === 1 ? end : factor === 0 ? start : start + (end - start) * factor;
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Replaces infinity with maximum safe value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - core - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -76,12 +76,14 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
76
76
|
// Execute the "expensive" iterations calculations only when necessary
|
|
77
77
|
if (iterationCount > 1) {
|
|
78
78
|
// bitwise NOT operator seems to be generally faster than Math.floor() across browsers
|
|
79
|
-
const
|
|
79
|
+
const period = iterationDuration + (isCurrentTimeEqualOrAboveDuration ? 0 : _loopDelay);
|
|
80
|
+
const currentIteration = ~~(tickableCurrentTime / period);
|
|
80
81
|
tickable._currentIteration = helpers.clamp(currentIteration, 0, iterationCount);
|
|
81
82
|
// Prevent the iteration count to go above the max iterations when reaching the end of the animation
|
|
82
83
|
if (isCurrentTimeEqualOrAboveDuration) tickable._currentIteration--;
|
|
83
84
|
isOdd = tickable._currentIteration % 2;
|
|
84
|
-
|
|
85
|
+
// Derive elapsed from the same `~~` truncation that gave currentIteration. Using `% period` here can disagree with `~~(/period)` under float drift at iteration boundaries and write the wrong end of the tween for one frame.
|
|
86
|
+
iterationElapsedTime = tickableCurrentTime - currentIteration * period || 0;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
// Checks if exactly one of _reversed and (_alternate && isOdd) is true
|
|
@@ -113,12 +115,14 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
113
115
|
if (
|
|
114
116
|
forcedTick ||
|
|
115
117
|
tickMode === consts.tickModes.AUTO && (
|
|
116
|
-
|
|
118
|
+
// Timeline children render from their offset instead of their delay so the gap left by a truncated sibling is covered on seek.
|
|
119
|
+
time >= (parent && tickableDelay > 0 ? 0 : tickableDelay) && time <= tickableEndTime || // Normal render
|
|
117
120
|
time <= tickableDelay && tickablePrevTime > tickableDelay || // Playhead is before the animation start time so make sure the animation is at its initial state
|
|
118
121
|
time >= tickableEndTime && tickablePrevTime !== duration // Playhead is after the animation end time so make sure the animation is at its end state
|
|
119
122
|
) ||
|
|
120
123
|
iterationTime >= tickableEndTime && tickablePrevTime !== duration ||
|
|
121
|
-
iterationTime
|
|
124
|
+
// iterationTime is per-iteration, compared to the delay to catch a backward seek into a looped iteration's delay region. Exclude the final settled end, where iterationTime clamps to duration and would falsely match the delay region when the delay exceeds the duration.
|
|
125
|
+
iterationTime <= tickableDelay && tickablePrevTime > 0 && !isCurrentTimeEqualOrAboveDuration ||
|
|
122
126
|
time <= tickablePrevTime && tickablePrevTime === duration && completed || // Force a render if a seek occurs on an completed animation
|
|
123
127
|
isCurrentTimeEqualOrAboveDuration && !completed && isSetter // This prevents 0 duration tickables to be skipped
|
|
124
128
|
) {
|
|
@@ -134,7 +138,8 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
134
138
|
|
|
135
139
|
// Time has jumped more than globals.tickThreshold so consider this tick manual
|
|
136
140
|
const forcedRender = forcedTick || (isRunningBackwards ? deltaTime * -1 : deltaTime) >= globals.globals.tickThreshold;
|
|
137
|
-
|
|
141
|
+
// Round to match the precision of tween._absoluteStartTime so equal-time boundary checks compare cleanly without floating point drift from the unrounded _offset.
|
|
142
|
+
const absoluteTime = helpers.round(tickable._offset + (parent ? parent._offset : 0) + tickableDelay + iterationTime, 12);
|
|
138
143
|
|
|
139
144
|
// Only Animation can have tweens, Timer returns undefined
|
|
140
145
|
let tween = /** @type {Tween} */(/** @type {JSAnimation} */(tickable)._head);
|
|
@@ -153,15 +158,38 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
153
158
|
const tweenNextRep = tween._nextRep;
|
|
154
159
|
const tweenPrevRep = tween._prevRep;
|
|
155
160
|
const tweenHasComposition = tweenComposition !== consts.compositionTypes.none;
|
|
161
|
+
// The previous sibling stops writing at its truncated end, so this tween takes over the hold from that point.
|
|
162
|
+
const tweenPrevRepEndTime = tweenPrevRep ? tweenPrevRep._absoluteStartTime + tweenPrevRep._changeDuration : 0;
|
|
163
|
+
const tweenPrevRepIsCrossParent = tweenPrevRep && tweenPrevRep.parent !== tween.parent;
|
|
164
|
+
// Same parent keyframes take over at their own start, end plus delay equals the next start by construction.
|
|
165
|
+
// Cross parent siblings take over at their update start.
|
|
166
|
+
// Negative delay siblings take over at their own start instead.
|
|
167
|
+
const tweenNextRepTakeover = !tweenNextRep || tweenNextRep._isOverridden ? tweenAbsEndTime :
|
|
168
|
+
tweenNextRep.parent === tween.parent ? tweenAbsEndTime + tweenNextRep._delay :
|
|
169
|
+
tweenNextRep._absoluteStartTime < tweenNextRep._absoluteUpdateStartTime ? tweenNextRep._absoluteStartTime : tweenNextRep._absoluteUpdateStartTime;
|
|
156
170
|
|
|
157
171
|
if ((forcedRender || (
|
|
158
|
-
|
|
159
|
-
(tweenCurrentTime !==
|
|
160
|
-
|
|
172
|
+
// Tail keyframes always re-evaluate the gate so an earlier keyframe cannot leave the target stale by writing past its own range after a backward seek.
|
|
173
|
+
(tweenCurrentTime !== tweenChangeDuration || absoluteTime <= tweenNextRepTakeover ||
|
|
174
|
+
(tweenPrevRep && !tweenPrevRepIsCrossParent && (!tweenNextRep || tweenNextRep.parent !== tween.parent))) &&
|
|
175
|
+
// A cross parent tween re-renders its from value from the previous sibling truncated end so the handoff gap holds.
|
|
176
|
+
// A keyframe re-renders its from revert while the next keyframe time is stale so a backward jump over its range cannot leave the next value in place.
|
|
177
|
+
(tweenCurrentTime !== 0 || absoluteTime >= tween._absoluteStartTime ||
|
|
178
|
+
(tweenPrevRepIsCrossParent && !tween._hasFromValue && !tweenPrevRep._isOverridden && absoluteTime >= tweenPrevRepEndTime) ||
|
|
179
|
+
(tweenNextRep && !tweenNextRep._isOverridden && tweenNextRep.parent === tween.parent && tweenNextRep._currentTime !== 0 && iterationTime < tweenNextRep._startTime))
|
|
180
|
+
)) &&
|
|
181
|
+
// Non-first keyframes wait until the iteration reaches their own start before rendering, so the previous keyframe can handle the from-revert when scrubbed backward past this tween's range.
|
|
182
|
+
(!tweenPrevRep || tweenPrevRepIsCrossParent || iterationTime >= tween._startTime) &&
|
|
183
|
+
(!tweenHasComposition || (
|
|
161
184
|
!tween._isOverridden &&
|
|
162
185
|
(!tween._isOverlapped || absoluteTime <= tweenAbsEndTime) &&
|
|
163
|
-
|
|
164
|
-
(!
|
|
186
|
+
// The next sibling owns the value past its takeover point, so yielding there keeps writes single owner in both directions.
|
|
187
|
+
(!tweenNextRep || tweenNextRep._isOverridden || absoluteTime <= tweenNextRepTakeover) &&
|
|
188
|
+
// The previous sibling owns the value up to its truncated end.
|
|
189
|
+
// Cross parent tweens take over the hold from that point, explicit from values wait for their own start.
|
|
190
|
+
(!tweenPrevRep || (tweenPrevRep._isOverridden || (!tweenPrevRepIsCrossParent ?
|
|
191
|
+
absoluteTime >= tweenPrevRepEndTime + tween._delay :
|
|
192
|
+
absoluteTime >= tween._absoluteStartTime || (!tween._hasFromValue && absoluteTime >= tweenPrevRepEndTime))))
|
|
165
193
|
))
|
|
166
194
|
) {
|
|
167
195
|
|
|
@@ -172,7 +200,7 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
172
200
|
const tweenType = tween._tweenType;
|
|
173
201
|
const tweenIsObject = tweenType === consts.tweenTypes.OBJECT;
|
|
174
202
|
const tweenIsNumber = tweenValueType === consts.valueTypes.NUMBER;
|
|
175
|
-
// Only round the in-between frames values if the final value is a string
|
|
203
|
+
// Only round the in-between frames values if the final value is a string. Object targets consume raw numbers, so rounding is dead work there.
|
|
176
204
|
const tweenPrecision = (tweenIsNumber && tweenIsObject) || tweenProgress === 0 || tweenProgress === 1 ? -1 : globals.globals.precision;
|
|
177
205
|
|
|
178
206
|
// Recompose tween value
|
|
@@ -188,7 +216,22 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
188
216
|
number = /** @type {Number} */(tweenModifier(helpers.round(helpers.lerp(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));
|
|
189
217
|
value = `${number}${tween._unit}`;
|
|
190
218
|
} else if (tweenValueType === consts.valueTypes.COLOR) {
|
|
191
|
-
|
|
219
|
+
const ns = tween._numbers;
|
|
220
|
+
const fn = tween._fromNumbers;
|
|
221
|
+
const tn = tween._toNumbers;
|
|
222
|
+
const omt = 1 - tweenProgress;
|
|
223
|
+
const fr = fn[0], fg = fn[1], fb = fn[2];
|
|
224
|
+
const tr = tn[0], tg = tn[1], tb = tn[2];
|
|
225
|
+
// RGB channels lerp in pseudo-linear space (square inputs, sqrt result) to approximate gamma-correct blending.
|
|
226
|
+
// See https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-24-importance-being-linear.
|
|
227
|
+
ns[0] = /** @type {Number} */(tweenModifier(Math.sqrt(fr * fr * omt + tr * tr * tweenProgress)));
|
|
228
|
+
ns[1] = /** @type {Number} */(tweenModifier(Math.sqrt(fg * fg * omt + tg * tg * tweenProgress)));
|
|
229
|
+
ns[2] = /** @type {Number} */(tweenModifier(Math.sqrt(fb * fb * omt + tb * tb * tweenProgress)));
|
|
230
|
+
ns[3] = /** @type {Number} */(tweenModifier(helpers.lerp(fn[3], tn[3], tweenProgress)));
|
|
231
|
+
// The rgba string is built only for the dispatch path or the internalRender composition tick (setters handles the color comp)
|
|
232
|
+
if (!tween._setter || internalRender) {
|
|
233
|
+
value = `rgba(${helpers.round(ns[0], 0)},${helpers.round(ns[1], 0)},${helpers.round(ns[2], 0)},${ns[3]})`;
|
|
234
|
+
}
|
|
192
235
|
} else if (tweenValueType === consts.valueTypes.COMPLEX) {
|
|
193
236
|
value = values.composeComplexValue(tween, tweenProgress, tweenPrecision);
|
|
194
237
|
}
|
|
@@ -203,7 +246,9 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
203
246
|
const tweenProperty = tween.property;
|
|
204
247
|
tweenTarget = tween.target;
|
|
205
248
|
|
|
206
|
-
if (
|
|
249
|
+
if (tween._setter) {
|
|
250
|
+
tween._setter(tweenTarget, number, tween);
|
|
251
|
+
} else if (tweenIsObject) {
|
|
207
252
|
tweenTarget[tweenProperty] = value;
|
|
208
253
|
} else if (tweenType === consts.tweenTypes.ATTRIBUTE) {
|
|
209
254
|
/** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(value));
|
|
@@ -231,6 +276,9 @@ const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
231
276
|
tween._value = value;
|
|
232
277
|
}
|
|
233
278
|
|
|
279
|
+
} else if (tweenCurrentTime && tweenPrevRep && !tweenPrevRepIsCrossParent && iterationTime < tween._startTime) {
|
|
280
|
+
// Mark the keyframe as reverted when the playhead moves before its start, the previous keyframe owns the from revert and writes it once.
|
|
281
|
+
tween._currentTime = 0;
|
|
234
282
|
}
|
|
235
283
|
|
|
236
284
|
if (tweenTransformsNeedUpdate && tween._renderTransforms) {
|
|
@@ -338,6 +386,8 @@ const tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {
|
|
|
338
386
|
|
|
339
387
|
helpers.forEachChildren(tl, (/** @type {JSAnimation} */child) => {
|
|
340
388
|
const childTime = helpers.round((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds
|
|
389
|
+
// Skip past-end siblings on backward iteration so their progress=1 to-values don't render last and overwrite the active sibling's write. Compare against _delay + duration so children with a normalized delay are not skipped while still inside their active range.
|
|
390
|
+
if (tlIsRunningBackwards && childTime > child._delay + child.duration) return;
|
|
341
391
|
const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;
|
|
342
392
|
tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);
|
|
343
393
|
if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;
|