@visactor/vrender-animate 1.0.0-alpha.4 → 1.0.0-alpha.6

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.
Files changed (106) hide show
  1. package/cjs/animate.js +2 -1
  2. package/cjs/animate.js.map +1 -1
  3. package/cjs/config/morphing.d.ts +2 -0
  4. package/cjs/config/morphing.js +9 -0
  5. package/cjs/config/morphing.js.map +1 -0
  6. package/cjs/custom/clip-graphic.js +1 -1
  7. package/cjs/custom/clip-graphic.js.map +1 -1
  8. package/cjs/custom/clip.d.ts +1 -0
  9. package/cjs/custom/clip.js +6 -0
  10. package/cjs/custom/clip.js.map +1 -1
  11. package/cjs/custom/fade.js +6 -3
  12. package/cjs/custom/fade.js.map +1 -1
  13. package/cjs/custom/fromTo.js +2 -1
  14. package/cjs/custom/groupFade.js +1 -2
  15. package/cjs/custom/growHeight.js +4 -4
  16. package/cjs/custom/growHeight.js.map +1 -1
  17. package/cjs/custom/morphing.d.ts +51 -0
  18. package/cjs/custom/morphing.js +298 -0
  19. package/cjs/custom/morphing.js.map +1 -0
  20. package/cjs/custom/move.d.ts +4 -0
  21. package/cjs/custom/move.js +8 -7
  22. package/cjs/custom/move.js.map +1 -1
  23. package/cjs/custom/register.d.ts +2 -2
  24. package/cjs/custom/register.js +19 -1
  25. package/cjs/custom/register.js.map +1 -1
  26. package/cjs/custom/richtext/input-richtext.d.ts +4 -2
  27. package/cjs/custom/richtext/input-richtext.js +18 -9
  28. package/cjs/custom/richtext/input-richtext.js.map +1 -1
  29. package/cjs/custom/richtext/slide-richtext.js +1 -1
  30. package/cjs/custom/scale.js +3 -2
  31. package/cjs/custom/scale.js.map +1 -1
  32. package/cjs/custom/story.d.ts +68 -0
  33. package/cjs/custom/story.js +147 -2
  34. package/cjs/custom/story.js.map +1 -1
  35. package/cjs/executor/animate-executor.js +19 -18
  36. package/cjs/executor/animate-executor.js.map +1 -1
  37. package/cjs/index.d.ts +1 -0
  38. package/cjs/index.js +30 -1
  39. package/cjs/index.js.map +1 -1
  40. package/cjs/ticker/default-ticker.d.ts +3 -2
  41. package/cjs/ticker/default-ticker.js +9 -6
  42. package/cjs/ticker/default-ticker.js.map +1 -1
  43. package/cjs/ticker/manual-ticker.d.ts +2 -1
  44. package/cjs/ticker/manual-ticker.js +6 -4
  45. package/cjs/ticker/manual-ticker.js.map +1 -1
  46. package/cjs/timeline.d.ts +11 -3
  47. package/cjs/timeline.js +28 -15
  48. package/cjs/timeline.js.map +1 -1
  49. package/cjs/utils/easing-func.js +2 -1
  50. package/cjs/utils/transform.d.ts +2 -0
  51. package/cjs/utils/transform.js +10 -0
  52. package/cjs/utils/transform.js.map +1 -0
  53. package/dist/index.es.js +888 -85
  54. package/es/animate.js +2 -1
  55. package/es/animate.js.map +1 -1
  56. package/es/config/morphing.d.ts +2 -0
  57. package/es/config/morphing.js +5 -0
  58. package/es/config/morphing.js.map +1 -0
  59. package/es/custom/clip-graphic.js +1 -1
  60. package/es/custom/clip-graphic.js.map +1 -1
  61. package/es/custom/clip.d.ts +1 -0
  62. package/es/custom/clip.js +6 -0
  63. package/es/custom/clip.js.map +1 -1
  64. package/es/custom/fade.js +6 -3
  65. package/es/custom/fade.js.map +1 -1
  66. package/es/custom/fromTo.js +2 -1
  67. package/es/custom/groupFade.js +1 -2
  68. package/es/custom/growHeight.js +4 -4
  69. package/es/custom/growHeight.js.map +1 -1
  70. package/es/custom/morphing.d.ts +51 -0
  71. package/es/custom/morphing.js +289 -0
  72. package/es/custom/morphing.js.map +1 -0
  73. package/es/custom/move.d.ts +4 -0
  74. package/es/custom/move.js +7 -6
  75. package/es/custom/move.js.map +1 -1
  76. package/es/custom/register.d.ts +2 -2
  77. package/es/custom/register.js +7 -6
  78. package/es/custom/register.js.map +1 -1
  79. package/es/custom/richtext/input-richtext.d.ts +4 -2
  80. package/es/custom/richtext/input-richtext.js +18 -9
  81. package/es/custom/richtext/input-richtext.js.map +1 -1
  82. package/es/custom/richtext/slide-richtext.js +1 -1
  83. package/es/custom/scale.js +3 -2
  84. package/es/custom/scale.js.map +1 -1
  85. package/es/custom/story.d.ts +68 -0
  86. package/es/custom/story.js +140 -0
  87. package/es/custom/story.js.map +1 -1
  88. package/es/executor/animate-executor.js +20 -18
  89. package/es/executor/animate-executor.js.map +1 -1
  90. package/es/index.d.ts +1 -0
  91. package/es/index.js +2 -0
  92. package/es/index.js.map +1 -1
  93. package/es/ticker/default-ticker.d.ts +3 -2
  94. package/es/ticker/default-ticker.js +9 -6
  95. package/es/ticker/default-ticker.js.map +1 -1
  96. package/es/ticker/manual-ticker.d.ts +2 -1
  97. package/es/ticker/manual-ticker.js +6 -4
  98. package/es/ticker/manual-ticker.js.map +1 -1
  99. package/es/timeline.d.ts +11 -3
  100. package/es/timeline.js +28 -15
  101. package/es/timeline.js.map +1 -1
  102. package/es/utils/easing-func.js +2 -1
  103. package/es/utils/transform.d.ts +2 -0
  104. package/es/utils/transform.js +4 -0
  105. package/es/utils/transform.js.map +1 -0
  106. package/package.json +4 -4
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.multiToOneMorph = exports.splitGraphic = exports.cloneGraphic = exports.MultiToOneMorphingPath = exports.oneToMultiMorph = exports.morphPath = exports.MorphingPath = void 0;
6
+
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), morphing_1 = require("../config/morphing"), transform_1 = require("../utils/transform"), interpolateOtherAttrs = (attrs, out, ratio) => {
8
+ attrs.forEach((entry => {
9
+ if (Number.isFinite(entry.to)) out[entry.key] = entry.from + (entry.to - entry.from) * ratio; else if ("fill" === entry.key || "stroke" === entry.key) {
10
+ const color = (0, vrender_core_1.interpolateColor)(entry.from, entry.to, ratio, !1);
11
+ color && (out[entry.key] = color);
12
+ }
13
+ }));
14
+ }, interpolateMorphingData = (morphingData, path, ratio) => {
15
+ const tmpArr = [], newCp = [];
16
+ path.clear();
17
+ for (let i = 0; i < morphingData.length; i++) {
18
+ const item = morphingData[i], from = item.from, to = item.to, angle = item.rotation * ratio, fromCp = item.fromCp, toCp = item.toCp, sa = Math.sin(angle), ca = Math.cos(angle);
19
+ newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio, newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;
20
+ for (let m = 0; m < from.length; m += 2) {
21
+ const x0 = from[m], y0 = from[m + 1], x = x0 * (1 - ratio) + to[m] * ratio, y = y0 * (1 - ratio) + to[m + 1] * ratio;
22
+ tmpArr[m] = x * ca - y * sa + newCp[0], tmpArr[m + 1] = x * sa + y * ca + newCp[1];
23
+ }
24
+ let x0 = tmpArr[0], y0 = tmpArr[1];
25
+ path.moveTo(x0, y0);
26
+ for (let m = 2; m < from.length; m += 6) {
27
+ const x1 = tmpArr[m], y1 = tmpArr[m + 1], x2 = tmpArr[m + 2], y2 = tmpArr[m + 3], x3 = tmpArr[m + 4], y3 = tmpArr[m + 5];
28
+ x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3 ? path.lineTo(x3, y3) : path.bezierCurveTo(x1, y1, x2, y2, x3, y3),
29
+ x0 = x3, y0 = y3;
30
+ }
31
+ }
32
+ }, parseMorphingData = (fromPath, toPath, config) => {
33
+ const fromBezier = fromPath ? (0, vrender_core_1.pathToBezierCurves)(fromPath) : [], toBezier = (0,
34
+ vrender_core_1.pathToBezierCurves)(toPath);
35
+ config && fromBezier && (config.fromTransform && (0, vrender_core_1.applyTransformOnBezierCurves)(fromBezier, config.fromTransform.clone().getInverse()),
36
+ (0, vrender_core_1.applyTransformOnBezierCurves)(fromBezier, config.toTransfrom));
37
+ const [fromBezierCurves, toBezierCurves] = (0, vrender_core_1.alignBezierCurves)(fromBezier, toBezier);
38
+ return fromPath ? (0, vrender_core_1.findBestMorphingRotation)(fromBezierCurves, toBezierCurves, 10, Math.PI) : toBezierCurves.map(((to, index) => ({
39
+ from: fromBezierCurves[index],
40
+ to: to,
41
+ fromCp: [ 0, 0 ],
42
+ toCp: [ 0, 0 ],
43
+ rotation: 0
44
+ })));
45
+ }, validateOtherAttrs = [ "fill", "fillOpacity", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "stroke", "strokeOpacity", "lineDashOffset" ], parseOtherAnimateAttrs = (fromAttrs, toAttrs) => {
46
+ if (!fromAttrs || !toAttrs) return null;
47
+ const res = [];
48
+ let hasAttr = !1;
49
+ return Object.keys(fromAttrs).forEach((fromKey => {
50
+ if (!validateOtherAttrs.includes(fromKey)) return;
51
+ const toValue = toAttrs[fromKey];
52
+ if (!(0, vutils_1.isNil)(toValue) && !(0, vutils_1.isNil)(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {
53
+ if ("fill" === fromKey || "stroke" === fromKey) {
54
+ const parseColor = color => "string" == typeof color ? vrender_core_1.ColorStore.Get(color, vrender_core_1.ColorType.Color255) : color;
55
+ res.push({
56
+ from: (0, vutils_1.isArray)(fromAttrs[fromKey]) ? fromAttrs[fromKey].map(parseColor) : parseColor(fromAttrs[fromKey]),
57
+ to: (0, vutils_1.isArray)(toValue) ? toValue.map(parseColor) : parseColor(toValue),
58
+ key: fromKey
59
+ });
60
+ } else res.push({
61
+ from: fromAttrs[fromKey],
62
+ to: toValue,
63
+ key: fromKey
64
+ });
65
+ hasAttr = !0;
66
+ }
67
+ })), hasAttr ? res : null;
68
+ };
69
+
70
+ class MorphingPath extends custom_animate_1.ACustomAnimate {
71
+ constructor(config, duration, easing) {
72
+ super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs,
73
+ this.saveOnEnd = config.saveOnEnd;
74
+ }
75
+ getEndProps() {
76
+ return {};
77
+ }
78
+ onBind() {
79
+ this.target.createPathProxy(), this.onUpdate(!1, 0, this.target.attribute);
80
+ }
81
+ onEnd() {}
82
+ onUpdate(end, ratio, out) {
83
+ const target = this.target, pathProxy = "function" == typeof target.pathProxy ? target.pathProxy(target.attribute) : target.pathProxy;
84
+ interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio),
85
+ this.target.setAttributes(out), end && !this.saveOnEnd && (this.target.pathProxy = null);
86
+ }
87
+ }
88
+
89
+ exports.MorphingPath = MorphingPath;
90
+
91
+ const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
92
+ var _a, _b, _c;
93
+ if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) return __DEV__ && console.error(fromGraphic, " is not validate"),
94
+ null;
95
+ if (!toGraphic.valid || !toGraphic.toCustomPath) return __DEV__ && console.error(toGraphic, " is not validate"),
96
+ null;
97
+ let fromTransform = null == fromGraphic ? void 0 : fromGraphic.globalTransMatrix;
98
+ fromGraphicTransform && fromTransform && (fromTransform = fromGraphicTransform.clone().multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f));
99
+ const morphingData = parseMorphingData(null === (_a = null == fromGraphic ? void 0 : fromGraphic.toCustomPath) || void 0 === _a ? void 0 : _a.call(fromGraphic), toGraphic.toCustomPath(), {
100
+ fromTransform: fromTransform,
101
+ toTransfrom: toGraphic.globalTransMatrix
102
+ }), attrs = parseOtherAnimateAttrs(null == fromGraphic ? void 0 : fromGraphic.attribute, toGraphic.attribute), animate = toGraphic.animate(animationConfig);
103
+ (null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay);
104
+ const morphingPath = new MorphingPath({
105
+ morphingData: morphingData,
106
+ otherAttrs: attrs
107
+ }, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing);
108
+ return animate.play(morphingPath), animate;
109
+ };
110
+
111
+ exports.morphPath = morphPath;
112
+
113
+ const oneToMultiMorph = (fromGraphic, toGraphics, animationConfig) => {
114
+ var _a;
115
+ const validateToGraphics = toGraphics.filter((graphic => graphic && graphic.toCustomPath && graphic.valid));
116
+ validateToGraphics.length || __DEV__ && console.error(validateToGraphics, " is not validate"),
117
+ fromGraphic.valid && fromGraphic.toCustomPath || __DEV__ && console.error(fromGraphic, " is not validate");
118
+ const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? exports.cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : exports.splitGraphic)(fromGraphic, validateToGraphics.length, !1), oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd;
119
+ let count = validateToGraphics.length;
120
+ const onEachEnd = () => {
121
+ count--, 0 === count && oldOnEnd && oldOnEnd();
122
+ };
123
+ validateToGraphics.forEach(((toChild, index) => {
124
+ var _a;
125
+ const fromChild = childGraphics[index], delay = (null !== (_a = null == animationConfig ? void 0 : animationConfig.delay) && void 0 !== _a ? _a : 0) + ((null == animationConfig ? void 0 : animationConfig.individualDelay) ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild) : 0);
126
+ (0, exports.morphPath)(fromChild, toChild, Object.assign({}, animationConfig, {
127
+ onEnd: onEachEnd,
128
+ delay: delay
129
+ }), fromGraphic.globalTransMatrix);
130
+ }));
131
+ };
132
+
133
+ exports.oneToMultiMorph = oneToMultiMorph;
134
+
135
+ class MultiToOneMorphingPath extends custom_animate_1.ACustomAnimate {
136
+ constructor(config, duration, easing) {
137
+ super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs;
138
+ }
139
+ getEndProps() {
140
+ return {};
141
+ }
142
+ onBind() {
143
+ this.addPathProxy();
144
+ }
145
+ addPathProxy() {
146
+ this.target.shadowRoot.forEachChildren((child => {
147
+ child.createPathProxy();
148
+ })), this.onUpdate(!1, 0, this.target.attribute);
149
+ }
150
+ clearPathProxy() {
151
+ this.target.shadowRoot.forEachChildren((child => {
152
+ child.pathProxy = null;
153
+ }));
154
+ }
155
+ onEnd() {}
156
+ onUpdate(end, ratio, out) {
157
+ this.target.shadowRoot.forEachChildren(((child, index) => {
158
+ var _a;
159
+ interpolateMorphingData(this.morphingData[index], "function" == typeof child.pathProxy ? child.pathProxy(child.attribute) : child.pathProxy, ratio),
160
+ (null === (_a = this.otherAttrs) || void 0 === _a ? void 0 : _a[index]) && this.otherAttrs[index].length && interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);
161
+ })), end && (this.clearPathProxy(), this.morphingData = null);
162
+ }
163
+ }
164
+
165
+ exports.MultiToOneMorphingPath = MultiToOneMorphingPath;
166
+
167
+ const parseShadowChildAttrs = graphicAttrs => {
168
+ const attrs = {};
169
+ return Object.keys(graphicAttrs).forEach((key => {
170
+ (0, transform_1.isTransformKey)(key) || (attrs[key] = graphicAttrs[key]);
171
+ })), attrs;
172
+ }, appendShadowChildrenToGraphic = (graphic, children, count) => {
173
+ const childAttrs = parseShadowChildAttrs(graphic.attribute), shadowRoot = graphic.attachShadow();
174
+ if (children.length) shadowRoot.setTheme({
175
+ [children[0].type]: childAttrs
176
+ }), children.forEach((element => {
177
+ element.setAttributes({
178
+ pickable: !1
179
+ }), shadowRoot.appendChild(element);
180
+ })); else {
181
+ const box = graphic.AABBBounds, width = box.width(), height = box.height();
182
+ shadowRoot.setTheme({
183
+ rect: childAttrs
184
+ }), new Array(count).fill(0).forEach((el => {
185
+ const child = vrender_core_1.application.graphicService.creator.rect({
186
+ x: 0,
187
+ y: 0,
188
+ width: width,
189
+ height: height,
190
+ pickable: !1
191
+ });
192
+ shadowRoot.appendChild(child), children.push(child);
193
+ }));
194
+ }
195
+ }, cloneGraphic = (graphic, count, needAppend) => {
196
+ const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute), path = graphic.toCustomPath();
197
+ for (let i = 0; i < count; i++) {
198
+ const element = {
199
+ path: (new vrender_core_1.CustomPath2D).fromCustomPath2D(path)
200
+ };
201
+ children.push(vrender_core_1.application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
202
+ }
203
+ return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
204
+ };
205
+
206
+ exports.cloneGraphic = cloneGraphic;
207
+
208
+ const splitGraphic = (graphic, count, needAppend) => {
209
+ const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
210
+ if ("rect" === graphic.type) {
211
+ (0, vrender_core_1.splitRect)(graphic, count).forEach((element => {
212
+ children.push(vrender_core_1.application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element)));
213
+ }));
214
+ } else if ("arc" === graphic.type) {
215
+ (0, vrender_core_1.splitArc)(graphic, count).forEach((element => {
216
+ children.push(vrender_core_1.application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
217
+ }));
218
+ } else if ("circle" === graphic.type) {
219
+ (0, vrender_core_1.splitCircle)(graphic, count).forEach((element => {
220
+ children.push(vrender_core_1.application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
221
+ }));
222
+ } else if ("line" === graphic.type) {
223
+ const childrenAttrs = (0, vrender_core_1.splitLine)(graphic, count), defaultSymbol = {
224
+ size: 10,
225
+ symbolType: "circle"
226
+ };
227
+ childrenAttrs.forEach((element => {
228
+ children.push(vrender_core_1.application.graphicService.creator.symbol(needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)));
229
+ }));
230
+ } else if ("polygon" === graphic.type) {
231
+ (0, vrender_core_1.splitPolygon)(graphic, count).forEach((element => {
232
+ children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
233
+ }));
234
+ } else if ("area" === graphic.type) {
235
+ (0, vrender_core_1.splitArea)(graphic, count).forEach((element => {
236
+ children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
237
+ }));
238
+ } else if ("path" === graphic.type) {
239
+ (0, vrender_core_1.splitPath)(graphic, count).forEach((element => {
240
+ "path" in element ? children.push(vrender_core_1.application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))) : children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
241
+ }));
242
+ }
243
+ return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
244
+ };
245
+
246
+ exports.splitGraphic = splitGraphic;
247
+
248
+ const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
249
+ var _a, _b, _c;
250
+ const validateFromGraphics = fromGraphics.filter((graphic => graphic.toCustomPath && graphic.valid));
251
+ validateFromGraphics.length || __DEV__ && console.error(fromGraphics, " is not validate"),
252
+ toGraphic.valid && toGraphic.toCustomPath || __DEV__ && console.error(toGraphic, " is not validate");
253
+ const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? exports.cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : exports.splitGraphic)(toGraphic, validateFromGraphics.length, !0), toAttrs = toGraphic.attribute;
254
+ toGraphic.setAttribute("visible", !1);
255
+ const morphingData = validateFromGraphics.map(((graphic, index) => parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {
256
+ fromTransform: graphic.globalTransMatrix,
257
+ toTransfrom: childGraphics[index].globalTransMatrix
258
+ }))), otherAttrs = validateFromGraphics.map(((graphic, index) => parseOtherAnimateAttrs(graphic.attribute, toAttrs)));
259
+ if (null == animationConfig ? void 0 : animationConfig.individualDelay) {
260
+ const oldOnEnd = animationConfig.onEnd;
261
+ let count = validateFromGraphics.length;
262
+ const onEachEnd = () => {
263
+ count--, 0 === count && (toGraphic.setAttributes({
264
+ visible: !0,
265
+ ratio: null
266
+ }, !1, {
267
+ type: vrender_core_1.AttributeUpdateType.ANIMATE_END
268
+ }), toGraphic.detachShadow(), oldOnEnd && oldOnEnd());
269
+ };
270
+ childGraphics.forEach(((to, index) => {
271
+ var _a, _b, _c;
272
+ const delay = (null !== (_a = animationConfig.delay) && void 0 !== _a ? _a : 0) + animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to), animate = to.animate(Object.assign({}, animationConfig, {
273
+ onEnd: onEachEnd
274
+ }));
275
+ animate.wait(delay), animate.play(new MorphingPath({
276
+ morphingData: morphingData[index],
277
+ saveOnEnd: !0,
278
+ otherAttrs: otherAttrs[index]
279
+ }, null !== (_b = animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing));
280
+ }));
281
+ } else {
282
+ const oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd, config = animationConfig ? Object.assign({}, animationConfig) : {};
283
+ config.onEnd = () => {
284
+ toGraphic.setAttribute("visible", !0, !1, {
285
+ type: vrender_core_1.AttributeUpdateType.ANIMATE_END
286
+ }), toGraphic.detachShadow(), oldOnEnd && oldOnEnd();
287
+ };
288
+ const animate = toGraphic.animate(config);
289
+ (null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay),
290
+ animate.play(new MultiToOneMorphingPath({
291
+ morphingData: morphingData,
292
+ otherAttrs: otherAttrs
293
+ }, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing));
294
+ }
295
+ };
296
+
297
+ exports.multiToOneMorph = multiToOneMorph;
298
+ //# sourceMappingURL=morphing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/morphing.ts"],"names":[],"mappings":";;;AAAA,yDA+BgC;AAChC,6CAAgE;AAChE,qDAAkD;AAClD,iDAAkE;AAClE,kDAAoD;AAwBpD,MAAM,qBAAqB,GAAG,C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CAAC,CAAC;QAE1C,IAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,KAAK,EAAE;YAC1B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SACrC;QAED,OAAO,CAAC,IAAI,CACV,IAAI,sBAAsB,CACxB,EAAE,YAAY,EAAE,UAAU,EAAE,EAC5B,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,mCAAI,uCAA4B,CAAC,QAAQ,EAClE,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,mCAAI,uCAA4B,CAAC,MAAM,CAC/D,CACF,CAAC;KACH;AACH,CAAC,CAAC;AAhGW,QAAA,eAAe,mBAgG1B","file":"morphing.js","sourcesContent":["import {\n splitArc,\n splitCircle,\n splitLine,\n splitRect,\n splitPolygon,\n splitArea,\n splitPath,\n CustomPath2D,\n application,\n interpolateColor,\n ColorStore,\n ColorType,\n alignBezierCurves,\n applyTransformOnBezierCurves,\n findBestMorphingRotation,\n pathToBezierCurves,\n AttributeUpdateType,\n type MorphingAnimateConfig,\n type MultiMorphingAnimateConfig,\n type ICustomPath2D,\n type IGraphic,\n type IRect,\n type EasingType,\n type IArc,\n type ICircle,\n type IGraphicAttribute,\n type ILine,\n type IPolygon,\n type IArea,\n type IPath\n} from '@visactor/vrender-core';\nimport { isArray, isNil, type IMatrix } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\nimport { DefaultMorphingAnimateConfig } from '../config/morphing';\nimport { isTransformKey } from '../utils/transform';\n\ndeclare const __DEV__: boolean;\n\ninterface MorphingDataItem {\n from: number[];\n to: number[];\n fromCp: number[];\n toCp: number[];\n rotation: number;\n}\n\ninterface OtherAttrItem {\n from: any;\n to: any;\n key: string;\n}\n\n/**\n * 插值计算非路径属性(如颜色、透明度等)\n * @param attrs 要插值的属性数组\n * @param out 输出对象\n * @param ratio 插值比例\n */\nconst interpolateOtherAttrs = (attrs: OtherAttrItem[], out: any, ratio: number) => {\n attrs.forEach(entry => {\n if (Number.isFinite(entry.to)) {\n out[entry.key] = entry.from + (entry.to - entry.from) * ratio;\n } else if (entry.key === 'fill' || entry.key === 'stroke') {\n // 保存解析的结果到step\n const color = interpolateColor(entry.from, entry.to, ratio, false);\n if (color) {\n out[entry.key] = color;\n }\n }\n });\n};\n\n/* Adapted from zrender by ecomfe\n * https://github.com/ecomfe/zrender\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/ecomfe/zrender/blob/master/src/tool/morphPath.ts\n * License: https://github.com/ecomfe/zrender/blob/master/LICENSE\n * @license\n */\n/**\n * 根据给定比例插值计算形变数据并应用到路径\n * @param morphingData 形变数据\n * @param path 目标路径对象\n * @param ratio 插值比例\n */\nconst interpolateMorphingData = (morphingData: MorphingDataItem[], path: ICustomPath2D, ratio: number) => {\n const tmpArr: number[] = [];\n const newCp: number[] = [];\n path.clear();\n\n for (let i = 0; i < morphingData.length; i++) {\n const item = morphingData[i];\n const from = item.from;\n const to = item.to;\n const angle = item.rotation * ratio;\n const fromCp = item.fromCp;\n const toCp = item.toCp;\n const sa = Math.sin(angle);\n const ca = Math.cos(angle);\n\n newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio;\n newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;\n\n for (let m = 0; m < from.length; m += 2) {\n const x0 = from[m];\n const y0 = from[m + 1];\n const x1 = to[m];\n const y1 = to[m + 1];\n\n const x = x0 * (1 - ratio) + x1 * ratio;\n const y = y0 * (1 - ratio) + y1 * ratio;\n\n tmpArr[m] = x * ca - y * sa + newCp[0];\n tmpArr[m + 1] = x * sa + y * ca + newCp[1];\n }\n\n let x0 = tmpArr[0];\n let y0 = tmpArr[1];\n\n path.moveTo(x0, y0);\n\n for (let m = 2; m < from.length; m += 6) {\n const x1 = tmpArr[m];\n const y1 = tmpArr[m + 1];\n const x2 = tmpArr[m + 2];\n const y2 = tmpArr[m + 3];\n const x3 = tmpArr[m + 4];\n const y3 = tmpArr[m + 5];\n\n // Is a line.\n if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {\n path.lineTo(x3, y3);\n } else {\n path.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n x0 = x3;\n y0 = y3;\n }\n }\n};\n\n/**\n * 解析形变数据,将源路径和目标路径转换为贝塞尔曲线并找到最佳旋转角度\n * @param fromPath 源路径\n * @param toPath 目标路径\n * @param config 变换配置\n * @returns 形变数据数组\n */\nconst parseMorphingData = (\n fromPath: ICustomPath2D | null,\n toPath: ICustomPath2D,\n config?: {\n fromTransform?: IMatrix;\n toTransfrom: IMatrix;\n }\n) => {\n // [fromPath, toPath] = [toPath, fromPath];\n const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [];\n const toBezier = pathToBezierCurves(toPath);\n\n if (config && fromBezier) {\n config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse());\n applyTransformOnBezierCurves(fromBezier, config.toTransfrom);\n // applyTransformOnBezierCurves(toBezier, config.toTransfrom.clone().getInverse());\n }\n\n const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);\n\n return fromPath\n ? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI)\n : toBezierCurves.map((to, index) => {\n return {\n from: fromBezierCurves[index],\n to,\n fromCp: [0, 0],\n toCp: [0, 0],\n rotation: 0\n };\n });\n};\n\nconst validateOtherAttrs = [\n 'fill',\n 'fillOpacity',\n 'shadowBlur',\n 'shadowColor',\n 'shadowOffsetX',\n 'shadowOffsetY',\n 'stroke',\n 'strokeOpacity',\n 'lineDashOffset'\n // 'lineWidth'\n];\n\n/**\n * 解析可动画属性,提取源属性和目标属性的差异\n * @param fromAttrs 源属性\n * @param toAttrs 目标属性\n * @returns 可动画属性数组\n */\nconst parseOtherAnimateAttrs = (\n fromAttrs: Partial<IGraphicAttribute> | null,\n toAttrs: Partial<IGraphicAttribute> | null\n) => {\n if (!fromAttrs || !toAttrs) {\n return null;\n }\n const res: OtherAttrItem[] = [];\n let hasAttr = false;\n\n Object.keys(fromAttrs).forEach(fromKey => {\n if (!validateOtherAttrs.includes(fromKey)) {\n return;\n }\n\n const toValue = (toAttrs as any)[fromKey];\n if (!isNil(toValue) && !isNil((fromAttrs as any)[fromKey]) && toValue !== (fromAttrs as any)[fromKey]) {\n if (fromKey === 'fill' || fromKey === 'stroke') {\n const parseColor = (color: string) => {\n return typeof color === 'string' ? ColorStore.Get(color, ColorType.Color255) : color;\n };\n res.push({\n from: isArray(fromAttrs[fromKey])\n ? (fromAttrs[fromKey] as any).map(parseColor)\n : parseColor((fromAttrs as any)[fromKey]),\n to: isArray(toValue) ? toValue.map(parseColor) : parseColor(toValue),\n key: fromKey\n });\n } else {\n res.push({ from: (fromAttrs as any)[fromKey], to: toValue, key: fromKey });\n }\n\n hasAttr = true;\n }\n });\n\n return hasAttr ? res : null;\n};\n\n/**\n * 形变路径动画类,用于处理路径和其他属性的形变\n */\nexport class MorphingPath extends ACustomAnimate<Record<string, any>> {\n declare path: CustomPath2D;\n\n saveOnEnd?: boolean;\n otherAttrs?: OtherAttrItem[];\n\n constructor(\n config: { morphingData: MorphingDataItem[]; otherAttrs?: OtherAttrItem[]; saveOnEnd?: boolean },\n duration: number,\n easing: EasingType\n ) {\n super({}, {}, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n this.saveOnEnd = config.saveOnEnd;\n }\n\n private morphingData?: MorphingDataItem[];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n (this.target as IGraphic).createPathProxy();\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n onEnd(): void {\n return;\n }\n\n /**\n * 更新动画状态\n * @param end 是否结束\n * @param ratio 动画进度比例\n * @param out 输出属性对象\n */\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const target = this.target as IGraphic;\n const pathProxy = typeof target.pathProxy === 'function' ? target.pathProxy(target.attribute) : target.pathProxy;\n interpolateMorphingData(this.morphingData, pathProxy, ratio);\n if (this.otherAttrs && this.otherAttrs.length) {\n interpolateOtherAttrs(this.otherAttrs, out, ratio);\n }\n this.target.setAttributes(out);\n // 计算位置\n if (end && !this.saveOnEnd) {\n (this.target as IGraphic).pathProxy = null;\n }\n }\n}\n\n/**\n * 创建从一个图形到另一个图形的形变动画\n * @param fromGraphic 源图形\n * @param toGraphic 目标图形\n * @param animationConfig 动画配置\n * @param fromGraphicTransform 源图形变换矩阵\n * @returns 动画实例\n */\nexport const morphPath = (\n fromGraphic: IGraphic | null,\n toGraphic: IGraphic,\n animationConfig?: MorphingAnimateConfig,\n fromGraphicTransform?: IMatrix\n) => {\n if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n return null;\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n return null;\n }\n\n let fromTransform = fromGraphic?.globalTransMatrix;\n\n if (fromGraphicTransform && fromTransform) {\n fromTransform = fromGraphicTransform\n .clone()\n .multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f);\n }\n const morphingData = parseMorphingData(fromGraphic?.toCustomPath?.(), toGraphic.toCustomPath(), {\n fromTransform,\n toTransfrom: toGraphic.globalTransMatrix\n });\n\n const attrs = parseOtherAnimateAttrs(fromGraphic?.attribute, toGraphic.attribute);\n const animate = toGraphic.animate(animationConfig);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n const morphingPath = new MorphingPath(\n { morphingData, otherAttrs: attrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n );\n animate.play(morphingPath);\n\n return animate;\n};\n\n/**\n * 创建从一个图形到多个图形的形变动画\n * @param fromGraphic 源图形\n * @param toGraphics 目标图形数组\n * @param animationConfig 动画配置\n */\nexport const oneToMultiMorph = (\n fromGraphic: IGraphic,\n toGraphics: IGraphic[],\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateToGraphics = toGraphics.filter(graphic => graphic && graphic.toCustomPath && graphic.valid);\n if (!validateToGraphics.length) {\n if (__DEV__) {\n console.error(validateToGraphics, ' is not validate');\n }\n }\n\n if (!fromGraphic.valid || !fromGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(fromGraphic, validateToGraphics.length, false);\n\n const oldOnEnd = animationConfig?.onEnd;\n let count = validateToGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0 && oldOnEnd) {\n oldOnEnd();\n }\n };\n\n validateToGraphics.forEach((toChild, index) => {\n const fromChild = childGraphics[index];\n const delay =\n (animationConfig?.delay ?? 0) +\n (animationConfig?.individualDelay\n ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild)\n : 0);\n morphPath(\n fromChild,\n toChild,\n Object.assign({}, animationConfig, { onEnd: onEachEnd, delay }),\n fromGraphic.globalTransMatrix\n );\n });\n};\n\n/**\n * 多对一形变路径动画类,用于处理多个路径形变为一个目标路径\n */\nexport class MultiToOneMorphingPath extends ACustomAnimate<Record<string, any>> {\n declare path: CustomPath2D;\n\n otherAttrs?: OtherAttrItem[][];\n\n constructor(\n config: { morphingData: MorphingDataItem[][]; otherAttrs?: OtherAttrItem[][] },\n duration: number,\n easing: EasingType\n ) {\n super({}, {}, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n }\n\n private morphingData?: MorphingDataItem[][];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.addPathProxy();\n }\n\n /**\n * 为每个子图形添加路径代理\n */\n private addPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).createPathProxy();\n });\n\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n /**\n * 清除所有子图形的路径代理\n */\n private clearPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).pathProxy = null;\n });\n }\n\n onEnd(): void {\n return;\n }\n\n /**\n * 更新动画状态\n * @param end 是否结束\n * @param ratio 动画进度比例\n * @param out 输出属性对象\n */\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren((child: IGraphic, index) => {\n interpolateMorphingData(\n this.morphingData[index],\n typeof child.pathProxy === 'function' ? child.pathProxy(child.attribute) : child.pathProxy,\n ratio\n );\n\n if (this.otherAttrs?.[index] && this.otherAttrs[index].length) {\n interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);\n }\n });\n\n // 计算位置\n if (end) {\n this.clearPathProxy();\n this.morphingData = null;\n }\n }\n}\n\n/**\n * 解析图形的阴影子元素属性(排除变换相关属性)\n * @param graphicAttrs 图形属性\n * @returns 阴影子元素属性\n */\nconst parseShadowChildAttrs = (graphicAttrs: Partial<IGraphicAttribute>) => {\n const attrs: Partial<IGraphicAttribute> = {};\n\n Object.keys(graphicAttrs).forEach(key => {\n if (!isTransformKey(key)) {\n (attrs as any)[key] = (graphicAttrs as any)[key];\n }\n });\n\n // if (attrs.fill == null) {\n // attrs.fill = !!attrs.fillColor;\n // }\n // if (attrs.stroke == null) {\n // attrs.stroke = !!attrs.strokeColor;\n // }\n\n return attrs;\n};\n\n/**\n * 将阴影子元素添加到图形中\n * @param graphic 目标图形\n * @param children 子元素数组\n * @param count 子元素数量\n */\nconst appendShadowChildrenToGraphic = (graphic: IGraphic, children: IGraphic[], count: number) => {\n const childAttrs = parseShadowChildAttrs(graphic.attribute);\n const shadowRoot = graphic.attachShadow();\n\n if (children.length) {\n shadowRoot.setTheme({\n [children[0].type]: childAttrs\n });\n children.forEach(element => {\n element.setAttributes({ pickable: false });\n shadowRoot.appendChild(element);\n });\n } else {\n const box = graphic.AABBBounds;\n const width = box.width();\n const height = box.height();\n\n shadowRoot.setTheme({\n rect: childAttrs\n });\n new Array(count).fill(0).forEach(el => {\n const child = application.graphicService.creator.rect({\n x: 0,\n y: 0,\n width,\n height: height,\n pickable: false\n });\n shadowRoot.appendChild(child);\n children.push(child);\n });\n }\n};\n\n/**\n * 克隆图形为多个相同的图形\n * @param graphic 源图形\n * @param count 克隆数量\n * @param needAppend 是否需要添加到源图形中\n * @returns 克隆的图形数组\n */\nexport const cloneGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n const path = graphic.toCustomPath();\n\n for (let i = 0; i < count; i++) {\n const element = {\n path: new CustomPath2D().fromCustomPath2D(path)\n };\n\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\n/**\n * 将图形分割为多个子图形\n * @param graphic 源图形\n * @param count 分割数量\n * @param needAppend 是否需要添加到源图形中\n * @returns 分割后的图形数组\n */\nexport const splitGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n\n if (graphic.type === 'rect') {\n const childrenAttrs = splitRect(graphic as IRect, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'arc') {\n const childrenAttrs = splitArc(graphic as IArc, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'circle') {\n const childrenAttrs = splitCircle(graphic as ICircle, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'line') {\n const childrenAttrs = splitLine(graphic as ILine, count);\n const defaultSymbol = { size: 10, symbolType: 'circle' };\n\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.symbol(\n needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)\n )\n );\n });\n } else if (graphic.type === 'polygon') {\n const childrenAttrs = splitPolygon(graphic as IPolygon, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'area') {\n const childrenAttrs = splitArea(graphic as IArea, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'path') {\n const childrenAttrs = splitPath(graphic as IPath, count);\n childrenAttrs.forEach(element => {\n if ('path' in element) {\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n } else {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n });\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\n/**\n * 创建从多个图形到一个图形的形变动画\n * @param fromGraphics 源图形数组\n * @param toGraphic 目标图形\n * @param animationConfig 动画配置\n */\nexport const multiToOneMorph = (\n fromGraphics: IGraphic[],\n toGraphic: IGraphic,\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateFromGraphics = fromGraphics.filter(graphic => graphic.toCustomPath && graphic.valid);\n if (!validateFromGraphics.length) {\n if (__DEV__) {\n console.error(fromGraphics, ' is not validate');\n }\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(toGraphic, validateFromGraphics.length, true);\n\n const toAttrs = toGraphic.attribute;\n toGraphic.setAttribute('visible', false);\n\n const morphingData = validateFromGraphics.map((graphic, index) => {\n return parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {\n fromTransform: graphic.globalTransMatrix,\n toTransfrom: childGraphics[index].globalTransMatrix\n });\n });\n const otherAttrs = validateFromGraphics.map((graphic, index) => {\n return parseOtherAnimateAttrs(graphic.attribute, toAttrs);\n });\n\n if (animationConfig?.individualDelay) {\n const oldOnEnd = animationConfig.onEnd;\n let count = validateFromGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0) {\n toGraphic.setAttributes({ visible: true, ratio: null } as any, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n toGraphic.detachShadow();\n if (oldOnEnd) {\n oldOnEnd();\n }\n }\n };\n childGraphics.forEach((to, index) => {\n const delay =\n (animationConfig.delay ?? 0) +\n animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to);\n const animate = to.animate(Object.assign({}, animationConfig, { onEnd: onEachEnd }));\n animate.wait(delay);\n\n animate.play(\n new MorphingPath(\n {\n morphingData: morphingData[index],\n saveOnEnd: true,\n otherAttrs: otherAttrs[index]\n },\n animationConfig.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n });\n } else {\n const oldOnEnd = animationConfig?.onEnd;\n const config = animationConfig ? Object.assign({}, animationConfig) : {};\n\n config.onEnd = () => {\n toGraphic.setAttribute('visible', true, false, { type: AttributeUpdateType.ANIMATE_END });\n toGraphic.detachShadow();\n\n if (oldOnEnd) {\n oldOnEnd();\n }\n };\n\n const animate = toGraphic.animate(config);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n animate.play(\n new MultiToOneMorphingPath(\n { morphingData, otherAttrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n }\n};\n"]}
@@ -13,6 +13,10 @@ export interface IMoveAnimationOptions {
13
13
  y?: number;
14
14
  }>;
15
15
  excludeChannels?: string[];
16
+ layoutRect?: {
17
+ width: number;
18
+ height: number;
19
+ };
16
20
  }
17
21
  interface IAnimationParameters {
18
22
  width: number;
@@ -5,12 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  }), exports.MoveOut = exports.MoveIn = exports.MoveBase = exports.moveOut = exports.moveIn = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), moveIn = (graphic, options, animationParameters) => {
8
- var _a, _b;
9
- const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt, excludeChannels: excludeChannels = []} = null != options ? options : {};
8
+ var _a, _b, _c, _d;
9
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt, excludeChannels: excludeChannels = [], layoutRect: layoutRect = {}} = null != options ? options : {};
10
10
  let changedX = 0, changedY = 0;
11
- "negative" === orient && (changedX = graphic.stage.viewWidth, changedY = graphic.stage.viewHeight),
11
+ "negative" === orient && (changedX = null !== (_a = layoutRect.width) && void 0 !== _a ? _a : graphic.stage.viewWidth,
12
+ changedY = null !== (_b = layoutRect.height) && void 0 !== _b ? _b : graphic.stage.viewHeight),
12
13
  changedX += offset, changedY += offset;
13
- const point = (0, vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
14
+ const point = (0, vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
14
15
  vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y) ? point.y : changedY, finalAttrs = graphic.getFinalAttribute(), finalAttrsX = excludeChannels.includes("x") ? graphic.attribute.x : finalAttrs.x, finalAttrsY = excludeChannels.includes("y") ? graphic.attribute.y : finalAttrs.y;
15
16
  switch (direction) {
16
17
  case "x":
@@ -50,9 +51,9 @@ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./cust
50
51
  exports.moveIn = moveIn;
51
52
 
52
53
  const moveOut = (graphic, options, animationParameters) => {
53
- var _a, _b;
54
- const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupWidth = graphic.stage.viewWidth, groupHeight = graphic.stage.viewHeight, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = (0,
55
- vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
54
+ var _a, _b, _c, _d, _e, _f;
55
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupWidth = null !== (_b = null === (_a = options.layoutRect) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : graphic.stage.viewWidth, groupHeight = null !== (_d = null === (_c = options.layoutRect) || void 0 === _c ? void 0 : _c.height) && void 0 !== _d ? _d : graphic.stage.viewHeight, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = (0,
56
+ vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
56
57
  vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y)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AC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;SACtD;QAED,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,gBAAgB,MAAK,KAAK,EAAE;YAC1D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AAnBD,wBAmBC;AAED,MAAa,OAAQ,SAAQ,QAAQ;IACnC,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAA,eAAO,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AATD,0BASC","file":"move.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isFunction, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport type FunctionCallback<T> = (...args: any[]) => T;\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n excludeChannels?: string[];\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n changedX = graphic.stage.viewWidth;\n changedY = graphic.stage.viewHeight;\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt)\n ? pointOpt.call(null, graphic.context?.data?.[0], graphic, animationParameters)\n : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n const finalAttrs = graphic.getFinalAttribute();\n const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;\n const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: finalAttrsX }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: finalAttrsY }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: finalAttrsX,\n y: finalAttrsY\n }\n };\n }\n};\n\nexport const moveOut = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n // const groupBounds = graphic.parent ? graphic.parent.getBounds() : null;\n const groupWidth = graphic.stage.viewWidth;\n const groupHeight = graphic.stage.viewHeight;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt)\n ? pointOpt.call(null, graphic.context?.data?.[0], graphic, animationParameters)\n : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: graphic.attribute.x },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: graphic.attribute.y },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: graphic.attribute.x,\n y: graphic.attribute.y\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n\nexport class MoveBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class MoveIn extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n }\n}\n\nexport class MoveOut extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this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AAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AATD,0BASC","file":"move.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isFunction, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport type FunctionCallback<T> = (...args: any[]) => T;\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n excludeChannels?: string[];\n layoutRect?: { width: number; height: number };\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [], layoutRect = {} } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n changedX = (layoutRect as any).width ?? graphic.stage.viewWidth;\n changedY = (layoutRect as any).height ?? graphic.stage.viewHeight;\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt)\n ? pointOpt.call(null, graphic.context?.data?.[0], graphic, animationParameters)\n : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n const finalAttrs = graphic.getFinalAttribute();\n const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;\n const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: finalAttrsX }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: finalAttrsY }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: finalAttrsX,\n y: finalAttrsY\n }\n };\n }\n};\n\nexport const moveOut = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n // const groupBounds = graphic.parent ? graphic.parent.getBounds() : null;\n const groupWidth = options.layoutRect?.width ?? graphic.stage.viewWidth;\n const groupHeight = options.layoutRect?.height ?? graphic.stage.viewHeight;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt)\n ? pointOpt.call(null, graphic.context?.data?.[0], graphic, animationParameters)\n : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: graphic.attribute.x },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: graphic.attribute.y },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: graphic.attribute.x,\n y: graphic.attribute.y\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n\nexport class MoveBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class MoveIn extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n }\n}\n\nexport class MoveOut extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n }\n}\n"]}
@@ -16,7 +16,7 @@ import { SlideRichText } from './richtext/slide-richtext';
16
16
  import { SlideOutRichText } from './richtext/slide-out-richtext';
17
17
  import { ScaleIn, ScaleOut } from './scale';
18
18
  import { State } from './state';
19
- import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, SlideIn, SlideOut, SpinIn, SpinOut } from './story';
19
+ import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, PulseAnimate, SlideIn, SlideOut, SpinIn, SpinOut, StrokeIn, StrokeOut } from './story';
20
20
  import { Update } from './update';
21
21
  import { MoveIn, MoveOut } from './move';
22
22
  import { RotateIn, RotateOut } from './rotate';
@@ -25,4 +25,4 @@ import { FromTo } from './fromTo';
25
25
  import { GroupFadeIn, GroupFadeOut } from './groupFade';
26
26
  import { StreamLight } from './streamLight';
27
27
  export declare const registerCustomAnimate: () => void;
28
- export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
28
+ export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, StrokeIn, StrokeOut, PulseAnimate, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.MoveRotateOut = exports.MoveScaleOut = exports.SpinOut = exports.GrowOut = exports.SlideOut = exports.MoveRotateIn = exports.MoveScaleIn = exports.SpinIn = exports.GrowIn = exports.SlideIn = exports.SlideOutRichText = exports.SlideRichText = exports.OutputRichText = exports.InputRichText = exports.InputText = exports.LabelItemDisappear = exports.LabelItemAppear = exports.MotionPath = exports.Update = exports.State = exports.RotateOut = exports.RotateIn = exports.MoveOut = exports.MoveIn = exports.ScaleOut = exports.ScaleIn = exports.PoptipDisappear = exports.PoptipAppear = exports.IncreaseCount = exports.GrowWidthOut = exports.GrowWidthIn = exports.GrowRadiusOut = exports.GrowRadiusIn = exports.GrowPointsYOut = exports.GrowPointsYIn = exports.GrowPointsXOut = exports.GrowPointsXIn = exports.GrowPointsOut = exports.GrowPointsIn = exports.GrowHeightOut = exports.GrowHeightIn = exports.GrowCenterOut = exports.GrowCenterIn = exports.GrowAngleOut = exports.GrowAngleIn = exports.FadeOut = exports.FadeIn = exports.ClipOut = exports.ClipIn = exports.registerCustomAnimate = void 0,
6
- exports.StreamLight = exports.FromTo = exports.GroupFadeOut = exports.GroupFadeIn = void 0;
6
+ exports.StreamLight = exports.FromTo = exports.GroupFadeOut = exports.GroupFadeIn = exports.PulseAnimate = exports.StrokeOut = exports.StrokeIn = void 0;
7
7
 
8
8
  const animate_executor_1 = require("../executor/animate-executor"), clip_1 = require("./clip");
9
9
 
@@ -274,6 +274,11 @@ Object.defineProperty(exports, "GrowIn", {
274
274
  get: function() {
275
275
  return story_1.MoveScaleOut;
276
276
  }
277
+ }), Object.defineProperty(exports, "PulseAnimate", {
278
+ enumerable: !0,
279
+ get: function() {
280
+ return story_1.PulseAnimate;
281
+ }
277
282
  }), Object.defineProperty(exports, "SlideIn", {
278
283
  enumerable: !0,
279
284
  get: function() {
@@ -294,6 +299,16 @@ Object.defineProperty(exports, "GrowIn", {
294
299
  get: function() {
295
300
  return story_1.SpinOut;
296
301
  }
302
+ }), Object.defineProperty(exports, "StrokeIn", {
303
+ enumerable: !0,
304
+ get: function() {
305
+ return story_1.StrokeIn;
306
+ }
307
+ }), Object.defineProperty(exports, "StrokeOut", {
308
+ enumerable: !0,
309
+ get: function() {
310
+ return story_1.StrokeOut;
311
+ }
297
312
  });
298
313
 
299
314
  const update_1 = require("./update");
@@ -419,11 +434,14 @@ const registerCustomAnimate = () => {
419
434
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("spinIn", story_1.SpinIn),
420
435
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("moveScaleIn", story_1.MoveScaleIn),
421
436
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("moveRotateIn", story_1.MoveRotateIn),
437
+ animate_executor_1.AnimateExecutor.registerBuiltInAnimate("strokeIn", story_1.StrokeIn),
422
438
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("slideOut", story_1.SlideOut),
423
439
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("growOut", story_1.GrowOut),
424
440
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("spinOut", story_1.SpinOut),
425
441
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("moveScaleOut", story_1.MoveScaleOut),
426
442
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("moveRotateOut", story_1.MoveRotateOut),
443
+ animate_executor_1.AnimateExecutor.registerBuiltInAnimate("strokeOut", story_1.StrokeOut),
444
+ animate_executor_1.AnimateExecutor.registerBuiltInAnimate("pulse", story_1.PulseAnimate),
427
445
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("MotionPath", motionPath_1.MotionPath),
428
446
  animate_executor_1.AnimateExecutor.registerBuiltInAnimate("streamLight", streamLight_1.StreamLight);
429
447
  };