@visactor/vrender-animate 0.23.0-alpha.3 → 1.0.0-alpha.1
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/cjs/animate-extension.d.ts +1 -3
- package/cjs/animate-extension.js +0 -7
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +1 -5
- package/cjs/animate.js +12 -12
- package/cjs/animate.js.map +1 -1
- package/cjs/component/component-animator.d.ts +3 -2
- package/cjs/component/component-animator.js +18 -32
- package/cjs/component/component-animator.js.map +1 -1
- package/cjs/custom/clip-graphic.d.ts +1 -1
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +1 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +1 -2
- package/cjs/custom/common.js +12 -10
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.d.ts +2 -4
- package/cjs/custom/custom-animate.js +2 -2
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/fade.d.ts +1 -1
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/from-to.d.ts +9 -0
- package/cjs/custom/from-to.js +38 -0
- package/cjs/custom/from-to.js.map +1 -0
- package/cjs/custom/group-fade.d.ts +8 -14
- package/cjs/custom/group-fade.js +9 -50
- package/cjs/custom/group-fade.js.map +1 -1
- package/cjs/custom/growAngle.d.ts +2 -2
- package/cjs/custom/growAngle.js +17 -12
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.d.ts +1 -2
- package/cjs/custom/growCenter.js +8 -7
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.d.ts +1 -3
- package/cjs/custom/growHeight.js +7 -7
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.d.ts +1 -2
- package/cjs/custom/growPoints.js +19 -17
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.d.ts +4 -5
- package/cjs/custom/growRadius.js +12 -12
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.d.ts +1 -3
- package/cjs/custom/growWidth.js +7 -6
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/input-text.d.ts +1 -2
- package/cjs/custom/input-text.js.map +1 -1
- package/cjs/custom/label-item-animate.js +2 -2
- package/cjs/custom/label-item-animate.js.map +1 -1
- package/cjs/custom/move.d.ts +92 -0
- package/cjs/custom/move.js +131 -0
- package/cjs/custom/move.js.map +1 -0
- package/cjs/custom/number.d.ts +1 -2
- package/cjs/custom/number.js.map +1 -1
- package/cjs/custom/poptip-animate.js +2 -1
- package/cjs/custom/poptip-animate.js.map +1 -1
- package/cjs/custom/register.js +21 -2
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +33 -0
- package/cjs/custom/richtext/input-richtext.js +70 -0
- package/cjs/custom/richtext/input-richtext.js.map +1 -0
- package/cjs/custom/richtext/output-richtext.d.ts +37 -0
- package/cjs/custom/richtext/output-richtext.js +94 -0
- package/cjs/custom/richtext/output-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/cjs/custom/richtext/slide-out-richtext.js +146 -0
- package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
- package/cjs/custom/richtext/slide-richtext.js +144 -0
- package/cjs/custom/richtext/slide-richtext.js.map +1 -0
- package/cjs/custom/rotate.d.ts +33 -0
- package/cjs/custom/rotate.js +76 -0
- package/cjs/custom/rotate.js.map +1 -0
- package/cjs/custom/scale.d.ts +2 -2
- package/cjs/custom/scale.js +25 -21
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.js +1 -2
- package/cjs/custom/state.d.ts +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.d.ts +128 -0
- package/cjs/custom/story.js +347 -0
- package/cjs/custom/story.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +2 -3
- package/cjs/custom/tag-points.js +18 -5
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.d.ts +2 -1
- package/cjs/custom/update.js +10 -2
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +6 -5
- package/cjs/executor/animate-executor.js +57 -29
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/executor/executor.d.ts +6 -3
- package/cjs/executor/executor.js.map +1 -1
- package/cjs/index.d.ts +3 -6
- package/cjs/index.js +16 -4
- package/cjs/index.js.map +1 -1
- package/cjs/interpolate/store.d.ts +2 -2
- package/cjs/interpolate/store.js +2 -0
- package/cjs/interpolate/store.js.map +1 -1
- package/cjs/state/animation-state.d.ts +2 -2
- package/cjs/state/animation-state.js +3 -3
- package/cjs/state/animation-state.js.map +1 -1
- package/cjs/state/graphic-extension.d.ts +1 -1
- package/cjs/state/graphic-extension.js.map +1 -1
- package/cjs/step.d.ts +2 -4
- package/cjs/step.js +1 -1
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +2 -3
- package/cjs/ticker/default-ticker.js +14 -12
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +1 -1
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +1 -2
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/easing-func.js +2 -1
- package/dist/index.es.js +1859 -554
- package/es/animate-extension.d.ts +1 -3
- package/es/animate-extension.js +0 -7
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +1 -5
- package/es/animate.js +1 -3
- package/es/animate.js.map +1 -1
- package/es/component/component-animator.d.ts +3 -2
- package/es/component/component-animator.js +18 -32
- package/es/component/component-animator.js.map +1 -1
- package/es/custom/clip-graphic.d.ts +1 -1
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +1 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +1 -2
- package/es/custom/common.js +12 -10
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.d.ts +2 -4
- package/es/custom/custom-animate.js +2 -2
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/fade.d.ts +1 -1
- package/es/custom/fade.js.map +1 -1
- package/es/custom/from-to.d.ts +9 -0
- package/es/custom/from-to.js +30 -0
- package/es/custom/from-to.js.map +1 -0
- package/es/custom/group-fade.d.ts +8 -14
- package/es/custom/group-fade.js +9 -50
- package/es/custom/group-fade.js.map +1 -1
- package/es/custom/growAngle.d.ts +2 -2
- package/es/custom/growAngle.js +20 -12
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.d.ts +1 -2
- package/es/custom/growCenter.js +8 -7
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.d.ts +1 -3
- package/es/custom/growHeight.js +8 -8
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.d.ts +1 -2
- package/es/custom/growPoints.js +19 -17
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.d.ts +4 -5
- package/es/custom/growRadius.js +12 -10
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.d.ts +1 -3
- package/es/custom/growWidth.js +8 -7
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/input-text.d.ts +1 -2
- package/es/custom/input-text.js.map +1 -1
- package/es/custom/label-item-animate.js +2 -2
- package/es/custom/label-item-animate.js.map +1 -1
- package/es/custom/move.d.ts +92 -0
- package/es/custom/move.js +116 -0
- package/es/custom/move.js.map +1 -0
- package/es/custom/number.d.ts +1 -2
- package/es/custom/number.js.map +1 -1
- package/es/custom/poptip-animate.js +2 -1
- package/es/custom/poptip-animate.js.map +1 -1
- package/es/custom/register.js +41 -16
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +33 -0
- package/es/custom/richtext/input-richtext.js +64 -0
- package/es/custom/richtext/input-richtext.js.map +1 -0
- package/es/custom/richtext/output-richtext.d.ts +37 -0
- package/es/custom/richtext/output-richtext.js +88 -0
- package/es/custom/richtext/output-richtext.js.map +1 -0
- package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/es/custom/richtext/slide-out-richtext.js +140 -0
- package/es/custom/richtext/slide-out-richtext.js.map +1 -0
- package/es/custom/richtext/slide-richtext.d.ts +36 -0
- package/es/custom/richtext/slide-richtext.js +138 -0
- package/es/custom/richtext/slide-richtext.js.map +1 -0
- package/es/custom/rotate.d.ts +33 -0
- package/es/custom/rotate.js +62 -0
- package/es/custom/rotate.js.map +1 -0
- package/es/custom/scale.d.ts +2 -2
- package/es/custom/scale.js +25 -21
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.js +1 -2
- package/es/custom/state.d.ts +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.d.ts +128 -0
- package/es/custom/story.js +323 -0
- package/es/custom/story.js.map +1 -0
- package/es/custom/tag-points.d.ts +2 -3
- package/es/custom/tag-points.js +19 -6
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.d.ts +2 -1
- package/es/custom/update.js +10 -2
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +6 -5
- package/es/executor/animate-executor.js +55 -29
- package/es/executor/animate-executor.js.map +1 -1
- package/es/executor/executor.d.ts +6 -3
- package/es/executor/executor.js.map +1 -1
- package/es/index.d.ts +3 -6
- package/es/index.js +4 -10
- package/es/index.js.map +1 -1
- package/es/interpolate/store.d.ts +2 -2
- package/es/interpolate/store.js +2 -0
- package/es/interpolate/store.js.map +1 -1
- package/es/state/animation-state.d.ts +2 -2
- package/es/state/animation-state.js +4 -2
- package/es/state/animation-state.js.map +1 -1
- package/es/state/graphic-extension.d.ts +1 -1
- package/es/state/graphic-extension.js.map +1 -1
- package/es/step.d.ts +2 -4
- package/es/step.js +2 -2
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +2 -3
- package/es/ticker/default-ticker.js +5 -5
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +1 -1
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +1 -2
- package/es/timeline.js +1 -1
- package/es/timeline.js.map +1 -1
- package/es/utils/easing-func.js +2 -1
- package/package.json +5 -5
- package/cjs/custom/label-animate.d.ts +0 -4
- package/cjs/custom/label-animate.js +0 -48
- package/cjs/custom/label-animate.js.map +0 -1
- package/cjs/intreface/animate.d.ts +0 -92
- package/cjs/intreface/animate.js +0 -10
- package/cjs/intreface/animate.js.map +0 -1
- package/cjs/intreface/easing.d.ts +0 -3
- package/cjs/intreface/easing.js +0 -6
- package/cjs/intreface/easing.js.map +0 -1
- package/cjs/intreface/ticker.d.ts +0 -37
- package/cjs/intreface/ticker.js +0 -11
- package/cjs/intreface/ticker.js.map +0 -1
- package/cjs/intreface/timeline.d.ts +0 -17
- package/cjs/intreface/timeline.js +0 -6
- package/cjs/intreface/timeline.js.map +0 -1
- package/cjs/intreface/type.d.ts +0 -13
- package/cjs/intreface/type.js +0 -15
- package/cjs/intreface/type.js.map +0 -1
- package/es/custom/label-animate.d.ts +0 -4
- package/es/custom/label-animate.js +0 -42
- package/es/custom/label-animate.js.map +0 -1
- package/es/intreface/animate.d.ts +0 -92
- package/es/intreface/animate.js +0 -6
- package/es/intreface/animate.js.map +0 -1
- package/es/intreface/easing.d.ts +0 -3
- package/es/intreface/easing.js +0 -2
- package/es/intreface/easing.js.map +0 -1
- package/es/intreface/ticker.d.ts +0 -37
- package/es/intreface/ticker.js +0 -7
- package/es/intreface/ticker.js.map +0 -1
- package/es/intreface/timeline.d.ts +0 -17
- package/es/intreface/timeline.js +0 -2
- package/es/intreface/timeline.js.map +0 -1
- package/es/intreface/type.d.ts +0 -13
- package/es/intreface/type.js +0 -14
- package/es/intreface/type.js.map +0 -1
|
@@ -28,7 +28,7 @@ export class AnimateExecutor {
|
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
30
30
|
parseParams(params, isTimeline) {
|
|
31
|
-
var _a;
|
|
31
|
+
var _a, _b;
|
|
32
32
|
const totalTime = this.resolveValue(params.totalTime, void 0, void 0), startTime = this.resolveValue(params.startTime, void 0, 0), parsedParams = Object.assign({}, params);
|
|
33
33
|
parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
|
|
34
34
|
const oneByOne = this.resolveValue(params.oneByOne, void 0, !1);
|
|
@@ -52,8 +52,8 @@ export class AnimateExecutor {
|
|
|
52
52
|
delayAfter: slice.delayAfter * scale,
|
|
53
53
|
duration: slice.duration * scale,
|
|
54
54
|
effects: effects.map((effect => {
|
|
55
|
-
var _a;
|
|
56
|
-
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[effect.type], customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
55
|
+
var _a, _b;
|
|
56
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"], customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
57
57
|
return Object.assign(Object.assign({}, effect), {
|
|
58
58
|
custom: custom,
|
|
59
59
|
customType: customType
|
|
@@ -68,7 +68,7 @@ export class AnimateExecutor {
|
|
|
68
68
|
let oneByOneDelay = 0, oneByOneTime = 0;
|
|
69
69
|
oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = duration + oneByOneTime),
|
|
70
70
|
parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay,
|
|
71
|
-
parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[params.type];
|
|
71
|
+
parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
|
|
72
72
|
const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
|
|
73
73
|
if (parsedParams.customType = customType, totalTime) {
|
|
74
74
|
const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2), scale = totalTime ? totalTime / _totalTime : 1;
|
|
@@ -80,7 +80,10 @@ export class AnimateExecutor {
|
|
|
80
80
|
return parsedParams;
|
|
81
81
|
}
|
|
82
82
|
execute(params) {
|
|
83
|
-
|
|
83
|
+
Array.isArray(params) ? params.forEach((param => this._execute(param))) : this._execute(params);
|
|
84
|
+
}
|
|
85
|
+
_execute(params) {
|
|
86
|
+
if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
|
|
84
87
|
const isTimeline = "timeSlices" in params;
|
|
85
88
|
let filteredChildren;
|
|
86
89
|
isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter((child => {
|
|
@@ -101,23 +104,28 @@ export class AnimateExecutor {
|
|
|
101
104
|
filteredChildren ? filteredChildren.forEach(((child, index) => cb(child, index, filteredChildren.length))) : this._target.count <= 1 ? cb(this._target, 0, 1) : this._target.forEachChildren(((child, index) => cb(child, index, this._target.count - 1)));
|
|
102
105
|
}
|
|
103
106
|
executeTypeConfigItem(params, graphic, index, count) {
|
|
104
|
-
var _a, _b, _c, _d, _e;
|
|
105
|
-
const {type: type, channel: channel, customParameters: customParameters, easing: easing = "linear", delay: delay = 0, delayAfter: delayAfter = 0, duration: duration = 300, startTime: startTime = 0, oneByOneDelay: oneByOneDelay = 0, loop: loop, bounce: bounce, priority: priority = 0, options: options, custom: custom, customType: customType, controlOptions: controlOptions} = params, animate = graphic.animate();
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
108
|
+
const {type: type = "fromTo", channel: channel, customParameters: customParameters, easing: easing = "linear", delay: delay = 0, delayAfter: delayAfter = 0, duration: duration = 300, startTime: startTime = 0, oneByOneDelay: oneByOneDelay = 0, loop: loop, bounce: bounce, priority: priority = 0, options: options, custom: custom, customType: customType, controlOptions: controlOptions} = params, animate = graphic.animate();
|
|
106
109
|
animate.priority = priority;
|
|
107
|
-
const delayValue = delay
|
|
108
|
-
datum && indexKey && (index = null !== (
|
|
109
|
-
animate.startAt(startTime);
|
|
110
|
+
const delayValue = isFunction(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay, datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
|
|
111
|
+
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index),
|
|
112
|
+
animate.startAt(startTime + delayValue);
|
|
110
113
|
const wait = index * oneByOneDelay;
|
|
111
|
-
wait > 0 && animate.wait(wait)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
wait > 0 && animate.wait(wait);
|
|
115
|
+
let parsedFromProps = null, props = params.to, from = params.from;
|
|
116
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)),
|
|
117
|
+
props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)),
|
|
118
|
+
from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic),
|
|
119
|
+
oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1));
|
|
120
|
+
const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
121
|
+
return delayAfterValue > 0 && animate.wait(delayAfterValue), loop && loop > 0 && animate.loop(loop),
|
|
122
|
+
bounce && animate.bounce(!0), animate;
|
|
123
|
+
}
|
|
124
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
|
|
125
|
+
var _a, _b, _c, _d;
|
|
118
126
|
if (custom && customType) {
|
|
119
|
-
const customParams = this.resolveValue(customParameters, graphic, {}), objOptions = isFunction(options) ? options.call(null, customParameters.data &&
|
|
120
|
-
customParams.options = objOptions, 1 === customType ? this.createCustomAnimation(animate, custom, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
127
|
+
const customParams = this.resolveValue(customParameters, graphic, {}), objOptions = isFunction(options) ? options.call(null, null !== (_b = customParameters && (null === (_a = customParameters.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParameters) : options;
|
|
128
|
+
customParams.options = objOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
121
129
|
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
122
130
|
}
|
|
123
131
|
executeTimelineItem(params, graphic, index, count) {
|
|
@@ -132,12 +140,15 @@ export class AnimateExecutor {
|
|
|
132
140
|
})), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
133
141
|
}
|
|
134
142
|
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
135
|
-
|
|
143
|
+
var _a, _b, _c, _d;
|
|
144
|
+
const {effects: effects, duration: duration = 300, delay: delay = 0, delayAfter: delayAfter = 0} = slice, delayValue = isFunction(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay, delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : delayAfter;
|
|
136
145
|
delayValue > 0 && animate.wait(delayValue);
|
|
137
146
|
(Array.isArray(effects) ? effects : [ effects ]).forEach((effect => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
const {type: type = "fromTo", channel: channel, customParameters: customParameters, easing: easing = "linear", options: options} = effect;
|
|
148
|
+
let parsedFromProps = null, props = effect.to, from = effect.from;
|
|
149
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)),
|
|
150
|
+
props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)),
|
|
151
|
+
from = parsedFromProps.from), this._handleRunAnimate(animate, effect.custom, effect.customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
141
152
|
})), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
142
153
|
}
|
|
143
154
|
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
@@ -148,22 +159,37 @@ export class AnimateExecutor {
|
|
|
148
159
|
interpolator(ratio, from, to, step, target, animate.target, customParams);
|
|
149
160
|
}, animate.to(props, duration, easing);
|
|
150
161
|
}
|
|
151
|
-
createCustomAnimation(animate, CustomAnimateConstructor, props, duration, easing, customParams) {
|
|
152
|
-
const customAnimate = new CustomAnimateConstructor(
|
|
162
|
+
createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
|
|
163
|
+
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
153
164
|
animate.play(customAnimate);
|
|
154
165
|
}
|
|
155
166
|
createPropsFromChannel(channel, graphic) {
|
|
156
167
|
const props = {};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
let from = null;
|
|
169
|
+
return channel ? (Array.isArray(channel) ? channel.forEach((key => {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
|
|
172
|
+
void 0 !== value && (props[key] = value);
|
|
173
|
+
})) : Object.entries(channel).forEach((([key, config]) => {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data, graphic, {}) : props[key] = config.to),
|
|
176
|
+
void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_b = graphic.context) || void 0 === _b ? void 0 : _b.data, graphic, {}) : from[key] = config.from);
|
|
177
|
+
})), {
|
|
178
|
+
from: from,
|
|
179
|
+
props: props
|
|
180
|
+
}) : {
|
|
181
|
+
from: from,
|
|
182
|
+
props: props
|
|
183
|
+
};
|
|
161
184
|
}
|
|
162
185
|
resolveValue(value, graphic, defaultValue) {
|
|
163
186
|
var _a;
|
|
164
187
|
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data, graphic, {}) : value;
|
|
165
188
|
}
|
|
166
189
|
executeItem(params, graphic, index = 0, count = 1) {
|
|
190
|
+
return Array.isArray(params) ? params.map((param => this._executeItem(param, graphic, index, count))).filter(Boolean) : [ this._executeItem(params, graphic, index, count) ].filter(Boolean);
|
|
191
|
+
}
|
|
192
|
+
_executeItem(params, graphic, index = 0, count = 1) {
|
|
167
193
|
if (!graphic) return null;
|
|
168
194
|
const isTimeline = "timeSlices" in params;
|
|
169
195
|
let animate = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/executor/animate-executor.ts"],"names":[],"mappings":"AAeA,OAAO,EAAa,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASlE,MAAM,OAAO,eAAe;IAG1B,MAAM,CAAC,sBAAsB,CAAC,IA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1D,IAAI,UAAU,EAAE;YAEd,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAkC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC/F;aAAM;YAEL,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,YAAoC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACnG;QAGD,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAKD,IAAI,CAAC,IAA4C;QAE/C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACrC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAGD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAGtB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;;AAjnBM,iCAAiB,GAAgD,EAAE,CAAC","file":"animate-executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type {\n IAnimationConfig,\n IAnimationTimeline,\n IAnimationTypeConfig,\n MarkFunctionCallback,\n MarkFunctionValueType,\n IAnimationTimeSlice,\n IAnimationChannelAttrs,\n IAnimationChannelAttributes,\n IAnimationCustomConstructor,\n IAnimationChannelInterpolator\n} from './executor';\nimport type { EasingType } from '../intreface/easing';\nimport type { IAnimate } from '../intreface/animate';\nimport { cloneDeep, isArray, isFunction } from '@visactor/vutils';\n\ninterface IAnimateExecutor {\n execute: (params: IAnimationConfig) => void;\n executeItem: (params: IAnimationConfig, graphic: IGraphic, index?: number) => IAnimate | null;\n onStart: (cb?: () => void) => void;\n onEnd: (cb?: () => void) => void;\n}\n\nexport class AnimateExecutor implements IAnimateExecutor {\n static builtInAnimateMap: Record<string, IAnimationCustomConstructor> = {};\n\n static registerBuiltInAnimate(name: string, animate: IAnimationCustomConstructor) {\n AnimateExecutor.builtInAnimateMap[name] = animate;\n }\n\n declare _target: IGraphic;\n\n // 所有动画实例\n private _animates: IAnimate[] = [];\n\n // 动画开始回调\n private _startCallbacks: (() => void)[] = [];\n // 动画结束回调\n private _endCallbacks: (() => void)[] = [];\n\n // 是否已经开始动画\n private _started: boolean = false;\n\n // 当前正在运行的动画数量\n private _activeCount: number = 0;\n\n constructor(target: IGraphic) {\n this._target = target;\n }\n\n /**\n * 注册一个回调,当动画开始时调用\n */\n onStart(cb?: () => void): void {\n if (cb) {\n this._startCallbacks.push(cb);\n\n // 如果动画已经开始,立即调用回调\n if (this._started && this._activeCount > 0) {\n cb();\n }\n } else {\n this._startCallbacks.forEach(cb => {\n cb();\n });\n }\n }\n\n /**\n * 注册一个回调,当所有动画结束时调用\n */\n onEnd(cb?: () => void): void {\n if (cb) {\n this._endCallbacks.push(cb);\n } else {\n this._endCallbacks.forEach(cb => {\n cb();\n });\n }\n }\n\n /**\n * 跟踪动画并附加生命周期钩子\n */\n private _trackAnimation(animate: IAnimate): void {\n this._animates.push(animate);\n this._activeCount++;\n\n // 如果这是第一个正在运行的动画,触发onStart回调\n if (this._activeCount === 1 && !this._started) {\n this._started = true;\n this.onStart();\n }\n\n // 处理动画完成\n animate.onEnd(() => {\n this._activeCount--;\n\n // 从跟踪的动画中移除\n const index = this._animates.indexOf(animate);\n if (index >= 0) {\n this._animates.splice(index, 1);\n }\n\n // 如果所有动画都已完成,触发onEnd回调\n if (this._activeCount === 0 && this._started) {\n this._started = false;\n this.onEnd();\n }\n });\n }\n\n parseParams(params: IAnimationConfig, isTimeline: boolean): IAnimationConfig {\n const totalTime = this.resolveValue(params.totalTime, undefined, undefined);\n const startTime = this.resolveValue(params.startTime, undefined, 0);\n\n // execute只在mark层面调用,所以性能影响可以忽略\n // TODO 存在性能问题,如果后续调用频繁,需要重新修改\n const parsedParams: Record<string, any> = { ...params };\n parsedParams.oneByOneDelay = 0;\n parsedParams.startTime = startTime;\n parsedParams.totalTime = totalTime;\n\n const oneByOne = this.resolveValue(params.oneByOne, undefined, false);\n\n if (isTimeline) {\n const timeSlices = (parsedParams as IAnimationTimeline).timeSlices;\n if (!isArray(timeSlices)) {\n (parsedParams as IAnimationTimeline).timeSlices = [timeSlices];\n }\n let sliceTime = 0;\n ((parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]).forEach(slice => {\n slice.delay = this.resolveValue(slice.delay, undefined, 0);\n slice.delayAfter = this.resolveValue(slice.delayAfter, undefined, 0);\n slice.duration = this.resolveValue(slice.duration, undefined, 300);\n sliceTime += slice.delay + slice.duration + slice.delayAfter;\n });\n let oneByOneDelay = 0;\n let oneByOneTime = 0;\n if (oneByOne) {\n oneByOneTime = Number(oneByOne);\n oneByOneDelay = oneByOneTime;\n }\n parsedParams.oneByOne = oneByOneTime;\n parsedParams.oneByOneDelay = oneByOneDelay;\n\n if (totalTime) {\n const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);\n const scale = totalTime ? totalTime / _totalTime : 1;\n ((parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]) = (\n (parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]\n ).map(slice => {\n let effects = slice.effects;\n if (!Array.isArray(effects)) {\n effects = [effects];\n }\n return {\n ...slice,\n delay: (slice.delay as number) * scale,\n delayAfter: (slice.delayAfter as number) * scale,\n duration: (slice.duration as number) * scale,\n effects: effects.map(effect => {\n const custom = effect.custom ?? AnimateExecutor.builtInAnimateMap[effect.type as any];\n const customType =\n custom && isFunction(custom) ? (/^class\\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;\n return {\n ...effect,\n custom,\n customType\n };\n })\n };\n });\n parsedParams.oneByOne = oneByOneTime * scale;\n parsedParams.oneByOneDelay = oneByOneDelay * scale;\n (parsedParams as IAnimationTimeline).startTime = startTime * scale;\n }\n } else {\n const delay = this.resolveValue((params as IAnimationTypeConfig).delay, undefined, 0);\n const delayAfter = this.resolveValue((params as IAnimationTypeConfig).delayAfter, undefined, 0);\n const duration = this.resolveValue((params as IAnimationTypeConfig).duration, undefined, 300);\n\n let oneByOneDelay = 0;\n let oneByOneTime = 0;\n if (oneByOne) {\n oneByOneTime = Number(oneByOne);\n oneByOneDelay = duration + oneByOneTime;\n }\n parsedParams.oneByOne = oneByOneTime;\n parsedParams.oneByOneDelay = oneByOneDelay;\n parsedParams.custom =\n (params as IAnimationTypeConfig).custom ??\n AnimateExecutor.builtInAnimateMap[(params as IAnimationTypeConfig).type];\n\n const customType =\n parsedParams.custom && isFunction(parsedParams.custom)\n ? /^class\\s/.test(Function.prototype.toString.call(parsedParams.custom))\n ? 1\n : 2\n : 0;\n parsedParams.customType = customType;\n\n if (totalTime) {\n const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2);\n const scale = totalTime ? totalTime / _totalTime : 1;\n parsedParams.delay = delay * scale;\n parsedParams.delayAfter = delayAfter * scale;\n parsedParams.duration = duration * scale;\n parsedParams.oneByOne = oneByOneTime * scale;\n parsedParams.oneByOneDelay = oneByOneDelay * scale;\n (parsedParams as IAnimationTypeConfig).startTime = startTime;\n }\n }\n\n return parsedParams;\n }\n\n /**\n * 执行动画,针对一组元素\n */\n execute(params: IAnimationConfig) {\n if (params.selfOnly) {\n return this.executeItem(params, this._target, 0, 1);\n }\n\n // 判断是否为timeline配置\n const isTimeline = 'timeSlices' in params;\n\n // 筛选符合条件的子图元\n let filteredChildren: IGraphic[];\n\n // 如果设置了partitioner,则进行筛选\n if (isTimeline && params.partitioner) {\n filteredChildren = (filteredChildren ?? (this._target.getChildren() as IGraphic[])).filter(child => {\n return (params as IAnimationTimeline).partitioner((child.context as any)?.data, child, {});\n });\n }\n\n // 如果需要排序,则进行排序\n if (isTimeline && (params as IAnimationTimeline).sort) {\n filteredChildren = filteredChildren ?? (this._target.getChildren() as IGraphic[]);\n filteredChildren.sort((a, b) => {\n return (params as IAnimationTimeline).sort((a.context as any)?.data, (b.context as any)?.data, a, b, {});\n });\n }\n\n const parsedParams = this.parseParams(params, isTimeline);\n\n const cb = isTimeline\n ? (child: IGraphic, index: number, count: number) => {\n // 执行单个图元的timeline动画\n const animate = this.executeTimelineItem(parsedParams as IAnimationTimeline, child, index, count);\n if (animate) {\n this._trackAnimation(animate);\n }\n }\n : (child: IGraphic, index: number, count: number) => {\n // 执行单个图元的config动画\n const animate = this.executeTypeConfigItem(parsedParams as IAnimationTypeConfig, child, index, count);\n if (animate) {\n this._trackAnimation(animate);\n }\n };\n\n // 执行每个图元的动画\n if (filteredChildren) {\n filteredChildren.forEach((child, index) => cb(child, index, filteredChildren.length));\n } else if (this._target.count <= 1) {\n cb(this._target, 0, 1);\n } else {\n this._target.forEachChildren((child, index) => cb(child as IGraphic, index, this._target.count - 1));\n }\n\n return;\n }\n\n /**\n * 执行 TypeConfig 类型的动画\n */\n private executeTypeConfigItem(\n params: IAnimationTypeConfig,\n graphic: IGraphic,\n index: number,\n count: number\n ): IAnimate {\n const {\n type,\n channel,\n customParameters,\n easing = 'linear',\n delay = 0,\n delayAfter = 0,\n duration = 300,\n startTime = 0,\n oneByOneDelay = 0,\n loop,\n bounce,\n priority = 0,\n options,\n custom,\n customType, // 0: undefined, 1: class, 2: function\n controlOptions\n } = params as any;\n\n // 创建动画实例\n const animate = graphic.animate() as unknown as IAnimate;\n animate.priority = priority;\n\n const delayValue = delay as number;\n\n // 如果设置了indexKey,则使用indexKey作为index\n const datum = graphic.context?.data?.[0];\n const indexKey = graphic.context?.indexKey;\n if (datum && indexKey) {\n index = datum[indexKey] ?? index;\n }\n\n // 设置开始时间\n animate.startAt(startTime as number);\n const wait = index * oneByOneDelay;\n wait > 0 && animate.wait(wait);\n\n // 添加延迟\n if (delayValue > 0) {\n animate.wait(delayValue);\n }\n\n // 根据 channel 配置创建属性对象\n const props = params.to ?? this.createPropsFromChannel(channel, graphic);\n\n this._handleRunAnimate(\n animate,\n custom,\n customType,\n props,\n duration as number,\n easing,\n customParameters,\n options,\n type,\n graphic\n );\n\n if (oneByOneDelay) {\n animate.wait(oneByOneDelay * (count - index - 1));\n }\n\n // 添加后延迟\n if ((delayAfter as number) > 0) {\n animate.wait(delayAfter as number);\n }\n\n // 设置循环\n if (loop && (loop as number) > 0) {\n animate.loop(loop as number);\n }\n\n // 设置反弹\n if (bounce) {\n animate.bounce(true);\n }\n\n return animate;\n }\n\n private _handleRunAnimate(\n animate: IAnimate,\n custom: IAnimationCustomConstructor | IAnimationChannelInterpolator,\n customType: number, // 0: undefined, 1: class, 2: function\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParameters: any,\n options: any,\n type: string,\n graphic: IGraphic\n ) {\n // 处理自定义动画\n if (custom && customType) {\n const customParams = this.resolveValue(customParameters, graphic, {});\n const objOptions = isFunction(options)\n ? options.call(null, customParameters.data && customParameters.data[0], graphic, customParameters)\n : options;\n customParams.options = objOptions;\n if (customType === 1) {\n // 自定义动画构造器 - 创建自定义动画类\n this.createCustomAnimation(\n animate,\n custom as IAnimationCustomConstructor,\n props,\n duration as number,\n easing,\n customParams\n );\n } else if (customType === 2) {\n // 自定义插值器 - 创建自定义插值动画\n this.createCustomInterpolatorAnimation(\n animate,\n custom as IAnimationChannelInterpolator,\n props,\n duration as number,\n easing,\n customParams\n );\n }\n } else if (type === 'to') {\n animate.to(props, duration as number, easing);\n } else if (type === 'from') {\n animate.from(props, duration as number, easing);\n }\n }\n\n /**\n * 执行 Timeline 类型的动画\n */\n private executeTimelineItem(params: IAnimationTimeline, graphic: IGraphic, index: number, count: number): IAnimate {\n const { timeSlices, startTime = 0, loop, bounce, oneByOneDelay, priority, controlOptions } = params as any;\n\n // 如果设置了indexKey,则使用indexKey作为index\n const datum = graphic.context?.data?.[0];\n const indexKey = graphic.context?.indexKey;\n if (datum && indexKey) {\n index = datum[indexKey] ?? index;\n }\n\n // 创建动画实例\n const animate = graphic.animate() as unknown as IAnimate;\n animate.priority = priority;\n\n // 设置开始时间\n animate.startAt(startTime as number);\n animate.wait(index * oneByOneDelay);\n\n // 设置循环\n if (loop && (loop as number) > 0) {\n animate.loop(loop as number);\n }\n\n // 设置反弹\n if (bounce) {\n animate.bounce(true);\n }\n\n // 处理时间切片\n const slices = Array.isArray(timeSlices) ? timeSlices : [timeSlices];\n\n slices.forEach(slice => {\n this.applyTimeSliceToAnimate(slice, animate, graphic);\n });\n\n // 后等待\n if (oneByOneDelay) {\n animate.wait(oneByOneDelay * (count - index - 1));\n }\n\n return animate;\n }\n\n /**\n * 将时间切片应用到动画实例\n */\n private applyTimeSliceToAnimate(slice: IAnimationTimeSlice, animate: IAnimate, graphic: IGraphic) {\n const { effects, duration = 300, delay = 0, delayAfter = 0 } = slice;\n\n // 解析时间参数\n // const durationValue = duration as number;\n const delayValue = delay as number;\n const delayAfterValue = delayAfter as number;\n\n // 添加延迟\n if (delayValue > 0) {\n animate.wait(delayValue);\n }\n\n // 处理动画效果\n const effectsArray = Array.isArray(effects) ? effects : [effects];\n\n effectsArray.forEach(effect => {\n const { type = 'to', channel, customParameters, easing = 'linear', options } = effect;\n\n // 根据 channel 配置创建属性对象\n const props = effect.to ?? this.createPropsFromChannel(channel, graphic);\n this._handleRunAnimate(\n animate,\n effect.custom,\n (effect as any).customType,\n props,\n duration as number,\n easing,\n customParameters,\n options,\n type,\n graphic\n );\n });\n\n // 添加后延迟\n if (delayAfterValue > 0) {\n animate.wait(delayAfterValue);\n }\n }\n\n /**\n * 创建自定义插值器动画\n */\n private createCustomInterpolatorAnimation(\n animate: IAnimate,\n interpolator: IAnimationChannelInterpolator,\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParams: any\n ) {\n // 获取动画目标的当前属性作为起始值\n const from: Record<string, any> = {};\n const to = props;\n\n // 为每个属性填充起始值\n Object.keys(to).forEach(key => {\n from[key] = animate.target.getComputedAttribute(key);\n });\n\n animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {\n interpolator(ratio, from, to, step, target, animate.target, customParams);\n };\n\n animate.to(props, duration, easing);\n }\n\n /**\n * 创建自定义动画类\n */\n private createCustomAnimation(\n animate: IAnimate,\n CustomAnimateConstructor: IAnimationCustomConstructor,\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParams: any\n ) {\n // 获取动画目标的当前属性作为起始值\n // const from: Record<string, any> = {};\n const to = props;\n\n // // 为每个属性填充起始值\n // Object.keys(to).forEach(key => {\n // from[key] = animate.target.getComputedAttribute(key);\n // });\n\n // 实例化自定义动画类\n // 自定义动画自己去计算from\n const customAnimate = new CustomAnimateConstructor(null, to, duration, easing, customParams);\n\n // 播放自定义动画\n animate.play(customAnimate);\n }\n\n /**\n * 从 channel 配置创建属性对象\n */\n private createPropsFromChannel(\n channel: IAnimationChannelAttrs | IAnimationChannelAttributes | undefined,\n graphic: IGraphic\n ): Record<string, any> {\n const props: Record<string, any> = {};\n\n if (!channel) {\n return props;\n }\n\n if (!Array.isArray(channel)) {\n // 如果是对象,解析 from/to 配置\n Object.entries(channel).forEach(([key, config]) => {\n if (config.to !== undefined) {\n if (typeof config.to === 'function') {\n props[key] = config.to((graphic.context as any)?.data, graphic, {});\n } else {\n props[key] = config.to;\n }\n }\n });\n }\n\n return props;\n }\n\n /**\n * 解析函数或值类型的配置项\n */\n private resolveValue<T>(value: MarkFunctionValueType<T> | undefined, graphic?: IGraphic, defaultValue?: T): T {\n if (value === undefined) {\n return defaultValue as T;\n }\n\n if (typeof value === 'function' && graphic) {\n return (value as MarkFunctionCallback<T>)((graphic.context as any)?.data, graphic, {});\n }\n\n return value as T;\n }\n\n /**\n * 执行动画(具体执行到内部的单个图元)\n */\n executeItem(params: IAnimationConfig, graphic: IGraphic, index: number = 0, count: number = 1): IAnimate | null {\n if (!graphic) {\n return null;\n }\n\n const isTimeline = 'timeSlices' in params;\n let animate: IAnimate | null = null;\n\n const parsedParams = this.parseParams(params, isTimeline);\n\n if (isTimeline) {\n // 处理 Timeline 类型的动画配置\n animate = this.executeTimelineItem(parsedParams as IAnimationTimeline, graphic, index, count);\n } else {\n // 处理 TypeConfig 类型的动画配置\n animate = this.executeTypeConfigItem(parsedParams as IAnimationTypeConfig, graphic, index, count);\n }\n\n // 跟踪动画以进行生命周期管理\n if (animate) {\n this._trackAnimation(animate);\n }\n\n return animate;\n }\n\n /**\n * 停止所有由该执行器管理的动画\n */\n stop(type?: 'start' | 'end' | Record<string, any>): void {\n // animate.stop会从数组里删除,所以需要while循环,不能forEach\n while (this._animates.length > 0) {\n const animate = this._animates.pop();\n animate?.stop(type);\n }\n\n // 清空动画实例数组\n this._animates = [];\n this._activeCount = 0;\n\n // 如果动画正在运行,触发结束回调\n if (this._started) {\n this._started = false;\n this.onEnd();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/executor/animate-executor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASvD,MAAM,OAAO,eAAe;IAG1B,MAAM,CAAC,sBAAsB,CAAC,IAAY,EAAE,OAAoC;QAC9E,eAAe,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACpD,CAAC;IAkBD,YAAY,MAAgB;QAbpB,cAAS,GAAe,EAAE,CAAC;QAG3B,oBAAe,GAAmB,EAAE,CAAC;QAErC,kBAAa,GAAmB,EAAE,CAAC;QAGnC,aAAQ,GAAY,KAAK,CAAC;QAG1B,iBAAY,GAAW,CAAC,CAAC;QAG/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAKD,OAAO,CAAC,EAAe;QACrB,IAAI,EAAE,EAAE;YACN,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAG9B,IAAI,IAAI,CAAC,QA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U,GAAG,YAAY,IAAI,MAAM,CAAC;QAC1C,IAAI,OAAO,GAAoB,IAAI,CAAC;QAEpC,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAE1D,IAAI,UAAU,EAAE;YAEd,OAAO,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAkC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC/F;aAAM;YAEL,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,YAAoC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACnG;QAGD,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAKD,IAAI,CAAC,IAA4C;QAE/C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACrC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAGD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAGtB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;;AAjsBM,iCAAiB,GAAgD,EAAE,CAAC","file":"animate-executor.js","sourcesContent":["import type { IGraphic, EasingType, IAnimate } from '@visactor/vrender-core';\nimport type {\n IAnimationConfig,\n IAnimationTimeline,\n IAnimationTypeConfig,\n MarkFunctionCallback,\n MarkFunctionValueType,\n IAnimationTimeSlice,\n IAnimationChannelAttrs,\n IAnimationChannelAttributes,\n IAnimationCustomConstructor,\n IAnimationChannelInterpolator\n} from './executor';\nimport { isArray, isFunction } from '@visactor/vutils';\n\ninterface IAnimateExecutor {\n execute: (params: IAnimationConfig) => void;\n executeItem: (params: IAnimationConfig, graphic: IGraphic, index?: number) => IAnimate[];\n onStart: (cb?: () => void) => void;\n onEnd: (cb?: () => void) => void;\n}\n\nexport class AnimateExecutor implements IAnimateExecutor {\n static builtInAnimateMap: Record<string, IAnimationCustomConstructor> = {};\n\n static registerBuiltInAnimate(name: string, animate: IAnimationCustomConstructor) {\n AnimateExecutor.builtInAnimateMap[name] = animate;\n }\n\n declare _target: IGraphic;\n\n // 所有动画实例\n private _animates: IAnimate[] = [];\n\n // 动画开始回调\n private _startCallbacks: (() => void)[] = [];\n // 动画结束回调\n private _endCallbacks: (() => void)[] = [];\n\n // 是否已经开始动画\n private _started: boolean = false;\n\n // 当前正在运行的动画数量\n private _activeCount: number = 0;\n\n constructor(target: IGraphic) {\n this._target = target;\n }\n\n /**\n * 注册一个回调,当动画开始时调用\n */\n onStart(cb?: () => void): void {\n if (cb) {\n this._startCallbacks.push(cb);\n\n // 如果动画已经开始,立即调用回调\n if (this._started && this._activeCount > 0) {\n cb();\n }\n } else {\n this._startCallbacks.forEach(cb => {\n cb();\n });\n }\n }\n\n /**\n * 注册一个回调,当所有动画结束时调用\n */\n onEnd(cb?: () => void): void {\n if (cb) {\n this._endCallbacks.push(cb);\n } else {\n this._endCallbacks.forEach(cb => {\n cb();\n });\n }\n }\n\n /**\n * 跟踪动画并附加生命周期钩子\n */\n private _trackAnimation(animate: IAnimate): void {\n this._animates.push(animate);\n this._activeCount++;\n\n // 如果这是第一个正在运行的动画,触发onStart回调\n if (this._activeCount === 1 && !this._started) {\n this._started = true;\n this.onStart();\n }\n\n // 处理动画完成\n animate.onEnd(() => {\n this._activeCount--;\n\n // 从跟踪的动画中移除\n const index = this._animates.indexOf(animate);\n if (index >= 0) {\n this._animates.splice(index, 1);\n }\n\n // 如果所有动画都已完成,触发onEnd回调\n if (this._activeCount === 0 && this._started) {\n this._started = false;\n this.onEnd();\n }\n });\n }\n\n parseParams(params: IAnimationConfig, isTimeline: boolean): IAnimationConfig {\n const totalTime = this.resolveValue(params.totalTime, undefined, undefined);\n const startTime = this.resolveValue(params.startTime, undefined, 0);\n\n // execute只在mark层面调用,所以性能影响可以忽略\n // TODO 存在性能问题,如果后续调用频繁,需要重新修改\n const parsedParams: Record<string, any> = { ...params };\n parsedParams.oneByOneDelay = 0;\n parsedParams.startTime = startTime;\n parsedParams.totalTime = totalTime;\n\n const oneByOne = this.resolveValue(params.oneByOne, undefined, false);\n\n if (isTimeline) {\n const timeSlices = (parsedParams as IAnimationTimeline).timeSlices;\n if (!isArray(timeSlices)) {\n (parsedParams as IAnimationTimeline).timeSlices = [timeSlices];\n }\n let sliceTime = 0;\n ((parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]).forEach(slice => {\n slice.delay = this.resolveValue(slice.delay, undefined, 0);\n slice.delayAfter = this.resolveValue(slice.delayAfter, undefined, 0);\n slice.duration = this.resolveValue(slice.duration, undefined, 300);\n sliceTime += slice.delay + slice.duration + slice.delayAfter;\n });\n let oneByOneDelay = 0;\n let oneByOneTime = 0;\n if (oneByOne) {\n oneByOneTime = Number(oneByOne);\n oneByOneDelay = oneByOneTime;\n }\n parsedParams.oneByOne = oneByOneTime;\n parsedParams.oneByOneDelay = oneByOneDelay;\n\n if (totalTime) {\n const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);\n const scale = totalTime ? totalTime / _totalTime : 1;\n ((parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]) = (\n (parsedParams as IAnimationTimeline).timeSlices as IAnimationTimeSlice[]\n ).map(slice => {\n let effects = slice.effects;\n if (!Array.isArray(effects)) {\n effects = [effects];\n }\n return {\n ...slice,\n delay: (slice.delay as number) * scale,\n delayAfter: (slice.delayAfter as number) * scale,\n duration: (slice.duration as number) * scale,\n effects: effects.map(effect => {\n const custom = effect.custom ?? AnimateExecutor.builtInAnimateMap[(effect.type as any) ?? 'fromTo'];\n const customType =\n custom && isFunction(custom) ? (/^class\\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;\n return {\n ...effect,\n custom,\n customType\n };\n })\n };\n });\n parsedParams.oneByOne = oneByOneTime * scale;\n parsedParams.oneByOneDelay = oneByOneDelay * scale;\n (parsedParams as IAnimationTimeline).startTime = startTime * scale;\n }\n } else {\n const delay = this.resolveValue((params as IAnimationTypeConfig).delay, undefined, 0);\n const delayAfter = this.resolveValue((params as IAnimationTypeConfig).delayAfter, undefined, 0);\n const duration = this.resolveValue((params as IAnimationTypeConfig).duration, undefined, 300);\n\n let oneByOneDelay = 0;\n let oneByOneTime = 0;\n if (oneByOne) {\n oneByOneTime = Number(oneByOne);\n oneByOneDelay = duration + oneByOneTime;\n }\n parsedParams.oneByOne = oneByOneTime;\n parsedParams.oneByOneDelay = oneByOneDelay;\n parsedParams.custom =\n (params as IAnimationTypeConfig).custom ??\n AnimateExecutor.builtInAnimateMap[(params as IAnimationTypeConfig).type ?? 'fromTo'];\n\n const customType =\n parsedParams.custom && isFunction(parsedParams.custom)\n ? /^class\\s/.test(Function.prototype.toString.call(parsedParams.custom))\n ? 1\n : 2\n : 0;\n parsedParams.customType = customType;\n\n if (totalTime) {\n const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2);\n const scale = totalTime ? totalTime / _totalTime : 1;\n parsedParams.delay = delay * scale;\n parsedParams.delayAfter = delayAfter * scale;\n parsedParams.duration = duration * scale;\n parsedParams.oneByOne = oneByOneTime * scale;\n parsedParams.oneByOneDelay = oneByOneDelay * scale;\n (parsedParams as IAnimationTypeConfig).startTime = startTime;\n }\n }\n\n return parsedParams;\n }\n\n execute(params: IAnimationConfig | IAnimationConfig[]) {\n if (Array.isArray(params)) {\n params.forEach(param => this._execute(param));\n } else {\n this._execute(params);\n }\n }\n\n /**\n * 执行动画,针对一组元素\n */\n _execute(params: IAnimationConfig) {\n if (params.selfOnly) {\n return this._executeItem(params, this._target, 0, 1);\n }\n\n // 判断是否为timeline配置\n const isTimeline = 'timeSlices' in params;\n\n // 筛选符合条件的子图元\n let filteredChildren: IGraphic[];\n\n // 如果设置了partitioner,则进行筛选\n if (isTimeline && params.partitioner) {\n filteredChildren = (filteredChildren ?? (this._target.getChildren() as IGraphic[])).filter(child => {\n return (params as IAnimationTimeline).partitioner((child.context as any)?.data, child, {});\n });\n }\n\n // 如果需要排序,则进行排序\n if (isTimeline && (params as IAnimationTimeline).sort) {\n filteredChildren = filteredChildren ?? (this._target.getChildren() as IGraphic[]);\n filteredChildren.sort((a, b) => {\n return (params as IAnimationTimeline).sort((a.context as any)?.data, (b.context as any)?.data, a, b, {});\n });\n }\n\n const parsedParams = this.parseParams(params, isTimeline);\n\n const cb = isTimeline\n ? (child: IGraphic, index: number, count: number) => {\n // 执行单个图元的timeline动画\n const animate = this.executeTimelineItem(parsedParams as IAnimationTimeline, child, index, count);\n if (animate) {\n this._trackAnimation(animate);\n }\n }\n : (child: IGraphic, index: number, count: number) => {\n // 执行单个图元的config动画\n const animate = this.executeTypeConfigItem(parsedParams as IAnimationTypeConfig, child, index, count);\n if (animate) {\n this._trackAnimation(animate);\n }\n };\n\n // 执行每个图元的动画\n if (filteredChildren) {\n filteredChildren.forEach((child, index) => cb(child, index, filteredChildren.length));\n } else if (this._target.count <= 1) {\n cb(this._target, 0, 1);\n } else {\n this._target.forEachChildren((child, index) => cb(child as IGraphic, index, this._target.count - 1));\n }\n\n return;\n }\n\n /**\n * 执行 TypeConfig 类型的动画\n */\n private executeTypeConfigItem(\n params: IAnimationTypeConfig,\n graphic: IGraphic,\n index: number,\n count: number\n ): IAnimate {\n const {\n type = 'fromTo',\n channel,\n customParameters,\n easing = 'linear',\n delay = 0,\n delayAfter = 0,\n duration = 300,\n startTime = 0,\n oneByOneDelay = 0,\n loop,\n bounce,\n priority = 0,\n options,\n custom,\n customType, // 0: undefined, 1: class, 2: function\n controlOptions\n } = params as any;\n\n // 创建动画实例\n const animate = graphic.animate() as unknown as IAnimate;\n animate.priority = priority;\n\n const delayValue = isFunction(delay) ? delay(graphic.context?.data?.[0], graphic, {}) : delay;\n\n // 如果设置了indexKey,则使用indexKey作为index\n const datum = graphic.context?.data?.[0];\n const indexKey = graphic.context?.indexKey;\n if (datum && indexKey) {\n index = datum[indexKey] ?? index;\n }\n\n // 设置开始时间\n animate.startAt((startTime as number) + delayValue);\n const wait = index * oneByOneDelay;\n wait > 0 && animate.wait(wait);\n\n // 放到startAt中,否则label无法确定主图元何时开始\n // // 添加延迟\n // if (delayValue > 0) {\n // animate.wait(delayValue);\n // }\n\n // 根据 channel 配置创建属性对象\n // 根据 channel 配置创建属性对象\n let parsedFromProps = null;\n let props = params.to;\n let from = params.from;\n if (!props) {\n if (!parsedFromProps) {\n parsedFromProps = this.createPropsFromChannel(channel, graphic);\n }\n props = parsedFromProps.props;\n }\n if (!from) {\n if (!parsedFromProps) {\n parsedFromProps = this.createPropsFromChannel(channel, graphic);\n }\n from = parsedFromProps.from;\n }\n\n this._handleRunAnimate(\n animate,\n custom,\n customType,\n from,\n props,\n duration as number,\n easing,\n customParameters,\n options,\n type,\n graphic\n );\n\n if (oneByOneDelay) {\n animate.wait(oneByOneDelay * (count - index - 1));\n }\n\n // 添加后延迟\n const delayAfterValue = isFunction(delayAfter) ? delayAfter(graphic.context?.data?.[0], graphic, {}) : delayAfter;\n if (delayAfterValue > 0) {\n animate.wait(delayAfterValue as number);\n }\n\n // 设置循环\n if (loop && (loop as number) > 0) {\n animate.loop(loop as number);\n }\n\n // 设置反弹\n if (bounce) {\n animate.bounce(true);\n }\n\n return animate;\n }\n\n private _handleRunAnimate(\n animate: IAnimate,\n custom: IAnimationCustomConstructor | IAnimationChannelInterpolator,\n customType: number, // 0: undefined, 1: class, 2: function\n from: Record<string, any> | null,\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParameters: any,\n options: any,\n type: string,\n graphic: IGraphic\n ) {\n // 处理自定义动画\n if (custom && customType) {\n const customParams = this.resolveValue(customParameters, graphic, {});\n const objOptions = isFunction(options)\n ? options.call(\n null,\n (customParameters && customParameters.data?.[0]) ?? graphic.context?.data?.[0],\n graphic,\n customParameters\n )\n : options;\n customParams.options = objOptions;\n if (customType === 1) {\n // 自定义动画构造器 - 创建自定义动画类\n this.createCustomAnimation(\n animate,\n custom as IAnimationCustomConstructor,\n from,\n props,\n duration as number,\n easing,\n customParams\n );\n } else if (customType === 2) {\n // 自定义插值器 - 创建自定义插值动画\n this.createCustomInterpolatorAnimation(\n animate,\n custom as IAnimationChannelInterpolator,\n props,\n duration as number,\n easing,\n customParams\n );\n }\n } else if (type === 'to') {\n animate.to(props, duration as number, easing);\n } else if (type === 'from') {\n animate.from(props, duration as number, easing);\n }\n }\n\n /**\n * 执行 Timeline 类型的动画\n */\n private executeTimelineItem(params: IAnimationTimeline, graphic: IGraphic, index: number, count: number): IAnimate {\n const { timeSlices, startTime = 0, loop, bounce, oneByOneDelay, priority, controlOptions } = params as any;\n\n // 如果设置了indexKey,则使用indexKey作为index\n const datum = graphic.context?.data?.[0];\n const indexKey = graphic.context?.indexKey;\n if (datum && indexKey) {\n index = datum[indexKey] ?? index;\n }\n\n // 创建动画实例\n const animate = graphic.animate() as unknown as IAnimate;\n animate.priority = priority;\n\n // 设置开始时间\n animate.startAt(startTime as number);\n animate.wait(index * oneByOneDelay);\n\n // 设置循环\n if (loop && (loop as number) > 0) {\n animate.loop(loop as number);\n }\n\n // 设置反弹\n if (bounce) {\n animate.bounce(true);\n }\n\n // 处理时间切片\n const slices = Array.isArray(timeSlices) ? timeSlices : [timeSlices];\n\n slices.forEach(slice => {\n this.applyTimeSliceToAnimate(slice, animate, graphic);\n });\n\n // 后等待\n if (oneByOneDelay) {\n animate.wait(oneByOneDelay * (count - index - 1));\n }\n\n return animate;\n }\n\n /**\n * 将时间切片应用到动画实例\n */\n private applyTimeSliceToAnimate(slice: IAnimationTimeSlice, animate: IAnimate, graphic: IGraphic) {\n const { effects, duration = 300, delay = 0, delayAfter = 0 } = slice;\n\n // 解析时间参数\n // const durationValue = duration as number;\n const delayValue = isFunction(delay) ? delay(graphic.context?.data?.[0], graphic, {}) : delay;\n const delayAfterValue = isFunction(delayAfter) ? delayAfter(graphic.context?.data?.[0], graphic, {}) : delayAfter;\n\n // 添加延迟\n if (delayValue > 0) {\n animate.wait(delayValue);\n }\n\n // 处理动画效果\n const effectsArray = Array.isArray(effects) ? effects : [effects];\n\n effectsArray.forEach(effect => {\n const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;\n\n // 根据 channel 配置创建属性对象\n let parsedFromProps = null;\n let props = effect.to;\n let from = effect.from;\n if (!props) {\n if (!parsedFromProps) {\n parsedFromProps = this.createPropsFromChannel(channel, graphic);\n }\n props = parsedFromProps.props;\n }\n if (!from) {\n if (!parsedFromProps) {\n parsedFromProps = this.createPropsFromChannel(channel, graphic);\n }\n from = parsedFromProps.from;\n }\n this._handleRunAnimate(\n animate,\n effect.custom,\n (effect as any).customType,\n from,\n props,\n duration as number,\n easing,\n customParameters,\n options,\n type,\n graphic\n );\n });\n\n // 添加后延迟\n if (delayAfterValue > 0) {\n animate.wait(delayAfterValue);\n }\n }\n\n /**\n * 创建自定义插值器动画\n */\n private createCustomInterpolatorAnimation(\n animate: IAnimate,\n interpolator: IAnimationChannelInterpolator,\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParams: any\n ) {\n // 获取动画目标的当前属性作为起始值\n const from: Record<string, any> = {};\n const to = props;\n\n // 为每个属性填充起始值\n Object.keys(to).forEach(key => {\n from[key] = animate.target.getComputedAttribute(key);\n });\n\n animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {\n interpolator(ratio, from, to, step, target, animate.target, customParams);\n };\n\n animate.to(props, duration, easing);\n }\n\n /**\n * 创建自定义动画类\n */\n private createCustomAnimation(\n animate: IAnimate,\n CustomAnimateConstructor: IAnimationCustomConstructor,\n from: Record<string, any> | null,\n props: Record<string, any>,\n duration: number,\n easing: EasingType,\n customParams: any\n ) {\n // 获取动画目标的当前属性作为起始值\n // const from: Record<string, any> = {};\n const to = props;\n\n // // 为每个属性填充起始值\n // Object.keys(to).forEach(key => {\n // from[key] = animate.target.getComputedAttribute(key);\n // });\n\n // 实例化自定义动画类\n // 自定义动画自己去计算from\n const customAnimate = new CustomAnimateConstructor(from, to, duration, easing, customParams);\n\n // 播放自定义动画\n animate.play(customAnimate);\n }\n\n /**\n * 从 channel 配置创建属性对象\n */\n private createPropsFromChannel(\n channel: IAnimationChannelAttrs | IAnimationChannelAttributes | undefined,\n graphic: IGraphic\n ): { from: Record<string, any> | null; props: Record<string, any> } {\n const props: Record<string, any> = {};\n let from: Record<string, any> | null = null;\n\n if (!channel) {\n return {\n from,\n props\n };\n }\n\n if (!Array.isArray(channel)) {\n // 如果是对象,解析 from/to 配置\n Object.entries(channel).forEach(([key, config]) => {\n if (config.to !== undefined) {\n if (typeof config.to === 'function') {\n props[key] = config.to((graphic.context as any)?.data, graphic, {});\n } else {\n props[key] = config.to;\n }\n }\n if (config.from !== undefined) {\n if (!from) {\n from = {};\n }\n if (typeof config.from === 'function') {\n from[key] = config.from((graphic.context as any)?.data, graphic, {});\n } else {\n from[key] = config.from;\n }\n }\n });\n } else {\n channel.forEach(key => {\n const value = graphic.context?.diffAttrs?.[key];\n if (value !== undefined) {\n props[key] = value;\n }\n });\n }\n\n return {\n from,\n props\n };\n }\n\n /**\n * 解析函数或值类型的配置项\n */\n private resolveValue<T>(value: MarkFunctionValueType<T> | undefined, graphic?: IGraphic, defaultValue?: T): T {\n if (value === undefined) {\n return defaultValue as T;\n }\n\n if (typeof value === 'function' && graphic) {\n return (value as MarkFunctionCallback<T>)((graphic.context as any)?.data, graphic, {});\n }\n\n return value as T;\n }\n\n executeItem(params: IAnimationConfig | IAnimationConfig[], graphic: IGraphic, index: number = 0, count: number = 1) {\n if (Array.isArray(params)) {\n return params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean);\n }\n return [this._executeItem(params, graphic, index, count)].filter(Boolean);\n }\n\n /**\n * 执行动画(具体执行到内部的单个图元)\n */\n _executeItem(params: IAnimationConfig, graphic: IGraphic, index: number = 0, count: number = 1): IAnimate | null {\n if (!graphic) {\n return null;\n }\n\n const isTimeline = 'timeSlices' in params;\n let animate: IAnimate | null = null;\n\n const parsedParams = this.parseParams(params, isTimeline);\n\n if (isTimeline) {\n // 处理 Timeline 类型的动画配置\n animate = this.executeTimelineItem(parsedParams as IAnimationTimeline, graphic, index, count);\n } else {\n // 处理 TypeConfig 类型的动画配置\n animate = this.executeTypeConfigItem(parsedParams as IAnimationTypeConfig, graphic, index, count);\n }\n\n // 跟踪动画以进行生命周期管理\n if (animate) {\n this._trackAnimation(animate);\n }\n\n return animate;\n }\n\n /**\n * 停止所有由该执行器管理的动画\n */\n stop(type?: 'start' | 'end' | Record<string, any>): void {\n // animate.stop会从数组里删除,所以需要while循环,不能forEach\n while (this._animates.length > 0) {\n const animate = this._animates.pop();\n animate?.stop(type);\n }\n\n // 清空动画实例数组\n this._animates = [];\n this._activeCount = 0;\n\n // 如果动画正在运行,触发结束回调\n if (this._started) {\n this._started = false;\n this.onEnd();\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import type { IGraphic, EasingType } from '@visactor/vrender-core';
|
|
3
2
|
import type { ACustomAnimate } from '../custom/custom-animate';
|
|
4
3
|
export type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;
|
|
5
4
|
export type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;
|
|
@@ -20,10 +19,13 @@ export interface IAnimationEffect {
|
|
|
20
19
|
type?: string;
|
|
21
20
|
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
22
21
|
to?: Record<string, any>;
|
|
22
|
+
from?: Record<string, any>;
|
|
23
23
|
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
24
24
|
customParameters?: MarkFunctionValueType<any>;
|
|
25
25
|
easing?: EasingType;
|
|
26
|
-
options?: MarkFunctionValueType<any
|
|
26
|
+
options?: MarkFunctionValueType<any> | {
|
|
27
|
+
excludeChannels?: string[];
|
|
28
|
+
};
|
|
27
29
|
}
|
|
28
30
|
export interface IAnimationTimeSlice {
|
|
29
31
|
effects: IAnimationEffect | IAnimationEffect[];
|
|
@@ -40,6 +42,7 @@ export interface IAnimationTypeConfig {
|
|
|
40
42
|
type?: string;
|
|
41
43
|
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
42
44
|
to?: Record<string, any>;
|
|
45
|
+
from?: Record<string, any>;
|
|
43
46
|
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
44
47
|
customParameters?: MarkFunctionValueType<any>;
|
|
45
48
|
easing?: EasingType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/executor/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/executor/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic, EasingType } from '@visactor/vrender-core';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 to 配置(和channel互斥,如果同时设置,以to为准) */\n to?: Record<string, any>;\n /** 动画 from 配置 */\n from?: Record<string, any>;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?:\n | MarkFunctionValueType<any>\n | {\n // 忽略的属性\n excludeChannels?: string[];\n };\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 to 配置(和channel互斥,如果同时设置,以to为准) */\n to?: Record<string, any>;\n /** 动画 from 配置 */\n from?: Record<string, any>;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置(如果有循环,只算一个周期) */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n /** 该动画是否需要忽略子图元 */\n selfOnly?: boolean;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n /** 该动画是否需要忽略子图元 */\n selfOnly?: boolean;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
|
package/es/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
export * from './intreface/animate';
|
|
2
|
-
export * from './intreface/timeline';
|
|
3
|
-
export * from './intreface/easing';
|
|
4
|
-
export * from './intreface/type';
|
|
5
1
|
export { Animate } from './animate';
|
|
6
2
|
export { DefaultTimeline } from './timeline';
|
|
7
3
|
export { ManualTicker } from './ticker/manual-ticker';
|
|
8
4
|
export { DefaultTicker } from './ticker/default-ticker';
|
|
9
|
-
export { Step } from './step';
|
|
5
|
+
export { Step as AnimateStep } from './step';
|
|
10
6
|
export * from './utils/easing-func';
|
|
11
7
|
export { registerAnimate } from './register';
|
|
12
|
-
export { ACustomAnimate } from './custom/custom-animate';
|
|
8
|
+
export { ACustomAnimate, AComponentAnimate } from './custom/custom-animate';
|
|
9
|
+
export { ComponentAnimator } from './component/component-animator';
|
|
13
10
|
export { IncreaseCount } from './custom/number';
|
|
14
11
|
export { InputText } from './custom/input-text';
|
|
15
12
|
export { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';
|
package/es/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export * from "./intreface/animate";
|
|
2
|
-
|
|
3
|
-
export * from "./intreface/timeline";
|
|
4
|
-
|
|
5
|
-
export * from "./intreface/easing";
|
|
6
|
-
|
|
7
|
-
export * from "./intreface/type";
|
|
8
|
-
|
|
9
1
|
export { Animate } from "./animate";
|
|
10
2
|
|
|
11
3
|
export { DefaultTimeline } from "./timeline";
|
|
@@ -14,13 +6,15 @@ export { ManualTicker } from "./ticker/manual-ticker";
|
|
|
14
6
|
|
|
15
7
|
export { DefaultTicker } from "./ticker/default-ticker";
|
|
16
8
|
|
|
17
|
-
export { Step } from "./step";
|
|
9
|
+
export { Step as AnimateStep } from "./step";
|
|
18
10
|
|
|
19
11
|
export * from "./utils/easing-func";
|
|
20
12
|
|
|
21
13
|
export { registerAnimate } from "./register";
|
|
22
14
|
|
|
23
|
-
export { ACustomAnimate } from "./custom/custom-animate";
|
|
15
|
+
export { ACustomAnimate, AComponentAnimate } from "./custom/custom-animate";
|
|
16
|
+
|
|
17
|
+
export { ComponentAnimator } from "./component/component-animator";
|
|
24
18
|
|
|
25
19
|
export { IncreaseCount } from "./custom/number";
|
|
26
20
|
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG7C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACtH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,cAAc,aAAa,CAAC","file":"index.js","sourcesContent":["// 导出实现\nexport { Animate } from './animate';\nexport { DefaultTimeline } from './timeline';\nexport { ManualTicker } from './ticker/manual-ticker';\nexport { DefaultTicker } from './ticker/default-ticker';\nexport { Step as AnimateStep } from './step';\n\n// 导出工具函数\nexport * from './utils/easing-func';\nexport { registerAnimate } from './register';\nexport { ACustomAnimate, AComponentAnimate } from './custom/custom-animate';\nexport { ComponentAnimator } from './component/component-animator';\nexport { IncreaseCount } from './custom/number';\nexport { InputText } from './custom/input-text';\nexport { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';\nexport { TagPointsUpdate } from './custom/tag-points';\nexport { GroupFadeIn, GroupFadeOut } from './custom/group-fade';\nexport { RotateBySphereAnimate } from './custom/sphere';\nexport { AnimateExecutor } from './executor/animate-executor';\nexport type { IAnimationConfig } from './executor/executor';\nexport { registerCustomAnimate } from './custom/register';\n// Export animation state modules\nexport * from './state';\nexport { AnimationTransitionRegistry } from './state/animation-states-registry';\nexport { transitionRegistry } from './state/animation-states-registry';\nexport { AnimationStateManager } from './state/animation-state';\nexport { AnimationStateStore } from './state/animation-state';\n\n// Export component animation modules\nexport * from './component';\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
-
import type { IStep } from '../intreface/animate';
|
|
1
|
+
import type { IGraphic, IStep } from '@visactor/vrender-core';
|
|
3
2
|
import type { IPointLike } from '@visactor/vutils';
|
|
4
3
|
export declare class InterpolateUpdateStore {
|
|
5
4
|
opacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
5
|
+
baseOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
6
6
|
fillOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
7
7
|
strokeOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
8
8
|
zIndex: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
package/es/interpolate/store.js
CHANGED
|
@@ -6,6 +6,8 @@ export class InterpolateUpdateStore {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.opacity = (key, from, to, ratio, step, target) => {
|
|
8
8
|
target.attribute.opacity = interpolateNumber(from, to, ratio);
|
|
9
|
+
}, this.baseOpacity = (key, from, to, ratio, step, target) => {
|
|
10
|
+
target.attribute.baseOpacity = interpolateNumber(from, to, ratio);
|
|
9
11
|
}, this.fillOpacity = (key, from, to, ratio, step, target) => {
|
|
10
12
|
target.attribute.fillOpacity = interpolateNumber(from, to, ratio);
|
|
11
13
|
}, this.strokeOpacity = (key, from, to, ratio, step, target) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interpolate/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAwD7C,MAAM,OAAO,sBAAsB;IAAnC;QACE,YAAO,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE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OAAO,IAAI,CAAC;KACb;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QAChF,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACzB,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;aACP;YACD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACpB;QACD,IAAI,KAAK,EAAE;YACR,MAAM,CAAC,SAAiB,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","file":"store.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation } from '@visactor/vrender-core';\nimport { interpolateNumber } from './number';\nimport type { IStep } from '../intreface/animate';\nimport type { IPointLike } from '@visactor/vutils';\n\n// 直接设置,触发 隐藏类(Hidden Class)优化:\n/**\n *\nconst a = { type: 1 };\nconst ITERATIONS = 1e7; // 测试次数\n\n// 动态生成 keys 数组(确保引擎无法静态推断 key)\nconst keys = [];\nfor (let i = 0; i < ITERATIONS; i++) {\n // 通过条件确保 key 动态变化(但实际始终为 'type',避免属性缺失的开销)\n keys.push(Math.random() < 0 ? 'other' : 'type');\n}\n\n// 测试字面量访问\nfunction testLiteral() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与动态测试完全一致)\n sum += a.type; // 差异仅在此处:使用字面量访问\n }\n return sum;\n}\n\n// 测试变量动态访问\nfunction testDynamic() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与字面量测试完全一致)\n sum += a[key]; // 差异仅在此处:使用变量访问\n }\n return sum;\n}\n\n// 预热(避免 JIT 编译影响)\ntestLiteral();\ntestDynamic();\n\n// 正式测试\nconsole.time('literal');\ntestLiteral();\nconsole.timeEnd('literal');\n\nconsole.time('dynamic');\ntestDynamic();\nconsole.timeEnd('dynamic');\n\n\n// out:\n// literal: 7.1259765625 ms\n// dynamic: 9.322998046875 ms\n */\n\nexport class InterpolateUpdateStore {\n opacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.opacity = interpolateNumber(from, to, ratio);\n };\n fillOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.fillOpacity = interpolateNumber(from, to, ratio);\n };\n strokeOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);\n };\n zIndex = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.zIndex = interpolateNumber(from, to, ratio);\n };\n backgroundOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);\n };\n shadowOffsetX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);\n };\n shadowOffsetY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);\n };\n shadowBlur = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowBlur = interpolateNumber(from, to, ratio);\n };\n fill = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolateColor(from, to, ratio, false) as any;\n };\n fillPure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = step.fromParsedProps.fill\n ? (interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio) as any)\n : step.toParsedProps.fill;\n };\n stroke = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolateColor(from, to, ratio, false);\n };\n strokePure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = step.fromParsedProps.stroke\n ? (interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio) as any)\n : step.toParsedProps.stroke;\n };\n\n // 需要更新Bounds\n width = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).width = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n height = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).height = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n x = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.x = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n y = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.y = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n angle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.angle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleX = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleY = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n lineWidth = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.lineWidth = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n startAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).startAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n endAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).endAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n radius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).radius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n outerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).outerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n innerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).innerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n size = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).size = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n points = (key: string, from: IPointLike[], to: IPointLike[], ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).points = pointsInterpolation(from, to, ratio);\n target.addUpdateBoundTag();\n };\n}\n\nexport const interpolateUpdateStore = new InterpolateUpdateStore();\n\nexport function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic) {\n if (Number.isFinite(to) && Number.isFinite(from)) {\n (target.attribute as any)[key] = from + (to - from) * ratio;\n return true;\n } else if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < to.length; i++) {\n const v = from[i];\n const val = v + (to[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n (target.attribute as any)[key] = nextList;\n }\n return true;\n }\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interpolate/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAuD7C,MAAM,OAAO,sBAAsB;IAAnC;QACE,YAAO,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YAChG,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,gBAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YACnG,MAAM,CAAC,SAAiB,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC,CAAC;QACF,gBAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YACpG,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;Q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C,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACzB,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;aACP;YACD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACpB;QACD,IAAI,KAAK,EAAE;YACR,MAAM,CAAC,SAAiB,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","file":"store.js","sourcesContent":["import type { IGraphic, IStep } from '@visactor/vrender-core';\nimport { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation } from '@visactor/vrender-core';\nimport { interpolateNumber } from './number';\nimport type { IPointLike } from '@visactor/vutils';\n\n// 直接设置,触发 隐藏类(Hidden Class)优化:\n/**\n *\nconst a = { type: 1 };\nconst ITERATIONS = 1e7; // 测试次数\n\n// 动态生成 keys 数组(确保引擎无法静态推断 key)\nconst keys = [];\nfor (let i = 0; i < ITERATIONS; i++) {\n // 通过条件确保 key 动态变化(但实际始终为 'type',避免属性缺失的开销)\n keys.push(Math.random() < 0 ? 'other' : 'type');\n}\n\n// 测试字面量访问\nfunction testLiteral() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与动态测试完全一致)\n sum += a.type; // 差异仅在此处:使用字面量访问\n }\n return sum;\n}\n\n// 测试变量动态访问\nfunction testDynamic() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与字面量测试完全一致)\n sum += a[key]; // 差异仅在此处:使用变量访问\n }\n return sum;\n}\n\n// 预热(避免 JIT 编译影响)\ntestLiteral();\ntestDynamic();\n\n// 正式测试\nconsole.time('literal');\ntestLiteral();\nconsole.timeEnd('literal');\n\nconsole.time('dynamic');\ntestDynamic();\nconsole.timeEnd('dynamic');\n\n\n// out:\n// literal: 7.1259765625 ms\n// dynamic: 9.322998046875 ms\n */\n\nexport class InterpolateUpdateStore {\n opacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.opacity = interpolateNumber(from, to, ratio);\n };\n baseOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).baseOpacity = interpolateNumber(from, to, ratio);\n };\n fillOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.fillOpacity = interpolateNumber(from, to, ratio);\n };\n strokeOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);\n };\n zIndex = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.zIndex = interpolateNumber(from, to, ratio);\n };\n backgroundOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);\n };\n shadowOffsetX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);\n };\n shadowOffsetY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);\n };\n shadowBlur = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowBlur = interpolateNumber(from, to, ratio);\n };\n fill = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolateColor(from, to, ratio, false) as any;\n };\n fillPure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = step.fromParsedProps.fill\n ? (interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio) as any)\n : step.toParsedProps.fill;\n };\n stroke = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolateColor(from, to, ratio, false);\n };\n strokePure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = step.fromParsedProps.stroke\n ? (interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio) as any)\n : step.toParsedProps.stroke;\n };\n\n // 需要更新Bounds\n width = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).width = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n height = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).height = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n x = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.x = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n y = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.y = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n angle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.angle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleX = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleY = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n lineWidth = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.lineWidth = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n startAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).startAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n endAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).endAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n radius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).radius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n outerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).outerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n innerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).innerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n size = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).size = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n points = (key: string, from: IPointLike[], to: IPointLike[], ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).points = pointsInterpolation(from, to, ratio);\n target.addUpdateBoundTag();\n };\n}\n\nexport const interpolateUpdateStore = new InterpolateUpdateStore();\n\nexport function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic) {\n if (Number.isFinite(to) && Number.isFinite(from)) {\n (target.attribute as any)[key] = from + (to - from) * ratio;\n return true;\n } else if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < to.length; i++) {\n const v = from[i];\n const val = v + (to[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n (target.attribute as any)[key] = nextList;\n }\n return true;\n }\n return false;\n}\n"]}
|
|
@@ -24,14 +24,14 @@ export declare class AnimationStateStore {
|
|
|
24
24
|
}
|
|
25
25
|
interface IStateInfo {
|
|
26
26
|
state: string;
|
|
27
|
-
animationConfig: IAnimationConfig;
|
|
27
|
+
animationConfig: IAnimationConfig | IAnimationConfig[];
|
|
28
28
|
executor: AnimateExecutor;
|
|
29
29
|
}
|
|
30
30
|
export declare class AnimationStateManager {
|
|
31
31
|
protected graphic: IGraphic;
|
|
32
32
|
stateList: IStateInfo[] | null;
|
|
33
33
|
constructor(graphic: IGraphic);
|
|
34
|
-
applyState(nextState: string[], animationConfig: IAnimationState[], callback?: (empty?: boolean) => void): void;
|
|
34
|
+
applyState(nextState: string[], animationConfig: (IAnimationState | IAnimationState[])[], callback?: (empty?: boolean) => void): void;
|
|
35
35
|
applyAppearState(animationConfig: IAnimationConfig, callback?: () => void): void;
|
|
36
36
|
applyDisappearState(animationConfig: IAnimationConfig, callback?: () => void): void;
|
|
37
37
|
applyUpdateState(animationConfig: IAnimationConfig, callback?: () => void): void;
|