@visactor/vrender-animate 0.23.0-alpha.3 → 1.0.0-alpha.2

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 (275) hide show
  1. package/cjs/animate-extension.d.ts +1 -3
  2. package/cjs/animate-extension.js +0 -7
  3. package/cjs/animate-extension.js.map +1 -1
  4. package/cjs/animate.d.ts +1 -5
  5. package/cjs/animate.js +12 -12
  6. package/cjs/animate.js.map +1 -1
  7. package/cjs/component/component-animator.d.ts +3 -2
  8. package/cjs/component/component-animator.js +18 -32
  9. package/cjs/component/component-animator.js.map +1 -1
  10. package/cjs/custom/clip-graphic.d.ts +1 -1
  11. package/cjs/custom/clip-graphic.js +1 -1
  12. package/cjs/custom/clip-graphic.js.map +1 -1
  13. package/cjs/custom/clip.d.ts +1 -1
  14. package/cjs/custom/clip.js.map +1 -1
  15. package/cjs/custom/common.d.ts +1 -2
  16. package/cjs/custom/common.js +14 -10
  17. package/cjs/custom/common.js.map +1 -1
  18. package/cjs/custom/custom-animate.d.ts +2 -4
  19. package/cjs/custom/custom-animate.js +3 -3
  20. package/cjs/custom/custom-animate.js.map +1 -1
  21. package/cjs/custom/fade.d.ts +1 -1
  22. package/cjs/custom/fade.js.map +1 -1
  23. package/cjs/custom/from-to.d.ts +10 -0
  24. package/cjs/custom/from-to.js +45 -0
  25. package/cjs/custom/from-to.js.map +1 -0
  26. package/cjs/custom/group-fade.d.ts +8 -14
  27. package/cjs/custom/group-fade.js +9 -50
  28. package/cjs/custom/group-fade.js.map +1 -1
  29. package/cjs/custom/growAngle.d.ts +2 -2
  30. package/cjs/custom/growAngle.js +20 -14
  31. package/cjs/custom/growAngle.js.map +1 -1
  32. package/cjs/custom/growCenter.d.ts +1 -2
  33. package/cjs/custom/growCenter.js +10 -7
  34. package/cjs/custom/growCenter.js.map +1 -1
  35. package/cjs/custom/growHeight.d.ts +1 -3
  36. package/cjs/custom/growHeight.js +9 -7
  37. package/cjs/custom/growHeight.js.map +1 -1
  38. package/cjs/custom/growPoints.d.ts +1 -2
  39. package/cjs/custom/growPoints.js +23 -21
  40. package/cjs/custom/growPoints.js.map +1 -1
  41. package/cjs/custom/growRadius.d.ts +4 -5
  42. package/cjs/custom/growRadius.js +14 -12
  43. package/cjs/custom/growRadius.js.map +1 -1
  44. package/cjs/custom/growWidth.d.ts +1 -3
  45. package/cjs/custom/growWidth.js +9 -6
  46. package/cjs/custom/growWidth.js.map +1 -1
  47. package/cjs/custom/input-text.d.ts +1 -2
  48. package/cjs/custom/input-text.js.map +1 -1
  49. package/cjs/custom/label-item-animate.js +4 -2
  50. package/cjs/custom/label-item-animate.js.map +1 -1
  51. package/cjs/custom/move.d.ts +92 -0
  52. package/cjs/custom/move.js +133 -0
  53. package/cjs/custom/move.js.map +1 -0
  54. package/cjs/custom/number.d.ts +1 -2
  55. package/cjs/custom/number.js.map +1 -1
  56. package/cjs/custom/poptip-animate.js +4 -1
  57. package/cjs/custom/poptip-animate.js.map +1 -1
  58. package/cjs/custom/register.js +21 -2
  59. package/cjs/custom/register.js.map +1 -1
  60. package/cjs/custom/richtext/input-richtext.d.ts +33 -0
  61. package/cjs/custom/richtext/input-richtext.js +70 -0
  62. package/cjs/custom/richtext/input-richtext.js.map +1 -0
  63. package/cjs/custom/richtext/output-richtext.d.ts +37 -0
  64. package/cjs/custom/richtext/output-richtext.js +94 -0
  65. package/cjs/custom/richtext/output-richtext.js.map +1 -0
  66. package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
  67. package/cjs/custom/richtext/slide-out-richtext.js +146 -0
  68. package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
  69. package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
  70. package/cjs/custom/richtext/slide-richtext.js +144 -0
  71. package/cjs/custom/richtext/slide-richtext.js.map +1 -0
  72. package/cjs/custom/rotate.d.ts +33 -0
  73. package/cjs/custom/rotate.js +78 -0
  74. package/cjs/custom/rotate.js.map +1 -0
  75. package/cjs/custom/scale.d.ts +2 -2
  76. package/cjs/custom/scale.js +27 -21
  77. package/cjs/custom/scale.js.map +1 -1
  78. package/cjs/custom/sphere.js +3 -1
  79. package/cjs/custom/sphere.js.map +1 -1
  80. package/cjs/custom/state.d.ts +1 -1
  81. package/cjs/custom/state.js +1 -1
  82. package/cjs/custom/state.js.map +1 -1
  83. package/cjs/custom/story.d.ts +128 -0
  84. package/cjs/custom/story.js +351 -0
  85. package/cjs/custom/story.js.map +1 -0
  86. package/cjs/custom/tag-points.d.ts +2 -3
  87. package/cjs/custom/tag-points.js +19 -5
  88. package/cjs/custom/tag-points.js.map +1 -1
  89. package/cjs/custom/update.d.ts +2 -1
  90. package/cjs/custom/update.js +11 -2
  91. package/cjs/custom/update.js.map +1 -1
  92. package/cjs/executor/animate-executor.d.ts +6 -5
  93. package/cjs/executor/animate-executor.js +61 -29
  94. package/cjs/executor/animate-executor.js.map +1 -1
  95. package/cjs/executor/executor.d.ts +6 -3
  96. package/cjs/executor/executor.js.map +1 -1
  97. package/cjs/index.d.ts +3 -6
  98. package/cjs/index.js +16 -4
  99. package/cjs/index.js.map +1 -1
  100. package/cjs/interpolate/store.d.ts +2 -2
  101. package/cjs/interpolate/store.js +2 -0
  102. package/cjs/interpolate/store.js.map +1 -1
  103. package/cjs/state/animation-state.d.ts +2 -2
  104. package/cjs/state/animation-state.js +3 -3
  105. package/cjs/state/animation-state.js.map +1 -1
  106. package/cjs/state/graphic-extension.d.ts +1 -1
  107. package/cjs/state/graphic-extension.js.map +1 -1
  108. package/cjs/step.d.ts +4 -4
  109. package/cjs/step.js +10 -6
  110. package/cjs/step.js.map +1 -1
  111. package/cjs/ticker/default-ticker.d.ts +2 -3
  112. package/cjs/ticker/default-ticker.js +14 -12
  113. package/cjs/ticker/default-ticker.js.map +1 -1
  114. package/cjs/ticker/manual-ticker.d.ts +1 -1
  115. package/cjs/ticker/manual-ticker.js.map +1 -1
  116. package/cjs/timeline.d.ts +1 -2
  117. package/cjs/timeline.js.map +1 -1
  118. package/cjs/utils/easing-func.js +2 -1
  119. package/dist/index.es.js +1907 -548
  120. package/es/animate-extension.d.ts +1 -3
  121. package/es/animate-extension.js +0 -7
  122. package/es/animate-extension.js.map +1 -1
  123. package/es/animate.d.ts +1 -5
  124. package/es/animate.js +1 -3
  125. package/es/animate.js.map +1 -1
  126. package/es/component/component-animator.d.ts +3 -2
  127. package/es/component/component-animator.js +18 -32
  128. package/es/component/component-animator.js.map +1 -1
  129. package/es/custom/clip-graphic.d.ts +1 -1
  130. package/es/custom/clip-graphic.js +1 -1
  131. package/es/custom/clip-graphic.js.map +1 -1
  132. package/es/custom/clip.d.ts +1 -1
  133. package/es/custom/clip.js.map +1 -1
  134. package/es/custom/common.d.ts +1 -2
  135. package/es/custom/common.js +14 -10
  136. package/es/custom/common.js.map +1 -1
  137. package/es/custom/custom-animate.d.ts +2 -4
  138. package/es/custom/custom-animate.js +3 -3
  139. package/es/custom/custom-animate.js.map +1 -1
  140. package/es/custom/fade.d.ts +1 -1
  141. package/es/custom/fade.js.map +1 -1
  142. package/es/custom/from-to.d.ts +10 -0
  143. package/es/custom/from-to.js +37 -0
  144. package/es/custom/from-to.js.map +1 -0
  145. package/es/custom/group-fade.d.ts +8 -14
  146. package/es/custom/group-fade.js +9 -50
  147. package/es/custom/group-fade.js.map +1 -1
  148. package/es/custom/growAngle.d.ts +2 -2
  149. package/es/custom/growAngle.js +23 -14
  150. package/es/custom/growAngle.js.map +1 -1
  151. package/es/custom/growCenter.d.ts +1 -2
  152. package/es/custom/growCenter.js +10 -7
  153. package/es/custom/growCenter.js.map +1 -1
  154. package/es/custom/growHeight.d.ts +1 -3
  155. package/es/custom/growHeight.js +10 -8
  156. package/es/custom/growHeight.js.map +1 -1
  157. package/es/custom/growPoints.d.ts +1 -2
  158. package/es/custom/growPoints.js +23 -21
  159. package/es/custom/growPoints.js.map +1 -1
  160. package/es/custom/growRadius.d.ts +4 -5
  161. package/es/custom/growRadius.js +14 -10
  162. package/es/custom/growRadius.js.map +1 -1
  163. package/es/custom/growWidth.d.ts +1 -3
  164. package/es/custom/growWidth.js +10 -7
  165. package/es/custom/growWidth.js.map +1 -1
  166. package/es/custom/input-text.d.ts +1 -2
  167. package/es/custom/input-text.js.map +1 -1
  168. package/es/custom/label-item-animate.js +4 -2
  169. package/es/custom/label-item-animate.js.map +1 -1
  170. package/es/custom/move.d.ts +92 -0
  171. package/es/custom/move.js +118 -0
  172. package/es/custom/move.js.map +1 -0
  173. package/es/custom/number.d.ts +1 -2
  174. package/es/custom/number.js.map +1 -1
  175. package/es/custom/poptip-animate.js +4 -1
  176. package/es/custom/poptip-animate.js.map +1 -1
  177. package/es/custom/register.js +41 -16
  178. package/es/custom/register.js.map +1 -1
  179. package/es/custom/richtext/input-richtext.d.ts +33 -0
  180. package/es/custom/richtext/input-richtext.js +64 -0
  181. package/es/custom/richtext/input-richtext.js.map +1 -0
  182. package/es/custom/richtext/output-richtext.d.ts +37 -0
  183. package/es/custom/richtext/output-richtext.js +88 -0
  184. package/es/custom/richtext/output-richtext.js.map +1 -0
  185. package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
  186. package/es/custom/richtext/slide-out-richtext.js +140 -0
  187. package/es/custom/richtext/slide-out-richtext.js.map +1 -0
  188. package/es/custom/richtext/slide-richtext.d.ts +36 -0
  189. package/es/custom/richtext/slide-richtext.js +138 -0
  190. package/es/custom/richtext/slide-richtext.js.map +1 -0
  191. package/es/custom/rotate.d.ts +33 -0
  192. package/es/custom/rotate.js +64 -0
  193. package/es/custom/rotate.js.map +1 -0
  194. package/es/custom/scale.d.ts +2 -2
  195. package/es/custom/scale.js +27 -21
  196. package/es/custom/scale.js.map +1 -1
  197. package/es/custom/sphere.js +3 -1
  198. package/es/custom/sphere.js.map +1 -1
  199. package/es/custom/state.d.ts +1 -1
  200. package/es/custom/state.js +1 -1
  201. package/es/custom/state.js.map +1 -1
  202. package/es/custom/story.d.ts +128 -0
  203. package/es/custom/story.js +327 -0
  204. package/es/custom/story.js.map +1 -0
  205. package/es/custom/tag-points.d.ts +2 -3
  206. package/es/custom/tag-points.js +20 -6
  207. package/es/custom/tag-points.js.map +1 -1
  208. package/es/custom/update.d.ts +2 -1
  209. package/es/custom/update.js +11 -2
  210. package/es/custom/update.js.map +1 -1
  211. package/es/executor/animate-executor.d.ts +6 -5
  212. package/es/executor/animate-executor.js +58 -29
  213. package/es/executor/animate-executor.js.map +1 -1
  214. package/es/executor/executor.d.ts +6 -3
  215. package/es/executor/executor.js.map +1 -1
  216. package/es/index.d.ts +3 -6
  217. package/es/index.js +4 -10
  218. package/es/index.js.map +1 -1
  219. package/es/interpolate/store.d.ts +2 -2
  220. package/es/interpolate/store.js +2 -0
  221. package/es/interpolate/store.js.map +1 -1
  222. package/es/state/animation-state.d.ts +2 -2
  223. package/es/state/animation-state.js +4 -2
  224. package/es/state/animation-state.js.map +1 -1
  225. package/es/state/graphic-extension.d.ts +1 -1
  226. package/es/state/graphic-extension.js.map +1 -1
  227. package/es/step.d.ts +4 -4
  228. package/es/step.js +11 -7
  229. package/es/step.js.map +1 -1
  230. package/es/ticker/default-ticker.d.ts +2 -3
  231. package/es/ticker/default-ticker.js +5 -5
  232. package/es/ticker/default-ticker.js.map +1 -1
  233. package/es/ticker/manual-ticker.d.ts +1 -1
  234. package/es/ticker/manual-ticker.js.map +1 -1
  235. package/es/timeline.d.ts +1 -2
  236. package/es/timeline.js +1 -1
  237. package/es/timeline.js.map +1 -1
  238. package/es/utils/easing-func.js +2 -1
  239. package/package.json +5 -5
  240. package/cjs/custom/label-animate.d.ts +0 -4
  241. package/cjs/custom/label-animate.js +0 -48
  242. package/cjs/custom/label-animate.js.map +0 -1
  243. package/cjs/intreface/animate.d.ts +0 -92
  244. package/cjs/intreface/animate.js +0 -10
  245. package/cjs/intreface/animate.js.map +0 -1
  246. package/cjs/intreface/easing.d.ts +0 -3
  247. package/cjs/intreface/easing.js +0 -6
  248. package/cjs/intreface/easing.js.map +0 -1
  249. package/cjs/intreface/ticker.d.ts +0 -37
  250. package/cjs/intreface/ticker.js +0 -11
  251. package/cjs/intreface/ticker.js.map +0 -1
  252. package/cjs/intreface/timeline.d.ts +0 -17
  253. package/cjs/intreface/timeline.js +0 -6
  254. package/cjs/intreface/timeline.js.map +0 -1
  255. package/cjs/intreface/type.d.ts +0 -13
  256. package/cjs/intreface/type.js +0 -15
  257. package/cjs/intreface/type.js.map +0 -1
  258. package/es/custom/label-animate.d.ts +0 -4
  259. package/es/custom/label-animate.js +0 -42
  260. package/es/custom/label-animate.js.map +0 -1
  261. package/es/intreface/animate.d.ts +0 -92
  262. package/es/intreface/animate.js +0 -6
  263. package/es/intreface/animate.js.map +0 -1
  264. package/es/intreface/easing.d.ts +0 -3
  265. package/es/intreface/easing.js +0 -2
  266. package/es/intreface/easing.js.map +0 -1
  267. package/es/intreface/ticker.d.ts +0 -37
  268. package/es/intreface/ticker.js +0 -7
  269. package/es/intreface/ticker.js.map +0 -1
  270. package/es/intreface/timeline.d.ts +0 -17
  271. package/es/intreface/timeline.js +0 -2
  272. package/es/intreface/timeline.js.map +0 -1
  273. package/es/intreface/type.d.ts +0 -13
  274. package/es/intreface/type.js +0 -14
  275. package/es/intreface/type.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -1,26 +1,5 @@
1
- import { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation, ColorStore, ColorType, Generator, AnimateStatus as AnimateStatus$1, PerformanceRAF, application, CustomPath2D, CurveContext, Graphic, AttributeUpdateType, pointInterpolation } from '@visactor/vrender-core';
2
- import { pi2, isString, EventEmitter, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid, isNil } from '@visactor/vutils';
3
-
4
- var AnimateMode;
5
- (function (AnimateMode) {
6
- AnimateMode[AnimateMode["NORMAL"] = 0] = "NORMAL";
7
- AnimateMode[AnimateMode["SET_ATTR_IMMEDIATELY"] = 1] = "SET_ATTR_IMMEDIATELY";
8
- })(AnimateMode || (AnimateMode = {}));
9
-
10
- var AnimateStepType;
11
- (function (AnimateStepType) {
12
- AnimateStepType["wait"] = "wait";
13
- AnimateStepType["from"] = "from";
14
- AnimateStepType["to"] = "to";
15
- AnimateStepType["customAnimate"] = "customAnimate";
16
- })(AnimateStepType || (AnimateStepType = {}));
17
- var AnimateStatus;
18
- (function (AnimateStatus) {
19
- AnimateStatus[AnimateStatus["INITIAL"] = 0] = "INITIAL";
20
- AnimateStatus[AnimateStatus["RUNNING"] = 1] = "RUNNING";
21
- AnimateStatus[AnimateStatus["PAUSED"] = 2] = "PAUSED";
22
- AnimateStatus[AnimateStatus["END"] = 3] = "END";
23
- })(AnimateStatus || (AnimateStatus = {}));
1
+ import { interpolateColor, interpolatePureColorArrayToStr, pointsInterpolation, Generator, ColorStore, ColorType, AnimateStatus, AnimateStepType, PerformanceRAF, STATUS, application, CustomPath2D, CurveContext, Graphic, AttributeUpdateType, pointInterpolation, RichText } from '@visactor/vrender-core';
2
+ import { pi2, isString, EventEmitter, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid, isNil, isNumberClose } from '@visactor/vutils';
24
3
 
25
4
  class Easing {
26
5
  constructor() {
@@ -231,6 +210,9 @@ class InterpolateUpdateStore {
231
210
  this.opacity = (key, from, to, ratio, step, target) => {
232
211
  target.attribute.opacity = interpolateNumber(from, to, ratio);
233
212
  };
213
+ this.baseOpacity = (key, from, to, ratio, step, target) => {
214
+ target.attribute.baseOpacity = interpolateNumber(from, to, ratio);
215
+ };
234
216
  this.fillOpacity = (key, from, to, ratio, step, target) => {
235
217
  target.attribute.fillOpacity = interpolateNumber(from, to, ratio);
236
218
  };
@@ -367,6 +349,9 @@ class Step {
367
349
  constructor(type, props, duration, easing) {
368
350
  this._startTime = 0;
369
351
  this._hasFirstRun = false;
352
+ this._syncAttributeUpdate = () => {
353
+ this.target.setAttributes(this.target.attribute);
354
+ };
370
355
  this.type = type;
371
356
  this.props = props;
372
357
  this.duration = duration;
@@ -379,11 +364,14 @@ class Step {
379
364
  if (type === 'wait') {
380
365
  this.onUpdate = noop;
381
366
  }
367
+ this.id = Generator.GenAutoIncrementId();
368
+ this.syncAttributeUpdate = noop;
382
369
  }
383
370
  bind(target, animate) {
384
371
  this.target = target;
385
372
  this.animate = animate;
386
373
  this.onBind();
374
+ this.syncAttributeUpdate();
387
375
  }
388
376
  append(step) {
389
377
  this.next = step;
@@ -463,6 +451,9 @@ class Step {
463
451
  return this._startTime;
464
452
  }
465
453
  onBind() {
454
+ if (this.target.type === 'glyph') {
455
+ this.syncAttributeUpdate = this._syncAttributeUpdate;
456
+ }
466
457
  }
467
458
  onFirstRun() {
468
459
  }
@@ -530,6 +521,7 @@ class Step {
530
521
  func(key, fromValue, toValue, easedRatio, this, this.target);
531
522
  });
532
523
  this.onUpdate(end, easedRatio, out);
524
+ this.syncAttributeUpdate();
533
525
  }
534
526
  onUpdate(end, ratio, out) {
535
527
  }
@@ -609,10 +601,10 @@ class DefaultTimeline {
609
601
  const scaledDelta = delta * this._playSpeed;
610
602
  this._currentTime += scaledDelta;
611
603
  this.forEachAccessAnimate((animate, i) => {
612
- if (animate.status === AnimateStatus$1.END) {
604
+ if (animate.status === AnimateStatus.END) {
613
605
  this.removeAnimate(animate, true, i);
614
606
  }
615
- else if (animate.status === AnimateStatus$1.RUNNING || animate.status === AnimateStatus$1.INITIAL) {
607
+ else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {
616
608
  animate.advance(scaledDelta);
617
609
  }
618
610
  });
@@ -1047,13 +1039,6 @@ class Animate {
1047
1039
  }
1048
1040
  }
1049
1041
 
1050
- var STATUS;
1051
- (function (STATUS) {
1052
- STATUS[STATUS["INITIAL"] = 0] = "INITIAL";
1053
- STATUS[STATUS["RUNNING"] = 1] = "RUNNING";
1054
- STATUS[STATUS["PAUSE"] = 2] = "PAUSE";
1055
- })(STATUS || (STATUS = {}));
1056
-
1057
1042
  const performanceRAF = new PerformanceRAF();
1058
1043
  class RAFTickHandler {
1059
1044
  constructor() {
@@ -1080,6 +1065,9 @@ class DefaultTicker extends EventEmitter {
1080
1065
  this.timelines = [];
1081
1066
  this.frameTimeHistory = [];
1082
1067
  this.checkSkip = (delta) => {
1068
+ if (this.stage.params.optimize.tickRenderMode === 'performance') {
1069
+ return false;
1070
+ }
1083
1071
  const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
1084
1072
  return skip;
1085
1073
  };
@@ -1469,7 +1457,7 @@ class AnimateExecutor {
1469
1457
  });
1470
1458
  }
1471
1459
  parseParams(params, isTimeline) {
1472
- var _a;
1460
+ var _a, _b;
1473
1461
  const totalTime = this.resolveValue(params.totalTime, undefined, undefined);
1474
1462
  const startTime = this.resolveValue(params.startTime, undefined, 0);
1475
1463
  const parsedParams = Object.assign({}, params);
@@ -1506,8 +1494,8 @@ class AnimateExecutor {
1506
1494
  effects = [effects];
1507
1495
  }
1508
1496
  return Object.assign(Object.assign({}, slice), { delay: slice.delay * scale, delayAfter: slice.delayAfter * scale, duration: slice.duration * scale, effects: effects.map(effect => {
1509
- var _a;
1510
- const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[effect.type];
1497
+ var _a, _b;
1498
+ const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = effect.type) !== null && _b !== void 0 ? _b : 'fromTo'];
1511
1499
  const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
1512
1500
  return Object.assign(Object.assign({}, effect), { custom,
1513
1501
  customType });
@@ -1531,7 +1519,7 @@ class AnimateExecutor {
1531
1519
  parsedParams.oneByOne = oneByOneTime;
1532
1520
  parsedParams.oneByOneDelay = oneByOneDelay;
1533
1521
  parsedParams.custom =
1534
- (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[params.type];
1522
+ (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = params.type) !== null && _b !== void 0 ? _b : 'fromTo'];
1535
1523
  const customType = parsedParams.custom && isFunction(parsedParams.custom)
1536
1524
  ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom))
1537
1525
  ? 1
@@ -1552,8 +1540,16 @@ class AnimateExecutor {
1552
1540
  return parsedParams;
1553
1541
  }
1554
1542
  execute(params) {
1543
+ if (Array.isArray(params)) {
1544
+ params.forEach(param => this._execute(param));
1545
+ }
1546
+ else {
1547
+ this._execute(params);
1548
+ }
1549
+ }
1550
+ _execute(params) {
1555
1551
  if (params.selfOnly) {
1556
- return this.executeItem(params, this._target, 0, 1);
1552
+ return this._executeItem(params, this._target, 0, 1);
1557
1553
  }
1558
1554
  const isTimeline = 'timeSlices' in params;
1559
1555
  let filteredChildren;
@@ -1596,29 +1592,41 @@ class AnimateExecutor {
1596
1592
  return;
1597
1593
  }
1598
1594
  executeTypeConfigItem(params, graphic, index, count) {
1599
- var _a, _b, _c, _d, _e;
1600
- const { type, channel, customParameters, easing = 'linear', delay = 0, delayAfter = 0, duration = 300, startTime = 0, oneByOneDelay = 0, loop, bounce, priority = 0, options, custom, customType, controlOptions } = params;
1595
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1596
+ const { type = 'fromTo', channel, customParameters, easing = 'linear', delay = 0, delayAfter = 0, duration = 300, startTime = 0, oneByOneDelay = 0, loop, bounce, priority = 0, options, custom, customType, controlOptions } = params;
1601
1597
  const animate = graphic.animate();
1602
1598
  animate.priority = priority;
1603
- const delayValue = delay;
1604
- const datum = (_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
1605
- const indexKey = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.indexKey;
1599
+ const delayValue = isFunction(delay) ? delay((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {}) : delay;
1600
+ const datum = (_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0];
1601
+ const indexKey = (_e = graphic.context) === null || _e === void 0 ? void 0 : _e.indexKey;
1606
1602
  if (datum && indexKey) {
1607
- index = (_d = datum[indexKey]) !== null && _d !== void 0 ? _d : index;
1603
+ index = (_f = datum[indexKey]) !== null && _f !== void 0 ? _f : index;
1608
1604
  }
1609
- animate.startAt(startTime);
1605
+ animate.startAt(startTime + delayValue);
1610
1606
  const wait = index * oneByOneDelay;
1611
1607
  wait > 0 && animate.wait(wait);
1612
- if (delayValue > 0) {
1613
- animate.wait(delayValue);
1608
+ let parsedFromProps = null;
1609
+ let props = params.to;
1610
+ let from = params.from;
1611
+ if (!props) {
1612
+ if (!parsedFromProps) {
1613
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1614
+ }
1615
+ props = parsedFromProps.props;
1616
+ }
1617
+ if (!from) {
1618
+ if (!parsedFromProps) {
1619
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1620
+ }
1621
+ from = parsedFromProps.from;
1614
1622
  }
1615
- const props = (_e = params.to) !== null && _e !== void 0 ? _e : this.createPropsFromChannel(channel, graphic);
1616
- this._handleRunAnimate(animate, custom, customType, props, duration, easing, customParameters, options, type, graphic);
1623
+ this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
1617
1624
  if (oneByOneDelay) {
1618
1625
  animate.wait(oneByOneDelay * (count - index - 1));
1619
1626
  }
1620
- if (delayAfter > 0) {
1621
- animate.wait(delayAfter);
1627
+ const delayAfterValue = isFunction(delayAfter) ? delayAfter((_h = (_g = graphic.context) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h[0], graphic, {}) : delayAfter;
1628
+ if (delayAfterValue > 0) {
1629
+ animate.wait(delayAfterValue);
1622
1630
  }
1623
1631
  if (loop && loop > 0) {
1624
1632
  animate.loop(loop);
@@ -1628,15 +1636,16 @@ class AnimateExecutor {
1628
1636
  }
1629
1637
  return animate;
1630
1638
  }
1631
- _handleRunAnimate(animate, custom, customType, props, duration, easing, customParameters, options, type, graphic) {
1639
+ _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
1640
+ var _a, _b, _c, _d;
1632
1641
  if (custom && customType) {
1633
1642
  const customParams = this.resolveValue(customParameters, graphic, {});
1634
1643
  const objOptions = isFunction(options)
1635
- ? options.call(null, customParameters.data && customParameters.data[0], graphic, customParameters)
1644
+ ? options.call(null, (_b = (customParameters && ((_a = customParameters.data) === null || _a === void 0 ? void 0 : _a[0]))) !== null && _b !== void 0 ? _b : (_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], graphic, customParameters)
1636
1645
  : options;
1637
1646
  customParams.options = objOptions;
1638
1647
  if (customType === 1) {
1639
- this.createCustomAnimation(animate, custom, props, duration, easing, customParams);
1648
+ this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams);
1640
1649
  }
1641
1650
  else if (customType === 2) {
1642
1651
  this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
@@ -1677,18 +1686,35 @@ class AnimateExecutor {
1677
1686
  return animate;
1678
1687
  }
1679
1688
  applyTimeSliceToAnimate(slice, animate, graphic) {
1689
+ var _a, _b, _c, _d;
1680
1690
  const { effects, duration = 300, delay = 0, delayAfter = 0 } = slice;
1681
- const delayValue = delay;
1682
- const delayAfterValue = delayAfter;
1691
+ const delayValue = isFunction(delay) ? delay((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0], graphic, {}) : delay;
1692
+ const delayAfterValue = isFunction(delayAfter) ? delayAfter((_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0], graphic, {}) : delayAfter;
1683
1693
  if (delayValue > 0) {
1684
1694
  animate.wait(delayValue);
1685
1695
  }
1686
1696
  const effectsArray = Array.isArray(effects) ? effects : [effects];
1687
1697
  effectsArray.forEach(effect => {
1688
- var _a;
1689
- const { type = 'to', channel, customParameters, easing = 'linear', options } = effect;
1690
- const props = (_a = effect.to) !== null && _a !== void 0 ? _a : this.createPropsFromChannel(channel, graphic);
1691
- this._handleRunAnimate(animate, effect.custom, effect.customType, props, duration, easing, customParameters, options, type, graphic);
1698
+ var _a, _b;
1699
+ const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;
1700
+ let parsedFromProps = null;
1701
+ let props = effect.to;
1702
+ let from = effect.from;
1703
+ if (!props) {
1704
+ if (!parsedFromProps) {
1705
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1706
+ }
1707
+ props = parsedFromProps.props;
1708
+ }
1709
+ if (!from) {
1710
+ if (!parsedFromProps) {
1711
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1712
+ }
1713
+ from = parsedFromProps.from;
1714
+ }
1715
+ const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[type];
1716
+ const customType = (_b = effect.customType) !== null && _b !== void 0 ? _b : (custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0);
1717
+ this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
1692
1718
  });
1693
1719
  if (delayAfterValue > 0) {
1694
1720
  animate.wait(delayAfterValue);
@@ -1704,19 +1730,23 @@ class AnimateExecutor {
1704
1730
  };
1705
1731
  animate.to(props, duration, easing);
1706
1732
  }
1707
- createCustomAnimation(animate, CustomAnimateConstructor, props, duration, easing, customParams) {
1733
+ createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
1708
1734
  const to = props;
1709
- const customAnimate = new CustomAnimateConstructor(null, to, duration, easing, customParams);
1735
+ const customAnimate = new CustomAnimateConstructor(from, to, duration, easing, customParams);
1710
1736
  animate.play(customAnimate);
1711
1737
  }
1712
1738
  createPropsFromChannel(channel, graphic) {
1713
1739
  const props = {};
1740
+ let from = null;
1714
1741
  if (!channel) {
1715
- return props;
1742
+ return {
1743
+ from,
1744
+ props
1745
+ };
1716
1746
  }
1717
1747
  if (!Array.isArray(channel)) {
1718
1748
  Object.entries(channel).forEach(([key, config]) => {
1719
- var _a;
1749
+ var _a, _b;
1720
1750
  if (config.to !== undefined) {
1721
1751
  if (typeof config.to === 'function') {
1722
1752
  props[key] = config.to((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
@@ -1725,9 +1755,32 @@ class AnimateExecutor {
1725
1755
  props[key] = config.to;
1726
1756
  }
1727
1757
  }
1758
+ if (config.from !== undefined) {
1759
+ if (!from) {
1760
+ from = {};
1761
+ }
1762
+ if (typeof config.from === 'function') {
1763
+ from[key] = config.from((_b = graphic.context) === null || _b === void 0 ? void 0 : _b.data, graphic, {});
1764
+ }
1765
+ else {
1766
+ from[key] = config.from;
1767
+ }
1768
+ }
1769
+ });
1770
+ }
1771
+ else {
1772
+ channel.forEach(key => {
1773
+ var _a, _b;
1774
+ const value = (_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.diffAttrs) === null || _b === void 0 ? void 0 : _b[key];
1775
+ if (value !== undefined) {
1776
+ props[key] = value;
1777
+ }
1728
1778
  });
1729
1779
  }
1730
- return props;
1780
+ return {
1781
+ from,
1782
+ props
1783
+ };
1731
1784
  }
1732
1785
  resolveValue(value, graphic, defaultValue) {
1733
1786
  var _a;
@@ -1740,6 +1793,12 @@ class AnimateExecutor {
1740
1793
  return value;
1741
1794
  }
1742
1795
  executeItem(params, graphic, index = 0, count = 1) {
1796
+ if (Array.isArray(params)) {
1797
+ return params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean);
1798
+ }
1799
+ return [this._executeItem(params, graphic, index, count)].filter(Boolean);
1800
+ }
1801
+ _executeItem(params, graphic, index = 0, count = 1) {
1743
1802
  if (!graphic) {
1744
1803
  return null;
1745
1804
  }
@@ -1813,7 +1872,9 @@ class AnimationStateManager {
1813
1872
  nextState.forEach((state, index) => {
1814
1873
  shouldApplyState.push({
1815
1874
  state,
1816
- animationConfig: animationConfig[index].animation,
1875
+ animationConfig: isArray(animationConfig[index])
1876
+ ? animationConfig[index].map(item => item.animation)
1877
+ : animationConfig[index].animation,
1817
1878
  executor: new AnimateExecutor(this.graphic)
1818
1879
  });
1819
1880
  });
@@ -1831,7 +1892,9 @@ class AnimationStateManager {
1831
1892
  if (result.allowTransition) {
1832
1893
  shouldApplyState.push({
1833
1894
  state,
1834
- animationConfig: animationConfig[index].animation,
1895
+ animationConfig: isArray(animationConfig[index])
1896
+ ? animationConfig[index].map(item => item.animation)
1897
+ : animationConfig[index].animation,
1835
1898
  executor: new AnimateExecutor(this.graphic)
1836
1899
  });
1837
1900
  this.stateList.forEach(currState => {
@@ -1961,15 +2024,6 @@ class GraphicStateExtension {
1961
2024
  }
1962
2025
 
1963
2026
  class AnimateExtension {
1964
- setAttributesAndPreventAnimate(attributes) {
1965
- this.setAttributes(attributes);
1966
- this.animates &&
1967
- this.animates.forEach(animate => {
1968
- Object.keys(attributes).forEach(key => {
1969
- animate.preventAttr(key);
1970
- });
1971
- });
1972
- }
1973
2027
  getAttributes(final = false) {
1974
2028
  if (final && this.finalAttribute) {
1975
2029
  return this.finalAttribute;
@@ -2053,6 +2107,7 @@ class ACustomAnimate extends Step {
2053
2107
  }
2054
2108
  const easedRatio = this.easing(ratio);
2055
2109
  this.onUpdate(end, easedRatio, out);
2110
+ this.syncAttributeUpdate();
2056
2111
  }
2057
2112
  setProps(props) {
2058
2113
  this.props = props;
@@ -2061,14 +2116,107 @@ class ACustomAnimate extends Step {
2061
2116
  }
2062
2117
  }
2063
2118
  class AComponentAnimate extends ACustomAnimate {
2064
- onFirstRun() {
2119
+ completeBind(animator) {
2120
+ this.setStartTime(0);
2065
2121
  this._animator && this._animator.start();
2122
+ this.setDuration(animator.getDuration());
2066
2123
  }
2067
2124
  stop() {
2068
2125
  this._animator && this._animator.stop();
2069
2126
  }
2070
2127
  }
2071
2128
 
2129
+ class ComponentAnimator {
2130
+ constructor(component) {
2131
+ this.tasks = [];
2132
+ this.started = false;
2133
+ this.completed = 0;
2134
+ this.totalDuration = 0;
2135
+ this.onStartCallbacks = [];
2136
+ this.onEndCallbacks = [];
2137
+ this.onUpdateCallbacks = [];
2138
+ this.component = component;
2139
+ }
2140
+ animate(graphic, config) {
2141
+ if (this.started) {
2142
+ console.warn('Cannot add animations after animation has started');
2143
+ return this;
2144
+ }
2145
+ this.tasks.push({
2146
+ graphic,
2147
+ config
2148
+ });
2149
+ return this;
2150
+ }
2151
+ onStart(callback) {
2152
+ this.onStartCallbacks.push(callback);
2153
+ return this;
2154
+ }
2155
+ onEnd(callback) {
2156
+ this.onEndCallbacks.push(callback);
2157
+ return this;
2158
+ }
2159
+ onUpdate(callback) {
2160
+ this.onUpdateCallbacks.push(callback);
2161
+ return this;
2162
+ }
2163
+ start() {
2164
+ if (this.started) {
2165
+ console.warn('Animation has already started');
2166
+ return this;
2167
+ }
2168
+ this.started = true;
2169
+ this.completed = 0;
2170
+ this.onStartCallbacks.forEach(callback => callback());
2171
+ if (this.tasks.length === 0) {
2172
+ setTimeout(() => {
2173
+ this.onEndCallbacks.forEach(callback => callback());
2174
+ }, 0);
2175
+ return this;
2176
+ }
2177
+ this.tasks.forEach(task => {
2178
+ const executor = new AnimateExecutor(task.graphic);
2179
+ executor.onEnd(() => {
2180
+ this.completed++;
2181
+ if (this.completed === this.tasks.length) {
2182
+ this.onEndCallbacks.forEach(callback => callback());
2183
+ }
2184
+ });
2185
+ const animate = executor.executeItem(task.config, task.graphic);
2186
+ task.animate = animate;
2187
+ animate.forEach(animate => {
2188
+ this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
2189
+ });
2190
+ });
2191
+ return this;
2192
+ }
2193
+ deleteSelfAttr(key) {
2194
+ this.tasks.forEach(task => {
2195
+ if (task.animate) {
2196
+ task.animate.forEach(animate => animate.preventAttr(key));
2197
+ }
2198
+ });
2199
+ }
2200
+ stop(type) {
2201
+ this.tasks.forEach(task => {
2202
+ if (task.animate) {
2203
+ task.animate.forEach(animate => animate.stop(type));
2204
+ }
2205
+ });
2206
+ if (this.started && this.completed !== this.tasks.length) {
2207
+ this.onEndCallbacks.forEach(callback => callback());
2208
+ this.completed = this.tasks.length;
2209
+ }
2210
+ return this;
2211
+ }
2212
+ getDuration() {
2213
+ return this.totalDuration;
2214
+ }
2215
+ }
2216
+ function createComponentAnimator(component) {
2217
+ return new ComponentAnimator(component);
2218
+ }
2219
+
2072
2220
  class IncreaseCount extends ACustomAnimate {
2073
2221
  constructor(from, to, duration, easing, params) {
2074
2222
  super(from, to, duration, easing, params);
@@ -2341,6 +2489,7 @@ class ClipGraphicAnimate extends ACustomAnimate {
2341
2489
  this._clipGraphic = params === null || params === void 0 ? void 0 : params.clipGraphic;
2342
2490
  }
2343
2491
  onBind() {
2492
+ super.onBind();
2344
2493
  if (this._group && this._clipGraphic) {
2345
2494
  this._lastClip = this._group.attribute.clip;
2346
2495
  this._lastPath = this._group.attribute.path;
@@ -2509,6 +2658,12 @@ class TagPointsUpdate extends ACustomAnimate {
2509
2658
  return [];
2510
2659
  }
2511
2660
  onBind() {
2661
+ super.onBind();
2662
+ const { points, segments } = this.target.attribute;
2663
+ const { points: pointsTo, segments: segmentsTo } = this.target.getFinalAttribute();
2664
+ this.from = { points, segments };
2665
+ this.to = { points: pointsTo, segments: segmentsTo };
2666
+ this.props = this.to;
2512
2667
  const originFromPoints = this.getPoints(this.from);
2513
2668
  const originToPoints = this.getPoints(this.to, true);
2514
2669
  this.fromPoints = !originFromPoints ? [] : !Array.isArray(originFromPoints) ? [originFromPoints] : originFromPoints;
@@ -2611,77 +2766,109 @@ class TagPointsUpdate extends ACustomAnimate {
2611
2766
  }
2612
2767
  return;
2613
2768
  }
2614
- out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
2769
+ this.target.setAttributes({ clipRange: this.clipRange + (1 - this.clipRange) * ratio });
2615
2770
  }
2616
2771
  if (this.segmentsCache && this.to.segments) {
2617
2772
  let start = 0;
2618
- out.segments = this.to.segments.map((segment, index) => {
2773
+ const segments = this.to.segments.map((segment, index) => {
2619
2774
  const end = start + this.segmentsCache[index];
2620
2775
  const points = this.points.slice(start, end);
2621
2776
  start = end;
2622
2777
  return Object.assign(Object.assign({}, segment), { points });
2623
2778
  });
2779
+ this.target.attribute.points = segments;
2624
2780
  }
2625
2781
  else {
2626
- out.points = this.points;
2782
+ this.target.attribute.points = this.points;
2627
2783
  }
2784
+ this.target.addUpdatePositionTag();
2785
+ this.target.addUpdateShapeAndBoundsTag();
2628
2786
  }
2629
2787
  }
2630
2788
 
2631
- class GroupFadeIn extends ACustomAnimate {
2632
- getEndProps() {
2633
- return {};
2789
+ class CommonIn extends ACustomAnimate {
2790
+ constructor(from, to, duration, easing, params) {
2791
+ super(from, to, duration, easing, params);
2634
2792
  }
2635
2793
  onBind() {
2636
- this.target.setTheme({
2637
- common: {
2638
- opacity: 0
2639
- }
2794
+ var _a;
2795
+ super.onBind();
2796
+ const attrs = this.target.getFinalAttribute();
2797
+ const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
2798
+ const to = {};
2799
+ const from = {};
2800
+ this.keys.forEach(key => {
2801
+ var _a, _b;
2802
+ to[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
2803
+ from[key] = (_b = fromAttrs[key]) !== null && _b !== void 0 ? _b : 0;
2640
2804
  });
2641
- return;
2805
+ const finalAttribute = this.target.getFinalAttribute();
2806
+ if (finalAttribute) {
2807
+ Object.assign(this.target.attribute, finalAttribute);
2808
+ }
2809
+ this.props = to;
2810
+ this.propKeys = this.keys;
2811
+ this.from = from;
2812
+ this.to = to;
2813
+ this.target.setAttributes(from);
2642
2814
  }
2643
- onEnd() {
2644
- this.target.setTheme({
2645
- common: {
2646
- opacity: 1
2647
- }
2648
- });
2649
- return;
2815
+ onEnd(cb) {
2816
+ super.onEnd(cb);
2650
2817
  }
2651
2818
  onUpdate(end, ratio, out) {
2652
- this.target.setTheme({
2653
- common: {
2654
- opacity: ratio
2655
- }
2819
+ const attribute = this.target.attribute;
2820
+ this.propKeys.forEach(key => {
2821
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2656
2822
  });
2823
+ this.target.addUpdatePositionTag();
2824
+ this.target.addUpdateShapeAndBoundsTag();
2657
2825
  }
2658
2826
  }
2659
- class GroupFadeOut extends ACustomAnimate {
2660
- getEndProps() {
2661
- return {};
2827
+ class CommonOut extends ACustomAnimate {
2828
+ constructor(from, to, duration, easing, params) {
2829
+ super(from, to, duration, easing, params);
2662
2830
  }
2663
2831
  onBind() {
2664
- this.target.setTheme({
2665
- common: {
2666
- opacity: 1
2667
- }
2832
+ super.onBind();
2833
+ const attrs = this.target.attribute;
2834
+ const to = {};
2835
+ const from = {};
2836
+ this.keys.forEach(key => {
2837
+ var _a;
2838
+ to[key] = 0;
2839
+ from[key] = (_a = attrs[key]) !== null && _a !== void 0 ? _a : 1;
2668
2840
  });
2669
- return;
2841
+ this.props = to;
2842
+ this.propKeys = this.keys;
2843
+ this.from = from;
2844
+ this.to = to;
2845
+ Object.assign(this.target.attribute, from);
2846
+ this.target.addUpdatePositionTag();
2847
+ this.target.addUpdateBoundTag();
2670
2848
  }
2671
- onEnd() {
2672
- this.target.setTheme({
2673
- common: {
2674
- opacity: 0
2675
- }
2676
- });
2677
- return;
2849
+ onEnd(cb) {
2850
+ super.onEnd(cb);
2678
2851
  }
2679
2852
  onUpdate(end, ratio, out) {
2680
- this.target.setTheme({
2681
- common: {
2682
- opacity: 1 - ratio
2683
- }
2853
+ const attribute = this.target.attribute;
2854
+ this.propKeys.forEach(key => {
2855
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2684
2856
  });
2857
+ this.target.addUpdatePositionTag();
2858
+ this.target.addUpdateShapeAndBoundsTag();
2859
+ }
2860
+ }
2861
+
2862
+ class GroupFadeIn extends CommonIn {
2863
+ constructor(from, to, duration, easing, params) {
2864
+ super(from, to, duration, easing, params);
2865
+ this.keys = ['baseOpacity'];
2866
+ }
2867
+ }
2868
+ class GroupFadeOut extends CommonOut {
2869
+ constructor(from, to, duration, easing, params) {
2870
+ super(from, to, duration, easing, params);
2871
+ this.keys = ['baseOpacity'];
2685
2872
  }
2686
2873
  }
2687
2874
 
@@ -2700,6 +2887,7 @@ class RotateBySphereAnimate extends ACustomAnimate {
2700
2887
  this.phi = phi;
2701
2888
  }
2702
2889
  onBind() {
2890
+ super.onBind();
2703
2891
  return;
2704
2892
  }
2705
2893
  onEnd() {
@@ -2729,99 +2917,29 @@ class RotateBySphereAnimate extends ACustomAnimate {
2729
2917
  }
2730
2918
  }
2731
2919
 
2732
- class CommonIn extends ACustomAnimate {
2920
+ class ClipIn extends CommonIn {
2733
2921
  constructor(from, to, duration, easing, params) {
2734
2922
  super(from, to, duration, easing, params);
2923
+ this.keys = ['clipRange'];
2735
2924
  }
2736
- onBind() {
2737
- var _a, _b, _c;
2738
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
2739
- this.target.setAttributes(this.params.diffAttrs);
2740
- }
2741
- const attrs = this.target.getAttributes(true);
2742
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : {};
2743
- const to = {};
2744
- const from = {};
2745
- this.keys.forEach(key => {
2746
- var _a, _b;
2747
- to[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
2748
- from[key] = (_b = fromAttrs === null || fromAttrs === void 0 ? void 0 : fromAttrs[key]) !== null && _b !== void 0 ? _b : 0;
2749
- });
2750
- this.props = to;
2751
- this.propKeys = this.keys;
2752
- this.animate.reSyncProps();
2753
- this.from = from;
2754
- this.to = to;
2755
- this.target.setAttributes(from);
2756
- }
2757
- onEnd(cb) {
2758
- super.onEnd(cb);
2925
+ }
2926
+ class ClipOut extends CommonOut {
2927
+ constructor(from, to, duration, easing, params) {
2928
+ super(from, to, duration, easing, params);
2929
+ this.keys = ['clipRange'];
2759
2930
  }
2760
- onUpdate(end, ratio, out) {
2761
- const attribute = this.target.attribute;
2762
- this.propKeys.forEach(key => {
2763
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2764
- });
2765
- this.target.addUpdatePositionTag();
2766
- this.target.addUpdateShapeAndBoundsTag();
2931
+ }
2932
+
2933
+ class FadeIn extends CommonIn {
2934
+ constructor(from, to, duration, easing, params) {
2935
+ super(from, to, duration, easing, params);
2936
+ this.keys = ['opacity'];
2767
2937
  }
2768
2938
  }
2769
- class CommonOut extends ACustomAnimate {
2939
+ class FadeOut extends CommonOut {
2770
2940
  constructor(from, to, duration, easing, params) {
2771
2941
  super(from, to, duration, easing, params);
2772
- }
2773
- onBind() {
2774
- const attrs = this.target.getFinalAttribute();
2775
- const to = {};
2776
- const from = {};
2777
- this.keys.forEach(key => {
2778
- var _a;
2779
- to[key] = 0;
2780
- from[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
2781
- });
2782
- this.props = to;
2783
- this.propKeys = this.keys;
2784
- this.animate.reSyncProps();
2785
- this.from = from;
2786
- this.to = to;
2787
- this.target.setAttributes(from);
2788
- }
2789
- onEnd(cb) {
2790
- super.onEnd(cb);
2791
- }
2792
- onUpdate(end, ratio, out) {
2793
- const attribute = this.target.attribute;
2794
- this.propKeys.forEach(key => {
2795
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2796
- });
2797
- this.target.addUpdatePositionTag();
2798
- this.target.addUpdateShapeAndBoundsTag();
2799
- }
2800
- }
2801
-
2802
- class ClipIn extends CommonIn {
2803
- constructor(from, to, duration, easing, params) {
2804
- super(from, to, duration, easing, params);
2805
- this.keys = ['clipRange'];
2806
- }
2807
- }
2808
- class ClipOut extends CommonOut {
2809
- constructor(from, to, duration, easing, params) {
2810
- super(from, to, duration, easing, params);
2811
- this.keys = ['clipRange'];
2812
- }
2813
- }
2814
-
2815
- class FadeIn extends CommonIn {
2816
- constructor(from, to, duration, easing, params) {
2817
- super(from, to, duration, easing, params);
2818
- this.keys = ['opacity'];
2819
- }
2820
- }
2821
- class FadeOut extends CommonOut {
2822
- constructor(from, to, duration, easing, params) {
2823
- super(from, to, duration, easing, params);
2824
- this.keys = ['opacity'];
2942
+ this.keys = ['opacity'];
2825
2943
  }
2826
2944
  }
2827
2945
 
@@ -2872,7 +2990,7 @@ const growAngleIn = (graphic, options, animationParameters) => {
2872
2990
  : growAngleInIndividual(graphic, options);
2873
2991
  };
2874
2992
  const growAngleOutIndividual = (graphic, options, animationParameters) => {
2875
- const attrs = graphic.getFinalAttribute();
2993
+ const attrs = graphic.attribute;
2876
2994
  if (options && options.orient === 'anticlockwise') {
2877
2995
  return {
2878
2996
  from: { startAngle: attrs.startAngle },
@@ -2885,7 +3003,7 @@ const growAngleOutIndividual = (graphic, options, animationParameters) => {
2885
3003
  };
2886
3004
  };
2887
3005
  const growAngleOutOverall = (graphic, options, animationParameters) => {
2888
- const attrs = graphic.getFinalAttribute();
3006
+ const attrs = graphic.attribute;
2889
3007
  if (options && options.orient === 'anticlockwise') {
2890
3008
  const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;
2891
3009
  return {
@@ -2938,6 +3056,26 @@ class GrowAngleBase extends ACustomAnimate {
2938
3056
  this.valid = false;
2939
3057
  }
2940
3058
  }
3059
+ deleteSelfAttr(key) {
3060
+ delete this.props[key];
3061
+ this.fromProps && delete this.fromProps[key];
3062
+ const index = this.propKeys.indexOf(key);
3063
+ if (index !== -1) {
3064
+ this.propKeys.splice(index, 1);
3065
+ }
3066
+ if (this.propKeys && this.propKeys.length > 1) {
3067
+ this._updateFunction = this.updateAngle;
3068
+ }
3069
+ else if (this.propKeys[0] === 'startAngle') {
3070
+ this._updateFunction = this.updateStartAngle;
3071
+ }
3072
+ else if (this.propKeys[0] === 'endAngle') {
3073
+ this._updateFunction = this.updateEndAngle;
3074
+ }
3075
+ else {
3076
+ this._updateFunction = null;
3077
+ }
3078
+ }
2941
3079
  updateStartAngle(ratio) {
2942
3080
  this.target.attribute.startAngle =
2943
3081
  this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
@@ -2950,41 +3088,39 @@ class GrowAngleBase extends ACustomAnimate {
2950
3088
  this.updateEndAngle(ratio);
2951
3089
  }
2952
3090
  onUpdate(end, ratio, out) {
2953
- this._updateFunction(ratio);
2954
- this.target.addUpdateShapeAndBoundsTag();
3091
+ if (this._updateFunction) {
3092
+ this._updateFunction(ratio);
3093
+ this.target.addUpdateShapeAndBoundsTag();
3094
+ }
2955
3095
  }
2956
3096
  }
2957
3097
  class GrowAngleIn extends GrowAngleBase {
2958
3098
  onBind() {
2959
- var _a, _b, _c;
2960
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
2961
- Object.assign(this.target.attribute, this.params.diffAttrs);
2962
- }
3099
+ var _a, _b;
3100
+ super.onBind();
2963
3101
  const { from, to } = growAngleIn(this.target, this.params.options, this.params);
2964
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3102
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
2965
3103
  this.props = to;
2966
3104
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2967
3105
  this.from = fromAttrs;
2968
3106
  this.to = to;
2969
- Object.assign(this.target.attribute, fromAttrs);
2970
- this.target.addUpdatePositionTag();
2971
- this.target.addUpdateBoundTag();
3107
+ const finalAttribute = this.target.getFinalAttribute();
3108
+ if (finalAttribute) {
3109
+ Object.assign(this.target.attribute, finalAttribute);
3110
+ }
3111
+ this.target.setAttributes(fromAttrs);
2972
3112
  this.determineUpdateFunction();
2973
3113
  }
2974
3114
  }
2975
3115
  class GrowAngleOut extends GrowAngleBase {
2976
3116
  onBind() {
2977
- var _a, _b;
3117
+ super.onBind();
2978
3118
  const { from, to } = growAngleOut(this.target, this.params.options, this.params);
2979
- const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3119
+ const fromAttrs = from;
2980
3120
  this.props = to;
2981
3121
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2982
- this.animate.reSyncProps();
2983
- this.from = fromAttrs;
3122
+ this.from = fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : this.target.attribute;
2984
3123
  this.to = to;
2985
- Object.assign(this.target.attribute, fromAttrs);
2986
- this.target.addUpdatePositionTag();
2987
- this.target.addUpdateBoundTag();
2988
3124
  this.determineUpdateFunction();
2989
3125
  }
2990
3126
  }
@@ -3067,7 +3203,7 @@ const growCenterIn = (graphic, options, animationParameters) => {
3067
3203
  }
3068
3204
  };
3069
3205
  const growCenterOut = (graphic, options, animationParameters) => {
3070
- const attrs = graphic.getFinalAttribute();
3206
+ const attrs = graphic.attribute;
3071
3207
  switch (options === null || options === void 0 ? void 0 : options.direction) {
3072
3208
  case 'x': {
3073
3209
  const x = attrs.x;
@@ -3145,17 +3281,18 @@ class GrowCenterIn extends ACustomAnimate {
3145
3281
  super(from, to, duration, easing, params);
3146
3282
  }
3147
3283
  onBind() {
3148
- var _a, _b, _c;
3149
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
3150
- this.target.setAttributes(this.params.diffAttrs);
3151
- }
3284
+ var _a, _b;
3285
+ super.onBind();
3152
3286
  const { from, to } = growCenterIn(this.target, this.params.options, this.params);
3153
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3287
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3154
3288
  this.props = to;
3155
3289
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3156
- this.animate.reSyncProps();
3157
3290
  this.from = fromAttrs;
3158
3291
  this.to = to;
3292
+ const finalAttribute = this.target.getFinalAttribute();
3293
+ if (finalAttribute) {
3294
+ Object.assign(this.target.attribute, finalAttribute);
3295
+ }
3159
3296
  this.target.setAttributes(fromAttrs);
3160
3297
  }
3161
3298
  onEnd(cb) {
@@ -3175,12 +3312,11 @@ class GrowCenterOut extends ACustomAnimate {
3175
3312
  super(from, to, duration, easing, params);
3176
3313
  }
3177
3314
  onBind() {
3178
- const attrs = this.target.getFinalAttribute();
3315
+ super.onBind();
3179
3316
  const { from, to } = growCenterOut(this.target, this.params.options, this.params);
3180
3317
  this.props = to;
3181
3318
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3182
- this.animate.reSyncProps();
3183
- this.from = from || attrs;
3319
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3184
3320
  this.to = to;
3185
3321
  }
3186
3322
  onEnd(cb) {
@@ -3252,19 +3388,19 @@ class GrowHeightIn extends ACustomAnimate {
3252
3388
  super(from, to, duration, easing, params);
3253
3389
  }
3254
3390
  onBind() {
3255
- var _a, _b, _c;
3256
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
3257
- Object.assign(this.target.attribute, this.params.diffAttrs);
3258
- }
3391
+ var _a, _b;
3392
+ super.onBind();
3259
3393
  const { from, to } = growHeightIn(this.target, this.params.options, this.params);
3260
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3394
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3261
3395
  this.props = to;
3262
3396
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3263
3397
  this.from = fromAttrs;
3264
3398
  this.to = to;
3265
- Object.assign(this.target.attribute, fromAttrs);
3266
- this.target.addUpdatePositionTag();
3267
- this.target.addUpdateBoundTag();
3399
+ const finalAttribute = this.target.getFinalAttribute();
3400
+ if (finalAttribute) {
3401
+ Object.assign(this.target.attribute, finalAttribute);
3402
+ }
3403
+ this.target.setAttributes(fromAttrs);
3268
3404
  }
3269
3405
  onEnd(cb) {
3270
3406
  super.onEnd(cb);
@@ -3330,12 +3466,11 @@ class GrowHeightOut extends ACustomAnimate {
3330
3466
  super(from, to, duration, easing, params);
3331
3467
  }
3332
3468
  onBind() {
3333
- const attrs = this.target.getFinalAttribute();
3469
+ super.onBind();
3334
3470
  const { from, to } = growHeightOut(this.target, this.params.options, this.params);
3335
3471
  this.props = to;
3336
3472
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3337
- this.animate.reSyncProps();
3338
- this.from = from || attrs;
3473
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3339
3474
  this.to = to;
3340
3475
  }
3341
3476
  onEnd(cb) {
@@ -3389,7 +3524,7 @@ const growPointsOut = (graphic, options, animationParameters) => {
3389
3524
  to: { points: getCenterPoints(graphic, options) }
3390
3525
  };
3391
3526
  };
3392
- let GworPointsBase$1 = class GworPointsBase extends ACustomAnimate {
3527
+ class GworPointsBase extends ACustomAnimate {
3393
3528
  constructor(from, to, duration, easing, params) {
3394
3529
  super(from, to, duration, easing, params);
3395
3530
  }
@@ -3407,33 +3542,35 @@ let GworPointsBase$1 = class GworPointsBase extends ACustomAnimate {
3407
3542
  this.target.addUpdatePositionTag();
3408
3543
  this.target.addUpdateShapeAndBoundsTag();
3409
3544
  }
3410
- };
3411
- class GrowPointsIn extends GworPointsBase$1 {
3545
+ }
3546
+ class GrowPointsIn extends GworPointsBase {
3412
3547
  onBind() {
3413
- var _a, _b;
3548
+ super.onBind();
3414
3549
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3415
3550
  const { from, to } = growPointsIn(this.target, this.params.options, this.params);
3416
- const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3417
3551
  this.props = to;
3418
3552
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3419
- this.animate.reSyncProps();
3420
- this.from = fromAttrs;
3553
+ this.from = from;
3421
3554
  this.to = to;
3422
- this.target.setAttributes(fromAttrs);
3555
+ const finalAttribute = this.target.getFinalAttribute();
3556
+ if (finalAttribute) {
3557
+ Object.assign(this.target.attribute, finalAttribute);
3558
+ }
3559
+ this.target.setAttributes(from);
3423
3560
  }
3424
3561
  else {
3425
3562
  this.valid = false;
3426
3563
  }
3427
3564
  }
3428
3565
  }
3429
- class GrowPointsOut extends GworPointsBase$1 {
3566
+ class GrowPointsOut extends GworPointsBase {
3430
3567
  onBind() {
3568
+ super.onBind();
3431
3569
  if (['area', 'line'].includes(this.target.type)) {
3432
3570
  const attrs = this.target.getFinalAttribute();
3433
3571
  const { from, to } = growPointsOut(this.target, this.params.options, this.params);
3434
3572
  this.props = to;
3435
3573
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3436
- this.animate.reSyncProps();
3437
3574
  this.from = from || attrs;
3438
3575
  this.to = to;
3439
3576
  }
@@ -3472,32 +3609,34 @@ const growPointsXOut = (graphic, options, animationParameters) => {
3472
3609
  to: { points: changePointsX(graphic, options, animationParameters) }
3473
3610
  };
3474
3611
  };
3475
- class GrowPointsXIn extends GworPointsBase$1 {
3612
+ class GrowPointsXIn extends GworPointsBase {
3476
3613
  onBind() {
3477
- var _a, _b;
3614
+ super.onBind();
3478
3615
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3479
3616
  const { from, to } = growPointsXIn(this.target, this.params.options, this.params);
3480
- const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3481
3617
  this.props = to;
3482
3618
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3483
- this.animate.reSyncProps();
3484
- this.from = fromAttrs;
3619
+ this.from = from;
3485
3620
  this.to = to;
3486
- this.target.setAttributes(fromAttrs);
3621
+ const finalAttribute = this.target.getFinalAttribute();
3622
+ if (finalAttribute) {
3623
+ Object.assign(this.target.attribute, finalAttribute);
3624
+ }
3625
+ this.target.setAttributes(from);
3487
3626
  }
3488
3627
  else {
3489
3628
  this.valid = false;
3490
3629
  }
3491
3630
  }
3492
3631
  }
3493
- class GrowPointsXOut extends GworPointsBase$1 {
3632
+ class GrowPointsXOut extends GworPointsBase {
3494
3633
  onBind() {
3634
+ super.onBind();
3495
3635
  if (['area', 'line'].includes(this.target.type)) {
3496
3636
  const attrs = this.target.getFinalAttribute();
3497
3637
  const { from, to } = growPointsXOut(this.target, this.params.options, this.params);
3498
3638
  this.props = to;
3499
3639
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3500
- this.animate.reSyncProps();
3501
3640
  this.from = from || attrs;
3502
3641
  this.to = to;
3503
3642
  }
@@ -3536,36 +3675,34 @@ const growPointsYOut = (graphic, options, animationParameters) => {
3536
3675
  to: { points: changePointsY(graphic, options, animationParameters) }
3537
3676
  };
3538
3677
  };
3539
- class GrowPointsYIn extends GworPointsBase$1 {
3678
+ class GrowPointsYIn extends GworPointsBase {
3540
3679
  onBind() {
3541
- var _a, _b, _c;
3542
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
3543
- this.target.setAttributes(this.params.diffAttrs);
3544
- }
3680
+ super.onBind();
3545
3681
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3546
3682
  const { from, to } = growPointsYIn(this.target, this.params.options, this.params);
3547
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3548
3683
  this.props = to;
3549
3684
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3550
- this.animate.reSyncProps();
3551
- this.from = fromAttrs;
3685
+ this.from = from;
3552
3686
  this.to = to;
3553
- this.target.setAttributes(fromAttrs);
3687
+ const finalAttribute = this.target.getFinalAttribute();
3688
+ if (finalAttribute) {
3689
+ Object.assign(this.target.attribute, finalAttribute);
3690
+ }
3691
+ this.target.setAttributes(from);
3554
3692
  }
3555
3693
  else {
3556
3694
  this.valid = false;
3557
3695
  }
3558
3696
  }
3559
3697
  }
3560
- class GrowPointsYOut extends GworPointsBase$1 {
3698
+ class GrowPointsYOut extends GworPointsBase {
3561
3699
  onBind() {
3562
- if (['area', 'line'].includes(this.target.type)) {
3563
- const attrs = this.target.getFinalAttribute();
3700
+ super.onBind();
3701
+ if (['area', 'line', 'polygon'].includes(this.target.type)) {
3564
3702
  const { from, to } = growPointsYOut(this.target, this.params.options, this.params);
3565
3703
  this.props = to;
3566
3704
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3567
- this.animate.reSyncProps();
3568
- this.from = from || attrs;
3705
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3569
3706
  this.to = to;
3570
3707
  }
3571
3708
  else {
@@ -3640,7 +3777,7 @@ const growRadiusOut = (graphic, options, animationParameters) => {
3640
3777
  ? growRadiusOutOverall(graphic, options)
3641
3778
  : growRadiusOutIndividual(graphic, options);
3642
3779
  };
3643
- class GworPointsBase extends ACustomAnimate {
3780
+ class GrowPointsBase extends ACustomAnimate {
3644
3781
  constructor(from, to, duration, easing, params) {
3645
3782
  super(from, to, duration, easing, params);
3646
3783
  }
@@ -3653,33 +3790,31 @@ class GworPointsBase extends ACustomAnimate {
3653
3790
  this.target.addUpdateShapeAndBoundsTag();
3654
3791
  }
3655
3792
  }
3656
- class GrowRadiusIn extends GworPointsBase {
3793
+ class GrowRadiusIn extends GrowPointsBase {
3657
3794
  onBind() {
3658
- var _a, _b, _c;
3659
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
3660
- this.target.setAttributes(this.params.diffAttrs);
3661
- }
3795
+ var _a, _b;
3796
+ super.onBind();
3662
3797
  const { from, to } = growRadiusIn(this.target, this.params.options, this.params);
3663
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3798
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3664
3799
  this.props = to;
3665
3800
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3666
- this.animate.reSyncProps();
3667
3801
  this.from = fromAttrs;
3668
3802
  this.to = to;
3803
+ const finalAttribute = this.target.getFinalAttribute();
3804
+ if (finalAttribute) {
3805
+ Object.assign(this.target.attribute, finalAttribute);
3806
+ }
3669
3807
  this.target.setAttributes(fromAttrs);
3670
3808
  }
3671
3809
  }
3672
- class GrowRadiusOut extends GworPointsBase {
3810
+ class GrowRadiusOut extends GrowPointsBase {
3673
3811
  onBind() {
3674
- var _a, _b;
3675
- const { from, to } = growRadiusOut(this.target, this.params.options, this.params);
3676
- const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3812
+ super.onBind();
3813
+ const { to } = growRadiusOut(this.target, this.params.options, this.params);
3677
3814
  this.props = to;
3678
3815
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3679
- this.animate.reSyncProps();
3680
- this.from = fromAttrs;
3816
+ this.from = this.target.attribute;
3681
3817
  this.to = to;
3682
- this.target.setAttributes(fromAttrs);
3683
3818
  }
3684
3819
  }
3685
3820
 
@@ -3786,17 +3921,18 @@ class GrowWidthIn extends ACustomAnimate {
3786
3921
  super(from, to, duration, easing, params);
3787
3922
  }
3788
3923
  onBind() {
3789
- var _a, _b, _c;
3790
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
3791
- this.target.setAttributes(this.params.diffAttrs);
3792
- }
3924
+ var _a, _b;
3925
+ super.onBind();
3793
3926
  const { from, to } = growWidthIn(this.target, this.params.options, this.params);
3794
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3927
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3795
3928
  this.props = to;
3796
3929
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3797
- this.animate.reSyncProps();
3798
3930
  this.from = fromAttrs;
3799
3931
  this.to = to;
3932
+ const finalAttribute = this.target.getFinalAttribute();
3933
+ if (finalAttribute) {
3934
+ Object.assign(this.target.attribute, finalAttribute);
3935
+ }
3800
3936
  this.target.setAttributes(fromAttrs);
3801
3937
  }
3802
3938
  onEnd(cb) {
@@ -3816,12 +3952,11 @@ class GrowWidthOut extends ACustomAnimate {
3816
3952
  super(from, to, duration, easing, params);
3817
3953
  }
3818
3954
  onBind() {
3819
- const attrs = this.target.getFinalAttribute();
3955
+ super.onBind();
3820
3956
  const { from, to } = growWidthOut(this.target, this.params.options, this.params);
3821
3957
  this.props = to;
3822
3958
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3823
- this.animate.reSyncProps();
3824
- this.from = from || attrs;
3959
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3825
3960
  this.to = to;
3826
3961
  }
3827
3962
  onEnd(cb) {
@@ -3837,189 +3972,9 @@ class GrowWidthOut extends ACustomAnimate {
3837
3972
  }
3838
3973
  }
3839
3974
 
3840
- /******************************************************************************
3841
- Copyright (c) Microsoft Corporation.
3842
-
3843
- Permission to use, copy, modify, and/or distribute this software for any
3844
- purpose with or without fee is hereby granted.
3845
-
3846
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3847
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3848
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3849
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3850
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3851
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3852
- PERFORMANCE OF THIS SOFTWARE.
3853
- ***************************************************************************** */
3854
- function __rest(s, e) {
3855
- var t = {};
3856
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3857
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3858
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3859
- }
3860
- return t;
3861
- }
3862
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3863
- var e = new Error(message);
3864
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3865
- };
3866
-
3867
- class ComponentAnimator {
3868
- constructor(component) {
3869
- this.tasks = [];
3870
- this.started = false;
3871
- this.completed = 0;
3872
- this.totalDuration = 0;
3873
- this.onStartCallbacks = [];
3874
- this.onEndCallbacks = [];
3875
- this.onUpdateCallbacks = [];
3876
- this.component = component;
3877
- }
3878
- animate(graphic, config, delay = 0) {
3879
- if (this.started) {
3880
- console.warn('Cannot add animations after animation has started');
3881
- return this;
3882
- }
3883
- this.tasks.push({
3884
- graphic,
3885
- config,
3886
- delay
3887
- });
3888
- let configDuration = 300;
3889
- let configDelay = 0;
3890
- if ('duration' in config) {
3891
- const typeConfig = config;
3892
- configDuration = typeof typeConfig.duration === 'number' ? typeConfig.duration : 300;
3893
- configDelay = typeof typeConfig.delay === 'number' ? typeConfig.delay : 0;
3894
- }
3895
- else if ('timeSlices' in config) {
3896
- const timelineConfig = config;
3897
- const timeSlices = Array.isArray(timelineConfig.timeSlices)
3898
- ? timelineConfig.timeSlices
3899
- : [timelineConfig.timeSlices];
3900
- let totalTimeSliceDuration = 0;
3901
- timeSlices.forEach(slice => {
3902
- const sliceDuration = typeof slice.duration === 'number' ? slice.duration : 300;
3903
- const sliceDelay = typeof slice.delay === 'number' ? slice.delay : 0;
3904
- const sliceDelayAfter = typeof slice.delayAfter === 'number' ? slice.delayAfter : 0;
3905
- totalTimeSliceDuration += sliceDuration + sliceDelay + sliceDelayAfter;
3906
- });
3907
- configDuration = totalTimeSliceDuration;
3908
- }
3909
- const duration = configDuration + configDelay + delay;
3910
- if (duration > this.totalDuration) {
3911
- this.totalDuration = duration;
3912
- }
3913
- return this;
3914
- }
3915
- onStart(callback) {
3916
- this.onStartCallbacks.push(callback);
3917
- return this;
3918
- }
3919
- onEnd(callback) {
3920
- this.onEndCallbacks.push(callback);
3921
- return this;
3922
- }
3923
- onUpdate(callback) {
3924
- this.onUpdateCallbacks.push(callback);
3925
- return this;
3926
- }
3927
- start() {
3928
- if (this.started) {
3929
- console.warn('Animation has already started');
3930
- return this;
3931
- }
3932
- this.started = true;
3933
- this.completed = 0;
3934
- this.onStartCallbacks.forEach(callback => callback());
3935
- if (this.tasks.length === 0) {
3936
- setTimeout(() => {
3937
- this.onEndCallbacks.forEach(callback => callback());
3938
- }, 0);
3939
- return this;
3940
- }
3941
- this.tasks.forEach(task => {
3942
- const executor = new AnimateExecutor(task.graphic);
3943
- executor.onEnd(() => {
3944
- this.completed++;
3945
- if (this.completed === this.tasks.length) {
3946
- this.onEndCallbacks.forEach(callback => callback());
3947
- }
3948
- });
3949
- if (task.delay > 0) {
3950
- setTimeout(() => {
3951
- const animate = executor.executeItem(task.config, task.graphic);
3952
- task.animate = animate;
3953
- }, task.delay);
3954
- }
3955
- else {
3956
- const animate = executor.executeItem(task.config, task.graphic);
3957
- task.animate = animate;
3958
- }
3959
- });
3960
- return this;
3961
- }
3962
- stop(jumpToEnd = true) {
3963
- this.tasks.forEach(task => {
3964
- if (task.animate) {
3965
- task.animate.stop(jumpToEnd ? 'end' : 'start');
3966
- }
3967
- });
3968
- if (this.started && this.completed !== this.tasks.length) {
3969
- this.onEndCallbacks.forEach(callback => callback());
3970
- this.completed = this.tasks.length;
3971
- }
3972
- return this;
3973
- }
3974
- getDuration() {
3975
- return this.totalDuration;
3976
- }
3977
- }
3978
- function createComponentAnimator(component) {
3979
- return new ComponentAnimator(component);
3980
- }
3981
-
3982
- class LabelUpdate extends AComponentAnimate {
3983
- onBind() {
3984
- const animator = createComponentAnimator(this.target);
3985
- this._animator = animator;
3986
- const duration = this.duration;
3987
- const easing = this.easing;
3988
- const { prevText, curText, prevLabelLine, curLabelLine } = this.params;
3989
- const diff = {};
3990
- for (const key in curText.attribute) {
3991
- if (prevText.attribute[key] !== curText.attribute[key]) {
3992
- diff[key] = curText.attribute[key];
3993
- }
3994
- }
3995
- const rest = __rest(diff, ["text"]);
3996
- animator.animate(prevText, {
3997
- type: 'to',
3998
- to: rest,
3999
- duration,
4000
- easing
4001
- });
4002
- animator.animate(prevText, {
4003
- type: 'increaseCount',
4004
- to: {
4005
- text: curText.attribute.text
4006
- },
4007
- duration,
4008
- easing
4009
- });
4010
- if (prevLabelLine) {
4011
- animator.animate(prevLabelLine, {
4012
- type: 'to',
4013
- to: curLabelLine.attribute,
4014
- duration,
4015
- easing
4016
- });
4017
- }
4018
- }
4019
- }
4020
-
4021
3975
  class LabelItemAppear extends AComponentAnimate {
4022
3976
  onBind() {
3977
+ super.onBind();
4023
3978
  const animator = createComponentAnimator(this.target);
4024
3979
  this._animator = animator;
4025
3980
  const duration = this.duration;
@@ -4140,10 +4095,12 @@ class LabelItemAppear extends AComponentAnimate {
4140
4095
  });
4141
4096
  });
4142
4097
  }
4098
+ this.completeBind(animator);
4143
4099
  }
4144
4100
  }
4145
4101
  class LabelItemDisappear extends AComponentAnimate {
4146
4102
  onBind() {
4103
+ super.onBind();
4147
4104
  const animator = createComponentAnimator(this.target);
4148
4105
  this._animator = animator;
4149
4106
  const duration = this.duration;
@@ -4210,11 +4167,13 @@ class LabelItemDisappear extends AComponentAnimate {
4210
4167
  easing
4211
4168
  });
4212
4169
  }
4170
+ this.completeBind(animator);
4213
4171
  }
4214
4172
  }
4215
4173
 
4216
4174
  class PoptipAppear extends AComponentAnimate {
4217
4175
  onBind() {
4176
+ super.onBind();
4218
4177
  const animator = createComponentAnimator(this.target);
4219
4178
  this._animator = animator;
4220
4179
  const duration = this.duration;
@@ -4283,10 +4242,12 @@ class PoptipAppear extends AComponentAnimate {
4283
4242
  ]
4284
4243
  });
4285
4244
  }
4245
+ this.completeBind(animator);
4286
4246
  }
4287
4247
  }
4288
4248
  class PoptipDisappear extends AComponentAnimate {
4289
4249
  onBind() {
4250
+ super.onBind();
4290
4251
  const animator = createComponentAnimator(this.target);
4291
4252
  this._animator = animator;
4292
4253
  const duration = this.duration;
@@ -4298,104 +4259,1164 @@ class PoptipDisappear extends AComponentAnimate {
4298
4259
  duration,
4299
4260
  easing
4300
4261
  });
4262
+ this.completeBind(animator);
4301
4263
  }
4302
4264
  }
4303
4265
 
4304
- class ScaleIn extends ACustomAnimate {
4266
+ class InputRichText extends ACustomAnimate {
4305
4267
  constructor(from, to, duration, easing, params) {
4306
4268
  super(from, to, duration, easing, params);
4307
- }
4308
- onBind() {
4309
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4310
- if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
4311
- Object.assign(this.target.attribute, this.params.diffAttrs);
4312
- }
4313
- let from;
4314
- let to;
4315
- const attrs = this.target.getFinalAttribute();
4316
- const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : {};
4317
- switch ((_d = this.params) === null || _d === void 0 ? void 0 : _d.direction) {
4269
+ this.fromTextConfig = [];
4270
+ this.toTextConfig = [];
4271
+ this.originalTextConfig = [];
4272
+ this.showCursor = false;
4273
+ this.cursorChar = '|';
4274
+ this.blinkCursor = true;
4275
+ this.beforeText = '';
4276
+ this.afterText = '';
4277
+ this.fadeInChars = false;
4278
+ this.fadeInDuration = 0.3;
4279
+ if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
4280
+ this.showCursor = params.showCursor;
4281
+ }
4282
+ if ((params === null || params === void 0 ? void 0 : params.cursorChar) !== undefined) {
4283
+ this.cursorChar = params.cursorChar;
4284
+ }
4285
+ if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
4286
+ this.blinkCursor = params.blinkCursor;
4287
+ }
4288
+ if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
4289
+ this.beforeText = params.beforeText;
4290
+ }
4291
+ if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
4292
+ this.afterText = params.afterText;
4293
+ }
4294
+ if ((params === null || params === void 0 ? void 0 : params.fadeInChars) !== undefined) {
4295
+ this.fadeInChars = params.fadeInChars;
4296
+ }
4297
+ if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
4298
+ this.fadeInDuration = params.fadeInDuration;
4299
+ }
4300
+ }
4301
+ onFirstRun() {
4302
+ const fromProps = this.getLastProps();
4303
+ const toProps = this.getEndProps();
4304
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [];
4305
+ this.valid = true;
4306
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4307
+ this.valid = false;
4308
+ return;
4309
+ }
4310
+ this.fromTextConfig =
4311
+ fromProps.textConfig && fromProps.textConfig.length > 0
4312
+ ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig)
4313
+ : [];
4314
+ this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4315
+ }
4316
+ onEnd(cb) {
4317
+ super.onEnd(cb);
4318
+ if (!cb) {
4319
+ this.target.setAttribute('textConfig', this.originalTextConfig);
4320
+ }
4321
+ }
4322
+ onUpdate(end, ratio, out) {
4323
+ if (!this.valid) {
4324
+ return;
4325
+ }
4326
+ const totalItems = this.toTextConfig.length;
4327
+ const fromItems = this.fromTextConfig.length;
4328
+ const maxTextShowRatio = this.fadeInChars ? 1 - this.fadeInDuration : 1;
4329
+ let currentLength;
4330
+ if (fromItems > totalItems) {
4331
+ currentLength = Math.round(fromItems - (fromItems - totalItems) * ratio);
4332
+ }
4333
+ else {
4334
+ if (this.fadeInChars) {
4335
+ const adjustedRatio = Math.min(1, ratio / maxTextShowRatio);
4336
+ currentLength = Math.round(fromItems + (totalItems - fromItems) * adjustedRatio);
4337
+ }
4338
+ else {
4339
+ currentLength = Math.round(fromItems + (totalItems - fromItems) * ratio);
4340
+ }
4341
+ }
4342
+ let currentTextConfig;
4343
+ if (fromItems > totalItems) {
4344
+ currentTextConfig = this.fromTextConfig.slice(0, currentLength);
4345
+ }
4346
+ else {
4347
+ currentTextConfig = this.toTextConfig.slice(0, currentLength).map((item, index) => {
4348
+ if (this.fadeInChars && 'text' in item) {
4349
+ const appearTime = (index / totalItems) * maxTextShowRatio;
4350
+ const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
4351
+ const opacity = Math.max(0, Math.min(1, fadeProgress));
4352
+ return Object.assign(Object.assign({}, item), { opacity: opacity });
4353
+ }
4354
+ return item;
4355
+ });
4356
+ }
4357
+ if (this.showCursor && currentLength < totalItems) {
4358
+ let shouldShowCursor = true;
4359
+ if (this.blinkCursor) {
4360
+ const blinkRate = 0.1;
4361
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 === 0;
4362
+ }
4363
+ if (shouldShowCursor && currentTextConfig.length > 0) {
4364
+ const lastIndex = currentTextConfig.length - 1;
4365
+ const lastItem = currentTextConfig[lastIndex];
4366
+ if ('text' in lastItem) {
4367
+ currentTextConfig[lastIndex] = Object.assign(Object.assign({}, lastItem), { text: String(lastItem.text) + this.cursorChar });
4368
+ }
4369
+ else {
4370
+ const cursorItem = {
4371
+ text: this.cursorChar,
4372
+ fontSize: 16
4373
+ };
4374
+ currentTextConfig.push(cursorItem);
4375
+ }
4376
+ }
4377
+ }
4378
+ this.target.setAttribute('textConfig', currentTextConfig);
4379
+ }
4380
+ }
4381
+
4382
+ class OutputRichText extends ACustomAnimate {
4383
+ constructor(from, to, duration, easing, params) {
4384
+ super(from, to, duration, easing, params);
4385
+ this.fromTextConfig = [];
4386
+ this.toTextConfig = [];
4387
+ this.originalTextConfig = [];
4388
+ this.showCursor = false;
4389
+ this.cursorChar = '|';
4390
+ this.blinkCursor = true;
4391
+ this.beforeText = '';
4392
+ this.afterText = '';
4393
+ this.fadeOutChars = false;
4394
+ this.fadeOutDuration = 0.3;
4395
+ this.direction = 'backward';
4396
+ if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
4397
+ this.showCursor = params.showCursor;
4398
+ }
4399
+ if ((params === null || params === void 0 ? void 0 : params.cursorChar) !== undefined) {
4400
+ this.cursorChar = params.cursorChar;
4401
+ }
4402
+ if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
4403
+ this.blinkCursor = params.blinkCursor;
4404
+ }
4405
+ if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
4406
+ this.beforeText = params.beforeText;
4407
+ }
4408
+ if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
4409
+ this.afterText = params.afterText;
4410
+ }
4411
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutChars) !== undefined) {
4412
+ this.fadeOutChars = params.fadeOutChars;
4413
+ }
4414
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutDuration) !== undefined) {
4415
+ this.fadeOutDuration = params.fadeOutDuration;
4416
+ }
4417
+ if ((params === null || params === void 0 ? void 0 : params.direction) !== undefined) {
4418
+ this.direction = params.direction;
4419
+ }
4420
+ this.propKeys = ['textConfig'];
4421
+ }
4422
+ onFirstRun() {
4423
+ const fromProps = this.getLastProps();
4424
+ const toProps = this.getEndProps();
4425
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [];
4426
+ this.valid = true;
4427
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4428
+ this.valid = false;
4429
+ return;
4430
+ }
4431
+ this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4432
+ this.toTextConfig =
4433
+ toProps.textConfig && toProps.textConfig.length > 0
4434
+ ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig)
4435
+ : [];
4436
+ }
4437
+ onEnd(cb) {
4438
+ super.onEnd(cb);
4439
+ if (!cb) {
4440
+ if (this.toTextConfig.length > 0) {
4441
+ this.target.setAttribute('textConfig', this.toTextConfig);
4442
+ }
4443
+ else {
4444
+ this.target.setAttribute('textConfig', []);
4445
+ }
4446
+ }
4447
+ }
4448
+ onUpdate(end, ratio, out) {
4449
+ if (!this.valid) {
4450
+ return;
4451
+ }
4452
+ const fromItems = this.fromTextConfig.length;
4453
+ const maxTextHideRatio = this.fadeOutChars ? 1 - this.fadeOutDuration : 1;
4454
+ let displayedLength;
4455
+ if (this.direction === 'forward') {
4456
+ if (this.fadeOutChars) {
4457
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
4458
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
4459
+ }
4460
+ else {
4461
+ displayedLength = Math.round(fromItems * (1 - ratio));
4462
+ }
4463
+ let currentTextConfig = this.direction === 'forward'
4464
+ ? this.fromTextConfig.slice(fromItems - displayedLength)
4465
+ : this.fromTextConfig.slice(0, displayedLength);
4466
+ if (this.fadeOutChars) {
4467
+ currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength);
4468
+ }
4469
+ if (this.showCursor && displayedLength > 0) {
4470
+ currentTextConfig = this.addCursor(currentTextConfig, ratio);
4471
+ }
4472
+ this.target.setAttribute('textConfig', currentTextConfig);
4473
+ }
4474
+ else {
4475
+ if (this.fadeOutChars) {
4476
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
4477
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
4478
+ }
4479
+ else {
4480
+ displayedLength = Math.round(fromItems * (1 - ratio));
4481
+ }
4482
+ let currentTextConfig = this.fromTextConfig.slice(0, displayedLength);
4483
+ if (this.fadeOutChars) {
4484
+ currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength);
4485
+ }
4486
+ if (this.showCursor && displayedLength > 0) {
4487
+ currentTextConfig = this.addCursor(currentTextConfig, ratio);
4488
+ }
4489
+ this.target.setAttribute('textConfig', currentTextConfig);
4490
+ }
4491
+ }
4492
+ applyFadeEffect(textConfig, ratio, totalItems, displayedLength) {
4493
+ if (this.direction === 'forward') ;
4494
+ const fadeProgress = (ratio - (1 - this.fadeOutDuration)) / this.fadeOutDuration;
4495
+ const fadeOpacity = Math.max(0, 1 - Math.min(1, fadeProgress));
4496
+ return textConfig.map((item, index) => {
4497
+ if (this.direction === 'forward') {
4498
+ if (index === 0 && 'text' in item) {
4499
+ return Object.assign(Object.assign({}, item), { opacity: fadeOpacity });
4500
+ }
4501
+ }
4502
+ else {
4503
+ if (index === textConfig.length - 1 && 'text' in item) {
4504
+ return Object.assign(Object.assign({}, item), { opacity: fadeOpacity });
4505
+ }
4506
+ }
4507
+ return item;
4508
+ });
4509
+ }
4510
+ addCursor(textConfig, ratio) {
4511
+ let shouldShowCursor = true;
4512
+ if (this.blinkCursor) {
4513
+ const blinkRate = 0.1;
4514
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 === 0;
4515
+ }
4516
+ if (shouldShowCursor && textConfig.length > 0) {
4517
+ const cursorIndex = this.direction === 'forward' ? 0 : textConfig.length - 1;
4518
+ const cursorItem = textConfig[cursorIndex];
4519
+ if ('text' in cursorItem) {
4520
+ const result = [...textConfig];
4521
+ if (this.direction === 'forward') {
4522
+ result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), { text: this.cursorChar + String(cursorItem.text) });
4523
+ }
4524
+ else {
4525
+ result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), { text: String(cursorItem.text) + this.cursorChar });
4526
+ }
4527
+ return result;
4528
+ }
4529
+ }
4530
+ return textConfig;
4531
+ }
4532
+ }
4533
+
4534
+ class SlideRichText extends ACustomAnimate {
4535
+ constructor(from, to, duration, easing, params) {
4536
+ super(from, to, duration, easing, params);
4537
+ this.fromTextConfig = [];
4538
+ this.toTextConfig = [];
4539
+ this.originalTextConfig = [];
4540
+ this.singleCharConfig = [];
4541
+ this.fadeInDuration = 0.3;
4542
+ this.slideDirection = 'right';
4543
+ this.slideDistance = 30;
4544
+ this.wordByWord = false;
4545
+ this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g;
4546
+ this.wordGroups = [];
4547
+ if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
4548
+ this.fadeInDuration = params.fadeInDuration;
4549
+ }
4550
+ if ((params === null || params === void 0 ? void 0 : params.slideDirection) !== undefined) {
4551
+ this.slideDirection = params.slideDirection;
4552
+ }
4553
+ if ((params === null || params === void 0 ? void 0 : params.slideDistance) !== undefined) {
4554
+ this.slideDistance = params.slideDistance;
4555
+ }
4556
+ if ((params === null || params === void 0 ? void 0 : params.wordByWord) !== undefined) {
4557
+ this.wordByWord = params.wordByWord;
4558
+ }
4559
+ if ((params === null || params === void 0 ? void 0 : params.wordRegex) !== undefined) {
4560
+ this.wordRegex = params.wordRegex;
4561
+ }
4562
+ }
4563
+ onFirstRun() {
4564
+ const fromProps = this.getLastProps();
4565
+ const toProps = this.getEndProps();
4566
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [];
4567
+ this.valid = true;
4568
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4569
+ this.valid = false;
4570
+ return;
4571
+ }
4572
+ this.fromTextConfig =
4573
+ fromProps.textConfig && fromProps.textConfig.length > 0
4574
+ ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig)
4575
+ : [];
4576
+ this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4577
+ this.singleCharConfig = this.toTextConfig.map(item => {
4578
+ if ('text' in item) {
4579
+ return Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4580
+ }
4581
+ return Object.assign(Object.assign({}, item), { opacity: 0 });
4582
+ });
4583
+ if (this.wordByWord) {
4584
+ this.calculateWordGroups();
4585
+ }
4586
+ }
4587
+ calculateWordGroups() {
4588
+ this.wordGroups = [];
4589
+ let fullText = '';
4590
+ const charMap = {};
4591
+ let fullTextIndex = 0;
4592
+ this.toTextConfig.forEach((item, configIndex) => {
4593
+ if ('text' in item) {
4594
+ const text = String(item.text);
4595
+ fullText += text;
4596
+ charMap[fullTextIndex] = configIndex;
4597
+ fullTextIndex++;
4598
+ }
4599
+ });
4600
+ let match;
4601
+ this.wordRegex.lastIndex = 0;
4602
+ while ((match = this.wordRegex.exec(fullText)) !== null) {
4603
+ const wordStart = match.index;
4604
+ const wordEnd = match.index + match[0].length;
4605
+ const wordIndices = [];
4606
+ for (let i = wordStart; i < wordEnd; i++) {
4607
+ if (charMap[i] !== undefined) {
4608
+ wordIndices.push(charMap[i]);
4609
+ }
4610
+ }
4611
+ if (wordIndices.length > 0) {
4612
+ this.wordGroups.push(wordIndices);
4613
+ }
4614
+ }
4615
+ const allocatedIndices = new Set();
4616
+ this.wordGroups.forEach(group => {
4617
+ group.forEach(index => allocatedIndices.add(index));
4618
+ });
4619
+ for (let i = 0; i < this.toTextConfig.length; i++) {
4620
+ if ('text' in this.toTextConfig[i] && !allocatedIndices.has(i)) {
4621
+ this.wordGroups.push([i]);
4622
+ }
4623
+ }
4624
+ }
4625
+ getInitialDx() {
4626
+ switch (this.slideDirection) {
4627
+ case 'left':
4628
+ return -this.slideDistance;
4629
+ case 'right':
4630
+ return this.slideDistance;
4631
+ default:
4632
+ return 0;
4633
+ }
4634
+ }
4635
+ getInitialDy() {
4636
+ switch (this.slideDirection) {
4637
+ case 'up':
4638
+ return -this.slideDistance;
4639
+ case 'down':
4640
+ return this.slideDistance;
4641
+ default:
4642
+ return 0;
4643
+ }
4644
+ }
4645
+ onEnd(cb) {
4646
+ super.onEnd(cb);
4647
+ if (!cb) {
4648
+ this.target.setAttribute('textConfig', this.originalTextConfig);
4649
+ }
4650
+ }
4651
+ onUpdate(end, ratio, out) {
4652
+ if (!this.valid) {
4653
+ return;
4654
+ }
4655
+ const maxTextShowRatio = 1 - this.fadeInDuration;
4656
+ let updatedTextConfig;
4657
+ if (this.wordByWord && this.wordGroups.length > 0) {
4658
+ updatedTextConfig = this.updateByWord(ratio, maxTextShowRatio);
4659
+ }
4660
+ else {
4661
+ updatedTextConfig = this.updateByCharacter(ratio, maxTextShowRatio);
4662
+ }
4663
+ this.target.setAttribute('textConfig', updatedTextConfig);
4664
+ }
4665
+ updateByWord(ratio, maxTextShowRatio) {
4666
+ const totalGroups = this.wordGroups.length;
4667
+ const updatedTextConfig = [...this.singleCharConfig];
4668
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
4669
+ let appearTime;
4670
+ if (this.slideDirection === 'left') {
4671
+ appearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4672
+ }
4673
+ else {
4674
+ appearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4675
+ }
4676
+ if (ratio < appearTime) {
4677
+ for (const charIndex of this.wordGroups[groupIndex]) {
4678
+ const item = updatedTextConfig[charIndex];
4679
+ if ('text' in item) {
4680
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4681
+ }
4682
+ }
4683
+ continue;
4684
+ }
4685
+ const animProgress = (ratio - appearTime) / this.fadeInDuration;
4686
+ const progress = Math.max(0, Math.min(1, animProgress));
4687
+ const dx = this.getInitialDx() * (1 - progress);
4688
+ const dy = this.getInitialDy() * (1 - progress);
4689
+ for (const charIndex of this.wordGroups[groupIndex]) {
4690
+ const item = updatedTextConfig[charIndex];
4691
+ if ('text' in item) {
4692
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: progress, dx,
4693
+ dy });
4694
+ }
4695
+ }
4696
+ }
4697
+ return updatedTextConfig;
4698
+ }
4699
+ updateByCharacter(ratio, maxTextShowRatio) {
4700
+ const totalItems = this.toTextConfig.length;
4701
+ const updatedTextConfig = [...this.singleCharConfig];
4702
+ for (let index = 0; index < updatedTextConfig.length; index++) {
4703
+ const item = updatedTextConfig[index];
4704
+ if ('text' in item) {
4705
+ let appearTime;
4706
+ if (this.slideDirection === 'left') {
4707
+ appearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4708
+ }
4709
+ else {
4710
+ appearTime = (index / totalItems) * maxTextShowRatio;
4711
+ }
4712
+ if (ratio < appearTime) {
4713
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4714
+ continue;
4715
+ }
4716
+ const animProgress = (ratio - appearTime) / this.fadeInDuration;
4717
+ const progress = Math.max(0, Math.min(1, animProgress));
4718
+ const dx = this.getInitialDx() * (1 - progress);
4719
+ const dy = this.getInitialDy() * (1 - progress);
4720
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: progress, dx,
4721
+ dy });
4722
+ }
4723
+ }
4724
+ return updatedTextConfig;
4725
+ }
4726
+ }
4727
+
4728
+ class SlideOutRichText extends ACustomAnimate {
4729
+ constructor(from, to, duration, easing, params) {
4730
+ super(from, to, duration, easing, params);
4731
+ this.fromTextConfig = [];
4732
+ this.toTextConfig = [];
4733
+ this.originalTextConfig = [];
4734
+ this.singleCharConfig = [];
4735
+ this.fadeOutDuration = 0.3;
4736
+ this.slideDirection = 'right';
4737
+ this.slideDistance = 30;
4738
+ this.wordByWord = false;
4739
+ this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g;
4740
+ this.wordGroups = [];
4741
+ this.reverseOrder = false;
4742
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutDuration) !== undefined) {
4743
+ this.fadeOutDuration = params.fadeOutDuration;
4744
+ }
4745
+ if ((params === null || params === void 0 ? void 0 : params.slideDirection) !== undefined) {
4746
+ this.slideDirection = params.slideDirection;
4747
+ }
4748
+ if ((params === null || params === void 0 ? void 0 : params.slideDistance) !== undefined) {
4749
+ this.slideDistance = params.slideDistance;
4750
+ }
4751
+ if ((params === null || params === void 0 ? void 0 : params.wordByWord) !== undefined) {
4752
+ this.wordByWord = params.wordByWord;
4753
+ }
4754
+ if ((params === null || params === void 0 ? void 0 : params.wordRegex) !== undefined) {
4755
+ this.wordRegex = params.wordRegex;
4756
+ }
4757
+ if ((params === null || params === void 0 ? void 0 : params.reverseOrder) !== undefined) {
4758
+ this.reverseOrder = params.reverseOrder;
4759
+ }
4760
+ this.propKeys = ['textConfig'];
4761
+ }
4762
+ onFirstRun() {
4763
+ const fromProps = this.getLastProps();
4764
+ const toProps = this.getEndProps();
4765
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [];
4766
+ this.valid = true;
4767
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4768
+ this.valid = false;
4769
+ return;
4770
+ }
4771
+ this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4772
+ this.toTextConfig =
4773
+ toProps.textConfig && toProps.textConfig.length > 0
4774
+ ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig)
4775
+ : [];
4776
+ this.singleCharConfig = this.fromTextConfig.map(item => {
4777
+ if ('text' in item) {
4778
+ return Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4779
+ }
4780
+ return Object.assign(Object.assign({}, item), { opacity: 1 });
4781
+ });
4782
+ if (this.wordByWord) {
4783
+ this.calculateWordGroups();
4784
+ }
4785
+ }
4786
+ calculateWordGroups() {
4787
+ this.wordGroups = [];
4788
+ let fullText = '';
4789
+ const charMap = {};
4790
+ let fullTextIndex = 0;
4791
+ this.fromTextConfig.forEach((item, configIndex) => {
4792
+ if ('text' in item) {
4793
+ const text = String(item.text);
4794
+ fullText += text;
4795
+ charMap[fullTextIndex] = configIndex;
4796
+ fullTextIndex++;
4797
+ }
4798
+ });
4799
+ let match;
4800
+ this.wordRegex.lastIndex = 0;
4801
+ while ((match = this.wordRegex.exec(fullText)) !== null) {
4802
+ const wordStart = match.index;
4803
+ const wordEnd = match.index + match[0].length;
4804
+ const wordIndices = [];
4805
+ for (let i = wordStart; i < wordEnd; i++) {
4806
+ if (charMap[i] !== undefined) {
4807
+ wordIndices.push(charMap[i]);
4808
+ }
4809
+ }
4810
+ if (wordIndices.length > 0) {
4811
+ this.wordGroups.push(wordIndices);
4812
+ }
4813
+ }
4814
+ const allocatedIndices = new Set();
4815
+ this.wordGroups.forEach(group => {
4816
+ group.forEach(index => allocatedIndices.add(index));
4817
+ });
4818
+ for (let i = 0; i < this.fromTextConfig.length; i++) {
4819
+ if ('text' in this.fromTextConfig[i] && !allocatedIndices.has(i)) {
4820
+ this.wordGroups.push([i]);
4821
+ }
4822
+ }
4823
+ }
4824
+ getTargetDx() {
4825
+ switch (this.slideDirection) {
4826
+ case 'left':
4827
+ return -this.slideDistance;
4828
+ case 'right':
4829
+ return this.slideDistance;
4830
+ default:
4831
+ return 0;
4832
+ }
4833
+ }
4834
+ getTargetDy() {
4835
+ switch (this.slideDirection) {
4836
+ case 'up':
4837
+ return -this.slideDistance;
4838
+ case 'down':
4839
+ return this.slideDistance;
4840
+ default:
4841
+ return 0;
4842
+ }
4843
+ }
4844
+ onEnd(cb) {
4845
+ super.onEnd(cb);
4846
+ if (!cb) {
4847
+ if (this.toTextConfig.length > 0) {
4848
+ this.target.setAttribute('textConfig', this.toTextConfig);
4849
+ }
4850
+ else {
4851
+ this.target.setAttribute('textConfig', []);
4852
+ }
4853
+ }
4854
+ }
4855
+ onUpdate(end, ratio, out) {
4856
+ if (!this.valid) {
4857
+ return;
4858
+ }
4859
+ const maxTextShowRatio = 1 - this.fadeOutDuration;
4860
+ let updatedTextConfig;
4861
+ if (this.wordByWord && this.wordGroups.length > 0) {
4862
+ updatedTextConfig = this.updateByWord(ratio, maxTextShowRatio);
4863
+ }
4864
+ else {
4865
+ updatedTextConfig = this.updateByCharacter(ratio, maxTextShowRatio);
4866
+ }
4867
+ this.target.setAttribute('textConfig', updatedTextConfig);
4868
+ }
4869
+ updateByWord(ratio, maxTextShowRatio) {
4870
+ const totalGroups = this.wordGroups.length;
4871
+ const updatedTextConfig = [...this.singleCharConfig];
4872
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
4873
+ let disappearTime;
4874
+ if (this.reverseOrder) {
4875
+ if (this.slideDirection === 'left') {
4876
+ disappearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4877
+ }
4878
+ else {
4879
+ disappearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4880
+ }
4881
+ }
4882
+ else {
4883
+ if (this.slideDirection === 'left') {
4884
+ disappearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4885
+ }
4886
+ else {
4887
+ disappearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4888
+ }
4889
+ }
4890
+ if (ratio < disappearTime) {
4891
+ for (const charIndex of this.wordGroups[groupIndex]) {
4892
+ const item = updatedTextConfig[charIndex];
4893
+ if ('text' in item) {
4894
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4895
+ }
4896
+ }
4897
+ continue;
4898
+ }
4899
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration;
4900
+ const progress = Math.max(0, Math.min(1, animProgress));
4901
+ const dx = this.getTargetDx() * progress;
4902
+ const dy = this.getTargetDy() * progress;
4903
+ const opacity = 1 - progress;
4904
+ for (const charIndex of this.wordGroups[groupIndex]) {
4905
+ const item = updatedTextConfig[charIndex];
4906
+ if ('text' in item) {
4907
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity,
4908
+ dx,
4909
+ dy });
4910
+ }
4911
+ }
4912
+ }
4913
+ return updatedTextConfig;
4914
+ }
4915
+ updateByCharacter(ratio, maxTextShowRatio) {
4916
+ const totalItems = this.fromTextConfig.length;
4917
+ const updatedTextConfig = [...this.singleCharConfig];
4918
+ for (let index = 0; index < updatedTextConfig.length; index++) {
4919
+ const item = updatedTextConfig[index];
4920
+ if ('text' in item) {
4921
+ let disappearTime;
4922
+ if (this.reverseOrder) {
4923
+ if (this.slideDirection === 'left') {
4924
+ disappearTime = (index / totalItems) * maxTextShowRatio;
4925
+ }
4926
+ else {
4927
+ disappearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4928
+ }
4929
+ }
4930
+ else {
4931
+ if (this.slideDirection === 'left') {
4932
+ disappearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4933
+ }
4934
+ else {
4935
+ disappearTime = (index / totalItems) * maxTextShowRatio;
4936
+ }
4937
+ }
4938
+ if (ratio < disappearTime) {
4939
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4940
+ continue;
4941
+ }
4942
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration;
4943
+ const progress = Math.max(0, Math.min(1, animProgress));
4944
+ const dx = this.getTargetDx() * progress;
4945
+ const dy = this.getTargetDy() * progress;
4946
+ const opacity = 1 - progress;
4947
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity,
4948
+ dx,
4949
+ dy });
4950
+ }
4951
+ }
4952
+ return updatedTextConfig;
4953
+ }
4954
+ }
4955
+
4956
+ class ScaleIn extends ACustomAnimate {
4957
+ constructor(from, to, duration, easing, params) {
4958
+ super(from, to, duration, easing, params);
4959
+ }
4960
+ onBind() {
4961
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4962
+ super.onBind();
4963
+ let from;
4964
+ let to;
4965
+ const attrs = this.target.getFinalAttribute();
4966
+ const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
4967
+ switch ((_b = this.params) === null || _b === void 0 ? void 0 : _b.direction) {
4318
4968
  case 'x':
4319
- from = { scaleX: (_e = fromAttrs.scaleX) !== null && _e !== void 0 ? _e : 0 };
4320
- to = { scaleX: (_f = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _f !== void 0 ? _f : 1 };
4321
- this.propKeys = ['scaleX'];
4969
+ from = { scaleX: (_c = fromAttrs.scaleX) !== null && _c !== void 0 ? _c : 0 };
4970
+ to = { scaleX: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _d !== void 0 ? _d : 1 };
4322
4971
  this._updateFunction = this.updateX;
4323
4972
  break;
4324
4973
  case 'y':
4325
- from = { scaleY: (_g = fromAttrs.scaleY) !== null && _g !== void 0 ? _g : 0 };
4326
- to = { scaleY: (_h = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _h !== void 0 ? _h : 1 };
4327
- this.propKeys = ['scaleY'];
4974
+ from = { scaleY: (_e = fromAttrs.scaleY) !== null && _e !== void 0 ? _e : 0 };
4975
+ to = { scaleY: (_f = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _f !== void 0 ? _f : 1 };
4328
4976
  this._updateFunction = this.updateY;
4329
4977
  break;
4330
4978
  case 'xy':
4331
4979
  default:
4332
- from = { scaleX: (_j = fromAttrs.scaleX) !== null && _j !== void 0 ? _j : 0, scaleY: (_k = fromAttrs.scaleY) !== null && _k !== void 0 ? _k : 0 };
4980
+ from = { scaleX: (_g = fromAttrs.scaleX) !== null && _g !== void 0 ? _g : 0, scaleY: (_h = fromAttrs.scaleY) !== null && _h !== void 0 ? _h : 0 };
4333
4981
  to = {
4334
- scaleX: (_l = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _l !== void 0 ? _l : 1,
4335
- scaleY: (_m = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _m !== void 0 ? _m : 1
4982
+ scaleX: (_j = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _j !== void 0 ? _j : 1,
4983
+ scaleY: (_k = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _k !== void 0 ? _k : 1
4336
4984
  };
4337
- this.propKeys = ['scaleX', 'scaleY'];
4338
4985
  this._updateFunction = this.updateXY;
4339
4986
  }
4987
+ const finalAttribute = this.target.getFinalAttribute();
4988
+ if (finalAttribute) {
4989
+ Object.assign(this.target.attribute, finalAttribute);
4990
+ }
4340
4991
  this.props = to;
4341
4992
  this.from = from;
4342
4993
  this.to = to;
4343
- Object.assign(this.target.attribute, from);
4994
+ this.target.setAttributes(from);
4995
+ }
4996
+ onEnd(cb) {
4997
+ super.onEnd(cb);
4998
+ }
4999
+ updateX(ratio) {
5000
+ this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
5001
+ }
5002
+ updateY(ratio) {
5003
+ this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
5004
+ }
5005
+ updateXY(ratio) {
5006
+ this.updateX(ratio);
5007
+ this.updateY(ratio);
5008
+ }
5009
+ deleteSelfAttr(key) {
5010
+ delete this.props[key];
5011
+ this.fromProps && delete this.fromProps[key];
5012
+ const index = this.propKeys.indexOf(key);
5013
+ if (index !== -1) {
5014
+ this.propKeys.splice(index, 1);
5015
+ }
5016
+ if (this.propKeys && this.propKeys.length > 1) {
5017
+ this._updateFunction = this.updateXY;
5018
+ }
5019
+ else if (this.propKeys[0] === 'scaleX') {
5020
+ this._updateFunction = this.updateX;
5021
+ }
5022
+ else if (this.propKeys[0] === 'scaleY') {
5023
+ this._updateFunction = this.updateY;
5024
+ }
5025
+ else {
5026
+ this._updateFunction = null;
5027
+ }
5028
+ }
5029
+ onUpdate(end, ratio, out) {
5030
+ if (this._updateFunction) {
5031
+ this._updateFunction(ratio);
5032
+ this.target.addUpdatePositionTag();
5033
+ }
5034
+ }
5035
+ }
5036
+ class ScaleOut extends ACustomAnimate {
5037
+ constructor(from, to, duration, easing, params) {
5038
+ super(from, to, duration, easing, params);
5039
+ }
5040
+ onBind() {
5041
+ var _a, _b, _c, _d, _e;
5042
+ super.onBind();
5043
+ let from;
5044
+ let to;
5045
+ const attrs = this.target.attribute;
5046
+ switch ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) {
5047
+ case 'x':
5048
+ from = { scaleX: (_b = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _b !== void 0 ? _b : 1 };
5049
+ to = { scaleX: 0 };
5050
+ break;
5051
+ case 'y':
5052
+ from = { scaleY: (_c = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _c !== void 0 ? _c : 1 };
5053
+ to = { scaleY: 0 };
5054
+ break;
5055
+ case 'xy':
5056
+ default:
5057
+ from = { scaleX: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _d !== void 0 ? _d : 1, scaleY: (_e = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _e !== void 0 ? _e : 1 };
5058
+ to = {
5059
+ scaleX: 0,
5060
+ scaleY: 0
5061
+ };
5062
+ }
5063
+ this.props = to;
5064
+ this.from = from;
5065
+ this.to = to;
5066
+ }
5067
+ onEnd(cb) {
5068
+ super.onEnd(cb);
5069
+ }
5070
+ onUpdate(end, ratio, out) {
5071
+ const attribute = this.target.attribute;
5072
+ this.propKeys.forEach(key => {
5073
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5074
+ });
5075
+ this.target.addUpdatePositionTag();
5076
+ }
5077
+ }
5078
+
5079
+ class State extends ACustomAnimate {
5080
+ constructor(from, to, duration, easing, params) {
5081
+ super(from, to, duration, easing, params);
5082
+ }
5083
+ update(end, ratio, out) {
5084
+ this.onStart();
5085
+ if (!this.props || !this.propKeys) {
5086
+ return;
5087
+ }
5088
+ const easedRatio = this.easing(ratio);
5089
+ this.animate.interpolateUpdateFunction
5090
+ ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)
5091
+ : this.interpolateUpdateFunctions.forEach((func, index) => {
5092
+ if (!this.animate.validAttr(this.propKeys[index])) {
5093
+ return;
5094
+ }
5095
+ const key = this.propKeys[index];
5096
+ const fromValue = this.fromProps[key];
5097
+ const toValue = this.props[key];
5098
+ func(key, fromValue, toValue, easedRatio, this, this.target);
5099
+ });
5100
+ this.onUpdate(end, easedRatio, out);
5101
+ this.syncAttributeUpdate();
5102
+ }
5103
+ }
5104
+
5105
+ class SlideIn extends ACustomAnimate {
5106
+ constructor(from, to, duration, easing, params) {
5107
+ super(from, to, duration, easing, params);
5108
+ }
5109
+ onBind() {
5110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5111
+ super.onBind();
5112
+ const attrs = this.target.getFinalAttribute();
5113
+ const direction = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) || 'right';
5114
+ const distance = ((_b = this.params) === null || _b === void 0 ? void 0 : _b.distance) || 50;
5115
+ const fromOpacity = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0;
5116
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5117
+ const to = { opacity: 1, baseOpacity: 1 };
5118
+ if (direction === 'top') {
5119
+ from.y = ((_e = attrs.y) !== null && _e !== void 0 ? _e : 0) - distance;
5120
+ to.y = (_f = attrs.y) !== null && _f !== void 0 ? _f : 0;
5121
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5122
+ }
5123
+ else if (direction === 'bottom') {
5124
+ from.y = ((_g = attrs.y) !== null && _g !== void 0 ? _g : 0) + distance;
5125
+ to.y = (_h = attrs.y) !== null && _h !== void 0 ? _h : 0;
5126
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5127
+ }
5128
+ else if (direction === 'left') {
5129
+ from.x = ((_j = attrs.x) !== null && _j !== void 0 ? _j : 0) - distance;
5130
+ to.x = (_k = attrs.x) !== null && _k !== void 0 ? _k : 0;
5131
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5132
+ }
5133
+ else {
5134
+ from.x = ((_l = attrs.x) !== null && _l !== void 0 ? _l : 0) + distance;
5135
+ to.x = (_m = attrs.x) !== null && _m !== void 0 ? _m : 0;
5136
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5137
+ }
5138
+ this.from = from;
5139
+ this.to = to;
5140
+ this.props = to;
5141
+ this.target.setAttributes(from);
5142
+ }
5143
+ onUpdate(end, ratio, out) {
5144
+ const attribute = this.target.attribute;
5145
+ this.propKeys.forEach(key => {
5146
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5147
+ });
5148
+ this.target.addUpdatePositionTag();
5149
+ this.target.addUpdateShapeAndBoundsTag();
5150
+ }
5151
+ }
5152
+ class GrowIn extends ACustomAnimate {
5153
+ constructor(from, to, duration, easing, params) {
5154
+ super(from, to, duration, easing, params);
5155
+ }
5156
+ onBind() {
5157
+ var _a, _b, _c, _d, _e, _f, _g;
5158
+ super.onBind();
5159
+ const attrs = this.target.getFinalAttribute();
5160
+ const fromScale = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) !== null && _b !== void 0 ? _b : 0;
5161
+ const direction = ((_c = this.params) === null || _c === void 0 ? void 0 : _c.direction) || 'xy';
5162
+ const fromOpacity = (_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.fromOpacity) !== null && _e !== void 0 ? _e : 0;
5163
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5164
+ const to = { opacity: 1, baseOpacity: 1 };
5165
+ this.propKeys = ['opacity', 'baseOpacity'];
5166
+ if (direction === 'x' || direction === 'xy') {
5167
+ from.scaleX = fromScale;
5168
+ to.scaleX = (_f = attrs.scaleX) !== null && _f !== void 0 ? _f : 1;
5169
+ this.propKeys.push('scaleX');
5170
+ }
5171
+ if (direction === 'y' || direction === 'xy') {
5172
+ from.scaleY = fromScale;
5173
+ to.scaleY = (_g = attrs.scaleY) !== null && _g !== void 0 ? _g : 1;
5174
+ this.propKeys.push('scaleY');
5175
+ }
5176
+ this.from = from;
5177
+ this.to = to;
5178
+ this.props = to;
5179
+ this.target.setAttributes(from);
5180
+ }
5181
+ onUpdate(end, ratio, out) {
5182
+ const attribute = this.target.attribute;
5183
+ this.propKeys.forEach(key => {
5184
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5185
+ });
5186
+ this.target.addUpdatePositionTag();
5187
+ this.target.addUpdateShapeAndBoundsTag();
5188
+ }
5189
+ }
5190
+ class SpinIn extends ACustomAnimate {
5191
+ constructor(from, to, duration, easing, params) {
5192
+ super(from, to, duration, easing, params);
5193
+ }
5194
+ onBind() {
5195
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5196
+ super.onBind();
5197
+ const attrs = this.target.getFinalAttribute();
5198
+ const fromAngle = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) !== null && _b !== void 0 ? _b : Math.PI * 2;
5199
+ const fromScale = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromScale) !== null && _d !== void 0 ? _d : 0;
5200
+ const fromOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.fromOpacity) !== null && _f !== void 0 ? _f : 0;
5201
+ const from = {
5202
+ opacity: fromOpacity,
5203
+ baseOpacity: fromOpacity,
5204
+ angle: fromAngle,
5205
+ scaleX: fromScale,
5206
+ scaleY: fromScale
5207
+ };
5208
+ const to = {
5209
+ opacity: 1,
5210
+ baseOpacity: 1,
5211
+ angle: (_g = attrs.angle) !== null && _g !== void 0 ? _g : 0,
5212
+ scaleX: (_h = attrs.scaleX) !== null && _h !== void 0 ? _h : 1,
5213
+ scaleY: (_j = attrs.scaleY) !== null && _j !== void 0 ? _j : 1
5214
+ };
5215
+ this.propKeys = ['opacity', 'baseOpacity', 'angle', 'scaleX', 'scaleY'];
5216
+ this.from = from;
5217
+ this.to = to;
5218
+ this.props = to;
5219
+ this.target.setAttributes(from);
5220
+ }
5221
+ onUpdate(end, ratio, out) {
5222
+ const attribute = this.target.attribute;
5223
+ this.propKeys.forEach(key => {
5224
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5225
+ });
4344
5226
  this.target.addUpdatePositionTag();
4345
- this.target.addUpdateBoundTag();
5227
+ this.target.addUpdateShapeAndBoundsTag();
4346
5228
  }
4347
- onEnd(cb) {
4348
- super.onEnd(cb);
5229
+ }
5230
+ class MoveScaleIn extends ACustomAnimate {
5231
+ constructor(from, to, duration, easing, params) {
5232
+ var _a;
5233
+ super(from, to, duration, easing, params);
5234
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5235
+ this.slideInDuration = duration * slideRatio;
5236
+ this.growInDuration = duration * (1 - slideRatio);
4349
5237
  }
4350
- updateX(ratio) {
4351
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
5238
+ onBind() {
5239
+ var _a, _b, _c, _d, _e, _f;
5240
+ super.onBind();
5241
+ const executor = new AnimateExecutor(this.target);
5242
+ executor.execute({
5243
+ type: 'custom',
5244
+ custom: SlideIn,
5245
+ customParameters: {
5246
+ direction: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.slideDirection) || 'right',
5247
+ distance: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.slideDistance) || 50,
5248
+ fromOpacity: (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0
5249
+ },
5250
+ duration: this.slideInDuration,
5251
+ easing: this.easing
5252
+ });
5253
+ executor.execute({
5254
+ type: 'custom',
5255
+ custom: GrowIn,
5256
+ customParameters: {
5257
+ fromScale: ((_e = this.params) === null || _e === void 0 ? void 0 : _e.fromScale) || 0.5,
5258
+ direction: ((_f = this.params) === null || _f === void 0 ? void 0 : _f.scaleDirection) || 'xy',
5259
+ fromOpacity: 1
5260
+ },
5261
+ duration: this.growInDuration,
5262
+ easing: this.easing,
5263
+ delay: this.slideInDuration
5264
+ });
4352
5265
  }
4353
- updateY(ratio) {
4354
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
5266
+ onUpdate(end, ratio, out) {
4355
5267
  }
4356
- updateXY(ratio) {
4357
- this.updateX(ratio);
4358
- this.updateY(ratio);
5268
+ }
5269
+ class MoveRotateIn extends ACustomAnimate {
5270
+ constructor(from, to, duration, easing, params) {
5271
+ var _a;
5272
+ super(from, to, duration, easing, params);
5273
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5274
+ this.slideInDuration = duration * slideRatio;
5275
+ this.spinInDuration = duration * (1 - slideRatio);
5276
+ }
5277
+ onBind() {
5278
+ var _a, _b, _c, _d, _e, _f;
5279
+ super.onBind();
5280
+ const executor = new AnimateExecutor(this.target);
5281
+ executor.execute({
5282
+ type: 'custom',
5283
+ custom: SlideIn,
5284
+ customParameters: {
5285
+ direction: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.slideDirection) || 'right',
5286
+ distance: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.slideDistance) || 50,
5287
+ fromOpacity: (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0
5288
+ },
5289
+ duration: this.slideInDuration,
5290
+ easing: this.easing
5291
+ });
5292
+ executor.execute({
5293
+ type: 'custom',
5294
+ custom: SpinIn,
5295
+ customParameters: {
5296
+ fromAngle: ((_e = this.params) === null || _e === void 0 ? void 0 : _e.fromAngle) || Math.PI,
5297
+ fromScale: ((_f = this.params) === null || _f === void 0 ? void 0 : _f.fromScale) || 0.5,
5298
+ fromOpacity: 1
5299
+ },
5300
+ duration: this.spinInDuration,
5301
+ easing: this.easing,
5302
+ delay: this.slideInDuration
5303
+ });
4359
5304
  }
4360
5305
  onUpdate(end, ratio, out) {
4361
- this._updateFunction(ratio);
4362
- this.target.addUpdatePositionTag();
4363
5306
  }
4364
5307
  }
4365
- class ScaleOut extends ACustomAnimate {
5308
+ class SlideOut extends ACustomAnimate {
4366
5309
  constructor(from, to, duration, easing, params) {
4367
5310
  super(from, to, duration, easing, params);
4368
5311
  }
4369
- onBind() {
4370
- var _a, _b, _c, _d, _e;
4371
- let from;
4372
- let to;
4373
- const attrs = this.target.getFinalAttribute();
4374
- switch ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) {
4375
- case 'x':
4376
- from = { scaleX: (_b = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _b !== void 0 ? _b : 1 };
4377
- to = { scaleX: 0 };
4378
- break;
4379
- case 'y':
4380
- from = { scaleY: (_c = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _c !== void 0 ? _c : 1 };
4381
- to = { scaleY: 0 };
4382
- break;
4383
- case 'xy':
4384
- default:
4385
- from = { scaleX: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _d !== void 0 ? _d : 1, scaleY: (_e = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _e !== void 0 ? _e : 1 };
4386
- to = {
4387
- scaleX: 0,
4388
- scaleY: 0
4389
- };
5312
+ onFirstRun() {
5313
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5314
+ const attrs = this.target.getAttributes();
5315
+ const direction = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) || 'right';
5316
+ const distance = ((_b = this.params) === null || _b === void 0 ? void 0 : _b.distance) || 50;
5317
+ const fromOpacity = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 1;
5318
+ const toOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.toOpacity) !== null && _f !== void 0 ? _f : 0;
5319
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5320
+ const to = { opacity: toOpacity, baseOpacity: toOpacity };
5321
+ if (direction === 'top') {
5322
+ from.y = (_g = attrs.y) !== null && _g !== void 0 ? _g : 0;
5323
+ to.y = ((_h = attrs.y) !== null && _h !== void 0 ? _h : 0) - distance;
5324
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5325
+ }
5326
+ else if (direction === 'bottom') {
5327
+ from.y = (_j = attrs.y) !== null && _j !== void 0 ? _j : 0;
5328
+ to.y = ((_k = attrs.y) !== null && _k !== void 0 ? _k : 0) + distance;
5329
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5330
+ }
5331
+ else if (direction === 'left') {
5332
+ from.x = (_l = attrs.x) !== null && _l !== void 0 ? _l : 0;
5333
+ to.x = ((_m = attrs.x) !== null && _m !== void 0 ? _m : 0) - distance;
5334
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5335
+ }
5336
+ else {
5337
+ from.x = (_o = attrs.x) !== null && _o !== void 0 ? _o : 0;
5338
+ to.x = ((_p = attrs.x) !== null && _p !== void 0 ? _p : 0) + distance;
5339
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
4390
5340
  }
5341
+ this.from = from;
5342
+ this.to = to;
4391
5343
  this.props = to;
4392
- this.propKeys = Object.keys(to);
4393
- this.animate.reSyncProps();
5344
+ }
5345
+ onUpdate(end, ratio, out) {
5346
+ const attribute = this.target.attribute;
5347
+ this.propKeys.forEach(key => {
5348
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5349
+ });
5350
+ this.target.addUpdatePositionTag();
5351
+ this.target.addUpdateShapeAndBoundsTag();
5352
+ }
5353
+ }
5354
+ class GrowOut extends ACustomAnimate {
5355
+ constructor(from, to, duration, easing, params) {
5356
+ super(from, to, duration, easing, params);
5357
+ }
5358
+ onFirstRun() {
5359
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5360
+ const attrs = this.target.getAttributes();
5361
+ const toScale = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) !== null && _b !== void 0 ? _b : 0;
5362
+ const direction = ((_c = this.params) === null || _c === void 0 ? void 0 : _c.direction) || 'xy';
5363
+ const fromOpacity = (_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.fromOpacity) !== null && _e !== void 0 ? _e : 1;
5364
+ const toOpacity = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.toOpacity) !== null && _g !== void 0 ? _g : 0;
5365
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5366
+ const to = { opacity: toOpacity, baseOpacity: toOpacity };
5367
+ this.propKeys = ['opacity', 'baseOpacity'];
5368
+ if (direction === 'x' || direction === 'xy') {
5369
+ from.scaleX = (_h = attrs.scaleX) !== null && _h !== void 0 ? _h : 1;
5370
+ to.scaleX = toScale;
5371
+ this.propKeys.push('scaleX');
5372
+ }
5373
+ if (direction === 'y' || direction === 'xy') {
5374
+ from.scaleY = (_j = attrs.scaleY) !== null && _j !== void 0 ? _j : 1;
5375
+ to.scaleY = toScale;
5376
+ this.propKeys.push('scaleY');
5377
+ }
4394
5378
  this.from = from;
4395
5379
  this.to = to;
5380
+ this.props = to;
4396
5381
  }
4397
- onEnd(cb) {
4398
- super.onEnd(cb);
5382
+ onUpdate(end, ratio, out) {
5383
+ const attribute = this.target.attribute;
5384
+ this.propKeys.forEach(key => {
5385
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5386
+ });
5387
+ this.target.addUpdatePositionTag();
5388
+ this.target.addUpdateShapeAndBoundsTag();
5389
+ }
5390
+ }
5391
+ class SpinOut extends ACustomAnimate {
5392
+ constructor(from, to, duration, easing, params) {
5393
+ super(from, to, duration, easing, params);
5394
+ }
5395
+ onFirstRun() {
5396
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5397
+ const attrs = this.target.getAttributes();
5398
+ const toAngle = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) !== null && _b !== void 0 ? _b : Math.PI * 2;
5399
+ const toScale = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromScale) !== null && _d !== void 0 ? _d : 0;
5400
+ const fromOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.fromOpacity) !== null && _f !== void 0 ? _f : 1;
5401
+ const toOpacity = (_h = (_g = this.params) === null || _g === void 0 ? void 0 : _g.toOpacity) !== null && _h !== void 0 ? _h : 0;
5402
+ const from = {
5403
+ opacity: fromOpacity,
5404
+ baseOpacity: fromOpacity,
5405
+ angle: (_j = attrs.angle) !== null && _j !== void 0 ? _j : 0,
5406
+ scaleX: (_k = attrs.scaleX) !== null && _k !== void 0 ? _k : 1,
5407
+ scaleY: (_l = attrs.scaleY) !== null && _l !== void 0 ? _l : 1
5408
+ };
5409
+ const to = {
5410
+ opacity: toOpacity,
5411
+ baseOpacity: toOpacity,
5412
+ angle: toAngle,
5413
+ scaleX: toScale,
5414
+ scaleY: toScale
5415
+ };
5416
+ this.propKeys = ['opacity', 'baseOpacity', 'angle', 'scaleX', 'scaleY'];
5417
+ this.from = from;
5418
+ this.to = to;
5419
+ this.props = to;
4399
5420
  }
4400
5421
  onUpdate(end, ratio, out) {
4401
5422
  const attribute = this.target.attribute;
@@ -4403,13 +5424,105 @@ class ScaleOut extends ACustomAnimate {
4403
5424
  attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
4404
5425
  });
4405
5426
  this.target.addUpdatePositionTag();
5427
+ this.target.addUpdateShapeAndBoundsTag();
5428
+ }
5429
+ }
5430
+ class MoveScaleOut extends ACustomAnimate {
5431
+ constructor(from, to, duration, easing, params) {
5432
+ var _a;
5433
+ super(from, to, duration, easing, params);
5434
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5435
+ this.growOutDuration = duration * (1 - slideRatio);
5436
+ this.slideOutDuration = duration * slideRatio;
5437
+ }
5438
+ onFirstRun() {
5439
+ var _a, _b, _c, _d;
5440
+ const executor = new AnimateExecutor(this.target);
5441
+ executor.execute({
5442
+ type: 'custom',
5443
+ custom: GrowOut,
5444
+ customParameters: {
5445
+ fromScale: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) || 0.5,
5446
+ direction: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.scaleDirection) || 'xy',
5447
+ fromOpacity: 1,
5448
+ toOpacity: 1
5449
+ },
5450
+ duration: this.growOutDuration,
5451
+ easing: this.easing
5452
+ });
5453
+ executor.execute({
5454
+ type: 'custom',
5455
+ custom: SlideOut,
5456
+ customParameters: {
5457
+ direction: ((_c = this.params) === null || _c === void 0 ? void 0 : _c.slideDirection) || 'right',
5458
+ distance: ((_d = this.params) === null || _d === void 0 ? void 0 : _d.slideDistance) || 50,
5459
+ fromOpacity: 1
5460
+ },
5461
+ duration: this.slideOutDuration,
5462
+ easing: this.easing,
5463
+ delay: this.growOutDuration
5464
+ });
5465
+ }
5466
+ onUpdate(end, ratio, out) {
5467
+ }
5468
+ }
5469
+ class MoveRotateOut extends ACustomAnimate {
5470
+ constructor(from, to, duration, easing, params) {
5471
+ var _a;
5472
+ super(from, to, duration, easing, params);
5473
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5474
+ this.spinOutDuration = duration * (1 - slideRatio);
5475
+ this.slideOutDuration = duration * slideRatio;
5476
+ }
5477
+ onFirstRun() {
5478
+ var _a, _b, _c, _d;
5479
+ const executor = new AnimateExecutor(this.target);
5480
+ executor.execute({
5481
+ type: 'custom',
5482
+ custom: SpinOut,
5483
+ customParameters: {
5484
+ fromAngle: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) || Math.PI,
5485
+ fromScale: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.fromScale) || 0.5,
5486
+ fromOpacity: 1,
5487
+ toOpacity: 1
5488
+ },
5489
+ duration: this.spinOutDuration,
5490
+ easing: this.easing
5491
+ });
5492
+ executor.execute({
5493
+ type: 'custom',
5494
+ custom: SlideOut,
5495
+ customParameters: {
5496
+ direction: ((_c = this.params) === null || _c === void 0 ? void 0 : _c.slideDirection) || 'right',
5497
+ distance: ((_d = this.params) === null || _d === void 0 ? void 0 : _d.slideDistance) || 50,
5498
+ fromOpacity: 1
5499
+ },
5500
+ duration: this.slideOutDuration,
5501
+ easing: this.easing,
5502
+ delay: this.spinOutDuration
5503
+ });
5504
+ }
5505
+ onUpdate(end, ratio, out) {
4406
5506
  }
4407
5507
  }
4408
5508
 
4409
- class State extends ACustomAnimate {
5509
+ class Update extends ACustomAnimate {
4410
5510
  constructor(from, to, duration, easing, params) {
4411
5511
  super(from, to, duration, easing, params);
4412
5512
  }
5513
+ onBind() {
5514
+ var _a, _b;
5515
+ super.onBind();
5516
+ let { diffAttrs = {} } = (_a = this.target.context) !== null && _a !== void 0 ? _a : {};
5517
+ const { options } = this.params;
5518
+ if ((_b = options === null || options === void 0 ? void 0 : options.excludeChannels) === null || _b === void 0 ? void 0 : _b.length) {
5519
+ diffAttrs = Object.assign({}, diffAttrs);
5520
+ options.excludeChannels.forEach((channel) => {
5521
+ delete diffAttrs[channel];
5522
+ });
5523
+ }
5524
+ this.props = diffAttrs;
5525
+ }
4413
5526
  update(end, ratio, out) {
4414
5527
  this.onStart();
4415
5528
  if (!this.props || !this.propKeys) {
@@ -4431,10 +5544,236 @@ class State extends ACustomAnimate {
4431
5544
  }
4432
5545
  }
4433
5546
 
4434
- class Update extends ACustomAnimate {
5547
+ const moveIn = (graphic, options, animationParameters) => {
5548
+ var _a, _b;
5549
+ const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options !== null && options !== void 0 ? options : {};
5550
+ let changedX = 0;
5551
+ let changedY = 0;
5552
+ if (orient === 'negative') {
5553
+ if (animationParameters.group) {
5554
+ changedX = (_a = animationParameters.groupWidth) !== null && _a !== void 0 ? _a : animationParameters.group.getBounds().width();
5555
+ changedY = (_b = animationParameters.groupHeight) !== null && _b !== void 0 ? _b : animationParameters.group.getBounds().height();
5556
+ animationParameters.groupWidth = changedX;
5557
+ animationParameters.groupHeight = changedY;
5558
+ }
5559
+ else {
5560
+ changedX = animationParameters.width;
5561
+ changedY = animationParameters.height;
5562
+ }
5563
+ }
5564
+ changedX += offset;
5565
+ changedY += offset;
5566
+ const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;
5567
+ const fromX = point && isValidNumber(point.x) ? point.x : changedX;
5568
+ const fromY = point && isValidNumber(point.y) ? point.y : changedY;
5569
+ const finalAttrs = graphic.getFinalAttribute();
5570
+ const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;
5571
+ const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;
5572
+ switch (direction) {
5573
+ case 'x':
5574
+ return {
5575
+ from: { x: fromX },
5576
+ to: { x: finalAttrsX }
5577
+ };
5578
+ case 'y':
5579
+ return {
5580
+ from: { y: fromY },
5581
+ to: { y: finalAttrsY }
5582
+ };
5583
+ case 'xy':
5584
+ default:
5585
+ return {
5586
+ from: { x: fromX, y: fromY },
5587
+ to: {
5588
+ x: finalAttrsX,
5589
+ y: finalAttrsY
5590
+ }
5591
+ };
5592
+ }
5593
+ };
5594
+ const moveOut = (graphic, options, animationParameters) => {
5595
+ var _a, _b;
5596
+ const { offset = 0, orient, direction, point: pointOpt } = options !== null && options !== void 0 ? options : {};
5597
+ const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;
5598
+ const groupWidth = (_a = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.width()) !== null && _a !== void 0 ? _a : animationParameters.width;
5599
+ const groupHeight = (_b = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.height()) !== null && _b !== void 0 ? _b : animationParameters.height;
5600
+ const changedX = (orient === 'negative' ? groupWidth : 0) + offset;
5601
+ const changedY = (orient === 'negative' ? groupHeight : 0) + offset;
5602
+ const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;
5603
+ const fromX = point && isValidNumber(point.x) ? point.x : changedX;
5604
+ const fromY = point && isValidNumber(point.y) ? point.y : changedY;
5605
+ switch (direction) {
5606
+ case 'x':
5607
+ return {
5608
+ from: { x: graphic.attribute.x },
5609
+ to: { x: fromX }
5610
+ };
5611
+ case 'y':
5612
+ return {
5613
+ from: { y: graphic.attribute.y },
5614
+ to: { y: fromY }
5615
+ };
5616
+ case 'xy':
5617
+ default:
5618
+ return {
5619
+ from: {
5620
+ x: graphic.attribute.x,
5621
+ y: graphic.attribute.y
5622
+ },
5623
+ to: { x: fromX, y: fromY }
5624
+ };
5625
+ }
5626
+ };
5627
+ class MoveBase extends ACustomAnimate {
5628
+ constructor(from, to, duration, easing, params) {
5629
+ super(from, to, duration, easing, params);
5630
+ }
5631
+ onUpdate(end, ratio, out) {
5632
+ const attribute = this.target.attribute;
5633
+ this.propKeys.forEach(key => {
5634
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5635
+ });
5636
+ this.target.addUpdatePositionTag();
5637
+ this.target.addUpdateShapeAndBoundsTag();
5638
+ }
5639
+ }
5640
+ class MoveIn extends MoveBase {
5641
+ onBind() {
5642
+ super.onBind();
5643
+ const { from, to } = moveIn(this.target, this.params.options, this.params);
5644
+ this.props = to;
5645
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
5646
+ this.from = from;
5647
+ this.to = to;
5648
+ const finalAttribute = this.target.getFinalAttribute();
5649
+ if (finalAttribute) {
5650
+ Object.assign(this.target.attribute, finalAttribute);
5651
+ }
5652
+ this.target.setAttributes(from);
5653
+ }
5654
+ }
5655
+ class MoveOut extends MoveBase {
5656
+ onBind() {
5657
+ super.onBind();
5658
+ const { from, to } = moveOut(this.target, this.params.options, this.params);
5659
+ this.props = to;
5660
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
5661
+ this.from = from;
5662
+ this.to = to;
5663
+ }
5664
+ }
5665
+
5666
+ const rotateIn = (graphic, options) => {
5667
+ var _a;
5668
+ const finalAttrs = graphic.getFinalAttribute();
5669
+ const attributeAngle = (_a = finalAttrs.angle) !== null && _a !== void 0 ? _a : 0;
5670
+ let angle = 0;
5671
+ if (isNumberClose(attributeAngle / (Math.PI * 2), 0)) {
5672
+ angle = Math.round(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5673
+ }
5674
+ else if (isValidNumber(options === null || options === void 0 ? void 0 : options.angle)) {
5675
+ angle = options.angle;
5676
+ }
5677
+ else if ((options === null || options === void 0 ? void 0 : options.orient) === 'anticlockwise') {
5678
+ angle = Math.ceil(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5679
+ }
5680
+ else {
5681
+ angle = Math.floor(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5682
+ }
5683
+ return {
5684
+ from: { angle },
5685
+ to: { angle: attributeAngle }
5686
+ };
5687
+ };
5688
+ const rotateOut = (graphic, options) => {
5689
+ var _a;
5690
+ const finalAttrs = graphic.getFinalAttribute();
5691
+ const finalAngle = (_a = finalAttrs.angle) !== null && _a !== void 0 ? _a : 0;
5692
+ let angle = 0;
5693
+ if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {
5694
+ angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5695
+ }
5696
+ else if (isValidNumber(options === null || options === void 0 ? void 0 : options.angle)) {
5697
+ angle = options.angle;
5698
+ }
5699
+ else if ((options === null || options === void 0 ? void 0 : options.orient) === 'anticlockwise') {
5700
+ angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5701
+ }
5702
+ else {
5703
+ angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5704
+ }
5705
+ return {
5706
+ from: { angle: finalAngle },
5707
+ to: { angle }
5708
+ };
5709
+ };
5710
+ class RotateBase extends ACustomAnimate {
5711
+ constructor(from, to, duration, easing, params) {
5712
+ super(from, to, duration, easing, params);
5713
+ }
5714
+ onUpdate(end, ratio, out) {
5715
+ const attribute = this.target.attribute;
5716
+ this.propKeys.forEach(key => {
5717
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5718
+ });
5719
+ this.target.addUpdatePositionTag();
5720
+ this.target.addUpdateShapeAndBoundsTag();
5721
+ }
5722
+ }
5723
+ class RotateIn extends RotateBase {
5724
+ onBind() {
5725
+ super.onBind();
5726
+ const { from, to } = rotateIn(this.target, this.params.options);
5727
+ this.props = to;
5728
+ this.propKeys = ['angle'];
5729
+ this.from = from;
5730
+ this.to = to;
5731
+ const finalAttribute = this.target.getFinalAttribute();
5732
+ if (finalAttribute) {
5733
+ Object.assign(this.target.attribute, finalAttribute);
5734
+ }
5735
+ this.target.setAttributes(from);
5736
+ }
5737
+ }
5738
+ class RotateOut extends RotateBase {
5739
+ onBind() {
5740
+ super.onBind();
5741
+ const { from, to } = rotateOut(this.target, this.params.options);
5742
+ this.props = to;
5743
+ this.propKeys = ['angle'];
5744
+ this.from = from;
5745
+ this.to = to;
5746
+ }
5747
+ }
5748
+
5749
+ class FromTo extends ACustomAnimate {
4435
5750
  constructor(from, to, duration, easing, params) {
4436
- const { diffAttrs = {} } = params;
4437
- super(from, diffAttrs, duration, easing, params);
5751
+ super(from, to, duration, easing, params);
5752
+ this.from = from !== null && from !== void 0 ? from : {};
5753
+ }
5754
+ onBind() {
5755
+ super.onBind();
5756
+ const finalAttribute = this.target.getFinalAttribute();
5757
+ Object.keys(this.from).forEach(key => {
5758
+ if (this.props[key] == null) {
5759
+ this.props[key] = finalAttribute[key];
5760
+ }
5761
+ });
5762
+ }
5763
+ onFirstRun() {
5764
+ var _a;
5765
+ this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
5766
+ const startProps = this.animate.getStartProps();
5767
+ this.propKeys &&
5768
+ this.propKeys.forEach(key => {
5769
+ var _a;
5770
+ this.from[key] = (_a = this.from[key]) !== null && _a !== void 0 ? _a : startProps[key];
5771
+ });
5772
+ if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
5773
+ const finalAttribute = this.target.getFinalAttribute();
5774
+ this.target.setAttributes(finalAttribute);
5775
+ }
5776
+ this.target.setAttributes(this.from);
4438
5777
  }
4439
5778
  update(end, ratio, out) {
4440
5779
  this.onStart();
@@ -4443,22 +5782,24 @@ class Update extends ACustomAnimate {
4443
5782
  }
4444
5783
  const easedRatio = this.easing(ratio);
4445
5784
  this.animate.interpolateUpdateFunction
4446
- ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)
5785
+ ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target)
4447
5786
  : this.interpolateUpdateFunctions.forEach((func, index) => {
4448
5787
  if (!this.animate.validAttr(this.propKeys[index])) {
4449
5788
  return;
4450
5789
  }
4451
5790
  const key = this.propKeys[index];
4452
- const fromValue = this.fromProps[key];
5791
+ const fromValue = this.from[key];
4453
5792
  const toValue = this.props[key];
4454
5793
  func(key, fromValue, toValue, easedRatio, this, this.target);
4455
5794
  });
4456
5795
  this.onUpdate(end, easedRatio, out);
5796
+ this.syncAttributeUpdate();
4457
5797
  }
4458
5798
  }
4459
5799
 
4460
5800
  const registerCustomAnimate = () => {
4461
5801
  AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
5802
+ AnimateExecutor.registerBuiltInAnimate('fromTo', FromTo);
4462
5803
  AnimateExecutor.registerBuiltInAnimate('scaleIn', ScaleIn);
4463
5804
  AnimateExecutor.registerBuiltInAnimate('scaleOut', ScaleOut);
4464
5805
  AnimateExecutor.registerBuiltInAnimate('growHeightIn', GrowHeightIn);
@@ -4481,13 +5822,31 @@ const registerCustomAnimate = () => {
4481
5822
  AnimateExecutor.registerBuiltInAnimate('growAngleOut', GrowAngleOut);
4482
5823
  AnimateExecutor.registerBuiltInAnimate('growRadiusIn', GrowRadiusIn);
4483
5824
  AnimateExecutor.registerBuiltInAnimate('growRadiusOut', GrowRadiusOut);
5825
+ AnimateExecutor.registerBuiltInAnimate('moveIn', MoveIn);
5826
+ AnimateExecutor.registerBuiltInAnimate('moveOut', MoveOut);
5827
+ AnimateExecutor.registerBuiltInAnimate('rotateIn', RotateIn);
5828
+ AnimateExecutor.registerBuiltInAnimate('rotateOut', RotateOut);
4484
5829
  AnimateExecutor.registerBuiltInAnimate('update', Update);
4485
5830
  AnimateExecutor.registerBuiltInAnimate('state', State);
4486
5831
  AnimateExecutor.registerBuiltInAnimate('labelItemAppear', LabelItemAppear);
4487
5832
  AnimateExecutor.registerBuiltInAnimate('labelItemDisappear', LabelItemDisappear);
4488
5833
  AnimateExecutor.registerBuiltInAnimate('poptipAppear', PoptipAppear);
4489
5834
  AnimateExecutor.registerBuiltInAnimate('poptipDisappear', PoptipDisappear);
4490
- AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
5835
+ AnimateExecutor.registerBuiltInAnimate('inputText', InputText);
5836
+ AnimateExecutor.registerBuiltInAnimate('inputRichText', InputRichText);
5837
+ AnimateExecutor.registerBuiltInAnimate('outputRichText', OutputRichText);
5838
+ AnimateExecutor.registerBuiltInAnimate('slideRichText', SlideRichText);
5839
+ AnimateExecutor.registerBuiltInAnimate('slideOutRichText', SlideOutRichText);
5840
+ AnimateExecutor.registerBuiltInAnimate('slideIn', SlideIn);
5841
+ AnimateExecutor.registerBuiltInAnimate('growIn', GrowIn);
5842
+ AnimateExecutor.registerBuiltInAnimate('spinIn', SpinIn);
5843
+ AnimateExecutor.registerBuiltInAnimate('moveScaleIn', MoveScaleIn);
5844
+ AnimateExecutor.registerBuiltInAnimate('moveRotateIn', MoveRotateIn);
5845
+ AnimateExecutor.registerBuiltInAnimate('slideOut', SlideOut);
5846
+ AnimateExecutor.registerBuiltInAnimate('growOut', GrowOut);
5847
+ AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
5848
+ AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
5849
+ AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
4491
5850
  };
4492
5851
 
4493
- export { ACustomAnimate, Animate, AnimateExecutor, AnimateMode, AnimateStatus, AnimateStepType, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, GraphicStateExtension, GroupFadeIn, GroupFadeOut, IncreaseCount, InputText, ManualTicker, RotateBySphereAnimate, Step, TagPointsUpdate, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
5852
+ export { AComponentAnimate, ACustomAnimate, Animate, AnimateExecutor, Step as AnimateStep, AnimationStateManager, AnimationStateStore, AnimationStates, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ComponentAnimator, DefaultTicker, DefaultTimeline, GraphicStateExtension, GroupFadeIn, GroupFadeOut, IncreaseCount, InputText, ManualTicker, RotateBySphereAnimate, TagPointsUpdate, createComponentAnimator, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };