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 - text - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -20,6 +20,16 @@ var consts = require('../core/consts.cjs');
|
|
|
20
20
|
* } from '../types/index.js'
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} ScrambleTextTween
|
|
25
|
+
* @property {Number} from
|
|
26
|
+
* @property {Number} to
|
|
27
|
+
* @property {Number} duration
|
|
28
|
+
* @property {Number} delay
|
|
29
|
+
* @property {String} ease
|
|
30
|
+
* @property {(v: Number) => String} modifier
|
|
31
|
+
*/
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')
|
|
25
35
|
* @param {String} str
|
|
@@ -57,7 +67,7 @@ const originalTexts = new WeakMap();
|
|
|
57
67
|
* progressively revealing the original text.
|
|
58
68
|
*
|
|
59
69
|
* @param {ScrambleTextParams} [params]
|
|
60
|
-
* @return {FunctionValue}
|
|
70
|
+
* @return {FunctionValue<ScrambleTextTween>}
|
|
61
71
|
*/
|
|
62
72
|
const scrambleText = (params = {}) => {
|
|
63
73
|
if (!params) params = {};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
export function scrambleText(params?: ScrambleTextParams): FunctionValue
|
|
1
|
+
export function scrambleText(params?: ScrambleTextParams): FunctionValue<ScrambleTextTween>;
|
|
2
|
+
export type ScrambleTextTween = {
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
duration: number;
|
|
6
|
+
delay: number;
|
|
7
|
+
ease: string;
|
|
8
|
+
modifier: (v: number) => string;
|
|
9
|
+
};
|
|
2
10
|
import type { ScrambleTextParams } from '../types/index.js';
|
|
3
11
|
import type { FunctionValue } from '../types/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - text - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -18,6 +18,16 @@ import { noop } from '../core/consts.js';
|
|
|
18
18
|
* } from '../types/index.js'
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} ScrambleTextTween
|
|
23
|
+
* @property {Number} from
|
|
24
|
+
* @property {Number} to
|
|
25
|
+
* @property {Number} duration
|
|
26
|
+
* @property {Number} delay
|
|
27
|
+
* @property {String} ease
|
|
28
|
+
* @property {(v: Number) => String} modifier
|
|
29
|
+
*/
|
|
30
|
+
|
|
21
31
|
/**
|
|
22
32
|
* '-' is the range operator; place it at the start or end of the string to use it as a literal (e.g. '-abc' or 'abc-')
|
|
23
33
|
* @param {String} str
|
|
@@ -55,7 +65,7 @@ const originalTexts = new WeakMap();
|
|
|
55
65
|
* progressively revealing the original text.
|
|
56
66
|
*
|
|
57
67
|
* @param {ScrambleTextParams} [params]
|
|
58
|
-
* @return {FunctionValue}
|
|
68
|
+
* @return {FunctionValue<ScrambleTextTween>}
|
|
59
69
|
*/
|
|
60
70
|
const scrambleText = (params = {}) => {
|
|
61
71
|
if (!params) params = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - text - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -118,6 +118,7 @@ const filterLineElements = ($el, lineIndex, bin) => {
|
|
|
118
118
|
*/
|
|
119
119
|
const generateTemplate = (type, params = {}) => {
|
|
120
120
|
let template = ``;
|
|
121
|
+
if (!params) params = {};
|
|
121
122
|
const classString = helpers.isStr(params.class) ? ` class="${params.class}"` : '';
|
|
122
123
|
const cloneType = values.setValue(params.clone, false);
|
|
123
124
|
const wrapType = values.setValue(params.wrap, false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - text - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -116,6 +116,7 @@ const filterLineElements = ($el, lineIndex, bin) => {
|
|
|
116
116
|
*/
|
|
117
117
|
const generateTemplate = (type, params = {}) => {
|
|
118
118
|
let template = ``;
|
|
119
|
+
if (!params) params = {};
|
|
119
120
|
const classString = isStr(params.class) ? ` class="${params.class}"` : '';
|
|
120
121
|
const cloneType = setValue(params.clone, false);
|
|
121
122
|
const wrapType = setValue(params.wrap, false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - timeline - CJS
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -34,6 +34,7 @@ var position = require('./position.cjs');
|
|
|
34
34
|
* TimelinePosition,
|
|
35
35
|
* StaggerFunction,
|
|
36
36
|
* TargetsArray,
|
|
37
|
+
* TweakRegister,
|
|
37
38
|
* } from '../types/index.js'
|
|
38
39
|
*/
|
|
39
40
|
|
|
@@ -43,8 +44,6 @@ var position = require('./position.cjs');
|
|
|
43
44
|
* } from '../waapi/waapi.js'
|
|
44
45
|
*/
|
|
45
46
|
|
|
46
|
-
/** @import {TweakRegister} from 'tweaks' */
|
|
47
|
-
|
|
48
47
|
/**
|
|
49
48
|
* @param {Timeline} tl
|
|
50
49
|
* @return {Number}
|
|
@@ -237,13 +236,21 @@ class Timeline extends timer.Timer {
|
|
|
237
236
|
if (!helpers.isUnd(synced) && !helpers.isUnd(/** @type {WAAPIAnimation} */(synced).persist)) {
|
|
238
237
|
/** @type {WAAPIAnimation} */(synced).persist = true;
|
|
239
238
|
}
|
|
240
|
-
|
|
239
|
+
const editor = globals.globals.editor;
|
|
240
|
+
const childHook = editor && editor.addTimelineChild;
|
|
241
|
+
if (editor && editor.addTimelineSync) {
|
|
242
|
+
position = editor.addTimelineSync(synced, position, this.id);
|
|
243
|
+
editor.addTimelineChild = null; // Suppress the per-child hook for the internal .add, sync already registered.
|
|
244
|
+
}
|
|
245
|
+
const result = this.add(synced, { currentTime: [0, duration], duration, delay: 0, ease: 'linear', playbackEase: 'linear' }, position);
|
|
246
|
+
if (editor) editor.addTimelineChild = childHook;
|
|
247
|
+
return result;
|
|
241
248
|
}
|
|
242
249
|
|
|
243
250
|
/**
|
|
244
251
|
* @param {TargetsParam} targets
|
|
245
252
|
* @param {AnimationParams} parameters
|
|
246
|
-
* @param {TimelinePosition} [position]
|
|
253
|
+
* @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [position]
|
|
247
254
|
* @return {this}
|
|
248
255
|
*/
|
|
249
256
|
set(targets, parameters, position) {
|
|
@@ -260,6 +267,7 @@ class Timeline extends timer.Timer {
|
|
|
260
267
|
*/
|
|
261
268
|
call(callback, position) {
|
|
262
269
|
if (helpers.isUnd(callback) || callback && !helpers.isFnc(callback)) return this;
|
|
270
|
+
if (globals.globals.editor && globals.globals.editor.addTimelineCall) position = globals.globals.editor.addTimelineCall(callback, position, this.id);
|
|
263
271
|
return this.add({ duration: 0, delay: 0, onComplete: () => callback(this) }, position);
|
|
264
272
|
}
|
|
265
273
|
|
|
@@ -271,6 +279,7 @@ class Timeline extends timer.Timer {
|
|
|
271
279
|
*/
|
|
272
280
|
label(labelName, position$1) {
|
|
273
281
|
if (helpers.isUnd(labelName) || labelName && !helpers.isStr(labelName)) return this;
|
|
282
|
+
if (globals.globals.editor && globals.globals.editor.addTimelineLabel) position$1 = globals.globals.editor.addTimelineLabel(labelName, position$1, this.id);
|
|
274
283
|
this.labels[labelName] = position.parseTimelinePosition(this, position$1);
|
|
275
284
|
return this;
|
|
276
285
|
}
|
|
@@ -109,10 +109,10 @@ export class Timeline extends Timer {
|
|
|
109
109
|
/**
|
|
110
110
|
* @param {TargetsParam} targets
|
|
111
111
|
* @param {AnimationParams} parameters
|
|
112
|
-
* @param {TimelinePosition} [position]
|
|
112
|
+
* @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [position]
|
|
113
113
|
* @return {this}
|
|
114
114
|
*/
|
|
115
|
-
set(targets: TargetsParam, parameters: AnimationParams, position?: TimelinePosition): this;
|
|
115
|
+
set(targets: TargetsParam, parameters: AnimationParams, position?: TimelinePosition | StaggerFunction<number | string> | TweakRegister): this;
|
|
116
116
|
/**
|
|
117
117
|
* @param {Callback<Timer>} callback
|
|
118
118
|
* @param {TimelinePosition} [position]
|
|
@@ -164,7 +164,7 @@ import type { TargetsParam } from '../types/index.js';
|
|
|
164
164
|
import type { AnimationParams } from '../types/index.js';
|
|
165
165
|
import type { TimelinePosition } from '../types/index.js';
|
|
166
166
|
import type { StaggerFunction } from '../types/index.js';
|
|
167
|
-
import type { TweakRegister } from '
|
|
167
|
+
import type { TweakRegister } from '../types/index.js';
|
|
168
168
|
import type { TimerParams } from '../types/index.js';
|
|
169
169
|
import type { Tickable } from '../types/index.js';
|
|
170
170
|
import type { WAAPIAnimation } from '../waapi/waapi.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - timeline - ESM
|
|
3
|
-
* @version v4.
|
|
3
|
+
* @version v4.5.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -32,6 +32,7 @@ import { parseTimelinePosition } from './position.js';
|
|
|
32
32
|
* TimelinePosition,
|
|
33
33
|
* StaggerFunction,
|
|
34
34
|
* TargetsArray,
|
|
35
|
+
* TweakRegister,
|
|
35
36
|
* } from '../types/index.js'
|
|
36
37
|
*/
|
|
37
38
|
|
|
@@ -41,8 +42,6 @@ import { parseTimelinePosition } from './position.js';
|
|
|
41
42
|
* } from '../waapi/waapi.js'
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
|
-
/** @import {TweakRegister} from 'tweaks' */
|
|
45
|
-
|
|
46
45
|
/**
|
|
47
46
|
* @param {Timeline} tl
|
|
48
47
|
* @return {Number}
|
|
@@ -235,13 +234,21 @@ class Timeline extends Timer {
|
|
|
235
234
|
if (!isUnd(synced) && !isUnd(/** @type {WAAPIAnimation} */(synced).persist)) {
|
|
236
235
|
/** @type {WAAPIAnimation} */(synced).persist = true;
|
|
237
236
|
}
|
|
238
|
-
|
|
237
|
+
const editor = globals.editor;
|
|
238
|
+
const childHook = editor && editor.addTimelineChild;
|
|
239
|
+
if (editor && editor.addTimelineSync) {
|
|
240
|
+
position = editor.addTimelineSync(synced, position, this.id);
|
|
241
|
+
editor.addTimelineChild = null; // Suppress the per-child hook for the internal .add, sync already registered.
|
|
242
|
+
}
|
|
243
|
+
const result = this.add(synced, { currentTime: [0, duration], duration, delay: 0, ease: 'linear', playbackEase: 'linear' }, position);
|
|
244
|
+
if (editor) editor.addTimelineChild = childHook;
|
|
245
|
+
return result;
|
|
239
246
|
}
|
|
240
247
|
|
|
241
248
|
/**
|
|
242
249
|
* @param {TargetsParam} targets
|
|
243
250
|
* @param {AnimationParams} parameters
|
|
244
|
-
* @param {TimelinePosition} [position]
|
|
251
|
+
* @param {TimelinePosition|StaggerFunction<Number|String>|TweakRegister} [position]
|
|
245
252
|
* @return {this}
|
|
246
253
|
*/
|
|
247
254
|
set(targets, parameters, position) {
|
|
@@ -258,6 +265,7 @@ class Timeline extends Timer {
|
|
|
258
265
|
*/
|
|
259
266
|
call(callback, position) {
|
|
260
267
|
if (isUnd(callback) || callback && !isFnc(callback)) return this;
|
|
268
|
+
if (globals.editor && globals.editor.addTimelineCall) position = globals.editor.addTimelineCall(callback, position, this.id);
|
|
261
269
|
return this.add({ duration: 0, delay: 0, onComplete: () => callback(this) }, position);
|
|
262
270
|
}
|
|
263
271
|
|
|
@@ -269,6 +277,7 @@ class Timeline extends Timer {
|
|
|
269
277
|
*/
|
|
270
278
|
label(labelName, position) {
|
|
271
279
|
if (isUnd(labelName) || labelName && !isStr(labelName)) return this;
|
|
280
|
+
if (globals.editor && globals.editor.addTimelineLabel) position = globals.editor.addTimelineLabel(labelName, position, this.id);
|
|
272
281
|
this.labels[labelName] = parseTimelinePosition(this, position);
|
|
273
282
|
return this;
|
|
274
283
|
}
|
|
@@ -27,17 +27,36 @@ export type Renderable = JSAnimation | Timeline;
|
|
|
27
27
|
export type Tickable = Timer | Renderable;
|
|
28
28
|
export type CallbackArgument = Timer & JSAnimation & Timeline;
|
|
29
29
|
export type Revertible = Animatable | Tickable | WAAPIAnimation | Draggable | ScrollObserver | TextSplitter | Scope | AutoLayout;
|
|
30
|
+
export type TweakRegister = {
|
|
31
|
+
type: string;
|
|
32
|
+
defaultValue: any;
|
|
33
|
+
};
|
|
30
34
|
export type StaggerFunction<T> = (target?: Target, index?: number, targets?: TargetsArray, prevTween?: Tween | null, tl?: Timeline) => T;
|
|
31
35
|
export type StaggerParams = {
|
|
32
36
|
start?: number | string;
|
|
33
37
|
from?: number | "first" | "center" | "last" | "random" | Array<number>;
|
|
34
38
|
reversed?: boolean;
|
|
35
39
|
grid?: Array<number> | boolean;
|
|
36
|
-
axis?: ("x" | "y");
|
|
37
|
-
use?: string |
|
|
40
|
+
axis?: ("x" | "y" | "z");
|
|
41
|
+
use?: string | {
|
|
42
|
+
method(target: Target, i: number, length: number): number;
|
|
43
|
+
}["method"];
|
|
38
44
|
total?: number;
|
|
39
45
|
ease?: EasingParam;
|
|
40
46
|
modifier?: TweenModifier;
|
|
47
|
+
/**
|
|
48
|
+
* Additive uniform noise on the
|
|
49
|
+
* computed stagger value. Number form gives flat `+/-jitter`; tuple form
|
|
50
|
+
* ramps the magnitude `start -> end` across the from/axis/grid ordering
|
|
51
|
+
* and respects `ease`.
|
|
52
|
+
*/
|
|
53
|
+
jitter?: number | [number, number];
|
|
54
|
+
/**
|
|
55
|
+
* Seed for jitter draws and `from: 'random'`
|
|
56
|
+
* shuffling. `false` (default) uses Math.random. `true` seeds with `0`. A
|
|
57
|
+
* number is used directly as the seed.
|
|
58
|
+
*/
|
|
59
|
+
seed?: boolean | number;
|
|
41
60
|
};
|
|
42
61
|
export type DOMTarget = HTMLElement | SVGElement;
|
|
43
62
|
export type JSTarget = Record<string, any>;
|
|
@@ -89,7 +108,9 @@ export type SpringParams = {
|
|
|
89
108
|
*/
|
|
90
109
|
onComplete?: Callback<JSAnimation>;
|
|
91
110
|
};
|
|
92
|
-
export type Callback<T> =
|
|
111
|
+
export type Callback<T> = {
|
|
112
|
+
method(self: T): any;
|
|
113
|
+
}["method"];
|
|
93
114
|
export type TickableCallbacks<T extends unknown> = {
|
|
94
115
|
onBegin?: Callback<T>;
|
|
95
116
|
onBeforeUpdate?: Callback<T>;
|
|
@@ -115,7 +136,8 @@ export type TimerOptions = {
|
|
|
115
136
|
priority?: number;
|
|
116
137
|
};
|
|
117
138
|
export type TimerParams = TimerOptions & TickableCallbacks<Timer>;
|
|
118
|
-
export type
|
|
139
|
+
export type FunctionValueReturn = number | string | TweenKeyValue | EasingParam | Array<number | string | TweenKeyValue>;
|
|
140
|
+
export type FunctionValue<T = FunctionValueReturn> = (target?: Target, index?: number, targets?: TargetsArray, prevTween?: Tween | null) => T;
|
|
119
141
|
export type TweenModifier = (value: number) => number | string;
|
|
120
142
|
export type ColorArray = [number, number, number, number];
|
|
121
143
|
export type Tween = {
|
|
@@ -123,7 +145,7 @@ export type Tween = {
|
|
|
123
145
|
parent: JSAnimation;
|
|
124
146
|
property: string;
|
|
125
147
|
target: Target;
|
|
126
|
-
_value: string | number;
|
|
148
|
+
_value: string | number | any;
|
|
127
149
|
_toFunc: Function | null;
|
|
128
150
|
_fromFunc: Function | null;
|
|
129
151
|
_ease: EasingFunction;
|
|
@@ -142,7 +164,11 @@ export type Tween = {
|
|
|
142
164
|
_startTime: number;
|
|
143
165
|
_changeDuration: number;
|
|
144
166
|
_absoluteStartTime: number;
|
|
167
|
+
_absoluteUpdateStartTime: number;
|
|
168
|
+
_absoluteEndTime: number;
|
|
169
|
+
_hasFromValue: number;
|
|
145
170
|
_tweenType: tweenTypes;
|
|
171
|
+
_setter: ((target: any, value: number, tween: Tween) => void) | null;
|
|
146
172
|
_valueType: valueTypes;
|
|
147
173
|
_composition: number;
|
|
148
174
|
_isOverlapped: number;
|
|
@@ -174,11 +200,11 @@ export type TweenDecomposedValue = {
|
|
|
174
200
|
*/
|
|
175
201
|
o: string;
|
|
176
202
|
/**
|
|
177
|
-
* - Array of Numbers (
|
|
203
|
+
* - Array of Numbers (complex / color value type)
|
|
178
204
|
*/
|
|
179
205
|
d: Array<number>;
|
|
180
206
|
/**
|
|
181
|
-
* - Strings (
|
|
207
|
+
* - Strings (complex value type)
|
|
182
208
|
*/
|
|
183
209
|
s: Array<string>;
|
|
184
210
|
};
|
|
@@ -189,7 +215,7 @@ export type TweenPropertySiblings = {
|
|
|
189
215
|
export type TweenLookups = Record<string, TweenPropertySiblings>;
|
|
190
216
|
export type TweenReplaceLookups = WeakMap<Target, TweenLookups>;
|
|
191
217
|
export type TweenAdditiveLookups = Map<Target, TweenLookups>;
|
|
192
|
-
export type TweenParamValue = number | string | FunctionValue | EasingParam;
|
|
218
|
+
export type TweenParamValue = number | string | FunctionValue | EasingParam | TweakRegister;
|
|
193
219
|
export type TweenPropValue = TweenParamValue | [TweenParamValue, TweenParamValue];
|
|
194
220
|
export type TweenComposition = (string & {}) | "none" | "replace" | "blend" | compositionTypes;
|
|
195
221
|
export type TweenParamsOptions = {
|
|
@@ -290,7 +316,7 @@ export type AnimatablePropertyParamsOptions = {
|
|
|
290
316
|
modifier?: TweenModifier;
|
|
291
317
|
composition?: TweenComposition;
|
|
292
318
|
};
|
|
293
|
-
export type AnimatableParams = Record<string, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> &
|
|
319
|
+
export type AnimatableParams = Record<string, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions | Callback<JSAnimation>> & AnimatablePropertyParamsOptions & TickableCallbacks<JSAnimation> & RenderableCallbacks<JSAnimation>;
|
|
294
320
|
export type ReactRef = {
|
|
295
321
|
current?: HTMLElement | SVGElement | null;
|
|
296
322
|
};
|
|
@@ -305,7 +331,7 @@ export type ScopeParams = {
|
|
|
305
331
|
export type ScopedCallback<T> = (scope: Scope) => T;
|
|
306
332
|
export type ScopeCleanupCallback = (scope?: Scope) => any;
|
|
307
333
|
export type ScopeConstructorCallback = (scope?: Scope) => ScopeCleanupCallback | void;
|
|
308
|
-
export type ScopeMethod = (...args: any[]) =>
|
|
334
|
+
export type ScopeMethod = (...args: any[]) => any;
|
|
309
335
|
export type ScrollThresholdValue = string | number;
|
|
310
336
|
export type ScrollThresholdParam = {
|
|
311
337
|
target?: ScrollThresholdValue;
|
|
@@ -475,6 +501,5 @@ import type { TextSplitter } from '../text/split.js';
|
|
|
475
501
|
import type { Scope } from '../scope/scope.js';
|
|
476
502
|
import type { AutoLayout } from '../layout/layout.js';
|
|
477
503
|
import type { Spring } from '../easings/spring/index.js';
|
|
478
|
-
import type { TweakRegister } from 'tweaks';
|
|
479
504
|
import type { tweenTypes } from '../core/consts.js';
|
|
480
505
|
import type { valueTypes } from '../core/consts.js';
|