animejs 4.1.4 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -8
- package/{lib → dist/bundles}/anime.esm.js +6476 -6106
- package/dist/bundles/anime.esm.min.js +7 -0
- package/dist/bundles/anime.umd.js +8809 -0
- package/dist/bundles/anime.umd.min.js +7 -0
- package/dist/modules/animatable/animatable.cjs +150 -0
- package/dist/modules/animatable/animatable.d.ts +28 -0
- package/dist/modules/animatable/animatable.js +147 -0
- package/dist/modules/animatable/index.cjs +15 -0
- package/dist/modules/animatable/index.d.ts +1 -0
- package/dist/modules/animatable/index.js +8 -0
- package/dist/modules/animation/additive.cjs +82 -0
- package/dist/modules/animation/additive.d.ts +15 -0
- package/dist/modules/animation/additive.js +79 -0
- package/dist/modules/animation/animation.cjs +667 -0
- package/dist/modules/animation/animation.d.ts +45 -0
- package/dist/modules/animation/animation.js +664 -0
- package/dist/modules/animation/composition.cjs +383 -0
- package/dist/modules/animation/composition.d.ts +10 -0
- package/dist/modules/animation/composition.js +377 -0
- package/dist/modules/animation/index.cjs +15 -0
- package/dist/modules/animation/index.d.ts +1 -0
- package/dist/modules/animation/index.js +8 -0
- package/dist/modules/core/clock.cjs +110 -0
- package/dist/modules/core/clock.d.ts +51 -0
- package/dist/modules/core/clock.js +108 -0
- package/dist/modules/core/colors.cjs +102 -0
- package/dist/modules/core/colors.d.ts +2 -0
- package/dist/modules/core/colors.js +100 -0
- package/dist/modules/core/consts.cjs +159 -0
- package/dist/modules/core/consts.d.ts +61 -0
- package/dist/modules/core/consts.js +124 -0
- package/dist/modules/core/globals.cjs +78 -0
- package/dist/modules/core/globals.d.ts +29 -0
- package/dist/modules/core/globals.js +73 -0
- package/dist/modules/core/helpers.cjs +304 -0
- package/dist/modules/core/helpers.d.ts +43 -0
- package/dist/modules/core/helpers.js +261 -0
- package/dist/modules/core/render.cjs +391 -0
- package/dist/modules/core/render.d.ts +4 -0
- package/dist/modules/core/render.js +388 -0
- package/dist/modules/core/styles.cjs +116 -0
- package/dist/modules/core/styles.d.ts +5 -0
- package/dist/modules/core/styles.js +113 -0
- package/dist/modules/core/targets.cjs +136 -0
- package/dist/modules/core/targets.d.ts +118 -0
- package/dist/modules/core/targets.js +132 -0
- package/dist/modules/core/transforms.cjs +49 -0
- package/dist/modules/core/transforms.d.ts +2 -0
- package/dist/modules/core/transforms.js +47 -0
- package/dist/modules/core/units.cjs +67 -0
- package/dist/modules/core/units.d.ts +3 -0
- package/dist/modules/core/units.js +65 -0
- package/dist/modules/core/values.cjs +226 -0
- package/dist/modules/core/values.d.ts +14 -0
- package/dist/modules/core/values.js +216 -0
- package/dist/modules/draggable/draggable.cjs +1226 -0
- package/dist/modules/draggable/draggable.d.ts +272 -0
- package/dist/modules/draggable/draggable.js +1223 -0
- package/dist/modules/draggable/index.cjs +15 -0
- package/dist/modules/draggable/index.d.ts +1 -0
- package/dist/modules/draggable/index.js +8 -0
- package/dist/modules/easings/cubic-bezier/index.cjs +64 -0
- package/dist/modules/easings/cubic-bezier/index.d.ts +2 -0
- package/dist/modules/easings/cubic-bezier/index.js +62 -0
- package/dist/modules/easings/eases/index.cjs +14 -0
- package/dist/modules/easings/eases/index.d.ts +1 -0
- package/dist/modules/easings/eases/index.js +8 -0
- package/dist/modules/easings/eases/parser.cjs +191 -0
- package/dist/modules/easings/eases/parser.d.ts +125 -0
- package/dist/modules/easings/eases/parser.js +185 -0
- package/dist/modules/easings/index.cjs +26 -0
- package/dist/modules/easings/index.d.ts +6 -0
- package/dist/modules/easings/index.js +13 -0
- package/dist/modules/easings/irregular/index.cjs +41 -0
- package/dist/modules/easings/irregular/index.d.ts +2 -0
- package/dist/modules/easings/irregular/index.js +39 -0
- package/dist/modules/easings/linear/index.cjs +59 -0
- package/dist/modules/easings/linear/index.d.ts +2 -0
- package/dist/modules/easings/linear/index.js +57 -0
- package/dist/modules/easings/none.cjs +19 -0
- package/dist/modules/easings/none.d.ts +8 -0
- package/dist/modules/easings/none.js +17 -0
- package/dist/modules/easings/spring/index.cjs +255 -0
- package/dist/modules/easings/spring/index.d.ts +53 -0
- package/dist/modules/easings/spring/index.js +251 -0
- package/dist/modules/easings/steps/index.cjs +30 -0
- package/dist/modules/easings/steps/index.d.ts +2 -0
- package/dist/modules/easings/steps/index.js +28 -0
- package/dist/modules/engine/engine.cjs +168 -0
- package/dist/modules/engine/engine.d.ts +21 -0
- package/dist/modules/engine/engine.js +166 -0
- package/dist/modules/engine/index.cjs +14 -0
- package/dist/modules/engine/index.d.ts +1 -0
- package/dist/modules/engine/index.js +8 -0
- package/dist/modules/events/index.cjs +16 -0
- package/dist/modules/events/index.d.ts +1 -0
- package/dist/modules/events/index.js +8 -0
- package/dist/modules/events/scroll.cjs +940 -0
- package/dist/modules/events/scroll.d.ts +191 -0
- package/dist/modules/events/scroll.js +936 -0
- package/dist/modules/index.cjs +102 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +41 -0
- package/dist/modules/scope/index.cjs +15 -0
- package/dist/modules/scope/index.d.ts +1 -0
- package/dist/modules/scope/index.js +8 -0
- package/dist/modules/scope/scope.cjs +254 -0
- package/dist/modules/scope/scope.d.ts +115 -0
- package/dist/modules/scope/scope.js +251 -0
- package/dist/modules/svg/drawable.cjs +119 -0
- package/dist/modules/svg/drawable.d.ts +3 -0
- package/dist/modules/svg/drawable.js +117 -0
- package/dist/modules/svg/helpers.cjs +30 -0
- package/dist/modules/svg/helpers.d.ts +2 -0
- package/dist/modules/svg/helpers.js +28 -0
- package/dist/modules/svg/index.cjs +18 -0
- package/dist/modules/svg/index.d.ts +3 -0
- package/dist/modules/svg/index.js +10 -0
- package/dist/modules/svg/morphto.cjs +58 -0
- package/dist/modules/svg/morphto.d.ts +3 -0
- package/dist/modules/svg/morphto.js +56 -0
- package/dist/modules/svg/motionpath.cjs +79 -0
- package/dist/modules/svg/motionpath.d.ts +7 -0
- package/dist/modules/svg/motionpath.js +77 -0
- package/dist/modules/text/index.cjs +16 -0
- package/dist/modules/text/index.d.ts +1 -0
- package/dist/modules/text/index.js +8 -0
- package/dist/modules/text/split.cjs +488 -0
- package/dist/modules/text/split.d.ts +62 -0
- package/dist/modules/text/split.js +484 -0
- package/dist/modules/timeline/index.cjs +15 -0
- package/dist/modules/timeline/index.d.ts +1 -0
- package/dist/modules/timeline/index.js +8 -0
- package/dist/modules/timeline/position.cjs +72 -0
- package/dist/modules/timeline/position.d.ts +3 -0
- package/dist/modules/timeline/position.js +70 -0
- package/dist/modules/timeline/timeline.cjs +312 -0
- package/dist/modules/timeline/timeline.d.ts +163 -0
- package/dist/modules/timeline/timeline.js +309 -0
- package/dist/modules/timer/index.cjs +15 -0
- package/dist/modules/timer/index.d.ts +1 -0
- package/dist/modules/timer/index.js +8 -0
- package/dist/modules/timer/timer.cjs +491 -0
- package/dist/modules/timer/timer.d.ts +141 -0
- package/dist/modules/timer/timer.js +488 -0
- package/dist/modules/types/index.d.ts +404 -0
- package/dist/modules/utils/chainable.cjs +190 -0
- package/dist/modules/utils/chainable.d.ts +135 -0
- package/dist/modules/utils/chainable.js +177 -0
- package/dist/modules/utils/index.cjs +43 -0
- package/dist/modules/utils/index.d.ts +5 -0
- package/dist/modules/utils/index.js +14 -0
- package/dist/modules/utils/number.cjs +97 -0
- package/dist/modules/utils/number.d.ts +9 -0
- package/dist/modules/utils/number.js +85 -0
- package/dist/modules/utils/random.cjs +77 -0
- package/dist/modules/utils/random.d.ts +22 -0
- package/dist/modules/utils/random.js +72 -0
- package/dist/modules/utils/stagger.cjs +122 -0
- package/dist/modules/utils/stagger.d.ts +30 -0
- package/dist/modules/utils/stagger.js +120 -0
- package/dist/modules/utils/target.cjs +130 -0
- package/dist/modules/utils/target.d.ts +126 -0
- package/dist/modules/utils/target.js +125 -0
- package/dist/modules/utils/time.cjs +57 -0
- package/dist/modules/utils/time.d.ts +5 -0
- package/dist/modules/utils/time.js +54 -0
- package/dist/modules/waapi/composition.cjs +95 -0
- package/dist/modules/waapi/composition.d.ts +4 -0
- package/dist/modules/waapi/composition.js +92 -0
- package/dist/modules/waapi/index.cjs +15 -0
- package/dist/modules/waapi/index.d.ts +1 -0
- package/dist/modules/waapi/index.js +8 -0
- package/dist/modules/waapi/waapi.cjs +492 -0
- package/dist/modules/waapi/waapi.d.ts +116 -0
- package/dist/modules/waapi/waapi.js +489 -0
- package/package.json +166 -33
- package/lib/anime.cjs +0 -9
- package/lib/anime.esm.min.js +0 -9
- package/lib/anime.iife.js +0 -9
- package/lib/anime.iife.min.js +0 -9
- package/lib/anime.min.cjs +0 -9
- package/lib/anime.umd.js +0 -9
- package/lib/anime.umd.min.js +0 -9
- package/lib/gui/index.js +0 -6341
- package/types/index.d.ts +0 -1127
- package/types/index.js +0 -7395
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - timeline - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { globals } from '../core/globals.js';
|
|
9
|
+
import { minValue, compositionTypes, tickModes } from '../core/consts.js';
|
|
10
|
+
import { mergeObjects, isObj, isFnc, isUnd, isStr, normalizeTime, forEachChildren, isNum, addChild, clampInfinity } from '../core/helpers.js';
|
|
11
|
+
import { setValue } from '../core/values.js';
|
|
12
|
+
import { parseTargets } from '../core/targets.js';
|
|
13
|
+
import { tick } from '../core/render.js';
|
|
14
|
+
import { cleanInlineStyles } from '../core/styles.js';
|
|
15
|
+
import { removeTargetsFromRenderable } from '../animation/composition.js';
|
|
16
|
+
import { JSAnimation } from '../animation/animation.js';
|
|
17
|
+
import { Timer } from '../timer/timer.js';
|
|
18
|
+
import { parseEase } from '../easings/eases/parser.js';
|
|
19
|
+
import { parseTimelinePosition } from './position.js';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @import {
|
|
23
|
+
* TargetsParam,
|
|
24
|
+
* Callback,
|
|
25
|
+
* Tickable,
|
|
26
|
+
* TimerParams,
|
|
27
|
+
* AnimationParams,
|
|
28
|
+
* Target,
|
|
29
|
+
* Renderable,
|
|
30
|
+
* TimelineParams,
|
|
31
|
+
* DefaultsParams,
|
|
32
|
+
* TimelinePosition,
|
|
33
|
+
* StaggerFunction,
|
|
34
|
+
* } from '../types/index.js'
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @import {
|
|
39
|
+
* WAAPIAnimation,
|
|
40
|
+
* } from '../waapi/waapi.js'
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {Timeline} tl
|
|
45
|
+
* @return {Number}
|
|
46
|
+
*/
|
|
47
|
+
function getTimelineTotalDuration(tl) {
|
|
48
|
+
return clampInfinity(((tl.iterationDuration + tl._loopDelay) * tl.iterationCount) - tl._loopDelay) || minValue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @overload
|
|
53
|
+
* @param {TimerParams} childParams
|
|
54
|
+
* @param {Timeline} tl
|
|
55
|
+
* @param {Number} timePosition
|
|
56
|
+
* @return {Timeline}
|
|
57
|
+
*
|
|
58
|
+
* @overload
|
|
59
|
+
* @param {AnimationParams} childParams
|
|
60
|
+
* @param {Timeline} tl
|
|
61
|
+
* @param {Number} timePosition
|
|
62
|
+
* @param {TargetsParam} targets
|
|
63
|
+
* @param {Number} [index]
|
|
64
|
+
* @param {Number} [length]
|
|
65
|
+
* @return {Timeline}
|
|
66
|
+
*
|
|
67
|
+
* @param {TimerParams|AnimationParams} childParams
|
|
68
|
+
* @param {Timeline} tl
|
|
69
|
+
* @param {Number} timePosition
|
|
70
|
+
* @param {TargetsParam} [targets]
|
|
71
|
+
* @param {Number} [index]
|
|
72
|
+
* @param {Number} [length]
|
|
73
|
+
*/
|
|
74
|
+
function addTlChild(childParams, tl, timePosition, targets, index, length) {
|
|
75
|
+
const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;
|
|
76
|
+
// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined position
|
|
77
|
+
const adjustedPosition = isSetter ? timePosition - minValue : timePosition;
|
|
78
|
+
tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);
|
|
79
|
+
const tlChild = targets ?
|
|
80
|
+
new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :
|
|
81
|
+
new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);
|
|
82
|
+
tlChild.init(1);
|
|
83
|
+
// TODO: Might be better to insert at a position relative to startTime?
|
|
84
|
+
addChild(tl, tlChild);
|
|
85
|
+
forEachChildren(tl, (/** @type {Renderable} */child) => {
|
|
86
|
+
const childTLOffset = child._offset + child._delay;
|
|
87
|
+
const childDur = childTLOffset + child.duration;
|
|
88
|
+
if (childDur > tl.iterationDuration) tl.iterationDuration = childDur;
|
|
89
|
+
});
|
|
90
|
+
tl.duration = getTimelineTotalDuration(tl);
|
|
91
|
+
return tl;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
class Timeline extends Timer {
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {TimelineParams} [parameters]
|
|
98
|
+
*/
|
|
99
|
+
constructor(parameters = {}) {
|
|
100
|
+
super(/** @type {TimerParams&TimelineParams} */(parameters), null, 0);
|
|
101
|
+
/** @type {Number} */
|
|
102
|
+
this.duration = 0; // TL duration starts at 0 and grows when adding children
|
|
103
|
+
/** @type {Record<String, Number>} */
|
|
104
|
+
this.labels = {};
|
|
105
|
+
const defaultsParams = parameters.defaults;
|
|
106
|
+
const globalDefaults = globals.defaults;
|
|
107
|
+
/** @type {DefaultsParams} */
|
|
108
|
+
this.defaults = defaultsParams ? mergeObjects(defaultsParams, globalDefaults) : globalDefaults;
|
|
109
|
+
/** @type {Callback<this>} */
|
|
110
|
+
this.onRender = parameters.onRender || globalDefaults.onRender;
|
|
111
|
+
const tlPlaybackEase = setValue(parameters.playbackEase, globalDefaults.playbackEase);
|
|
112
|
+
this._ease = tlPlaybackEase ? parseEase(tlPlaybackEase) : null;
|
|
113
|
+
/** @type {Number} */
|
|
114
|
+
this.iterationDuration = 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @overload
|
|
119
|
+
* @param {TargetsParam} a1
|
|
120
|
+
* @param {AnimationParams} a2
|
|
121
|
+
* @param {TimelinePosition|StaggerFunction<Number|String>} [a3]
|
|
122
|
+
* @return {this}
|
|
123
|
+
*
|
|
124
|
+
* @overload
|
|
125
|
+
* @param {TimerParams} a1
|
|
126
|
+
* @param {TimelinePosition} [a2]
|
|
127
|
+
* @return {this}
|
|
128
|
+
*
|
|
129
|
+
* @param {TargetsParam|TimerParams} a1
|
|
130
|
+
* @param {TimelinePosition|AnimationParams} a2
|
|
131
|
+
* @param {TimelinePosition|StaggerFunction<Number|String>} [a3]
|
|
132
|
+
*/
|
|
133
|
+
add(a1, a2, a3) {
|
|
134
|
+
const isAnim = isObj(a2);
|
|
135
|
+
const isTimer = isObj(a1);
|
|
136
|
+
if (isAnim || isTimer) {
|
|
137
|
+
this._hasChildren = true;
|
|
138
|
+
if (isAnim) {
|
|
139
|
+
const childParams = /** @type {AnimationParams} */(a2);
|
|
140
|
+
// Check for function for children stagger positions
|
|
141
|
+
if (isFnc(a3)) {
|
|
142
|
+
const staggeredPosition = a3;
|
|
143
|
+
const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));
|
|
144
|
+
// Store initial duration before adding new children that will change the duration
|
|
145
|
+
const tlDuration = this.duration;
|
|
146
|
+
// Store initial _iterationDuration before adding new children that will change the duration
|
|
147
|
+
const tlIterationDuration = this.iterationDuration;
|
|
148
|
+
// Store the original id in order to add specific indexes to the new animations ids
|
|
149
|
+
const id = childParams.id;
|
|
150
|
+
let i = 0;
|
|
151
|
+
/** @type {Number} */
|
|
152
|
+
const parsedLength = (parsedTargetsArray.length);
|
|
153
|
+
parsedTargetsArray.forEach((/** @type {Target} */target) => {
|
|
154
|
+
// Create a new parameter object for each staggered children
|
|
155
|
+
const staggeredChildParams = { ...childParams };
|
|
156
|
+
// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculation
|
|
157
|
+
this.duration = tlDuration;
|
|
158
|
+
this.iterationDuration = tlIterationDuration;
|
|
159
|
+
if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;
|
|
160
|
+
addTlChild(
|
|
161
|
+
staggeredChildParams,
|
|
162
|
+
this,
|
|
163
|
+
parseTimelinePosition(this, staggeredPosition(target, i, parsedLength, this)),
|
|
164
|
+
target,
|
|
165
|
+
i,
|
|
166
|
+
parsedLength
|
|
167
|
+
);
|
|
168
|
+
i++;
|
|
169
|
+
});
|
|
170
|
+
} else {
|
|
171
|
+
addTlChild(
|
|
172
|
+
childParams,
|
|
173
|
+
this,
|
|
174
|
+
parseTimelinePosition(this, a3),
|
|
175
|
+
/** @type {TargetsParam} */(a1),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
// It's a Timer
|
|
180
|
+
addTlChild(
|
|
181
|
+
/** @type TimerParams */(a1),
|
|
182
|
+
this,
|
|
183
|
+
parseTimelinePosition(this,a2),
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return this.init(1); // 1 = internalRender
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @overload
|
|
192
|
+
* @param {Tickable} [synced]
|
|
193
|
+
* @param {TimelinePosition} [position]
|
|
194
|
+
* @return {this}
|
|
195
|
+
*
|
|
196
|
+
* @overload
|
|
197
|
+
* @param {globalThis.Animation} [synced]
|
|
198
|
+
* @param {TimelinePosition} [position]
|
|
199
|
+
* @return {this}
|
|
200
|
+
*
|
|
201
|
+
* @overload
|
|
202
|
+
* @param {WAAPIAnimation} [synced]
|
|
203
|
+
* @param {TimelinePosition} [position]
|
|
204
|
+
* @return {this}
|
|
205
|
+
*
|
|
206
|
+
* @param {Tickable|WAAPIAnimation|globalThis.Animation} [synced]
|
|
207
|
+
* @param {TimelinePosition} [position]
|
|
208
|
+
*/
|
|
209
|
+
sync(synced, position) {
|
|
210
|
+
if (isUnd(synced) || synced && isUnd(synced.pause)) return this;
|
|
211
|
+
synced.pause();
|
|
212
|
+
const duration = +(/** @type {globalThis.Animation} */(synced).effect ? /** @type {globalThis.Animation} */(synced).effect.getTiming().duration : /** @type {Tickable} */(synced).duration);
|
|
213
|
+
return this.add(synced, { currentTime: [0, duration], duration, ease: 'linear' }, position);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {TargetsParam} targets
|
|
218
|
+
* @param {AnimationParams} parameters
|
|
219
|
+
* @param {TimelinePosition} [position]
|
|
220
|
+
* @return {this}
|
|
221
|
+
*/
|
|
222
|
+
set(targets, parameters, position) {
|
|
223
|
+
if (isUnd(parameters)) return this;
|
|
224
|
+
parameters.duration = minValue;
|
|
225
|
+
parameters.composition = compositionTypes.replace;
|
|
226
|
+
return this.add(targets, parameters, position);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @param {Callback<Timer>} callback
|
|
231
|
+
* @param {TimelinePosition} [position]
|
|
232
|
+
* @return {this}
|
|
233
|
+
*/
|
|
234
|
+
call(callback, position) {
|
|
235
|
+
if (isUnd(callback) || callback && !isFnc(callback)) return this;
|
|
236
|
+
return this.add({ duration: 0, onComplete: () => callback(this) }, position);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @param {String} labelName
|
|
241
|
+
* @param {TimelinePosition} [position]
|
|
242
|
+
* @return {this}
|
|
243
|
+
*
|
|
244
|
+
*/
|
|
245
|
+
label(labelName, position) {
|
|
246
|
+
if (isUnd(labelName) || labelName && !isStr(labelName)) return this;
|
|
247
|
+
this.labels[labelName] = parseTimelinePosition(this, position);
|
|
248
|
+
return this;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {TargetsParam} targets
|
|
253
|
+
* @param {String} [propertyName]
|
|
254
|
+
* @return {this}
|
|
255
|
+
*/
|
|
256
|
+
remove(targets, propertyName) {
|
|
257
|
+
removeTargetsFromRenderable(parseTargets(targets), this, propertyName);
|
|
258
|
+
return this;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @param {Number} newDuration
|
|
263
|
+
* @return {this}
|
|
264
|
+
*/
|
|
265
|
+
stretch(newDuration) {
|
|
266
|
+
const currentDuration = this.duration;
|
|
267
|
+
if (currentDuration === normalizeTime(newDuration)) return this;
|
|
268
|
+
const timeScale = newDuration / currentDuration;
|
|
269
|
+
const labels = this.labels;
|
|
270
|
+
forEachChildren(this, (/** @type {JSAnimation} */child) => child.stretch(child.duration * timeScale));
|
|
271
|
+
for (let labelName in labels) labels[labelName] *= timeScale;
|
|
272
|
+
return super.stretch(newDuration);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @return {this}
|
|
277
|
+
*/
|
|
278
|
+
refresh() {
|
|
279
|
+
forEachChildren(this, (/** @type {JSAnimation} */child) => {
|
|
280
|
+
if (child.refresh) child.refresh();
|
|
281
|
+
});
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @return {this}
|
|
287
|
+
*/
|
|
288
|
+
revert() {
|
|
289
|
+
super.revert();
|
|
290
|
+
forEachChildren(this, (/** @type {JSAnimation} */child) => child.revert, true);
|
|
291
|
+
return cleanInlineStyles(this);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @param {Callback<this>} [callback]
|
|
296
|
+
* @return {Promise}
|
|
297
|
+
*/
|
|
298
|
+
then(callback) {
|
|
299
|
+
return super.then(callback);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @param {TimelineParams} [parameters]
|
|
305
|
+
* @return {Timeline}
|
|
306
|
+
*/
|
|
307
|
+
const createTimeline = parameters => new Timeline(parameters).init();
|
|
308
|
+
|
|
309
|
+
export { Timeline, createTimeline };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - timer - CJS
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
var timer = require('./timer.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.Timer = timer.Timer;
|
|
15
|
+
exports.createTimer = timer.createTimer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./timer.js";
|