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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) 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.map +1 -1
  12. package/cjs/custom/clip.d.ts +1 -1
  13. package/cjs/custom/clip.js.map +1 -1
  14. package/cjs/custom/common.d.ts +1 -2
  15. package/cjs/custom/common.js +12 -10
  16. package/cjs/custom/common.js.map +1 -1
  17. package/cjs/custom/custom-animate.d.ts +2 -4
  18. package/cjs/custom/custom-animate.js +2 -2
  19. package/cjs/custom/custom-animate.js.map +1 -1
  20. package/cjs/custom/fade.d.ts +1 -1
  21. package/cjs/custom/fade.js.map +1 -1
  22. package/cjs/custom/from-to.d.ts +9 -0
  23. package/cjs/custom/from-to.js +38 -0
  24. package/cjs/custom/from-to.js.map +1 -0
  25. package/cjs/custom/group-fade.d.ts +8 -14
  26. package/cjs/custom/group-fade.js +9 -50
  27. package/cjs/custom/group-fade.js.map +1 -1
  28. package/cjs/custom/growAngle.d.ts +2 -2
  29. package/cjs/custom/growAngle.js +17 -12
  30. package/cjs/custom/growAngle.js.map +1 -1
  31. package/cjs/custom/growCenter.d.ts +1 -2
  32. package/cjs/custom/growCenter.js +8 -7
  33. package/cjs/custom/growCenter.js.map +1 -1
  34. package/cjs/custom/growHeight.d.ts +1 -3
  35. package/cjs/custom/growHeight.js +7 -7
  36. package/cjs/custom/growHeight.js.map +1 -1
  37. package/cjs/custom/growPoints.d.ts +1 -2
  38. package/cjs/custom/growPoints.js +19 -17
  39. package/cjs/custom/growPoints.js.map +1 -1
  40. package/cjs/custom/growRadius.d.ts +4 -5
  41. package/cjs/custom/growRadius.js +12 -12
  42. package/cjs/custom/growRadius.js.map +1 -1
  43. package/cjs/custom/growWidth.d.ts +1 -3
  44. package/cjs/custom/growWidth.js +7 -6
  45. package/cjs/custom/growWidth.js.map +1 -1
  46. package/cjs/custom/input-text.d.ts +1 -2
  47. package/cjs/custom/input-text.js.map +1 -1
  48. package/cjs/custom/label-item-animate.js +2 -2
  49. package/cjs/custom/label-item-animate.js.map +1 -1
  50. package/cjs/custom/move.d.ts +92 -0
  51. package/cjs/custom/move.js +131 -0
  52. package/cjs/custom/move.js.map +1 -0
  53. package/cjs/custom/number.d.ts +1 -2
  54. package/cjs/custom/number.js.map +1 -1
  55. package/cjs/custom/poptip-animate.js +2 -1
  56. package/cjs/custom/poptip-animate.js.map +1 -1
  57. package/cjs/custom/register.js +21 -2
  58. package/cjs/custom/register.js.map +1 -1
  59. package/cjs/custom/richtext/input-richtext.d.ts +33 -0
  60. package/cjs/custom/richtext/input-richtext.js +70 -0
  61. package/cjs/custom/richtext/input-richtext.js.map +1 -0
  62. package/cjs/custom/richtext/output-richtext.d.ts +37 -0
  63. package/cjs/custom/richtext/output-richtext.js +94 -0
  64. package/cjs/custom/richtext/output-richtext.js.map +1 -0
  65. package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
  66. package/cjs/custom/richtext/slide-out-richtext.js +146 -0
  67. package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
  68. package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
  69. package/cjs/custom/richtext/slide-richtext.js +144 -0
  70. package/cjs/custom/richtext/slide-richtext.js.map +1 -0
  71. package/cjs/custom/rotate.d.ts +33 -0
  72. package/cjs/custom/rotate.js +76 -0
  73. package/cjs/custom/rotate.js.map +1 -0
  74. package/cjs/custom/scale.d.ts +2 -2
  75. package/cjs/custom/scale.js +25 -21
  76. package/cjs/custom/scale.js.map +1 -1
  77. package/cjs/custom/sphere.js +1 -2
  78. package/cjs/custom/state.d.ts +1 -1
  79. package/cjs/custom/state.js.map +1 -1
  80. package/cjs/custom/story.d.ts +128 -0
  81. package/cjs/custom/story.js +347 -0
  82. package/cjs/custom/story.js.map +1 -0
  83. package/cjs/custom/tag-points.d.ts +2 -3
  84. package/cjs/custom/tag-points.js +18 -5
  85. package/cjs/custom/tag-points.js.map +1 -1
  86. package/cjs/custom/update.d.ts +2 -1
  87. package/cjs/custom/update.js +10 -2
  88. package/cjs/custom/update.js.map +1 -1
  89. package/cjs/executor/animate-executor.d.ts +6 -5
  90. package/cjs/executor/animate-executor.js +57 -29
  91. package/cjs/executor/animate-executor.js.map +1 -1
  92. package/cjs/executor/executor.d.ts +6 -3
  93. package/cjs/executor/executor.js.map +1 -1
  94. package/cjs/index.d.ts +3 -6
  95. package/cjs/index.js +16 -4
  96. package/cjs/index.js.map +1 -1
  97. package/cjs/interpolate/store.d.ts +2 -2
  98. package/cjs/interpolate/store.js +2 -0
  99. package/cjs/interpolate/store.js.map +1 -1
  100. package/cjs/state/animation-state.d.ts +2 -2
  101. package/cjs/state/animation-state.js +3 -3
  102. package/cjs/state/animation-state.js.map +1 -1
  103. package/cjs/state/graphic-extension.d.ts +1 -1
  104. package/cjs/state/graphic-extension.js.map +1 -1
  105. package/cjs/step.d.ts +2 -4
  106. package/cjs/step.js +1 -1
  107. package/cjs/step.js.map +1 -1
  108. package/cjs/ticker/default-ticker.d.ts +2 -3
  109. package/cjs/ticker/default-ticker.js +14 -12
  110. package/cjs/ticker/default-ticker.js.map +1 -1
  111. package/cjs/ticker/manual-ticker.d.ts +1 -1
  112. package/cjs/ticker/manual-ticker.js.map +1 -1
  113. package/cjs/timeline.d.ts +1 -2
  114. package/cjs/timeline.js.map +1 -1
  115. package/cjs/utils/easing-func.js +2 -1
  116. package/dist/index.es.js +1859 -554
  117. package/es/animate-extension.d.ts +1 -3
  118. package/es/animate-extension.js +0 -7
  119. package/es/animate-extension.js.map +1 -1
  120. package/es/animate.d.ts +1 -5
  121. package/es/animate.js +1 -3
  122. package/es/animate.js.map +1 -1
  123. package/es/component/component-animator.d.ts +3 -2
  124. package/es/component/component-animator.js +18 -32
  125. package/es/component/component-animator.js.map +1 -1
  126. package/es/custom/clip-graphic.d.ts +1 -1
  127. package/es/custom/clip-graphic.js.map +1 -1
  128. package/es/custom/clip.d.ts +1 -1
  129. package/es/custom/clip.js.map +1 -1
  130. package/es/custom/common.d.ts +1 -2
  131. package/es/custom/common.js +12 -10
  132. package/es/custom/common.js.map +1 -1
  133. package/es/custom/custom-animate.d.ts +2 -4
  134. package/es/custom/custom-animate.js +2 -2
  135. package/es/custom/custom-animate.js.map +1 -1
  136. package/es/custom/fade.d.ts +1 -1
  137. package/es/custom/fade.js.map +1 -1
  138. package/es/custom/from-to.d.ts +9 -0
  139. package/es/custom/from-to.js +30 -0
  140. package/es/custom/from-to.js.map +1 -0
  141. package/es/custom/group-fade.d.ts +8 -14
  142. package/es/custom/group-fade.js +9 -50
  143. package/es/custom/group-fade.js.map +1 -1
  144. package/es/custom/growAngle.d.ts +2 -2
  145. package/es/custom/growAngle.js +20 -12
  146. package/es/custom/growAngle.js.map +1 -1
  147. package/es/custom/growCenter.d.ts +1 -2
  148. package/es/custom/growCenter.js +8 -7
  149. package/es/custom/growCenter.js.map +1 -1
  150. package/es/custom/growHeight.d.ts +1 -3
  151. package/es/custom/growHeight.js +8 -8
  152. package/es/custom/growHeight.js.map +1 -1
  153. package/es/custom/growPoints.d.ts +1 -2
  154. package/es/custom/growPoints.js +19 -17
  155. package/es/custom/growPoints.js.map +1 -1
  156. package/es/custom/growRadius.d.ts +4 -5
  157. package/es/custom/growRadius.js +12 -10
  158. package/es/custom/growRadius.js.map +1 -1
  159. package/es/custom/growWidth.d.ts +1 -3
  160. package/es/custom/growWidth.js +8 -7
  161. package/es/custom/growWidth.js.map +1 -1
  162. package/es/custom/input-text.d.ts +1 -2
  163. package/es/custom/input-text.js.map +1 -1
  164. package/es/custom/label-item-animate.js +2 -2
  165. package/es/custom/label-item-animate.js.map +1 -1
  166. package/es/custom/move.d.ts +92 -0
  167. package/es/custom/move.js +116 -0
  168. package/es/custom/move.js.map +1 -0
  169. package/es/custom/number.d.ts +1 -2
  170. package/es/custom/number.js.map +1 -1
  171. package/es/custom/poptip-animate.js +2 -1
  172. package/es/custom/poptip-animate.js.map +1 -1
  173. package/es/custom/register.js +41 -16
  174. package/es/custom/register.js.map +1 -1
  175. package/es/custom/richtext/input-richtext.d.ts +33 -0
  176. package/es/custom/richtext/input-richtext.js +64 -0
  177. package/es/custom/richtext/input-richtext.js.map +1 -0
  178. package/es/custom/richtext/output-richtext.d.ts +37 -0
  179. package/es/custom/richtext/output-richtext.js +88 -0
  180. package/es/custom/richtext/output-richtext.js.map +1 -0
  181. package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
  182. package/es/custom/richtext/slide-out-richtext.js +140 -0
  183. package/es/custom/richtext/slide-out-richtext.js.map +1 -0
  184. package/es/custom/richtext/slide-richtext.d.ts +36 -0
  185. package/es/custom/richtext/slide-richtext.js +138 -0
  186. package/es/custom/richtext/slide-richtext.js.map +1 -0
  187. package/es/custom/rotate.d.ts +33 -0
  188. package/es/custom/rotate.js +62 -0
  189. package/es/custom/rotate.js.map +1 -0
  190. package/es/custom/scale.d.ts +2 -2
  191. package/es/custom/scale.js +25 -21
  192. package/es/custom/scale.js.map +1 -1
  193. package/es/custom/sphere.js +1 -2
  194. package/es/custom/state.d.ts +1 -1
  195. package/es/custom/state.js.map +1 -1
  196. package/es/custom/story.d.ts +128 -0
  197. package/es/custom/story.js +323 -0
  198. package/es/custom/story.js.map +1 -0
  199. package/es/custom/tag-points.d.ts +2 -3
  200. package/es/custom/tag-points.js +19 -6
  201. package/es/custom/tag-points.js.map +1 -1
  202. package/es/custom/update.d.ts +2 -1
  203. package/es/custom/update.js +10 -2
  204. package/es/custom/update.js.map +1 -1
  205. package/es/executor/animate-executor.d.ts +6 -5
  206. package/es/executor/animate-executor.js +55 -29
  207. package/es/executor/animate-executor.js.map +1 -1
  208. package/es/executor/executor.d.ts +6 -3
  209. package/es/executor/executor.js.map +1 -1
  210. package/es/index.d.ts +3 -6
  211. package/es/index.js +4 -10
  212. package/es/index.js.map +1 -1
  213. package/es/interpolate/store.d.ts +2 -2
  214. package/es/interpolate/store.js +2 -0
  215. package/es/interpolate/store.js.map +1 -1
  216. package/es/state/animation-state.d.ts +2 -2
  217. package/es/state/animation-state.js +4 -2
  218. package/es/state/animation-state.js.map +1 -1
  219. package/es/state/graphic-extension.d.ts +1 -1
  220. package/es/state/graphic-extension.js.map +1 -1
  221. package/es/step.d.ts +2 -4
  222. package/es/step.js +2 -2
  223. package/es/step.js.map +1 -1
  224. package/es/ticker/default-ticker.d.ts +2 -3
  225. package/es/ticker/default-ticker.js +5 -5
  226. package/es/ticker/default-ticker.js.map +1 -1
  227. package/es/ticker/manual-ticker.d.ts +1 -1
  228. package/es/ticker/manual-ticker.js.map +1 -1
  229. package/es/timeline.d.ts +1 -2
  230. package/es/timeline.js +1 -1
  231. package/es/timeline.js.map +1 -1
  232. package/es/utils/easing-func.js +2 -1
  233. package/package.json +5 -5
  234. package/cjs/custom/label-animate.d.ts +0 -4
  235. package/cjs/custom/label-animate.js +0 -48
  236. package/cjs/custom/label-animate.js.map +0 -1
  237. package/cjs/intreface/animate.d.ts +0 -92
  238. package/cjs/intreface/animate.js +0 -10
  239. package/cjs/intreface/animate.js.map +0 -1
  240. package/cjs/intreface/easing.d.ts +0 -3
  241. package/cjs/intreface/easing.js +0 -6
  242. package/cjs/intreface/easing.js.map +0 -1
  243. package/cjs/intreface/ticker.d.ts +0 -37
  244. package/cjs/intreface/ticker.js +0 -11
  245. package/cjs/intreface/ticker.js.map +0 -1
  246. package/cjs/intreface/timeline.d.ts +0 -17
  247. package/cjs/intreface/timeline.js +0 -6
  248. package/cjs/intreface/timeline.js.map +0 -1
  249. package/cjs/intreface/type.d.ts +0 -13
  250. package/cjs/intreface/type.js +0 -15
  251. package/cjs/intreface/type.js.map +0 -1
  252. package/es/custom/label-animate.d.ts +0 -4
  253. package/es/custom/label-animate.js +0 -42
  254. package/es/custom/label-animate.js.map +0 -1
  255. package/es/intreface/animate.d.ts +0 -92
  256. package/es/intreface/animate.js +0 -6
  257. package/es/intreface/animate.js.map +0 -1
  258. package/es/intreface/easing.d.ts +0 -3
  259. package/es/intreface/easing.js +0 -2
  260. package/es/intreface/easing.js.map +0 -1
  261. package/es/intreface/ticker.d.ts +0 -37
  262. package/es/intreface/ticker.js +0 -7
  263. package/es/intreface/ticker.js.map +0 -1
  264. package/es/intreface/timeline.d.ts +0 -17
  265. package/es/intreface/timeline.js +0 -2
  266. package/es/intreface/timeline.js.map +0 -1
  267. package/es/intreface/type.d.ts +0 -13
  268. package/es/intreface/type.js +0 -14
  269. 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
  };
@@ -379,6 +361,7 @@ class Step {
379
361
  if (type === 'wait') {
380
362
  this.onUpdate = noop;
381
363
  }
364
+ this.id = Generator.GenAutoIncrementId();
382
365
  }
383
366
  bind(target, animate) {
384
367
  this.target = target;
@@ -609,10 +592,10 @@ class DefaultTimeline {
609
592
  const scaledDelta = delta * this._playSpeed;
610
593
  this._currentTime += scaledDelta;
611
594
  this.forEachAccessAnimate((animate, i) => {
612
- if (animate.status === AnimateStatus$1.END) {
595
+ if (animate.status === AnimateStatus.END) {
613
596
  this.removeAnimate(animate, true, i);
614
597
  }
615
- else if (animate.status === AnimateStatus$1.RUNNING || animate.status === AnimateStatus$1.INITIAL) {
598
+ else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {
616
599
  animate.advance(scaledDelta);
617
600
  }
618
601
  });
@@ -1047,13 +1030,6 @@ class Animate {
1047
1030
  }
1048
1031
  }
1049
1032
 
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
1033
  const performanceRAF = new PerformanceRAF();
1058
1034
  class RAFTickHandler {
1059
1035
  constructor() {
@@ -1080,6 +1056,9 @@ class DefaultTicker extends EventEmitter {
1080
1056
  this.timelines = [];
1081
1057
  this.frameTimeHistory = [];
1082
1058
  this.checkSkip = (delta) => {
1059
+ if (this.stage.params.optimize.tickRenderMode === 'performance') {
1060
+ return false;
1061
+ }
1083
1062
  const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
1084
1063
  return skip;
1085
1064
  };
@@ -1469,7 +1448,7 @@ class AnimateExecutor {
1469
1448
  });
1470
1449
  }
1471
1450
  parseParams(params, isTimeline) {
1472
- var _a;
1451
+ var _a, _b;
1473
1452
  const totalTime = this.resolveValue(params.totalTime, undefined, undefined);
1474
1453
  const startTime = this.resolveValue(params.startTime, undefined, 0);
1475
1454
  const parsedParams = Object.assign({}, params);
@@ -1506,8 +1485,8 @@ class AnimateExecutor {
1506
1485
  effects = [effects];
1507
1486
  }
1508
1487
  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];
1488
+ var _a, _b;
1489
+ const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = effect.type) !== null && _b !== void 0 ? _b : 'fromTo'];
1511
1490
  const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
1512
1491
  return Object.assign(Object.assign({}, effect), { custom,
1513
1492
  customType });
@@ -1531,7 +1510,7 @@ class AnimateExecutor {
1531
1510
  parsedParams.oneByOne = oneByOneTime;
1532
1511
  parsedParams.oneByOneDelay = oneByOneDelay;
1533
1512
  parsedParams.custom =
1534
- (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[params.type];
1513
+ (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[(_b = params.type) !== null && _b !== void 0 ? _b : 'fromTo'];
1535
1514
  const customType = parsedParams.custom && isFunction(parsedParams.custom)
1536
1515
  ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom))
1537
1516
  ? 1
@@ -1552,8 +1531,16 @@ class AnimateExecutor {
1552
1531
  return parsedParams;
1553
1532
  }
1554
1533
  execute(params) {
1534
+ if (Array.isArray(params)) {
1535
+ params.forEach(param => this._execute(param));
1536
+ }
1537
+ else {
1538
+ this._execute(params);
1539
+ }
1540
+ }
1541
+ _execute(params) {
1555
1542
  if (params.selfOnly) {
1556
- return this.executeItem(params, this._target, 0, 1);
1543
+ return this._executeItem(params, this._target, 0, 1);
1557
1544
  }
1558
1545
  const isTimeline = 'timeSlices' in params;
1559
1546
  let filteredChildren;
@@ -1596,29 +1583,41 @@ class AnimateExecutor {
1596
1583
  return;
1597
1584
  }
1598
1585
  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;
1586
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1587
+ 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
1588
  const animate = graphic.animate();
1602
1589
  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;
1590
+ 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;
1591
+ const datum = (_d = (_c = graphic.context) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[0];
1592
+ const indexKey = (_e = graphic.context) === null || _e === void 0 ? void 0 : _e.indexKey;
1606
1593
  if (datum && indexKey) {
1607
- index = (_d = datum[indexKey]) !== null && _d !== void 0 ? _d : index;
1594
+ index = (_f = datum[indexKey]) !== null && _f !== void 0 ? _f : index;
1608
1595
  }
1609
- animate.startAt(startTime);
1596
+ animate.startAt(startTime + delayValue);
1610
1597
  const wait = index * oneByOneDelay;
1611
1598
  wait > 0 && animate.wait(wait);
1612
- if (delayValue > 0) {
1613
- animate.wait(delayValue);
1599
+ let parsedFromProps = null;
1600
+ let props = params.to;
1601
+ let from = params.from;
1602
+ if (!props) {
1603
+ if (!parsedFromProps) {
1604
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1605
+ }
1606
+ props = parsedFromProps.props;
1607
+ }
1608
+ if (!from) {
1609
+ if (!parsedFromProps) {
1610
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1611
+ }
1612
+ from = parsedFromProps.from;
1614
1613
  }
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);
1614
+ this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
1617
1615
  if (oneByOneDelay) {
1618
1616
  animate.wait(oneByOneDelay * (count - index - 1));
1619
1617
  }
1620
- if (delayAfter > 0) {
1621
- animate.wait(delayAfter);
1618
+ 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;
1619
+ if (delayAfterValue > 0) {
1620
+ animate.wait(delayAfterValue);
1622
1621
  }
1623
1622
  if (loop && loop > 0) {
1624
1623
  animate.loop(loop);
@@ -1628,15 +1627,16 @@ class AnimateExecutor {
1628
1627
  }
1629
1628
  return animate;
1630
1629
  }
1631
- _handleRunAnimate(animate, custom, customType, props, duration, easing, customParameters, options, type, graphic) {
1630
+ _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
1631
+ var _a, _b, _c, _d;
1632
1632
  if (custom && customType) {
1633
1633
  const customParams = this.resolveValue(customParameters, graphic, {});
1634
1634
  const objOptions = isFunction(options)
1635
- ? options.call(null, customParameters.data && customParameters.data[0], graphic, customParameters)
1635
+ ? 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
1636
  : options;
1637
1637
  customParams.options = objOptions;
1638
1638
  if (customType === 1) {
1639
- this.createCustomAnimation(animate, custom, props, duration, easing, customParams);
1639
+ this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams);
1640
1640
  }
1641
1641
  else if (customType === 2) {
1642
1642
  this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
@@ -1677,18 +1677,32 @@ class AnimateExecutor {
1677
1677
  return animate;
1678
1678
  }
1679
1679
  applyTimeSliceToAnimate(slice, animate, graphic) {
1680
+ var _a, _b, _c, _d;
1680
1681
  const { effects, duration = 300, delay = 0, delayAfter = 0 } = slice;
1681
- const delayValue = delay;
1682
- const delayAfterValue = delayAfter;
1682
+ 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;
1683
+ 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
1684
  if (delayValue > 0) {
1684
1685
  animate.wait(delayValue);
1685
1686
  }
1686
1687
  const effectsArray = Array.isArray(effects) ? effects : [effects];
1687
1688
  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);
1689
+ const { type = 'fromTo', channel, customParameters, easing = 'linear', options } = effect;
1690
+ let parsedFromProps = null;
1691
+ let props = effect.to;
1692
+ let from = effect.from;
1693
+ if (!props) {
1694
+ if (!parsedFromProps) {
1695
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1696
+ }
1697
+ props = parsedFromProps.props;
1698
+ }
1699
+ if (!from) {
1700
+ if (!parsedFromProps) {
1701
+ parsedFromProps = this.createPropsFromChannel(channel, graphic);
1702
+ }
1703
+ from = parsedFromProps.from;
1704
+ }
1705
+ this._handleRunAnimate(animate, effect.custom, effect.customType, from, props, duration, easing, customParameters, options, type, graphic);
1692
1706
  });
1693
1707
  if (delayAfterValue > 0) {
1694
1708
  animate.wait(delayAfterValue);
@@ -1704,19 +1718,23 @@ class AnimateExecutor {
1704
1718
  };
1705
1719
  animate.to(props, duration, easing);
1706
1720
  }
1707
- createCustomAnimation(animate, CustomAnimateConstructor, props, duration, easing, customParams) {
1721
+ createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
1708
1722
  const to = props;
1709
- const customAnimate = new CustomAnimateConstructor(null, to, duration, easing, customParams);
1723
+ const customAnimate = new CustomAnimateConstructor(from, to, duration, easing, customParams);
1710
1724
  animate.play(customAnimate);
1711
1725
  }
1712
1726
  createPropsFromChannel(channel, graphic) {
1713
1727
  const props = {};
1728
+ let from = null;
1714
1729
  if (!channel) {
1715
- return props;
1730
+ return {
1731
+ from,
1732
+ props
1733
+ };
1716
1734
  }
1717
1735
  if (!Array.isArray(channel)) {
1718
1736
  Object.entries(channel).forEach(([key, config]) => {
1719
- var _a;
1737
+ var _a, _b;
1720
1738
  if (config.to !== undefined) {
1721
1739
  if (typeof config.to === 'function') {
1722
1740
  props[key] = config.to((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.data, graphic, {});
@@ -1725,9 +1743,32 @@ class AnimateExecutor {
1725
1743
  props[key] = config.to;
1726
1744
  }
1727
1745
  }
1746
+ if (config.from !== undefined) {
1747
+ if (!from) {
1748
+ from = {};
1749
+ }
1750
+ if (typeof config.from === 'function') {
1751
+ from[key] = config.from((_b = graphic.context) === null || _b === void 0 ? void 0 : _b.data, graphic, {});
1752
+ }
1753
+ else {
1754
+ from[key] = config.from;
1755
+ }
1756
+ }
1757
+ });
1758
+ }
1759
+ else {
1760
+ channel.forEach(key => {
1761
+ var _a, _b;
1762
+ const value = (_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.diffAttrs) === null || _b === void 0 ? void 0 : _b[key];
1763
+ if (value !== undefined) {
1764
+ props[key] = value;
1765
+ }
1728
1766
  });
1729
1767
  }
1730
- return props;
1768
+ return {
1769
+ from,
1770
+ props
1771
+ };
1731
1772
  }
1732
1773
  resolveValue(value, graphic, defaultValue) {
1733
1774
  var _a;
@@ -1740,6 +1781,12 @@ class AnimateExecutor {
1740
1781
  return value;
1741
1782
  }
1742
1783
  executeItem(params, graphic, index = 0, count = 1) {
1784
+ if (Array.isArray(params)) {
1785
+ return params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean);
1786
+ }
1787
+ return [this._executeItem(params, graphic, index, count)].filter(Boolean);
1788
+ }
1789
+ _executeItem(params, graphic, index = 0, count = 1) {
1743
1790
  if (!graphic) {
1744
1791
  return null;
1745
1792
  }
@@ -1813,7 +1860,9 @@ class AnimationStateManager {
1813
1860
  nextState.forEach((state, index) => {
1814
1861
  shouldApplyState.push({
1815
1862
  state,
1816
- animationConfig: animationConfig[index].animation,
1863
+ animationConfig: isArray(animationConfig[index])
1864
+ ? animationConfig[index].map(item => item.animation)
1865
+ : animationConfig[index].animation,
1817
1866
  executor: new AnimateExecutor(this.graphic)
1818
1867
  });
1819
1868
  });
@@ -1831,7 +1880,9 @@ class AnimationStateManager {
1831
1880
  if (result.allowTransition) {
1832
1881
  shouldApplyState.push({
1833
1882
  state,
1834
- animationConfig: animationConfig[index].animation,
1883
+ animationConfig: isArray(animationConfig[index])
1884
+ ? animationConfig[index].map(item => item.animation)
1885
+ : animationConfig[index].animation,
1835
1886
  executor: new AnimateExecutor(this.graphic)
1836
1887
  });
1837
1888
  this.stateList.forEach(currState => {
@@ -1961,15 +2012,6 @@ class GraphicStateExtension {
1961
2012
  }
1962
2013
 
1963
2014
  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
2015
  getAttributes(final = false) {
1974
2016
  if (final && this.finalAttribute) {
1975
2017
  return this.finalAttribute;
@@ -2061,14 +2103,107 @@ class ACustomAnimate extends Step {
2061
2103
  }
2062
2104
  }
2063
2105
  class AComponentAnimate extends ACustomAnimate {
2064
- onFirstRun() {
2106
+ completeBind(animator) {
2107
+ this.setStartTime(0);
2065
2108
  this._animator && this._animator.start();
2109
+ this.setDuration(animator.getDuration());
2066
2110
  }
2067
2111
  stop() {
2068
2112
  this._animator && this._animator.stop();
2069
2113
  }
2070
2114
  }
2071
2115
 
2116
+ class ComponentAnimator {
2117
+ constructor(component) {
2118
+ this.tasks = [];
2119
+ this.started = false;
2120
+ this.completed = 0;
2121
+ this.totalDuration = 0;
2122
+ this.onStartCallbacks = [];
2123
+ this.onEndCallbacks = [];
2124
+ this.onUpdateCallbacks = [];
2125
+ this.component = component;
2126
+ }
2127
+ animate(graphic, config) {
2128
+ if (this.started) {
2129
+ console.warn('Cannot add animations after animation has started');
2130
+ return this;
2131
+ }
2132
+ this.tasks.push({
2133
+ graphic,
2134
+ config
2135
+ });
2136
+ return this;
2137
+ }
2138
+ onStart(callback) {
2139
+ this.onStartCallbacks.push(callback);
2140
+ return this;
2141
+ }
2142
+ onEnd(callback) {
2143
+ this.onEndCallbacks.push(callback);
2144
+ return this;
2145
+ }
2146
+ onUpdate(callback) {
2147
+ this.onUpdateCallbacks.push(callback);
2148
+ return this;
2149
+ }
2150
+ start() {
2151
+ if (this.started) {
2152
+ console.warn('Animation has already started');
2153
+ return this;
2154
+ }
2155
+ this.started = true;
2156
+ this.completed = 0;
2157
+ this.onStartCallbacks.forEach(callback => callback());
2158
+ if (this.tasks.length === 0) {
2159
+ setTimeout(() => {
2160
+ this.onEndCallbacks.forEach(callback => callback());
2161
+ }, 0);
2162
+ return this;
2163
+ }
2164
+ this.tasks.forEach(task => {
2165
+ const executor = new AnimateExecutor(task.graphic);
2166
+ executor.onEnd(() => {
2167
+ this.completed++;
2168
+ if (this.completed === this.tasks.length) {
2169
+ this.onEndCallbacks.forEach(callback => callback());
2170
+ }
2171
+ });
2172
+ const animate = executor.executeItem(task.config, task.graphic);
2173
+ task.animate = animate;
2174
+ animate.forEach(animate => {
2175
+ this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
2176
+ });
2177
+ });
2178
+ return this;
2179
+ }
2180
+ deleteSelfAttr(key) {
2181
+ this.tasks.forEach(task => {
2182
+ if (task.animate) {
2183
+ task.animate.forEach(animate => animate.preventAttr(key));
2184
+ }
2185
+ });
2186
+ }
2187
+ stop(type) {
2188
+ this.tasks.forEach(task => {
2189
+ if (task.animate) {
2190
+ task.animate.forEach(animate => animate.stop(type));
2191
+ }
2192
+ });
2193
+ if (this.started && this.completed !== this.tasks.length) {
2194
+ this.onEndCallbacks.forEach(callback => callback());
2195
+ this.completed = this.tasks.length;
2196
+ }
2197
+ return this;
2198
+ }
2199
+ getDuration() {
2200
+ return this.totalDuration;
2201
+ }
2202
+ }
2203
+ function createComponentAnimator(component) {
2204
+ return new ComponentAnimator(component);
2205
+ }
2206
+
2072
2207
  class IncreaseCount extends ACustomAnimate {
2073
2208
  constructor(from, to, duration, easing, params) {
2074
2209
  super(from, to, duration, easing, params);
@@ -2509,6 +2644,11 @@ class TagPointsUpdate extends ACustomAnimate {
2509
2644
  return [];
2510
2645
  }
2511
2646
  onBind() {
2647
+ const { points, segments } = this.target.attribute;
2648
+ const { points: pointsTo, segments: segmentsTo } = this.target.getFinalAttribute();
2649
+ this.from = { points, segments };
2650
+ this.to = { points: pointsTo, segments: segmentsTo };
2651
+ this.props = this.to;
2512
2652
  const originFromPoints = this.getPoints(this.from);
2513
2653
  const originToPoints = this.getPoints(this.to, true);
2514
2654
  this.fromPoints = !originFromPoints ? [] : !Array.isArray(originFromPoints) ? [originFromPoints] : originFromPoints;
@@ -2611,77 +2751,107 @@ class TagPointsUpdate extends ACustomAnimate {
2611
2751
  }
2612
2752
  return;
2613
2753
  }
2614
- out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
2754
+ this.target.setAttributes({ clipRange: this.clipRange + (1 - this.clipRange) * ratio });
2615
2755
  }
2616
2756
  if (this.segmentsCache && this.to.segments) {
2617
2757
  let start = 0;
2618
- out.segments = this.to.segments.map((segment, index) => {
2758
+ const segments = this.to.segments.map((segment, index) => {
2619
2759
  const end = start + this.segmentsCache[index];
2620
2760
  const points = this.points.slice(start, end);
2621
2761
  start = end;
2622
2762
  return Object.assign(Object.assign({}, segment), { points });
2623
2763
  });
2764
+ this.target.attribute.points = segments;
2624
2765
  }
2625
2766
  else {
2626
- out.points = this.points;
2767
+ this.target.attribute.points = this.points;
2627
2768
  }
2769
+ this.target.addUpdatePositionTag();
2770
+ this.target.addUpdateShapeAndBoundsTag();
2628
2771
  }
2629
2772
  }
2630
2773
 
2631
- class GroupFadeIn extends ACustomAnimate {
2632
- getEndProps() {
2633
- return {};
2774
+ class CommonIn extends ACustomAnimate {
2775
+ constructor(from, to, duration, easing, params) {
2776
+ super(from, to, duration, easing, params);
2634
2777
  }
2635
2778
  onBind() {
2636
- this.target.setTheme({
2637
- common: {
2638
- opacity: 0
2639
- }
2779
+ var _a;
2780
+ const attrs = this.target.getFinalAttribute();
2781
+ const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
2782
+ const to = {};
2783
+ const from = {};
2784
+ this.keys.forEach(key => {
2785
+ var _a, _b;
2786
+ to[key] = (_a = attrs === null || attrs === void 0 ? void 0 : attrs[key]) !== null && _a !== void 0 ? _a : 1;
2787
+ from[key] = (_b = fromAttrs[key]) !== null && _b !== void 0 ? _b : 0;
2640
2788
  });
2641
- return;
2789
+ const finalAttribute = this.target.getFinalAttribute();
2790
+ if (finalAttribute) {
2791
+ Object.assign(this.target.attribute, finalAttribute);
2792
+ }
2793
+ this.props = to;
2794
+ this.propKeys = this.keys;
2795
+ this.from = from;
2796
+ this.to = to;
2797
+ this.target.setAttributes(from);
2642
2798
  }
2643
- onEnd() {
2644
- this.target.setTheme({
2645
- common: {
2646
- opacity: 1
2647
- }
2648
- });
2649
- return;
2799
+ onEnd(cb) {
2800
+ super.onEnd(cb);
2650
2801
  }
2651
2802
  onUpdate(end, ratio, out) {
2652
- this.target.setTheme({
2653
- common: {
2654
- opacity: ratio
2655
- }
2803
+ const attribute = this.target.attribute;
2804
+ this.propKeys.forEach(key => {
2805
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2656
2806
  });
2807
+ this.target.addUpdatePositionTag();
2808
+ this.target.addUpdateShapeAndBoundsTag();
2657
2809
  }
2658
2810
  }
2659
- class GroupFadeOut extends ACustomAnimate {
2660
- getEndProps() {
2661
- return {};
2811
+ class CommonOut extends ACustomAnimate {
2812
+ constructor(from, to, duration, easing, params) {
2813
+ super(from, to, duration, easing, params);
2662
2814
  }
2663
2815
  onBind() {
2664
- this.target.setTheme({
2665
- common: {
2666
- opacity: 1
2667
- }
2816
+ const attrs = this.target.attribute;
2817
+ const to = {};
2818
+ const from = {};
2819
+ this.keys.forEach(key => {
2820
+ var _a;
2821
+ to[key] = 0;
2822
+ from[key] = (_a = attrs[key]) !== null && _a !== void 0 ? _a : 1;
2668
2823
  });
2669
- return;
2824
+ this.props = to;
2825
+ this.propKeys = this.keys;
2826
+ this.from = from;
2827
+ this.to = to;
2828
+ Object.assign(this.target.attribute, from);
2829
+ this.target.addUpdatePositionTag();
2830
+ this.target.addUpdateBoundTag();
2670
2831
  }
2671
- onEnd() {
2672
- this.target.setTheme({
2673
- common: {
2674
- opacity: 0
2675
- }
2676
- });
2677
- return;
2832
+ onEnd(cb) {
2833
+ super.onEnd(cb);
2678
2834
  }
2679
2835
  onUpdate(end, ratio, out) {
2680
- this.target.setTheme({
2681
- common: {
2682
- opacity: 1 - ratio
2683
- }
2836
+ const attribute = this.target.attribute;
2837
+ this.propKeys.forEach(key => {
2838
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2684
2839
  });
2840
+ this.target.addUpdatePositionTag();
2841
+ this.target.addUpdateShapeAndBoundsTag();
2842
+ }
2843
+ }
2844
+
2845
+ class GroupFadeIn extends CommonIn {
2846
+ constructor(from, to, duration, easing, params) {
2847
+ super(from, to, duration, easing, params);
2848
+ this.keys = ['baseOpacity'];
2849
+ }
2850
+ }
2851
+ class GroupFadeOut extends CommonOut {
2852
+ constructor(from, to, duration, easing, params) {
2853
+ super(from, to, duration, easing, params);
2854
+ this.keys = ['baseOpacity'];
2685
2855
  }
2686
2856
  }
2687
2857
 
@@ -2729,99 +2899,29 @@ class RotateBySphereAnimate extends ACustomAnimate {
2729
2899
  }
2730
2900
  }
2731
2901
 
2732
- class CommonIn extends ACustomAnimate {
2902
+ class ClipIn extends CommonIn {
2733
2903
  constructor(from, to, duration, easing, params) {
2734
2904
  super(from, to, duration, easing, params);
2905
+ this.keys = ['clipRange'];
2735
2906
  }
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);
2907
+ }
2908
+ class ClipOut extends CommonOut {
2909
+ constructor(from, to, duration, easing, params) {
2910
+ super(from, to, duration, easing, params);
2911
+ this.keys = ['clipRange'];
2759
2912
  }
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();
2913
+ }
2914
+
2915
+ class FadeIn extends CommonIn {
2916
+ constructor(from, to, duration, easing, params) {
2917
+ super(from, to, duration, easing, params);
2918
+ this.keys = ['opacity'];
2767
2919
  }
2768
2920
  }
2769
- class CommonOut extends ACustomAnimate {
2921
+ class FadeOut extends CommonOut {
2770
2922
  constructor(from, to, duration, easing, params) {
2771
2923
  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'];
2924
+ this.keys = ['opacity'];
2825
2925
  }
2826
2926
  }
2827
2927
 
@@ -2872,7 +2972,7 @@ const growAngleIn = (graphic, options, animationParameters) => {
2872
2972
  : growAngleInIndividual(graphic, options);
2873
2973
  };
2874
2974
  const growAngleOutIndividual = (graphic, options, animationParameters) => {
2875
- const attrs = graphic.getFinalAttribute();
2975
+ const attrs = graphic.attribute;
2876
2976
  if (options && options.orient === 'anticlockwise') {
2877
2977
  return {
2878
2978
  from: { startAngle: attrs.startAngle },
@@ -2885,7 +2985,7 @@ const growAngleOutIndividual = (graphic, options, animationParameters) => {
2885
2985
  };
2886
2986
  };
2887
2987
  const growAngleOutOverall = (graphic, options, animationParameters) => {
2888
- const attrs = graphic.getFinalAttribute();
2988
+ const attrs = graphic.attribute;
2889
2989
  if (options && options.orient === 'anticlockwise') {
2890
2990
  const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;
2891
2991
  return {
@@ -2938,6 +3038,26 @@ class GrowAngleBase extends ACustomAnimate {
2938
3038
  this.valid = false;
2939
3039
  }
2940
3040
  }
3041
+ deleteSelfAttr(key) {
3042
+ delete this.props[key];
3043
+ this.fromProps && delete this.fromProps[key];
3044
+ const index = this.propKeys.indexOf(key);
3045
+ if (index !== -1) {
3046
+ this.propKeys.splice(index, 1);
3047
+ }
3048
+ if (this.propKeys && this.propKeys.length > 1) {
3049
+ this._updateFunction = this.updateAngle;
3050
+ }
3051
+ else if (this.propKeys[0] === 'startAngle') {
3052
+ this._updateFunction = this.updateStartAngle;
3053
+ }
3054
+ else if (this.propKeys[0] === 'endAngle') {
3055
+ this._updateFunction = this.updateEndAngle;
3056
+ }
3057
+ else {
3058
+ this._updateFunction = null;
3059
+ }
3060
+ }
2941
3061
  updateStartAngle(ratio) {
2942
3062
  this.target.attribute.startAngle =
2943
3063
  this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
@@ -2950,41 +3070,37 @@ class GrowAngleBase extends ACustomAnimate {
2950
3070
  this.updateEndAngle(ratio);
2951
3071
  }
2952
3072
  onUpdate(end, ratio, out) {
2953
- this._updateFunction(ratio);
2954
- this.target.addUpdateShapeAndBoundsTag();
3073
+ if (this._updateFunction) {
3074
+ this._updateFunction(ratio);
3075
+ this.target.addUpdateShapeAndBoundsTag();
3076
+ }
2955
3077
  }
2956
3078
  }
2957
3079
  class GrowAngleIn extends GrowAngleBase {
2958
3080
  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
- }
3081
+ var _a, _b;
2963
3082
  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;
3083
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
2965
3084
  this.props = to;
2966
3085
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2967
3086
  this.from = fromAttrs;
2968
3087
  this.to = to;
2969
- Object.assign(this.target.attribute, fromAttrs);
2970
- this.target.addUpdatePositionTag();
2971
- this.target.addUpdateBoundTag();
3088
+ const finalAttribute = this.target.getFinalAttribute();
3089
+ if (finalAttribute) {
3090
+ Object.assign(this.target.attribute, finalAttribute);
3091
+ }
3092
+ this.target.setAttributes(fromAttrs);
2972
3093
  this.determineUpdateFunction();
2973
3094
  }
2974
3095
  }
2975
3096
  class GrowAngleOut extends GrowAngleBase {
2976
3097
  onBind() {
2977
- var _a, _b;
2978
3098
  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;
3099
+ const fromAttrs = from;
2980
3100
  this.props = to;
2981
3101
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2982
- this.animate.reSyncProps();
2983
- this.from = fromAttrs;
3102
+ this.from = fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : this.target.attribute;
2984
3103
  this.to = to;
2985
- Object.assign(this.target.attribute, fromAttrs);
2986
- this.target.addUpdatePositionTag();
2987
- this.target.addUpdateBoundTag();
2988
3104
  this.determineUpdateFunction();
2989
3105
  }
2990
3106
  }
@@ -3067,7 +3183,7 @@ const growCenterIn = (graphic, options, animationParameters) => {
3067
3183
  }
3068
3184
  };
3069
3185
  const growCenterOut = (graphic, options, animationParameters) => {
3070
- const attrs = graphic.getFinalAttribute();
3186
+ const attrs = graphic.attribute;
3071
3187
  switch (options === null || options === void 0 ? void 0 : options.direction) {
3072
3188
  case 'x': {
3073
3189
  const x = attrs.x;
@@ -3145,17 +3261,17 @@ class GrowCenterIn extends ACustomAnimate {
3145
3261
  super(from, to, duration, easing, params);
3146
3262
  }
3147
3263
  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
- }
3264
+ var _a, _b;
3152
3265
  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;
3266
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3154
3267
  this.props = to;
3155
3268
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3156
- this.animate.reSyncProps();
3157
3269
  this.from = fromAttrs;
3158
3270
  this.to = to;
3271
+ const finalAttribute = this.target.getFinalAttribute();
3272
+ if (finalAttribute) {
3273
+ Object.assign(this.target.attribute, finalAttribute);
3274
+ }
3159
3275
  this.target.setAttributes(fromAttrs);
3160
3276
  }
3161
3277
  onEnd(cb) {
@@ -3175,12 +3291,10 @@ class GrowCenterOut extends ACustomAnimate {
3175
3291
  super(from, to, duration, easing, params);
3176
3292
  }
3177
3293
  onBind() {
3178
- const attrs = this.target.getFinalAttribute();
3179
3294
  const { from, to } = growCenterOut(this.target, this.params.options, this.params);
3180
3295
  this.props = to;
3181
3296
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3182
- this.animate.reSyncProps();
3183
- this.from = from || attrs;
3297
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3184
3298
  this.to = to;
3185
3299
  }
3186
3300
  onEnd(cb) {
@@ -3252,19 +3366,18 @@ class GrowHeightIn extends ACustomAnimate {
3252
3366
  super(from, to, duration, easing, params);
3253
3367
  }
3254
3368
  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
- }
3369
+ var _a, _b;
3259
3370
  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;
3371
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3261
3372
  this.props = to;
3262
3373
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3263
3374
  this.from = fromAttrs;
3264
3375
  this.to = to;
3265
- Object.assign(this.target.attribute, fromAttrs);
3266
- this.target.addUpdatePositionTag();
3267
- this.target.addUpdateBoundTag();
3376
+ const finalAttribute = this.target.getFinalAttribute();
3377
+ if (finalAttribute) {
3378
+ Object.assign(this.target.attribute, finalAttribute);
3379
+ }
3380
+ this.target.setAttributes(fromAttrs);
3268
3381
  }
3269
3382
  onEnd(cb) {
3270
3383
  super.onEnd(cb);
@@ -3330,12 +3443,10 @@ class GrowHeightOut extends ACustomAnimate {
3330
3443
  super(from, to, duration, easing, params);
3331
3444
  }
3332
3445
  onBind() {
3333
- const attrs = this.target.getFinalAttribute();
3334
3446
  const { from, to } = growHeightOut(this.target, this.params.options, this.params);
3335
3447
  this.props = to;
3336
3448
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3337
- this.animate.reSyncProps();
3338
- this.from = from || attrs;
3449
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3339
3450
  this.to = to;
3340
3451
  }
3341
3452
  onEnd(cb) {
@@ -3389,7 +3500,7 @@ const growPointsOut = (graphic, options, animationParameters) => {
3389
3500
  to: { points: getCenterPoints(graphic, options) }
3390
3501
  };
3391
3502
  };
3392
- let GworPointsBase$1 = class GworPointsBase extends ACustomAnimate {
3503
+ class GworPointsBase extends ACustomAnimate {
3393
3504
  constructor(from, to, duration, easing, params) {
3394
3505
  super(from, to, duration, easing, params);
3395
3506
  }
@@ -3407,33 +3518,33 @@ let GworPointsBase$1 = class GworPointsBase extends ACustomAnimate {
3407
3518
  this.target.addUpdatePositionTag();
3408
3519
  this.target.addUpdateShapeAndBoundsTag();
3409
3520
  }
3410
- };
3411
- class GrowPointsIn extends GworPointsBase$1 {
3521
+ }
3522
+ class GrowPointsIn extends GworPointsBase {
3412
3523
  onBind() {
3413
- var _a, _b;
3414
3524
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3415
3525
  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
3526
  this.props = to;
3418
3527
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3419
- this.animate.reSyncProps();
3420
- this.from = fromAttrs;
3528
+ this.from = from;
3421
3529
  this.to = to;
3422
- this.target.setAttributes(fromAttrs);
3530
+ const finalAttribute = this.target.getFinalAttribute();
3531
+ if (finalAttribute) {
3532
+ Object.assign(this.target.attribute, finalAttribute);
3533
+ }
3534
+ this.target.setAttributes(from);
3423
3535
  }
3424
3536
  else {
3425
3537
  this.valid = false;
3426
3538
  }
3427
3539
  }
3428
3540
  }
3429
- class GrowPointsOut extends GworPointsBase$1 {
3541
+ class GrowPointsOut extends GworPointsBase {
3430
3542
  onBind() {
3431
3543
  if (['area', 'line'].includes(this.target.type)) {
3432
3544
  const attrs = this.target.getFinalAttribute();
3433
3545
  const { from, to } = growPointsOut(this.target, this.params.options, this.params);
3434
3546
  this.props = to;
3435
3547
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3436
- this.animate.reSyncProps();
3437
3548
  this.from = from || attrs;
3438
3549
  this.to = to;
3439
3550
  }
@@ -3472,32 +3583,32 @@ const growPointsXOut = (graphic, options, animationParameters) => {
3472
3583
  to: { points: changePointsX(graphic, options, animationParameters) }
3473
3584
  };
3474
3585
  };
3475
- class GrowPointsXIn extends GworPointsBase$1 {
3586
+ class GrowPointsXIn extends GworPointsBase {
3476
3587
  onBind() {
3477
- var _a, _b;
3478
3588
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3479
3589
  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
3590
  this.props = to;
3482
3591
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3483
- this.animate.reSyncProps();
3484
- this.from = fromAttrs;
3592
+ this.from = from;
3485
3593
  this.to = to;
3486
- this.target.setAttributes(fromAttrs);
3594
+ const finalAttribute = this.target.getFinalAttribute();
3595
+ if (finalAttribute) {
3596
+ Object.assign(this.target.attribute, finalAttribute);
3597
+ }
3598
+ this.target.setAttributes(from);
3487
3599
  }
3488
3600
  else {
3489
3601
  this.valid = false;
3490
3602
  }
3491
3603
  }
3492
3604
  }
3493
- class GrowPointsXOut extends GworPointsBase$1 {
3605
+ class GrowPointsXOut extends GworPointsBase {
3494
3606
  onBind() {
3495
3607
  if (['area', 'line'].includes(this.target.type)) {
3496
3608
  const attrs = this.target.getFinalAttribute();
3497
3609
  const { from, to } = growPointsXOut(this.target, this.params.options, this.params);
3498
3610
  this.props = to;
3499
3611
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3500
- this.animate.reSyncProps();
3501
3612
  this.from = from || attrs;
3502
3613
  this.to = to;
3503
3614
  }
@@ -3536,36 +3647,32 @@ const growPointsYOut = (graphic, options, animationParameters) => {
3536
3647
  to: { points: changePointsY(graphic, options, animationParameters) }
3537
3648
  };
3538
3649
  };
3539
- class GrowPointsYIn extends GworPointsBase$1 {
3650
+ class GrowPointsYIn extends GworPointsBase {
3540
3651
  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
- }
3545
3652
  if (['area', 'line', 'polygon'].includes(this.target.type)) {
3546
3653
  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
3654
  this.props = to;
3549
3655
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3550
- this.animate.reSyncProps();
3551
- this.from = fromAttrs;
3656
+ this.from = from;
3552
3657
  this.to = to;
3553
- this.target.setAttributes(fromAttrs);
3658
+ const finalAttribute = this.target.getFinalAttribute();
3659
+ if (finalAttribute) {
3660
+ Object.assign(this.target.attribute, finalAttribute);
3661
+ }
3662
+ this.target.setAttributes(from);
3554
3663
  }
3555
3664
  else {
3556
3665
  this.valid = false;
3557
3666
  }
3558
3667
  }
3559
3668
  }
3560
- class GrowPointsYOut extends GworPointsBase$1 {
3669
+ class GrowPointsYOut extends GworPointsBase {
3561
3670
  onBind() {
3562
- if (['area', 'line'].includes(this.target.type)) {
3563
- const attrs = this.target.getFinalAttribute();
3671
+ if (['area', 'line', 'polygon'].includes(this.target.type)) {
3564
3672
  const { from, to } = growPointsYOut(this.target, this.params.options, this.params);
3565
3673
  this.props = to;
3566
3674
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3567
- this.animate.reSyncProps();
3568
- this.from = from || attrs;
3675
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3569
3676
  this.to = to;
3570
3677
  }
3571
3678
  else {
@@ -3640,7 +3747,7 @@ const growRadiusOut = (graphic, options, animationParameters) => {
3640
3747
  ? growRadiusOutOverall(graphic, options)
3641
3748
  : growRadiusOutIndividual(graphic, options);
3642
3749
  };
3643
- class GworPointsBase extends ACustomAnimate {
3750
+ class GrowPointsBase extends ACustomAnimate {
3644
3751
  constructor(from, to, duration, easing, params) {
3645
3752
  super(from, to, duration, easing, params);
3646
3753
  }
@@ -3653,33 +3760,29 @@ class GworPointsBase extends ACustomAnimate {
3653
3760
  this.target.addUpdateShapeAndBoundsTag();
3654
3761
  }
3655
3762
  }
3656
- class GrowRadiusIn extends GworPointsBase {
3763
+ class GrowRadiusIn extends GrowPointsBase {
3657
3764
  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
- }
3765
+ var _a, _b;
3662
3766
  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;
3767
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3664
3768
  this.props = to;
3665
3769
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3666
- this.animate.reSyncProps();
3667
3770
  this.from = fromAttrs;
3668
3771
  this.to = to;
3772
+ const finalAttribute = this.target.getFinalAttribute();
3773
+ if (finalAttribute) {
3774
+ Object.assign(this.target.attribute, finalAttribute);
3775
+ }
3669
3776
  this.target.setAttributes(fromAttrs);
3670
3777
  }
3671
3778
  }
3672
- class GrowRadiusOut extends GworPointsBase {
3779
+ class GrowRadiusOut extends GrowPointsBase {
3673
3780
  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;
3781
+ const { to } = growRadiusOut(this.target, this.params.options, this.params);
3677
3782
  this.props = to;
3678
3783
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3679
- this.animate.reSyncProps();
3680
- this.from = fromAttrs;
3784
+ this.from = this.target.attribute;
3681
3785
  this.to = to;
3682
- this.target.setAttributes(fromAttrs);
3683
3786
  }
3684
3787
  }
3685
3788
 
@@ -3786,17 +3889,17 @@ class GrowWidthIn extends ACustomAnimate {
3786
3889
  super(from, to, duration, easing, params);
3787
3890
  }
3788
3891
  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
- }
3892
+ var _a, _b;
3793
3893
  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;
3894
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3795
3895
  this.props = to;
3796
3896
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3797
- this.animate.reSyncProps();
3798
3897
  this.from = fromAttrs;
3799
3898
  this.to = to;
3899
+ const finalAttribute = this.target.getFinalAttribute();
3900
+ if (finalAttribute) {
3901
+ Object.assign(this.target.attribute, finalAttribute);
3902
+ }
3800
3903
  this.target.setAttributes(fromAttrs);
3801
3904
  }
3802
3905
  onEnd(cb) {
@@ -3816,12 +3919,10 @@ class GrowWidthOut extends ACustomAnimate {
3816
3919
  super(from, to, duration, easing, params);
3817
3920
  }
3818
3921
  onBind() {
3819
- const attrs = this.target.getFinalAttribute();
3820
3922
  const { from, to } = growWidthOut(this.target, this.params.options, this.params);
3821
3923
  this.props = to;
3822
3924
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3823
- this.animate.reSyncProps();
3824
- this.from = from || attrs;
3925
+ this.from = from !== null && from !== void 0 ? from : this.target.attribute;
3825
3926
  this.to = to;
3826
3927
  }
3827
3928
  onEnd(cb) {
@@ -3837,187 +3938,6 @@ class GrowWidthOut extends ACustomAnimate {
3837
3938
  }
3838
3939
  }
3839
3940
 
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
3941
  class LabelItemAppear extends AComponentAnimate {
4022
3942
  onBind() {
4023
3943
  const animator = createComponentAnimator(this.target);
@@ -4140,6 +4060,7 @@ class LabelItemAppear extends AComponentAnimate {
4140
4060
  });
4141
4061
  });
4142
4062
  }
4063
+ this.completeBind(animator);
4143
4064
  }
4144
4065
  }
4145
4066
  class LabelItemDisappear extends AComponentAnimate {
@@ -4210,6 +4131,7 @@ class LabelItemDisappear extends AComponentAnimate {
4210
4131
  easing
4211
4132
  });
4212
4133
  }
4134
+ this.completeBind(animator);
4213
4135
  }
4214
4136
  }
4215
4137
 
@@ -4283,6 +4205,7 @@ class PoptipAppear extends AComponentAnimate {
4283
4205
  ]
4284
4206
  });
4285
4207
  }
4208
+ this.completeBind(animator);
4286
4209
  }
4287
4210
  }
4288
4211
  class PoptipDisappear extends AComponentAnimate {
@@ -4298,104 +4221,1156 @@ class PoptipDisappear extends AComponentAnimate {
4298
4221
  duration,
4299
4222
  easing
4300
4223
  });
4224
+ this.completeBind(animator);
4301
4225
  }
4302
4226
  }
4303
4227
 
4304
- class ScaleIn extends ACustomAnimate {
4228
+ class InputRichText extends ACustomAnimate {
4305
4229
  constructor(from, to, duration, easing, params) {
4306
4230
  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);
4231
+ this.fromTextConfig = [];
4232
+ this.toTextConfig = [];
4233
+ this.originalTextConfig = [];
4234
+ this.showCursor = false;
4235
+ this.cursorChar = '|';
4236
+ this.blinkCursor = true;
4237
+ this.beforeText = '';
4238
+ this.afterText = '';
4239
+ this.fadeInChars = false;
4240
+ this.fadeInDuration = 0.3;
4241
+ if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
4242
+ this.showCursor = params.showCursor;
4312
4243
  }
4244
+ if ((params === null || params === void 0 ? void 0 : params.cursorChar) !== undefined) {
4245
+ this.cursorChar = params.cursorChar;
4246
+ }
4247
+ if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
4248
+ this.blinkCursor = params.blinkCursor;
4249
+ }
4250
+ if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
4251
+ this.beforeText = params.beforeText;
4252
+ }
4253
+ if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
4254
+ this.afterText = params.afterText;
4255
+ }
4256
+ if ((params === null || params === void 0 ? void 0 : params.fadeInChars) !== undefined) {
4257
+ this.fadeInChars = params.fadeInChars;
4258
+ }
4259
+ if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
4260
+ this.fadeInDuration = params.fadeInDuration;
4261
+ }
4262
+ }
4263
+ onFirstRun() {
4264
+ const fromProps = this.getLastProps();
4265
+ const toProps = this.getEndProps();
4266
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [];
4267
+ this.valid = true;
4268
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4269
+ this.valid = false;
4270
+ return;
4271
+ }
4272
+ this.fromTextConfig =
4273
+ fromProps.textConfig && fromProps.textConfig.length > 0
4274
+ ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig)
4275
+ : [];
4276
+ this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4277
+ }
4278
+ onEnd(cb) {
4279
+ super.onEnd(cb);
4280
+ if (!cb) {
4281
+ this.target.setAttribute('textConfig', this.originalTextConfig);
4282
+ }
4283
+ }
4284
+ onUpdate(end, ratio, out) {
4285
+ if (!this.valid) {
4286
+ return;
4287
+ }
4288
+ const totalItems = this.toTextConfig.length;
4289
+ const fromItems = this.fromTextConfig.length;
4290
+ const maxTextShowRatio = this.fadeInChars ? 1 - this.fadeInDuration : 1;
4291
+ let currentLength;
4292
+ if (fromItems > totalItems) {
4293
+ currentLength = Math.round(fromItems - (fromItems - totalItems) * ratio);
4294
+ }
4295
+ else {
4296
+ if (this.fadeInChars) {
4297
+ const adjustedRatio = Math.min(1, ratio / maxTextShowRatio);
4298
+ currentLength = Math.round(fromItems + (totalItems - fromItems) * adjustedRatio);
4299
+ }
4300
+ else {
4301
+ currentLength = Math.round(fromItems + (totalItems - fromItems) * ratio);
4302
+ }
4303
+ }
4304
+ let currentTextConfig;
4305
+ if (fromItems > totalItems) {
4306
+ currentTextConfig = this.fromTextConfig.slice(0, currentLength);
4307
+ }
4308
+ else {
4309
+ currentTextConfig = this.toTextConfig.slice(0, currentLength).map((item, index) => {
4310
+ if (this.fadeInChars && 'text' in item) {
4311
+ const appearTime = (index / totalItems) * maxTextShowRatio;
4312
+ const fadeProgress = (ratio - appearTime) / this.fadeInDuration;
4313
+ const opacity = Math.max(0, Math.min(1, fadeProgress));
4314
+ return Object.assign(Object.assign({}, item), { opacity: opacity });
4315
+ }
4316
+ return item;
4317
+ });
4318
+ }
4319
+ if (this.showCursor && currentLength < totalItems) {
4320
+ let shouldShowCursor = true;
4321
+ if (this.blinkCursor) {
4322
+ const blinkRate = 0.1;
4323
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 === 0;
4324
+ }
4325
+ if (shouldShowCursor && currentTextConfig.length > 0) {
4326
+ const lastIndex = currentTextConfig.length - 1;
4327
+ const lastItem = currentTextConfig[lastIndex];
4328
+ if ('text' in lastItem) {
4329
+ currentTextConfig[lastIndex] = Object.assign(Object.assign({}, lastItem), { text: String(lastItem.text) + this.cursorChar });
4330
+ }
4331
+ else {
4332
+ const cursorItem = {
4333
+ text: this.cursorChar,
4334
+ fontSize: 16
4335
+ };
4336
+ currentTextConfig.push(cursorItem);
4337
+ }
4338
+ }
4339
+ }
4340
+ this.target.setAttribute('textConfig', currentTextConfig);
4341
+ }
4342
+ }
4343
+
4344
+ class OutputRichText extends ACustomAnimate {
4345
+ constructor(from, to, duration, easing, params) {
4346
+ super(from, to, duration, easing, params);
4347
+ this.fromTextConfig = [];
4348
+ this.toTextConfig = [];
4349
+ this.originalTextConfig = [];
4350
+ this.showCursor = false;
4351
+ this.cursorChar = '|';
4352
+ this.blinkCursor = true;
4353
+ this.beforeText = '';
4354
+ this.afterText = '';
4355
+ this.fadeOutChars = false;
4356
+ this.fadeOutDuration = 0.3;
4357
+ this.direction = 'backward';
4358
+ if ((params === null || params === void 0 ? void 0 : params.showCursor) !== undefined) {
4359
+ this.showCursor = params.showCursor;
4360
+ }
4361
+ if ((params === null || params === void 0 ? void 0 : params.cursorChar) !== undefined) {
4362
+ this.cursorChar = params.cursorChar;
4363
+ }
4364
+ if ((params === null || params === void 0 ? void 0 : params.blinkCursor) !== undefined) {
4365
+ this.blinkCursor = params.blinkCursor;
4366
+ }
4367
+ if ((params === null || params === void 0 ? void 0 : params.beforeText) !== undefined) {
4368
+ this.beforeText = params.beforeText;
4369
+ }
4370
+ if ((params === null || params === void 0 ? void 0 : params.afterText) !== undefined) {
4371
+ this.afterText = params.afterText;
4372
+ }
4373
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutChars) !== undefined) {
4374
+ this.fadeOutChars = params.fadeOutChars;
4375
+ }
4376
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutDuration) !== undefined) {
4377
+ this.fadeOutDuration = params.fadeOutDuration;
4378
+ }
4379
+ if ((params === null || params === void 0 ? void 0 : params.direction) !== undefined) {
4380
+ this.direction = params.direction;
4381
+ }
4382
+ this.propKeys = ['textConfig'];
4383
+ }
4384
+ onFirstRun() {
4385
+ const fromProps = this.getLastProps();
4386
+ const toProps = this.getEndProps();
4387
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [];
4388
+ this.valid = true;
4389
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4390
+ this.valid = false;
4391
+ return;
4392
+ }
4393
+ this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4394
+ this.toTextConfig =
4395
+ toProps.textConfig && toProps.textConfig.length > 0
4396
+ ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig)
4397
+ : [];
4398
+ }
4399
+ onEnd(cb) {
4400
+ super.onEnd(cb);
4401
+ if (!cb) {
4402
+ if (this.toTextConfig.length > 0) {
4403
+ this.target.setAttribute('textConfig', this.toTextConfig);
4404
+ }
4405
+ else {
4406
+ this.target.setAttribute('textConfig', []);
4407
+ }
4408
+ }
4409
+ }
4410
+ onUpdate(end, ratio, out) {
4411
+ if (!this.valid) {
4412
+ return;
4413
+ }
4414
+ const fromItems = this.fromTextConfig.length;
4415
+ const maxTextHideRatio = this.fadeOutChars ? 1 - this.fadeOutDuration : 1;
4416
+ let displayedLength;
4417
+ if (this.direction === 'forward') {
4418
+ if (this.fadeOutChars) {
4419
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
4420
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
4421
+ }
4422
+ else {
4423
+ displayedLength = Math.round(fromItems * (1 - ratio));
4424
+ }
4425
+ let currentTextConfig = this.direction === 'forward'
4426
+ ? this.fromTextConfig.slice(fromItems - displayedLength)
4427
+ : this.fromTextConfig.slice(0, displayedLength);
4428
+ if (this.fadeOutChars) {
4429
+ currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength);
4430
+ }
4431
+ if (this.showCursor && displayedLength > 0) {
4432
+ currentTextConfig = this.addCursor(currentTextConfig, ratio);
4433
+ }
4434
+ this.target.setAttribute('textConfig', currentTextConfig);
4435
+ }
4436
+ else {
4437
+ if (this.fadeOutChars) {
4438
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
4439
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
4440
+ }
4441
+ else {
4442
+ displayedLength = Math.round(fromItems * (1 - ratio));
4443
+ }
4444
+ let currentTextConfig = this.fromTextConfig.slice(0, displayedLength);
4445
+ if (this.fadeOutChars) {
4446
+ currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength);
4447
+ }
4448
+ if (this.showCursor && displayedLength > 0) {
4449
+ currentTextConfig = this.addCursor(currentTextConfig, ratio);
4450
+ }
4451
+ this.target.setAttribute('textConfig', currentTextConfig);
4452
+ }
4453
+ }
4454
+ applyFadeEffect(textConfig, ratio, totalItems, displayedLength) {
4455
+ if (this.direction === 'forward') ;
4456
+ const fadeProgress = (ratio - (1 - this.fadeOutDuration)) / this.fadeOutDuration;
4457
+ const fadeOpacity = Math.max(0, 1 - Math.min(1, fadeProgress));
4458
+ return textConfig.map((item, index) => {
4459
+ if (this.direction === 'forward') {
4460
+ if (index === 0 && 'text' in item) {
4461
+ return Object.assign(Object.assign({}, item), { opacity: fadeOpacity });
4462
+ }
4463
+ }
4464
+ else {
4465
+ if (index === textConfig.length - 1 && 'text' in item) {
4466
+ return Object.assign(Object.assign({}, item), { opacity: fadeOpacity });
4467
+ }
4468
+ }
4469
+ return item;
4470
+ });
4471
+ }
4472
+ addCursor(textConfig, ratio) {
4473
+ let shouldShowCursor = true;
4474
+ if (this.blinkCursor) {
4475
+ const blinkRate = 0.1;
4476
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 === 0;
4477
+ }
4478
+ if (shouldShowCursor && textConfig.length > 0) {
4479
+ const cursorIndex = this.direction === 'forward' ? 0 : textConfig.length - 1;
4480
+ const cursorItem = textConfig[cursorIndex];
4481
+ if ('text' in cursorItem) {
4482
+ const result = [...textConfig];
4483
+ if (this.direction === 'forward') {
4484
+ result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), { text: this.cursorChar + String(cursorItem.text) });
4485
+ }
4486
+ else {
4487
+ result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), { text: String(cursorItem.text) + this.cursorChar });
4488
+ }
4489
+ return result;
4490
+ }
4491
+ }
4492
+ return textConfig;
4493
+ }
4494
+ }
4495
+
4496
+ class SlideRichText extends ACustomAnimate {
4497
+ constructor(from, to, duration, easing, params) {
4498
+ super(from, to, duration, easing, params);
4499
+ this.fromTextConfig = [];
4500
+ this.toTextConfig = [];
4501
+ this.originalTextConfig = [];
4502
+ this.singleCharConfig = [];
4503
+ this.fadeInDuration = 0.3;
4504
+ this.slideDirection = 'right';
4505
+ this.slideDistance = 30;
4506
+ this.wordByWord = false;
4507
+ this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g;
4508
+ this.wordGroups = [];
4509
+ if ((params === null || params === void 0 ? void 0 : params.fadeInDuration) !== undefined) {
4510
+ this.fadeInDuration = params.fadeInDuration;
4511
+ }
4512
+ if ((params === null || params === void 0 ? void 0 : params.slideDirection) !== undefined) {
4513
+ this.slideDirection = params.slideDirection;
4514
+ }
4515
+ if ((params === null || params === void 0 ? void 0 : params.slideDistance) !== undefined) {
4516
+ this.slideDistance = params.slideDistance;
4517
+ }
4518
+ if ((params === null || params === void 0 ? void 0 : params.wordByWord) !== undefined) {
4519
+ this.wordByWord = params.wordByWord;
4520
+ }
4521
+ if ((params === null || params === void 0 ? void 0 : params.wordRegex) !== undefined) {
4522
+ this.wordRegex = params.wordRegex;
4523
+ }
4524
+ }
4525
+ onFirstRun() {
4526
+ const fromProps = this.getLastProps();
4527
+ const toProps = this.getEndProps();
4528
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [];
4529
+ this.valid = true;
4530
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4531
+ this.valid = false;
4532
+ return;
4533
+ }
4534
+ this.fromTextConfig =
4535
+ fromProps.textConfig && fromProps.textConfig.length > 0
4536
+ ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig)
4537
+ : [];
4538
+ this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4539
+ this.singleCharConfig = this.toTextConfig.map(item => {
4540
+ if ('text' in item) {
4541
+ return Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4542
+ }
4543
+ return Object.assign(Object.assign({}, item), { opacity: 0 });
4544
+ });
4545
+ if (this.wordByWord) {
4546
+ this.calculateWordGroups();
4547
+ }
4548
+ }
4549
+ calculateWordGroups() {
4550
+ this.wordGroups = [];
4551
+ let fullText = '';
4552
+ const charMap = {};
4553
+ let fullTextIndex = 0;
4554
+ this.toTextConfig.forEach((item, configIndex) => {
4555
+ if ('text' in item) {
4556
+ const text = String(item.text);
4557
+ fullText += text;
4558
+ charMap[fullTextIndex] = configIndex;
4559
+ fullTextIndex++;
4560
+ }
4561
+ });
4562
+ let match;
4563
+ this.wordRegex.lastIndex = 0;
4564
+ while ((match = this.wordRegex.exec(fullText)) !== null) {
4565
+ const wordStart = match.index;
4566
+ const wordEnd = match.index + match[0].length;
4567
+ const wordIndices = [];
4568
+ for (let i = wordStart; i < wordEnd; i++) {
4569
+ if (charMap[i] !== undefined) {
4570
+ wordIndices.push(charMap[i]);
4571
+ }
4572
+ }
4573
+ if (wordIndices.length > 0) {
4574
+ this.wordGroups.push(wordIndices);
4575
+ }
4576
+ }
4577
+ const allocatedIndices = new Set();
4578
+ this.wordGroups.forEach(group => {
4579
+ group.forEach(index => allocatedIndices.add(index));
4580
+ });
4581
+ for (let i = 0; i < this.toTextConfig.length; i++) {
4582
+ if ('text' in this.toTextConfig[i] && !allocatedIndices.has(i)) {
4583
+ this.wordGroups.push([i]);
4584
+ }
4585
+ }
4586
+ }
4587
+ getInitialDx() {
4588
+ switch (this.slideDirection) {
4589
+ case 'left':
4590
+ return -this.slideDistance;
4591
+ case 'right':
4592
+ return this.slideDistance;
4593
+ default:
4594
+ return 0;
4595
+ }
4596
+ }
4597
+ getInitialDy() {
4598
+ switch (this.slideDirection) {
4599
+ case 'up':
4600
+ return -this.slideDistance;
4601
+ case 'down':
4602
+ return this.slideDistance;
4603
+ default:
4604
+ return 0;
4605
+ }
4606
+ }
4607
+ onEnd(cb) {
4608
+ super.onEnd(cb);
4609
+ if (!cb) {
4610
+ this.target.setAttribute('textConfig', this.originalTextConfig);
4611
+ }
4612
+ }
4613
+ onUpdate(end, ratio, out) {
4614
+ if (!this.valid) {
4615
+ return;
4616
+ }
4617
+ const maxTextShowRatio = 1 - this.fadeInDuration;
4618
+ let updatedTextConfig;
4619
+ if (this.wordByWord && this.wordGroups.length > 0) {
4620
+ updatedTextConfig = this.updateByWord(ratio, maxTextShowRatio);
4621
+ }
4622
+ else {
4623
+ updatedTextConfig = this.updateByCharacter(ratio, maxTextShowRatio);
4624
+ }
4625
+ this.target.setAttribute('textConfig', updatedTextConfig);
4626
+ }
4627
+ updateByWord(ratio, maxTextShowRatio) {
4628
+ const totalGroups = this.wordGroups.length;
4629
+ const updatedTextConfig = [...this.singleCharConfig];
4630
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
4631
+ let appearTime;
4632
+ if (this.slideDirection === 'left') {
4633
+ appearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4634
+ }
4635
+ else {
4636
+ appearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4637
+ }
4638
+ if (ratio < appearTime) {
4639
+ for (const charIndex of this.wordGroups[groupIndex]) {
4640
+ const item = updatedTextConfig[charIndex];
4641
+ if ('text' in item) {
4642
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4643
+ }
4644
+ }
4645
+ continue;
4646
+ }
4647
+ const animProgress = (ratio - appearTime) / this.fadeInDuration;
4648
+ const progress = Math.max(0, Math.min(1, animProgress));
4649
+ const dx = this.getInitialDx() * (1 - progress);
4650
+ const dy = this.getInitialDy() * (1 - progress);
4651
+ for (const charIndex of this.wordGroups[groupIndex]) {
4652
+ const item = updatedTextConfig[charIndex];
4653
+ if ('text' in item) {
4654
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: progress, dx,
4655
+ dy });
4656
+ }
4657
+ }
4658
+ }
4659
+ return updatedTextConfig;
4660
+ }
4661
+ updateByCharacter(ratio, maxTextShowRatio) {
4662
+ const totalItems = this.toTextConfig.length;
4663
+ const updatedTextConfig = [...this.singleCharConfig];
4664
+ for (let index = 0; index < updatedTextConfig.length; index++) {
4665
+ const item = updatedTextConfig[index];
4666
+ if ('text' in item) {
4667
+ let appearTime;
4668
+ if (this.slideDirection === 'left') {
4669
+ appearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4670
+ }
4671
+ else {
4672
+ appearTime = (index / totalItems) * maxTextShowRatio;
4673
+ }
4674
+ if (ratio < appearTime) {
4675
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: 0, dx: this.getInitialDx(), dy: this.getInitialDy() });
4676
+ continue;
4677
+ }
4678
+ const animProgress = (ratio - appearTime) / this.fadeInDuration;
4679
+ const progress = Math.max(0, Math.min(1, animProgress));
4680
+ const dx = this.getInitialDx() * (1 - progress);
4681
+ const dy = this.getInitialDy() * (1 - progress);
4682
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: progress, dx,
4683
+ dy });
4684
+ }
4685
+ }
4686
+ return updatedTextConfig;
4687
+ }
4688
+ }
4689
+
4690
+ class SlideOutRichText extends ACustomAnimate {
4691
+ constructor(from, to, duration, easing, params) {
4692
+ super(from, to, duration, easing, params);
4693
+ this.fromTextConfig = [];
4694
+ this.toTextConfig = [];
4695
+ this.originalTextConfig = [];
4696
+ this.singleCharConfig = [];
4697
+ this.fadeOutDuration = 0.3;
4698
+ this.slideDirection = 'right';
4699
+ this.slideDistance = 30;
4700
+ this.wordByWord = false;
4701
+ this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g;
4702
+ this.wordGroups = [];
4703
+ this.reverseOrder = false;
4704
+ if ((params === null || params === void 0 ? void 0 : params.fadeOutDuration) !== undefined) {
4705
+ this.fadeOutDuration = params.fadeOutDuration;
4706
+ }
4707
+ if ((params === null || params === void 0 ? void 0 : params.slideDirection) !== undefined) {
4708
+ this.slideDirection = params.slideDirection;
4709
+ }
4710
+ if ((params === null || params === void 0 ? void 0 : params.slideDistance) !== undefined) {
4711
+ this.slideDistance = params.slideDistance;
4712
+ }
4713
+ if ((params === null || params === void 0 ? void 0 : params.wordByWord) !== undefined) {
4714
+ this.wordByWord = params.wordByWord;
4715
+ }
4716
+ if ((params === null || params === void 0 ? void 0 : params.wordRegex) !== undefined) {
4717
+ this.wordRegex = params.wordRegex;
4718
+ }
4719
+ if ((params === null || params === void 0 ? void 0 : params.reverseOrder) !== undefined) {
4720
+ this.reverseOrder = params.reverseOrder;
4721
+ }
4722
+ this.propKeys = ['textConfig'];
4723
+ }
4724
+ onFirstRun() {
4725
+ const fromProps = this.getLastProps();
4726
+ const toProps = this.getEndProps();
4727
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [];
4728
+ this.valid = true;
4729
+ if (!this.originalTextConfig || this.originalTextConfig.length === 0) {
4730
+ this.valid = false;
4731
+ return;
4732
+ }
4733
+ this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig);
4734
+ this.toTextConfig =
4735
+ toProps.textConfig && toProps.textConfig.length > 0
4736
+ ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig)
4737
+ : [];
4738
+ this.singleCharConfig = this.fromTextConfig.map(item => {
4739
+ if ('text' in item) {
4740
+ return Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4741
+ }
4742
+ return Object.assign(Object.assign({}, item), { opacity: 1 });
4743
+ });
4744
+ if (this.wordByWord) {
4745
+ this.calculateWordGroups();
4746
+ }
4747
+ }
4748
+ calculateWordGroups() {
4749
+ this.wordGroups = [];
4750
+ let fullText = '';
4751
+ const charMap = {};
4752
+ let fullTextIndex = 0;
4753
+ this.fromTextConfig.forEach((item, configIndex) => {
4754
+ if ('text' in item) {
4755
+ const text = String(item.text);
4756
+ fullText += text;
4757
+ charMap[fullTextIndex] = configIndex;
4758
+ fullTextIndex++;
4759
+ }
4760
+ });
4761
+ let match;
4762
+ this.wordRegex.lastIndex = 0;
4763
+ while ((match = this.wordRegex.exec(fullText)) !== null) {
4764
+ const wordStart = match.index;
4765
+ const wordEnd = match.index + match[0].length;
4766
+ const wordIndices = [];
4767
+ for (let i = wordStart; i < wordEnd; i++) {
4768
+ if (charMap[i] !== undefined) {
4769
+ wordIndices.push(charMap[i]);
4770
+ }
4771
+ }
4772
+ if (wordIndices.length > 0) {
4773
+ this.wordGroups.push(wordIndices);
4774
+ }
4775
+ }
4776
+ const allocatedIndices = new Set();
4777
+ this.wordGroups.forEach(group => {
4778
+ group.forEach(index => allocatedIndices.add(index));
4779
+ });
4780
+ for (let i = 0; i < this.fromTextConfig.length; i++) {
4781
+ if ('text' in this.fromTextConfig[i] && !allocatedIndices.has(i)) {
4782
+ this.wordGroups.push([i]);
4783
+ }
4784
+ }
4785
+ }
4786
+ getTargetDx() {
4787
+ switch (this.slideDirection) {
4788
+ case 'left':
4789
+ return -this.slideDistance;
4790
+ case 'right':
4791
+ return this.slideDistance;
4792
+ default:
4793
+ return 0;
4794
+ }
4795
+ }
4796
+ getTargetDy() {
4797
+ switch (this.slideDirection) {
4798
+ case 'up':
4799
+ return -this.slideDistance;
4800
+ case 'down':
4801
+ return this.slideDistance;
4802
+ default:
4803
+ return 0;
4804
+ }
4805
+ }
4806
+ onEnd(cb) {
4807
+ super.onEnd(cb);
4808
+ if (!cb) {
4809
+ if (this.toTextConfig.length > 0) {
4810
+ this.target.setAttribute('textConfig', this.toTextConfig);
4811
+ }
4812
+ else {
4813
+ this.target.setAttribute('textConfig', []);
4814
+ }
4815
+ }
4816
+ }
4817
+ onUpdate(end, ratio, out) {
4818
+ if (!this.valid) {
4819
+ return;
4820
+ }
4821
+ const maxTextShowRatio = 1 - this.fadeOutDuration;
4822
+ let updatedTextConfig;
4823
+ if (this.wordByWord && this.wordGroups.length > 0) {
4824
+ updatedTextConfig = this.updateByWord(ratio, maxTextShowRatio);
4825
+ }
4826
+ else {
4827
+ updatedTextConfig = this.updateByCharacter(ratio, maxTextShowRatio);
4828
+ }
4829
+ this.target.setAttribute('textConfig', updatedTextConfig);
4830
+ }
4831
+ updateByWord(ratio, maxTextShowRatio) {
4832
+ const totalGroups = this.wordGroups.length;
4833
+ const updatedTextConfig = [...this.singleCharConfig];
4834
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
4835
+ let disappearTime;
4836
+ if (this.reverseOrder) {
4837
+ if (this.slideDirection === 'left') {
4838
+ disappearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4839
+ }
4840
+ else {
4841
+ disappearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4842
+ }
4843
+ }
4844
+ else {
4845
+ if (this.slideDirection === 'left') {
4846
+ disappearTime = ((totalGroups - 1 - groupIndex) / totalGroups) * maxTextShowRatio;
4847
+ }
4848
+ else {
4849
+ disappearTime = (groupIndex / totalGroups) * maxTextShowRatio;
4850
+ }
4851
+ }
4852
+ if (ratio < disappearTime) {
4853
+ for (const charIndex of this.wordGroups[groupIndex]) {
4854
+ const item = updatedTextConfig[charIndex];
4855
+ if ('text' in item) {
4856
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4857
+ }
4858
+ }
4859
+ continue;
4860
+ }
4861
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration;
4862
+ const progress = Math.max(0, Math.min(1, animProgress));
4863
+ const dx = this.getTargetDx() * progress;
4864
+ const dy = this.getTargetDy() * progress;
4865
+ const opacity = 1 - progress;
4866
+ for (const charIndex of this.wordGroups[groupIndex]) {
4867
+ const item = updatedTextConfig[charIndex];
4868
+ if ('text' in item) {
4869
+ updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), { opacity,
4870
+ dx,
4871
+ dy });
4872
+ }
4873
+ }
4874
+ }
4875
+ return updatedTextConfig;
4876
+ }
4877
+ updateByCharacter(ratio, maxTextShowRatio) {
4878
+ const totalItems = this.fromTextConfig.length;
4879
+ const updatedTextConfig = [...this.singleCharConfig];
4880
+ for (let index = 0; index < updatedTextConfig.length; index++) {
4881
+ const item = updatedTextConfig[index];
4882
+ if ('text' in item) {
4883
+ let disappearTime;
4884
+ if (this.reverseOrder) {
4885
+ if (this.slideDirection === 'left') {
4886
+ disappearTime = (index / totalItems) * maxTextShowRatio;
4887
+ }
4888
+ else {
4889
+ disappearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4890
+ }
4891
+ }
4892
+ else {
4893
+ if (this.slideDirection === 'left') {
4894
+ disappearTime = ((totalItems - 1 - index) / totalItems) * maxTextShowRatio;
4895
+ }
4896
+ else {
4897
+ disappearTime = (index / totalItems) * maxTextShowRatio;
4898
+ }
4899
+ }
4900
+ if (ratio < disappearTime) {
4901
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity: 1, dx: 0, dy: 0 });
4902
+ continue;
4903
+ }
4904
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration;
4905
+ const progress = Math.max(0, Math.min(1, animProgress));
4906
+ const dx = this.getTargetDx() * progress;
4907
+ const dy = this.getTargetDy() * progress;
4908
+ const opacity = 1 - progress;
4909
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), { opacity,
4910
+ dx,
4911
+ dy });
4912
+ }
4913
+ }
4914
+ return updatedTextConfig;
4915
+ }
4916
+ }
4917
+
4918
+ class ScaleIn extends ACustomAnimate {
4919
+ constructor(from, to, duration, easing, params) {
4920
+ super(from, to, duration, easing, params);
4921
+ }
4922
+ onBind() {
4923
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4313
4924
  let from;
4314
4925
  let to;
4315
4926
  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) {
4927
+ const fromAttrs = (_a = this.target.attribute) !== null && _a !== void 0 ? _a : {};
4928
+ switch ((_b = this.params) === null || _b === void 0 ? void 0 : _b.direction) {
4318
4929
  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'];
4930
+ from = { scaleX: (_c = fromAttrs.scaleX) !== null && _c !== void 0 ? _c : 0 };
4931
+ to = { scaleX: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _d !== void 0 ? _d : 1 };
4322
4932
  this._updateFunction = this.updateX;
4323
4933
  break;
4324
4934
  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'];
4935
+ from = { scaleY: (_e = fromAttrs.scaleY) !== null && _e !== void 0 ? _e : 0 };
4936
+ to = { scaleY: (_f = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _f !== void 0 ? _f : 1 };
4328
4937
  this._updateFunction = this.updateY;
4329
4938
  break;
4330
4939
  case 'xy':
4331
4940
  default:
4332
- from = { scaleX: (_j = fromAttrs.scaleX) !== null && _j !== void 0 ? _j : 0, scaleY: (_k = fromAttrs.scaleY) !== null && _k !== void 0 ? _k : 0 };
4941
+ from = { scaleX: (_g = fromAttrs.scaleX) !== null && _g !== void 0 ? _g : 0, scaleY: (_h = fromAttrs.scaleY) !== null && _h !== void 0 ? _h : 0 };
4333
4942
  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
4943
+ scaleX: (_j = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _j !== void 0 ? _j : 1,
4944
+ scaleY: (_k = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _k !== void 0 ? _k : 1
4336
4945
  };
4337
- this.propKeys = ['scaleX', 'scaleY'];
4338
4946
  this._updateFunction = this.updateXY;
4339
4947
  }
4948
+ const finalAttribute = this.target.getFinalAttribute();
4949
+ if (finalAttribute) {
4950
+ Object.assign(this.target.attribute, finalAttribute);
4951
+ }
4340
4952
  this.props = to;
4341
4953
  this.from = from;
4342
4954
  this.to = to;
4343
- Object.assign(this.target.attribute, from);
4955
+ this.target.setAttributes(from);
4956
+ }
4957
+ onEnd(cb) {
4958
+ super.onEnd(cb);
4959
+ }
4960
+ updateX(ratio) {
4961
+ this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
4962
+ }
4963
+ updateY(ratio) {
4964
+ this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
4965
+ }
4966
+ updateXY(ratio) {
4967
+ this.updateX(ratio);
4968
+ this.updateY(ratio);
4969
+ }
4970
+ deleteSelfAttr(key) {
4971
+ delete this.props[key];
4972
+ this.fromProps && delete this.fromProps[key];
4973
+ const index = this.propKeys.indexOf(key);
4974
+ if (index !== -1) {
4975
+ this.propKeys.splice(index, 1);
4976
+ }
4977
+ if (this.propKeys && this.propKeys.length > 1) {
4978
+ this._updateFunction = this.updateXY;
4979
+ }
4980
+ else if (this.propKeys[0] === 'scaleX') {
4981
+ this._updateFunction = this.updateX;
4982
+ }
4983
+ else if (this.propKeys[0] === 'scaleY') {
4984
+ this._updateFunction = this.updateY;
4985
+ }
4986
+ else {
4987
+ this._updateFunction = null;
4988
+ }
4989
+ }
4990
+ onUpdate(end, ratio, out) {
4991
+ if (this._updateFunction) {
4992
+ this._updateFunction(ratio);
4993
+ this.target.addUpdatePositionTag();
4994
+ }
4995
+ }
4996
+ }
4997
+ class ScaleOut extends ACustomAnimate {
4998
+ constructor(from, to, duration, easing, params) {
4999
+ super(from, to, duration, easing, params);
5000
+ }
5001
+ onBind() {
5002
+ var _a, _b, _c, _d, _e;
5003
+ let from;
5004
+ let to;
5005
+ const attrs = this.target.attribute;
5006
+ switch ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) {
5007
+ case 'x':
5008
+ from = { scaleX: (_b = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _b !== void 0 ? _b : 1 };
5009
+ to = { scaleX: 0 };
5010
+ break;
5011
+ case 'y':
5012
+ from = { scaleY: (_c = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _c !== void 0 ? _c : 1 };
5013
+ to = { scaleY: 0 };
5014
+ break;
5015
+ case 'xy':
5016
+ default:
5017
+ 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 };
5018
+ to = {
5019
+ scaleX: 0,
5020
+ scaleY: 0
5021
+ };
5022
+ }
5023
+ this.props = to;
5024
+ this.from = from;
5025
+ this.to = to;
5026
+ }
5027
+ onEnd(cb) {
5028
+ super.onEnd(cb);
5029
+ }
5030
+ onUpdate(end, ratio, out) {
5031
+ const attribute = this.target.attribute;
5032
+ this.propKeys.forEach(key => {
5033
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5034
+ });
4344
5035
  this.target.addUpdatePositionTag();
4345
- this.target.addUpdateBoundTag();
4346
5036
  }
4347
- onEnd(cb) {
4348
- super.onEnd(cb);
5037
+ }
5038
+
5039
+ class State extends ACustomAnimate {
5040
+ constructor(from, to, duration, easing, params) {
5041
+ super(from, to, duration, easing, params);
5042
+ }
5043
+ update(end, ratio, out) {
5044
+ this.onStart();
5045
+ if (!this.props || !this.propKeys) {
5046
+ return;
5047
+ }
5048
+ const easedRatio = this.easing(ratio);
5049
+ this.animate.interpolateUpdateFunction
5050
+ ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)
5051
+ : this.interpolateUpdateFunctions.forEach((func, index) => {
5052
+ if (!this.animate.validAttr(this.propKeys[index])) {
5053
+ return;
5054
+ }
5055
+ const key = this.propKeys[index];
5056
+ const fromValue = this.fromProps[key];
5057
+ const toValue = this.props[key];
5058
+ func(key, fromValue, toValue, easedRatio, this, this.target);
5059
+ });
5060
+ this.onUpdate(end, easedRatio, out);
5061
+ }
5062
+ }
5063
+
5064
+ class SlideIn extends ACustomAnimate {
5065
+ constructor(from, to, duration, easing, params) {
5066
+ super(from, to, duration, easing, params);
5067
+ }
5068
+ onBind() {
5069
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5070
+ const attrs = this.target.getFinalAttribute();
5071
+ const direction = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) || 'right';
5072
+ const distance = ((_b = this.params) === null || _b === void 0 ? void 0 : _b.distance) || 50;
5073
+ const fromOpacity = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0;
5074
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5075
+ const to = { opacity: 1, baseOpacity: 1 };
5076
+ if (direction === 'top') {
5077
+ from.y = ((_e = attrs.y) !== null && _e !== void 0 ? _e : 0) - distance;
5078
+ to.y = (_f = attrs.y) !== null && _f !== void 0 ? _f : 0;
5079
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5080
+ }
5081
+ else if (direction === 'bottom') {
5082
+ from.y = ((_g = attrs.y) !== null && _g !== void 0 ? _g : 0) + distance;
5083
+ to.y = (_h = attrs.y) !== null && _h !== void 0 ? _h : 0;
5084
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5085
+ }
5086
+ else if (direction === 'left') {
5087
+ from.x = ((_j = attrs.x) !== null && _j !== void 0 ? _j : 0) - distance;
5088
+ to.x = (_k = attrs.x) !== null && _k !== void 0 ? _k : 0;
5089
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5090
+ }
5091
+ else {
5092
+ from.x = ((_l = attrs.x) !== null && _l !== void 0 ? _l : 0) + distance;
5093
+ to.x = (_m = attrs.x) !== null && _m !== void 0 ? _m : 0;
5094
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5095
+ }
5096
+ this.from = from;
5097
+ this.to = to;
5098
+ this.props = to;
5099
+ this.target.setAttributes(from);
5100
+ }
5101
+ onUpdate(end, ratio, out) {
5102
+ const attribute = this.target.attribute;
5103
+ this.propKeys.forEach(key => {
5104
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5105
+ });
5106
+ this.target.addUpdatePositionTag();
5107
+ this.target.addUpdateShapeAndBoundsTag();
5108
+ }
5109
+ }
5110
+ class GrowIn extends ACustomAnimate {
5111
+ constructor(from, to, duration, easing, params) {
5112
+ super(from, to, duration, easing, params);
5113
+ }
5114
+ onBind() {
5115
+ var _a, _b, _c, _d, _e, _f, _g;
5116
+ const attrs = this.target.getFinalAttribute();
5117
+ const fromScale = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) !== null && _b !== void 0 ? _b : 0;
5118
+ const direction = ((_c = this.params) === null || _c === void 0 ? void 0 : _c.direction) || 'xy';
5119
+ const fromOpacity = (_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.fromOpacity) !== null && _e !== void 0 ? _e : 0;
5120
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5121
+ const to = { opacity: 1, baseOpacity: 1 };
5122
+ this.propKeys = ['opacity', 'baseOpacity'];
5123
+ if (direction === 'x' || direction === 'xy') {
5124
+ from.scaleX = fromScale;
5125
+ to.scaleX = (_f = attrs.scaleX) !== null && _f !== void 0 ? _f : 1;
5126
+ this.propKeys.push('scaleX');
5127
+ }
5128
+ if (direction === 'y' || direction === 'xy') {
5129
+ from.scaleY = fromScale;
5130
+ to.scaleY = (_g = attrs.scaleY) !== null && _g !== void 0 ? _g : 1;
5131
+ this.propKeys.push('scaleY');
5132
+ }
5133
+ this.from = from;
5134
+ this.to = to;
5135
+ this.props = to;
5136
+ this.target.setAttributes(from);
5137
+ }
5138
+ onUpdate(end, ratio, out) {
5139
+ const attribute = this.target.attribute;
5140
+ this.propKeys.forEach(key => {
5141
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5142
+ });
5143
+ this.target.addUpdatePositionTag();
5144
+ this.target.addUpdateShapeAndBoundsTag();
5145
+ }
5146
+ }
5147
+ class SpinIn extends ACustomAnimate {
5148
+ constructor(from, to, duration, easing, params) {
5149
+ super(from, to, duration, easing, params);
5150
+ }
5151
+ onBind() {
5152
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5153
+ const attrs = this.target.getFinalAttribute();
5154
+ const fromAngle = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) !== null && _b !== void 0 ? _b : Math.PI * 2;
5155
+ const fromScale = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromScale) !== null && _d !== void 0 ? _d : 0;
5156
+ const fromOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.fromOpacity) !== null && _f !== void 0 ? _f : 0;
5157
+ const from = {
5158
+ opacity: fromOpacity,
5159
+ baseOpacity: fromOpacity,
5160
+ angle: fromAngle,
5161
+ scaleX: fromScale,
5162
+ scaleY: fromScale
5163
+ };
5164
+ const to = {
5165
+ opacity: 1,
5166
+ baseOpacity: 1,
5167
+ angle: (_g = attrs.angle) !== null && _g !== void 0 ? _g : 0,
5168
+ scaleX: (_h = attrs.scaleX) !== null && _h !== void 0 ? _h : 1,
5169
+ scaleY: (_j = attrs.scaleY) !== null && _j !== void 0 ? _j : 1
5170
+ };
5171
+ this.propKeys = ['opacity', 'baseOpacity', 'angle', 'scaleX', 'scaleY'];
5172
+ this.from = from;
5173
+ this.to = to;
5174
+ this.props = to;
5175
+ this.target.setAttributes(from);
5176
+ }
5177
+ onUpdate(end, ratio, out) {
5178
+ const attribute = this.target.attribute;
5179
+ this.propKeys.forEach(key => {
5180
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5181
+ });
5182
+ this.target.addUpdatePositionTag();
5183
+ this.target.addUpdateShapeAndBoundsTag();
5184
+ }
5185
+ }
5186
+ class MoveScaleIn extends ACustomAnimate {
5187
+ constructor(from, to, duration, easing, params) {
5188
+ var _a;
5189
+ super(from, to, duration, easing, params);
5190
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5191
+ this.slideInDuration = duration * slideRatio;
5192
+ this.growInDuration = duration * (1 - slideRatio);
5193
+ }
5194
+ onBind() {
5195
+ var _a, _b, _c, _d, _e, _f;
5196
+ const executor = new AnimateExecutor(this.target);
5197
+ executor.execute({
5198
+ type: 'custom',
5199
+ custom: SlideIn,
5200
+ customParameters: {
5201
+ direction: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.slideDirection) || 'right',
5202
+ distance: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.slideDistance) || 50,
5203
+ fromOpacity: (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0
5204
+ },
5205
+ duration: this.slideInDuration,
5206
+ easing: this.easing
5207
+ });
5208
+ executor.execute({
5209
+ type: 'custom',
5210
+ custom: GrowIn,
5211
+ customParameters: {
5212
+ fromScale: ((_e = this.params) === null || _e === void 0 ? void 0 : _e.fromScale) || 0.5,
5213
+ direction: ((_f = this.params) === null || _f === void 0 ? void 0 : _f.scaleDirection) || 'xy',
5214
+ fromOpacity: 1
5215
+ },
5216
+ duration: this.growInDuration,
5217
+ easing: this.easing,
5218
+ delay: this.slideInDuration
5219
+ });
4349
5220
  }
4350
- updateX(ratio) {
4351
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
5221
+ onUpdate(end, ratio, out) {
4352
5222
  }
4353
- updateY(ratio) {
4354
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
5223
+ }
5224
+ class MoveRotateIn extends ACustomAnimate {
5225
+ constructor(from, to, duration, easing, params) {
5226
+ var _a;
5227
+ super(from, to, duration, easing, params);
5228
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5229
+ this.slideInDuration = duration * slideRatio;
5230
+ this.spinInDuration = duration * (1 - slideRatio);
4355
5231
  }
4356
- updateXY(ratio) {
4357
- this.updateX(ratio);
4358
- this.updateY(ratio);
5232
+ onBind() {
5233
+ var _a, _b, _c, _d, _e, _f;
5234
+ const executor = new AnimateExecutor(this.target);
5235
+ executor.execute({
5236
+ type: 'custom',
5237
+ custom: SlideIn,
5238
+ customParameters: {
5239
+ direction: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.slideDirection) || 'right',
5240
+ distance: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.slideDistance) || 50,
5241
+ fromOpacity: (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 0
5242
+ },
5243
+ duration: this.slideInDuration,
5244
+ easing: this.easing
5245
+ });
5246
+ executor.execute({
5247
+ type: 'custom',
5248
+ custom: SpinIn,
5249
+ customParameters: {
5250
+ fromAngle: ((_e = this.params) === null || _e === void 0 ? void 0 : _e.fromAngle) || Math.PI,
5251
+ fromScale: ((_f = this.params) === null || _f === void 0 ? void 0 : _f.fromScale) || 0.5,
5252
+ fromOpacity: 1
5253
+ },
5254
+ duration: this.spinInDuration,
5255
+ easing: this.easing,
5256
+ delay: this.slideInDuration
5257
+ });
4359
5258
  }
4360
5259
  onUpdate(end, ratio, out) {
4361
- this._updateFunction(ratio);
4362
- this.target.addUpdatePositionTag();
4363
5260
  }
4364
5261
  }
4365
- class ScaleOut extends ACustomAnimate {
5262
+ class SlideOut extends ACustomAnimate {
4366
5263
  constructor(from, to, duration, easing, params) {
4367
5264
  super(from, to, duration, easing, params);
4368
5265
  }
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
- };
5266
+ onFirstRun() {
5267
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5268
+ const attrs = this.target.getAttributes();
5269
+ const direction = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.direction) || 'right';
5270
+ const distance = ((_b = this.params) === null || _b === void 0 ? void 0 : _b.distance) || 50;
5271
+ const fromOpacity = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromOpacity) !== null && _d !== void 0 ? _d : 1;
5272
+ const toOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.toOpacity) !== null && _f !== void 0 ? _f : 0;
5273
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5274
+ const to = { opacity: toOpacity, baseOpacity: toOpacity };
5275
+ if (direction === 'top') {
5276
+ from.y = (_g = attrs.y) !== null && _g !== void 0 ? _g : 0;
5277
+ to.y = ((_h = attrs.y) !== null && _h !== void 0 ? _h : 0) - distance;
5278
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5279
+ }
5280
+ else if (direction === 'bottom') {
5281
+ from.y = (_j = attrs.y) !== null && _j !== void 0 ? _j : 0;
5282
+ to.y = ((_k = attrs.y) !== null && _k !== void 0 ? _k : 0) + distance;
5283
+ this.propKeys = ['opacity', 'baseOpacity', 'y'];
5284
+ }
5285
+ else if (direction === 'left') {
5286
+ from.x = (_l = attrs.x) !== null && _l !== void 0 ? _l : 0;
5287
+ to.x = ((_m = attrs.x) !== null && _m !== void 0 ? _m : 0) - distance;
5288
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
5289
+ }
5290
+ else {
5291
+ from.x = (_o = attrs.x) !== null && _o !== void 0 ? _o : 0;
5292
+ to.x = ((_p = attrs.x) !== null && _p !== void 0 ? _p : 0) + distance;
5293
+ this.propKeys = ['opacity', 'baseOpacity', 'x'];
4390
5294
  }
5295
+ this.from = from;
5296
+ this.to = to;
4391
5297
  this.props = to;
4392
- this.propKeys = Object.keys(to);
4393
- this.animate.reSyncProps();
5298
+ }
5299
+ onUpdate(end, ratio, out) {
5300
+ const attribute = this.target.attribute;
5301
+ this.propKeys.forEach(key => {
5302
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5303
+ });
5304
+ this.target.addUpdatePositionTag();
5305
+ this.target.addUpdateShapeAndBoundsTag();
5306
+ }
5307
+ }
5308
+ class GrowOut extends ACustomAnimate {
5309
+ constructor(from, to, duration, easing, params) {
5310
+ super(from, to, duration, easing, params);
5311
+ }
5312
+ onFirstRun() {
5313
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5314
+ const attrs = this.target.getAttributes();
5315
+ const toScale = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) !== null && _b !== void 0 ? _b : 0;
5316
+ const direction = ((_c = this.params) === null || _c === void 0 ? void 0 : _c.direction) || 'xy';
5317
+ const fromOpacity = (_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.fromOpacity) !== null && _e !== void 0 ? _e : 1;
5318
+ const toOpacity = (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.toOpacity) !== null && _g !== void 0 ? _g : 0;
5319
+ const from = { opacity: fromOpacity, baseOpacity: fromOpacity };
5320
+ const to = { opacity: toOpacity, baseOpacity: toOpacity };
5321
+ this.propKeys = ['opacity', 'baseOpacity'];
5322
+ if (direction === 'x' || direction === 'xy') {
5323
+ from.scaleX = (_h = attrs.scaleX) !== null && _h !== void 0 ? _h : 1;
5324
+ to.scaleX = toScale;
5325
+ this.propKeys.push('scaleX');
5326
+ }
5327
+ if (direction === 'y' || direction === 'xy') {
5328
+ from.scaleY = (_j = attrs.scaleY) !== null && _j !== void 0 ? _j : 1;
5329
+ to.scaleY = toScale;
5330
+ this.propKeys.push('scaleY');
5331
+ }
4394
5332
  this.from = from;
4395
5333
  this.to = to;
5334
+ this.props = to;
4396
5335
  }
4397
- onEnd(cb) {
4398
- super.onEnd(cb);
5336
+ onUpdate(end, ratio, out) {
5337
+ const attribute = this.target.attribute;
5338
+ this.propKeys.forEach(key => {
5339
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5340
+ });
5341
+ this.target.addUpdatePositionTag();
5342
+ this.target.addUpdateShapeAndBoundsTag();
5343
+ }
5344
+ }
5345
+ class SpinOut extends ACustomAnimate {
5346
+ constructor(from, to, duration, easing, params) {
5347
+ super(from, to, duration, easing, params);
5348
+ }
5349
+ onFirstRun() {
5350
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5351
+ const attrs = this.target.getAttributes();
5352
+ const toAngle = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) !== null && _b !== void 0 ? _b : Math.PI * 2;
5353
+ const toScale = (_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.fromScale) !== null && _d !== void 0 ? _d : 0;
5354
+ const fromOpacity = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.fromOpacity) !== null && _f !== void 0 ? _f : 1;
5355
+ const toOpacity = (_h = (_g = this.params) === null || _g === void 0 ? void 0 : _g.toOpacity) !== null && _h !== void 0 ? _h : 0;
5356
+ const from = {
5357
+ opacity: fromOpacity,
5358
+ baseOpacity: fromOpacity,
5359
+ angle: (_j = attrs.angle) !== null && _j !== void 0 ? _j : 0,
5360
+ scaleX: (_k = attrs.scaleX) !== null && _k !== void 0 ? _k : 1,
5361
+ scaleY: (_l = attrs.scaleY) !== null && _l !== void 0 ? _l : 1
5362
+ };
5363
+ const to = {
5364
+ opacity: toOpacity,
5365
+ baseOpacity: toOpacity,
5366
+ angle: toAngle,
5367
+ scaleX: toScale,
5368
+ scaleY: toScale
5369
+ };
5370
+ this.propKeys = ['opacity', 'baseOpacity', 'angle', 'scaleX', 'scaleY'];
5371
+ this.from = from;
5372
+ this.to = to;
5373
+ this.props = to;
4399
5374
  }
4400
5375
  onUpdate(end, ratio, out) {
4401
5376
  const attribute = this.target.attribute;
@@ -4403,13 +5378,104 @@ class ScaleOut extends ACustomAnimate {
4403
5378
  attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
4404
5379
  });
4405
5380
  this.target.addUpdatePositionTag();
5381
+ this.target.addUpdateShapeAndBoundsTag();
5382
+ }
5383
+ }
5384
+ class MoveScaleOut extends ACustomAnimate {
5385
+ constructor(from, to, duration, easing, params) {
5386
+ var _a;
5387
+ super(from, to, duration, easing, params);
5388
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5389
+ this.growOutDuration = duration * (1 - slideRatio);
5390
+ this.slideOutDuration = duration * slideRatio;
5391
+ }
5392
+ onFirstRun() {
5393
+ var _a, _b, _c, _d;
5394
+ const executor = new AnimateExecutor(this.target);
5395
+ executor.execute({
5396
+ type: 'custom',
5397
+ custom: GrowOut,
5398
+ customParameters: {
5399
+ fromScale: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.fromScale) || 0.5,
5400
+ direction: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.scaleDirection) || 'xy',
5401
+ fromOpacity: 1,
5402
+ toOpacity: 1
5403
+ },
5404
+ duration: this.growOutDuration,
5405
+ easing: this.easing
5406
+ });
5407
+ executor.execute({
5408
+ type: 'custom',
5409
+ custom: SlideOut,
5410
+ customParameters: {
5411
+ direction: ((_c = this.params) === null || _c === void 0 ? void 0 : _c.slideDirection) || 'right',
5412
+ distance: ((_d = this.params) === null || _d === void 0 ? void 0 : _d.slideDistance) || 50,
5413
+ fromOpacity: 1
5414
+ },
5415
+ duration: this.slideOutDuration,
5416
+ easing: this.easing,
5417
+ delay: this.growOutDuration
5418
+ });
5419
+ }
5420
+ onUpdate(end, ratio, out) {
5421
+ }
5422
+ }
5423
+ class MoveRotateOut extends ACustomAnimate {
5424
+ constructor(from, to, duration, easing, params) {
5425
+ var _a;
5426
+ super(from, to, duration, easing, params);
5427
+ const slideRatio = (_a = params === null || params === void 0 ? void 0 : params.slideRatio) !== null && _a !== void 0 ? _a : 0.5;
5428
+ this.spinOutDuration = duration * (1 - slideRatio);
5429
+ this.slideOutDuration = duration * slideRatio;
5430
+ }
5431
+ onFirstRun() {
5432
+ var _a, _b, _c, _d;
5433
+ const executor = new AnimateExecutor(this.target);
5434
+ executor.execute({
5435
+ type: 'custom',
5436
+ custom: SpinOut,
5437
+ customParameters: {
5438
+ fromAngle: ((_a = this.params) === null || _a === void 0 ? void 0 : _a.fromAngle) || Math.PI,
5439
+ fromScale: ((_b = this.params) === null || _b === void 0 ? void 0 : _b.fromScale) || 0.5,
5440
+ fromOpacity: 1,
5441
+ toOpacity: 1
5442
+ },
5443
+ duration: this.spinOutDuration,
5444
+ easing: this.easing
5445
+ });
5446
+ executor.execute({
5447
+ type: 'custom',
5448
+ custom: SlideOut,
5449
+ customParameters: {
5450
+ direction: ((_c = this.params) === null || _c === void 0 ? void 0 : _c.slideDirection) || 'right',
5451
+ distance: ((_d = this.params) === null || _d === void 0 ? void 0 : _d.slideDistance) || 50,
5452
+ fromOpacity: 1
5453
+ },
5454
+ duration: this.slideOutDuration,
5455
+ easing: this.easing,
5456
+ delay: this.spinOutDuration
5457
+ });
5458
+ }
5459
+ onUpdate(end, ratio, out) {
4406
5460
  }
4407
5461
  }
4408
5462
 
4409
- class State extends ACustomAnimate {
5463
+ class Update extends ACustomAnimate {
4410
5464
  constructor(from, to, duration, easing, params) {
4411
5465
  super(from, to, duration, easing, params);
4412
5466
  }
5467
+ onBind() {
5468
+ var _a, _b;
5469
+ let { diffAttrs = {} } = (_a = this.target.context) !== null && _a !== void 0 ? _a : {};
5470
+ const { options } = this.params;
5471
+ if ((_b = options === null || options === void 0 ? void 0 : options.excludeChannels) === null || _b === void 0 ? void 0 : _b.length) {
5472
+ diffAttrs = Object.assign({}, diffAttrs);
5473
+ options.excludeChannels.forEach((channel) => {
5474
+ delete diffAttrs[channel];
5475
+ });
5476
+ }
5477
+ this.props = diffAttrs;
5478
+ }
4413
5479
  update(end, ratio, out) {
4414
5480
  this.onStart();
4415
5481
  if (!this.props || !this.propKeys) {
@@ -4431,10 +5497,233 @@ class State extends ACustomAnimate {
4431
5497
  }
4432
5498
  }
4433
5499
 
4434
- class Update extends ACustomAnimate {
5500
+ const moveIn = (graphic, options, animationParameters) => {
5501
+ var _a, _b;
5502
+ const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options !== null && options !== void 0 ? options : {};
5503
+ let changedX = 0;
5504
+ let changedY = 0;
5505
+ if (orient === 'negative') {
5506
+ if (animationParameters.group) {
5507
+ changedX = (_a = animationParameters.groupWidth) !== null && _a !== void 0 ? _a : animationParameters.group.getBounds().width();
5508
+ changedY = (_b = animationParameters.groupHeight) !== null && _b !== void 0 ? _b : animationParameters.group.getBounds().height();
5509
+ animationParameters.groupWidth = changedX;
5510
+ animationParameters.groupHeight = changedY;
5511
+ }
5512
+ else {
5513
+ changedX = animationParameters.width;
5514
+ changedY = animationParameters.height;
5515
+ }
5516
+ }
5517
+ changedX += offset;
5518
+ changedY += offset;
5519
+ const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;
5520
+ const fromX = point && isValidNumber(point.x) ? point.x : changedX;
5521
+ const fromY = point && isValidNumber(point.y) ? point.y : changedY;
5522
+ const finalAttrs = graphic.getFinalAttribute();
5523
+ const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;
5524
+ const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;
5525
+ switch (direction) {
5526
+ case 'x':
5527
+ return {
5528
+ from: { x: fromX },
5529
+ to: { x: finalAttrsX }
5530
+ };
5531
+ case 'y':
5532
+ return {
5533
+ from: { y: fromY },
5534
+ to: { y: finalAttrsY }
5535
+ };
5536
+ case 'xy':
5537
+ default:
5538
+ return {
5539
+ from: { x: fromX, y: fromY },
5540
+ to: {
5541
+ x: finalAttrsX,
5542
+ y: finalAttrsY
5543
+ }
5544
+ };
5545
+ }
5546
+ };
5547
+ const moveOut = (graphic, options, animationParameters) => {
5548
+ var _a, _b;
5549
+ const { offset = 0, orient, direction, point: pointOpt } = options !== null && options !== void 0 ? options : {};
5550
+ const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;
5551
+ const groupWidth = (_a = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.width()) !== null && _a !== void 0 ? _a : animationParameters.width;
5552
+ const groupHeight = (_b = groupBounds === null || groupBounds === void 0 ? void 0 : groupBounds.height()) !== null && _b !== void 0 ? _b : animationParameters.height;
5553
+ const changedX = (orient === 'negative' ? groupWidth : 0) + offset;
5554
+ const changedY = (orient === 'negative' ? groupHeight : 0) + offset;
5555
+ const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;
5556
+ const fromX = point && isValidNumber(point.x) ? point.x : changedX;
5557
+ const fromY = point && isValidNumber(point.y) ? point.y : changedY;
5558
+ switch (direction) {
5559
+ case 'x':
5560
+ return {
5561
+ from: { x: graphic.attribute.x },
5562
+ to: { x: fromX }
5563
+ };
5564
+ case 'y':
5565
+ return {
5566
+ from: { y: graphic.attribute.y },
5567
+ to: { y: fromY }
5568
+ };
5569
+ case 'xy':
5570
+ default:
5571
+ return {
5572
+ from: {
5573
+ x: graphic.attribute.x,
5574
+ y: graphic.attribute.y
5575
+ },
5576
+ to: { x: fromX, y: fromY }
5577
+ };
5578
+ }
5579
+ };
5580
+ class MoveBase extends ACustomAnimate {
5581
+ constructor(from, to, duration, easing, params) {
5582
+ super(from, to, duration, easing, params);
5583
+ }
5584
+ onUpdate(end, ratio, out) {
5585
+ const attribute = this.target.attribute;
5586
+ this.propKeys.forEach(key => {
5587
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5588
+ });
5589
+ this.target.addUpdatePositionTag();
5590
+ this.target.addUpdateShapeAndBoundsTag();
5591
+ }
5592
+ }
5593
+ class MoveIn extends MoveBase {
5594
+ onBind() {
5595
+ const { from, to } = moveIn(this.target, this.params.options, this.params);
5596
+ this.props = to;
5597
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
5598
+ this.from = from;
5599
+ this.to = to;
5600
+ const finalAttribute = this.target.getFinalAttribute();
5601
+ if (finalAttribute) {
5602
+ Object.assign(this.target.attribute, finalAttribute);
5603
+ }
5604
+ this.target.setAttributes(from);
5605
+ }
5606
+ }
5607
+ class MoveOut extends MoveBase {
5608
+ onBind() {
5609
+ const { from, to } = moveOut(this.target, this.params.options, this.params);
5610
+ this.props = to;
5611
+ this.propKeys = Object.keys(to).filter(key => to[key] != null);
5612
+ this.from = from;
5613
+ this.to = to;
5614
+ }
5615
+ }
5616
+
5617
+ const rotateIn = (graphic, options) => {
5618
+ var _a;
5619
+ const finalAttrs = graphic.getFinalAttribute();
5620
+ const attributeAngle = (_a = finalAttrs.angle) !== null && _a !== void 0 ? _a : 0;
5621
+ let angle = 0;
5622
+ if (isNumberClose(attributeAngle / (Math.PI * 2), 0)) {
5623
+ angle = Math.round(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5624
+ }
5625
+ else if (isValidNumber(options === null || options === void 0 ? void 0 : options.angle)) {
5626
+ angle = options.angle;
5627
+ }
5628
+ else if ((options === null || options === void 0 ? void 0 : options.orient) === 'anticlockwise') {
5629
+ angle = Math.ceil(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5630
+ }
5631
+ else {
5632
+ angle = Math.floor(attributeAngle / (Math.PI * 2)) * Math.PI * 2;
5633
+ }
5634
+ return {
5635
+ from: { angle },
5636
+ to: { angle: attributeAngle }
5637
+ };
5638
+ };
5639
+ const rotateOut = (graphic, options) => {
5640
+ var _a;
5641
+ const finalAttrs = graphic.getFinalAttribute();
5642
+ const finalAngle = (_a = finalAttrs.angle) !== null && _a !== void 0 ? _a : 0;
5643
+ let angle = 0;
5644
+ if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {
5645
+ angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5646
+ }
5647
+ else if (isValidNumber(options === null || options === void 0 ? void 0 : options.angle)) {
5648
+ angle = options.angle;
5649
+ }
5650
+ else if ((options === null || options === void 0 ? void 0 : options.orient) === 'anticlockwise') {
5651
+ angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5652
+ }
5653
+ else {
5654
+ angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;
5655
+ }
5656
+ return {
5657
+ from: { angle: finalAngle },
5658
+ to: { angle }
5659
+ };
5660
+ };
5661
+ class RotateBase extends ACustomAnimate {
5662
+ constructor(from, to, duration, easing, params) {
5663
+ super(from, to, duration, easing, params);
5664
+ }
5665
+ onUpdate(end, ratio, out) {
5666
+ const attribute = this.target.attribute;
5667
+ this.propKeys.forEach(key => {
5668
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
5669
+ });
5670
+ this.target.addUpdatePositionTag();
5671
+ this.target.addUpdateShapeAndBoundsTag();
5672
+ }
5673
+ }
5674
+ class RotateIn extends RotateBase {
5675
+ onBind() {
5676
+ const { from, to } = rotateIn(this.target, this.params.options);
5677
+ this.props = to;
5678
+ this.propKeys = ['angle'];
5679
+ this.from = from;
5680
+ this.to = to;
5681
+ const finalAttribute = this.target.getFinalAttribute();
5682
+ if (finalAttribute) {
5683
+ Object.assign(this.target.attribute, finalAttribute);
5684
+ }
5685
+ this.target.setAttributes(from);
5686
+ }
5687
+ }
5688
+ class RotateOut extends RotateBase {
5689
+ onBind() {
5690
+ const { from, to } = rotateOut(this.target, this.params.options);
5691
+ this.props = to;
5692
+ this.propKeys = ['angle'];
5693
+ this.from = from;
5694
+ this.to = to;
5695
+ }
5696
+ }
5697
+
5698
+ class FromTo extends ACustomAnimate {
4435
5699
  constructor(from, to, duration, easing, params) {
4436
- const { diffAttrs = {} } = params;
4437
- super(from, diffAttrs, duration, easing, params);
5700
+ super(from, to, duration, easing, params);
5701
+ this.from = from;
5702
+ this.to = to;
5703
+ }
5704
+ onBind() {
5705
+ var _a;
5706
+ const finalAttribute = this.target.getFinalAttribute();
5707
+ const currAttribute = this.target.attribute;
5708
+ const fromKeys = Object.keys(this.from);
5709
+ const toKeys = Object.keys(this.to);
5710
+ fromKeys.forEach(key => {
5711
+ var _a;
5712
+ if (this.to[key] == null) {
5713
+ this.to[key] = (_a = finalAttribute[key]) !== null && _a !== void 0 ? _a : 0;
5714
+ }
5715
+ });
5716
+ toKeys.forEach(key => {
5717
+ var _a;
5718
+ if (this.from[key] == null) {
5719
+ this.from[key] = (_a = currAttribute[key]) !== null && _a !== void 0 ? _a : 0;
5720
+ }
5721
+ });
5722
+ this.propKeys = Object.keys(this.from);
5723
+ if (((_a = this.target.context) === null || _a === void 0 ? void 0 : _a.animationState) === 'appear') {
5724
+ const finalAttribute = this.target.getFinalAttribute();
5725
+ this.target.setAttributes(finalAttribute);
5726
+ }
4438
5727
  }
4439
5728
  update(end, ratio, out) {
4440
5729
  this.onStart();
@@ -4442,23 +5731,21 @@ class Update extends ACustomAnimate {
4442
5731
  return;
4443
5732
  }
4444
5733
  const easedRatio = this.easing(ratio);
4445
- this.animate.interpolateUpdateFunction
4446
- ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)
4447
- : this.interpolateUpdateFunctions.forEach((func, index) => {
4448
- if (!this.animate.validAttr(this.propKeys[index])) {
4449
- return;
4450
- }
4451
- const key = this.propKeys[index];
4452
- const fromValue = this.fromProps[key];
4453
- const toValue = this.props[key];
4454
- func(key, fromValue, toValue, easedRatio, this, this.target);
4455
- });
4456
- this.onUpdate(end, easedRatio, out);
5734
+ this.interpolateUpdateFunctions.forEach((func, index) => {
5735
+ if (!this.animate.validAttr(this.propKeys[index])) {
5736
+ return;
5737
+ }
5738
+ const key = this.propKeys[index];
5739
+ const fromValue = this.from[key];
5740
+ const toValue = this.to[key];
5741
+ func(key, fromValue, toValue, easedRatio, this, this.target);
5742
+ });
4457
5743
  }
4458
5744
  }
4459
5745
 
4460
5746
  const registerCustomAnimate = () => {
4461
5747
  AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
5748
+ AnimateExecutor.registerBuiltInAnimate('fromTo', FromTo);
4462
5749
  AnimateExecutor.registerBuiltInAnimate('scaleIn', ScaleIn);
4463
5750
  AnimateExecutor.registerBuiltInAnimate('scaleOut', ScaleOut);
4464
5751
  AnimateExecutor.registerBuiltInAnimate('growHeightIn', GrowHeightIn);
@@ -4481,13 +5768,31 @@ const registerCustomAnimate = () => {
4481
5768
  AnimateExecutor.registerBuiltInAnimate('growAngleOut', GrowAngleOut);
4482
5769
  AnimateExecutor.registerBuiltInAnimate('growRadiusIn', GrowRadiusIn);
4483
5770
  AnimateExecutor.registerBuiltInAnimate('growRadiusOut', GrowRadiusOut);
5771
+ AnimateExecutor.registerBuiltInAnimate('moveIn', MoveIn);
5772
+ AnimateExecutor.registerBuiltInAnimate('moveOut', MoveOut);
5773
+ AnimateExecutor.registerBuiltInAnimate('rotateIn', RotateIn);
5774
+ AnimateExecutor.registerBuiltInAnimate('rotateOut', RotateOut);
4484
5775
  AnimateExecutor.registerBuiltInAnimate('update', Update);
4485
5776
  AnimateExecutor.registerBuiltInAnimate('state', State);
4486
5777
  AnimateExecutor.registerBuiltInAnimate('labelItemAppear', LabelItemAppear);
4487
5778
  AnimateExecutor.registerBuiltInAnimate('labelItemDisappear', LabelItemDisappear);
4488
5779
  AnimateExecutor.registerBuiltInAnimate('poptipAppear', PoptipAppear);
4489
5780
  AnimateExecutor.registerBuiltInAnimate('poptipDisappear', PoptipDisappear);
4490
- AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
5781
+ AnimateExecutor.registerBuiltInAnimate('inputText', InputText);
5782
+ AnimateExecutor.registerBuiltInAnimate('inputRichText', InputRichText);
5783
+ AnimateExecutor.registerBuiltInAnimate('outputRichText', OutputRichText);
5784
+ AnimateExecutor.registerBuiltInAnimate('slideRichText', SlideRichText);
5785
+ AnimateExecutor.registerBuiltInAnimate('slideOutRichText', SlideOutRichText);
5786
+ AnimateExecutor.registerBuiltInAnimate('slideIn', SlideIn);
5787
+ AnimateExecutor.registerBuiltInAnimate('growIn', GrowIn);
5788
+ AnimateExecutor.registerBuiltInAnimate('spinIn', SpinIn);
5789
+ AnimateExecutor.registerBuiltInAnimate('moveScaleIn', MoveScaleIn);
5790
+ AnimateExecutor.registerBuiltInAnimate('moveRotateIn', MoveRotateIn);
5791
+ AnimateExecutor.registerBuiltInAnimate('slideOut', SlideOut);
5792
+ AnimateExecutor.registerBuiltInAnimate('growOut', GrowOut);
5793
+ AnimateExecutor.registerBuiltInAnimate('spinOut', SpinOut);
5794
+ AnimateExecutor.registerBuiltInAnimate('moveScaleOut', MoveScaleOut);
5795
+ AnimateExecutor.registerBuiltInAnimate('moveRotateOut', MoveRotateOut);
4491
5796
  };
4492
5797
 
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 };
5798
+ 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 };