@visactor/vrender-animate 0.22.4 → 0.23.0-alpha.3

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 (198) hide show
  1. package/cjs/animate-extension.d.ts +11 -3
  2. package/cjs/animate-extension.js +26 -11
  3. package/cjs/animate-extension.js.map +1 -1
  4. package/cjs/animate.js +5 -3
  5. package/cjs/animate.js.map +1 -1
  6. package/cjs/component/component-animate-extension.d.ts +1 -0
  7. package/cjs/component/component-animate-extension.js +1 -0
  8. package/cjs/component/component-animate-extension.js.map +1 -0
  9. package/cjs/component/component-animator.d.ts +21 -0
  10. package/cjs/component/component-animator.js +81 -0
  11. package/cjs/component/component-animator.js.map +1 -0
  12. package/cjs/component/index.d.ts +1 -0
  13. package/cjs/component/index.js +21 -0
  14. package/cjs/component/index.js.map +1 -0
  15. package/cjs/custom/common.js +9 -6
  16. package/cjs/custom/common.js.map +1 -1
  17. package/cjs/custom/custom-animate.d.ts +6 -0
  18. package/cjs/custom/custom-animate.js +12 -1
  19. package/cjs/custom/custom-animate.js.map +1 -1
  20. package/cjs/custom/group-fade.js +1 -2
  21. package/cjs/custom/growAngle.d.ts +8 -3
  22. package/cjs/custom/growAngle.js +29 -15
  23. package/cjs/custom/growAngle.js.map +1 -1
  24. package/cjs/custom/growCenter.js +9 -6
  25. package/cjs/custom/growCenter.js.map +1 -1
  26. package/cjs/custom/growHeight.js +11 -7
  27. package/cjs/custom/growHeight.js.map +1 -1
  28. package/cjs/custom/growPoints.js +13 -11
  29. package/cjs/custom/growPoints.js.map +1 -1
  30. package/cjs/custom/growRadius.js +13 -11
  31. package/cjs/custom/growRadius.js.map +1 -1
  32. package/cjs/custom/growWidth.js +9 -6
  33. package/cjs/custom/growWidth.js.map +1 -1
  34. package/cjs/custom/label-animate.d.ts +4 -0
  35. package/cjs/custom/label-animate.js +48 -0
  36. package/cjs/custom/label-animate.js.map +1 -0
  37. package/cjs/custom/label-item-animate.d.ts +7 -0
  38. package/cjs/custom/label-item-animate.js +219 -0
  39. package/cjs/custom/label-item-animate.js.map +1 -0
  40. package/cjs/custom/poptip-animate.d.ts +7 -0
  41. package/cjs/custom/poptip-animate.js +106 -0
  42. package/cjs/custom/poptip-animate.js.map +1 -0
  43. package/cjs/custom/register.js +8 -2
  44. package/cjs/custom/register.js.map +1 -1
  45. package/cjs/custom/scale.d.ts +4 -0
  46. package/cjs/custom/scale.js +30 -21
  47. package/cjs/custom/scale.js.map +1 -1
  48. package/cjs/custom/tag-points.js +1 -2
  49. package/cjs/custom/update.d.ts +0 -1
  50. package/cjs/custom/update.js +1 -1
  51. package/cjs/custom/update.js.map +1 -1
  52. package/cjs/executor/animate-executor.d.ts +2 -2
  53. package/cjs/executor/animate-executor.js +43 -27
  54. package/cjs/executor/animate-executor.js.map +1 -1
  55. package/cjs/executor/executor.d.ts +3 -0
  56. package/cjs/executor/executor.js.map +1 -1
  57. package/cjs/index.d.ts +2 -0
  58. package/cjs/index.js +1 -1
  59. package/cjs/index.js.map +1 -1
  60. package/cjs/interpolate/store.d.ts +2 -0
  61. package/cjs/interpolate/store.js +5 -2
  62. package/cjs/interpolate/store.js.map +1 -1
  63. package/cjs/intreface/animate.d.ts +1 -0
  64. package/cjs/intreface/animate.js.map +1 -1
  65. package/cjs/intreface/ticker.js +2 -1
  66. package/cjs/register.js +1 -5
  67. package/cjs/register.js.map +1 -1
  68. package/cjs/state/animation-state.d.ts +18 -0
  69. package/cjs/state/animation-state.js +45 -1
  70. package/cjs/state/animation-state.js.map +1 -1
  71. package/cjs/state/graphic-extension.d.ts +6 -0
  72. package/cjs/state/graphic-extension.js +20 -0
  73. package/cjs/state/graphic-extension.js.map +1 -1
  74. package/cjs/step.d.ts +1 -0
  75. package/cjs/step.js +14 -8
  76. package/cjs/step.js.map +1 -1
  77. package/cjs/ticker/default-ticker.d.ts +8 -3
  78. package/cjs/ticker/default-ticker.js +22 -22
  79. package/cjs/ticker/default-ticker.js.map +1 -1
  80. package/cjs/utils/easing-func.js +1 -2
  81. package/dist/index.es.js +853 -184
  82. package/es/animate-extension.d.ts +11 -3
  83. package/es/animate-extension.js +27 -10
  84. package/es/animate-extension.js.map +1 -1
  85. package/es/animate.js +5 -3
  86. package/es/animate.js.map +1 -1
  87. package/es/component/component-animate-extension.d.ts +1 -0
  88. package/es/component/component-animate-extension.js +1 -0
  89. package/es/component/component-animate-extension.js.map +1 -0
  90. package/es/component/component-animator.d.ts +21 -0
  91. package/es/component/component-animator.js +73 -0
  92. package/es/component/component-animator.js.map +1 -0
  93. package/es/component/index.d.ts +1 -0
  94. package/es/component/index.js +2 -0
  95. package/es/component/index.js.map +1 -0
  96. package/es/custom/common.js +9 -6
  97. package/es/custom/common.js.map +1 -1
  98. package/es/custom/custom-animate.d.ts +6 -0
  99. package/es/custom/custom-animate.js +9 -0
  100. package/es/custom/custom-animate.js.map +1 -1
  101. package/es/custom/group-fade.js +1 -2
  102. package/es/custom/growAngle.d.ts +8 -3
  103. package/es/custom/growAngle.js +27 -13
  104. package/es/custom/growAngle.js.map +1 -1
  105. package/es/custom/growCenter.js +9 -6
  106. package/es/custom/growCenter.js.map +1 -1
  107. package/es/custom/growHeight.js +11 -7
  108. package/es/custom/growHeight.js.map +1 -1
  109. package/es/custom/growPoints.js +12 -11
  110. package/es/custom/growPoints.js.map +1 -1
  111. package/es/custom/growRadius.js +13 -11
  112. package/es/custom/growRadius.js.map +1 -1
  113. package/es/custom/growWidth.js +9 -6
  114. package/es/custom/growWidth.js.map +1 -1
  115. package/es/custom/label-animate.d.ts +4 -0
  116. package/es/custom/label-animate.js +42 -0
  117. package/es/custom/label-animate.js.map +1 -0
  118. package/es/custom/label-item-animate.d.ts +7 -0
  119. package/es/custom/label-item-animate.js +213 -0
  120. package/es/custom/label-item-animate.js.map +1 -0
  121. package/es/custom/poptip-animate.d.ts +7 -0
  122. package/es/custom/poptip-animate.js +100 -0
  123. package/es/custom/poptip-animate.js.map +1 -0
  124. package/es/custom/register.js +24 -12
  125. package/es/custom/register.js.map +1 -1
  126. package/es/custom/scale.d.ts +4 -0
  127. package/es/custom/scale.js +30 -21
  128. package/es/custom/scale.js.map +1 -1
  129. package/es/custom/tag-points.js +1 -2
  130. package/es/custom/update.d.ts +0 -1
  131. package/es/custom/update.js +1 -1
  132. package/es/custom/update.js.map +1 -1
  133. package/es/executor/animate-executor.d.ts +2 -2
  134. package/es/executor/animate-executor.js +43 -27
  135. package/es/executor/animate-executor.js.map +1 -1
  136. package/es/executor/executor.d.ts +3 -0
  137. package/es/executor/executor.js.map +1 -1
  138. package/es/index.d.ts +2 -0
  139. package/es/index.js +2 -0
  140. package/es/index.js.map +1 -1
  141. package/es/interpolate/store.d.ts +2 -0
  142. package/es/interpolate/store.js +5 -3
  143. package/es/interpolate/store.js.map +1 -1
  144. package/es/intreface/animate.d.ts +1 -0
  145. package/es/intreface/animate.js.map +1 -1
  146. package/es/intreface/ticker.js +2 -1
  147. package/es/register.js +0 -8
  148. package/es/register.js.map +1 -1
  149. package/es/state/animation-state.d.ts +18 -0
  150. package/es/state/animation-state.js +44 -0
  151. package/es/state/animation-state.js.map +1 -1
  152. package/es/state/graphic-extension.d.ts +6 -0
  153. package/es/state/graphic-extension.js +20 -0
  154. package/es/state/graphic-extension.js.map +1 -1
  155. package/es/step.d.ts +1 -0
  156. package/es/step.js +14 -8
  157. package/es/step.js.map +1 -1
  158. package/es/ticker/default-ticker.d.ts +8 -3
  159. package/es/ticker/default-ticker.js +22 -22
  160. package/es/ticker/default-ticker.js.map +1 -1
  161. package/es/utils/easing-func.js +1 -2
  162. package/package.json +15 -15
  163. package/cjs/custom/scale-in.d.ts +0 -13
  164. package/cjs/custom/scale-in.js +0 -57
  165. package/cjs/custom/scale-in.js.map +0 -1
  166. package/cjs/interpolate/executor.d.ts +0 -66
  167. package/cjs/interpolate/executor.js +0 -6
  168. package/cjs/interpolate/executor.js.map +0 -1
  169. package/cjs/intreface/state.d.ts +0 -35
  170. package/cjs/intreface/state.js +0 -6
  171. package/cjs/intreface/state.js.map +0 -1
  172. package/cjs/state/animation-state-machine.d.ts +0 -22
  173. package/cjs/state/animation-state-machine.js +0 -53
  174. package/cjs/state/animation-state-machine.js.map +0 -1
  175. package/cjs/state/animation-state-queue.d.ts +0 -24
  176. package/cjs/state/animation-state-queue.js +0 -66
  177. package/cjs/state/animation-state-queue.js.map +0 -1
  178. package/cjs/state/animation-state-registry.d.ts +0 -14
  179. package/cjs/state/animation-state-registry.js +0 -53
  180. package/cjs/state/animation-state-registry.js.map +0 -1
  181. package/es/custom/scale-in.d.ts +0 -13
  182. package/es/custom/scale-in.js +0 -49
  183. package/es/custom/scale-in.js.map +0 -1
  184. package/es/interpolate/executor.d.ts +0 -66
  185. package/es/interpolate/executor.js +0 -2
  186. package/es/interpolate/executor.js.map +0 -1
  187. package/es/intreface/state.d.ts +0 -35
  188. package/es/intreface/state.js +0 -2
  189. package/es/intreface/state.js.map +0 -1
  190. package/es/state/animation-state-machine.d.ts +0 -22
  191. package/es/state/animation-state-machine.js +0 -47
  192. package/es/state/animation-state-machine.js.map +0 -1
  193. package/es/state/animation-state-queue.d.ts +0 -24
  194. package/es/state/animation-state-queue.js +0 -58
  195. package/es/state/animation-state-queue.js.map +0 -1
  196. package/es/state/animation-state-registry.d.ts +0 -14
  197. package/es/state/animation-state-registry.js +0 -45
  198. package/es/state/animation-state-registry.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { interpolateColor, interpolatePureColorArrayToStr, ColorStore, ColorType, Generator, AnimateStatus as AnimateStatus$1, PerformanceRAF, application, CustomPath2D, CurveContext, Graphic, AttributeUpdateType, pointInterpolation } from '@visactor/vrender-core';
2
- import { pi2, isString, EventEmitter, cloneDeep, isArray, isFunction, mixin, isValidNumber, clamp, Point, pi, isNumber, isValid, isNil } from '@visactor/vutils';
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
3
 
4
4
  var AnimateMode;
5
5
  (function (AnimateMode) {
@@ -256,13 +256,17 @@ class InterpolateUpdateStore {
256
256
  target.attribute.fill = interpolateColor(from, to, ratio, false);
257
257
  };
258
258
  this.fillPure = (key, from, to, ratio, step, target) => {
259
- target.attribute.fill = interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio);
259
+ target.attribute.fill = step.fromParsedProps.fill
260
+ ? interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio)
261
+ : step.toParsedProps.fill;
260
262
  };
261
263
  this.stroke = (key, from, to, ratio, step, target) => {
262
264
  target.attribute.stroke = interpolateColor(from, to, ratio, false);
263
265
  };
264
266
  this.strokePure = (key, from, to, ratio, step, target) => {
265
- target.attribute.stroke = interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio);
267
+ target.attribute.stroke = step.fromParsedProps.stroke
268
+ ? interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio)
269
+ : step.toParsedProps.stroke;
266
270
  };
267
271
  this.width = (key, from, to, ratio, step, target) => {
268
272
  target.attribute.width = interpolateNumber(from, to, ratio);
@@ -325,6 +329,10 @@ class InterpolateUpdateStore {
325
329
  target.attribute.size = interpolateNumber(from, to, ratio);
326
330
  target.addUpdateBoundTag();
327
331
  };
332
+ this.points = (key, from, to, ratio, step, target) => {
333
+ target.attribute.points = pointsInterpolation(from, to, ratio);
334
+ target.addUpdateBoundTag();
335
+ };
328
336
  }
329
337
  }
330
338
  const interpolateUpdateStore = new InterpolateUpdateStore();
@@ -414,7 +422,7 @@ class Step {
414
422
  const funcs = [];
415
423
  this.propKeys.forEach(key => {
416
424
  if (key === 'fill' || key === 'stroke') {
417
- const from = this.getLastProps()[key];
425
+ const from = this.fromProps[key];
418
426
  const to = this.props[key];
419
427
  if (isString(from) && isString(to)) {
420
428
  const fromArray = ColorStore.Get(from, ColorType.Color255);
@@ -427,8 +435,14 @@ class Step {
427
435
  }
428
436
  this.fromParsedProps[key] = fromArray;
429
437
  this.toParsedProps[key] = toArray;
438
+ funcs.push(interpolateUpdateStore[key === 'fill' ? 'fillPure' : 'strokePure']);
439
+ }
440
+ else if (interpolateUpdateStore[key]) {
441
+ funcs.push(interpolateUpdateStore[key]);
442
+ }
443
+ else {
444
+ funcs.push(commonInterpolateUpdate);
430
445
  }
431
- funcs.push(interpolateUpdateStore[key === 'fill' ? 'fillPure' : 'strokePure']);
432
446
  }
433
447
  else if (interpolateUpdateStore[key]) {
434
448
  funcs.push(interpolateUpdateStore[key]);
@@ -456,6 +470,12 @@ class Step {
456
470
  if (!this._hasFirstRun) {
457
471
  this._hasFirstRun = true;
458
472
  this.fromProps = this.getLastProps();
473
+ const startProps = this.animate.getStartProps();
474
+ this.propKeys &&
475
+ this.propKeys.forEach(key => {
476
+ var _a;
477
+ this.fromProps[key] = (_a = this.fromProps[key]) !== null && _a !== void 0 ? _a : startProps[key];
478
+ });
459
479
  this.determineInterpolateUpdateFunction();
460
480
  this.tryPreventConflict();
461
481
  this.trySyncStartProps();
@@ -514,11 +534,11 @@ class Step {
514
534
  onUpdate(end, ratio, out) {
515
535
  }
516
536
  onEnd(cb) {
537
+ this.target.setAttributes(this.props);
517
538
  if (cb) {
518
539
  this._endCb = cb;
519
540
  }
520
541
  else if (this._endCb) {
521
- this.target.setAttributes(this.props);
522
542
  this._endCb(this.animate, this);
523
543
  }
524
544
  }
@@ -531,6 +551,8 @@ class Step {
531
551
  getMergedEndProps() {
532
552
  return this.getEndProps();
533
553
  }
554
+ stop() {
555
+ }
534
556
  }
535
557
  class WaitStep extends Step {
536
558
  constructor(type, props, duration, easing) {
@@ -704,14 +726,14 @@ class Animate {
704
726
  }
705
727
  to(props, duration = 300, easing = 'linear') {
706
728
  const step = new Step(AnimateStepType.to, props, duration, easing);
707
- this.updateStepAfterAppend(step);
708
729
  step.bind(this.target, this);
730
+ this.updateStepAfterAppend(step);
709
731
  return this;
710
732
  }
711
733
  wait(delay) {
712
734
  const step = new WaitStep(AnimateStepType.wait, {}, delay, 'linear');
713
- this.updateStepAfterAppend(step);
714
735
  step.bind(this.target, this);
736
+ this.updateStepAfterAppend(step);
715
737
  return this;
716
738
  }
717
739
  updateStepAfterAppend(step) {
@@ -770,8 +792,8 @@ class Animate {
770
792
  return this;
771
793
  }
772
794
  play(customAnimate) {
773
- this.updateStepAfterAppend(customAnimate);
774
795
  customAnimate.bind(this.target, this);
796
+ this.updateStepAfterAppend(customAnimate);
775
797
  return this;
776
798
  }
777
799
  pause() {
@@ -866,6 +888,11 @@ class Animate {
866
888
  return this._endProps;
867
889
  }
868
890
  stop(type) {
891
+ let step = this._firstStep;
892
+ while (step) {
893
+ step.stop();
894
+ step = step.next;
895
+ }
869
896
  this.status = AnimateStatus.END;
870
897
  this.onEnd();
871
898
  if (!this.target) {
@@ -1037,7 +1064,7 @@ class RAFTickHandler {
1037
1064
  if (this.released) {
1038
1065
  return;
1039
1066
  }
1040
- cb(this);
1067
+ return cb(this);
1041
1068
  });
1042
1069
  }
1043
1070
  release() {
@@ -1050,36 +1077,37 @@ class RAFTickHandler {
1050
1077
  class DefaultTicker extends EventEmitter {
1051
1078
  constructor(stage) {
1052
1079
  super();
1053
- this.interval = 16;
1054
- this.lastFrameTime = -1;
1055
- this.lastExecutionTime = -1;
1056
- this.tickCounts = 0;
1057
1080
  this.timelines = [];
1058
- this.autoStop = true;
1081
+ this.frameTimeHistory = [];
1082
+ this.checkSkip = (delta) => {
1083
+ const skip = delta < this.interval + (Math.random() - 0.5) * 2 * this._jitter;
1084
+ return skip;
1085
+ };
1059
1086
  this.handleTick = (handler, params) => {
1060
1087
  const { once = false } = params !== null && params !== void 0 ? params : {};
1061
1088
  if (this.ifCanStop()) {
1062
1089
  this.stop();
1063
- return;
1090
+ return false;
1064
1091
  }
1065
1092
  const currentTime = handler.getTime();
1066
- const timeFromLastExecution = this.lastExecutionTime < 0 ? this.interval : currentTime - this.lastExecutionTime;
1067
- if (timeFromLastExecution >= this.interval) {
1068
- this._handlerTick();
1069
- this.lastExecutionTime = currentTime;
1093
+ this._lastTickTime = currentTime;
1094
+ if (this.lastFrameTime < 0) {
1095
+ this.lastFrameTime = currentTime - this.interval + this.timeOffset;
1096
+ this.frameTimeHistory.push(this.lastFrameTime);
1097
+ }
1098
+ const delta = currentTime - this.lastFrameTime;
1099
+ const skip = this.checkSkip(delta);
1100
+ if (!skip) {
1101
+ this._handlerTick(delta);
1102
+ this.lastFrameTime = currentTime;
1103
+ this.frameTimeHistory.push(this.lastFrameTime);
1070
1104
  }
1071
1105
  if (!once) {
1072
1106
  handler.tick(this.interval, this.handleTick);
1073
1107
  }
1108
+ return !skip;
1074
1109
  };
1075
- this._handlerTick = () => {
1076
- const tickerHandler = this.tickerHandler;
1077
- const time = tickerHandler.getTime();
1078
- let delta = 0;
1079
- if (this.lastFrameTime >= 0) {
1080
- delta = time - this.lastFrameTime;
1081
- }
1082
- this.lastFrameTime = time;
1110
+ this._handlerTick = (delta) => {
1083
1111
  if (this.status !== STATUS.RUNNING) {
1084
1112
  return;
1085
1113
  }
@@ -1091,10 +1119,15 @@ class DefaultTicker extends EventEmitter {
1091
1119
  };
1092
1120
  this.init();
1093
1121
  this.lastFrameTime = -1;
1094
- this.lastExecutionTime = -1;
1095
1122
  this.tickCounts = 0;
1096
1123
  this.stage = stage;
1097
1124
  this.autoStop = true;
1125
+ this.interval = 16;
1126
+ this.computeTimeOffsetAndJitter();
1127
+ }
1128
+ computeTimeOffsetAndJitter() {
1129
+ this.timeOffset = Math.floor(Math.random() * this.interval);
1130
+ this._jitter = Math.min(Math.max(this.interval * 0.2, 6), this.interval * 0.7);
1098
1131
  }
1099
1132
  init() {
1100
1133
  this.interval = 16;
@@ -1128,19 +1161,20 @@ class DefaultTicker extends EventEmitter {
1128
1161
  }
1129
1162
  setInterval(interval) {
1130
1163
  this.interval = interval;
1164
+ this.computeTimeOffsetAndJitter();
1131
1165
  }
1132
1166
  getInterval() {
1133
1167
  return this.interval;
1134
1168
  }
1135
1169
  setFPS(fps) {
1136
- this.setInterval(1000 / fps);
1170
+ this.setInterval(Math.floor(1000 / fps));
1137
1171
  }
1138
1172
  getFPS() {
1139
1173
  return 1000 / this.interval;
1140
1174
  }
1141
1175
  tick(interval) {
1142
1176
  this.tickerHandler.tick(interval, (handler) => {
1143
- this.handleTick(handler, { once: true });
1177
+ return this.handleTick(handler, { once: true });
1144
1178
  });
1145
1179
  }
1146
1180
  tickTo(t) {
@@ -1199,7 +1233,6 @@ class DefaultTicker extends EventEmitter {
1199
1233
  this.status = STATUS.INITIAL;
1200
1234
  this.setupTickHandler();
1201
1235
  this.lastFrameTime = -1;
1202
- this.lastExecutionTime = -1;
1203
1236
  }
1204
1237
  trySyncTickStatus() {
1205
1238
  if (this.status === STATUS.INITIAL && this.timelines.some(timeline => timeline.isRunning())) {
@@ -1215,7 +1248,7 @@ class DefaultTicker extends EventEmitter {
1215
1248
  this.timelines = [];
1216
1249
  (_a = this.tickerHandler) === null || _a === void 0 ? void 0 : _a.release();
1217
1250
  this.tickerHandler = null;
1218
- this.lastExecutionTime = -1;
1251
+ this.lastFrameTime = -1;
1219
1252
  }
1220
1253
  }
1221
1254
 
@@ -1435,11 +1468,11 @@ class AnimateExecutor {
1435
1468
  }
1436
1469
  });
1437
1470
  }
1438
- parseParams(params) {
1439
- const isTimeline = 'timeSlices' in params;
1471
+ parseParams(params, isTimeline) {
1472
+ var _a;
1440
1473
  const totalTime = this.resolveValue(params.totalTime, undefined, undefined);
1441
1474
  const startTime = this.resolveValue(params.startTime, undefined, 0);
1442
- const parsedParams = cloneDeep(params);
1475
+ const parsedParams = Object.assign({}, params);
1443
1476
  parsedParams.oneByOneDelay = 0;
1444
1477
  parsedParams.startTime = startTime;
1445
1478
  parsedParams.totalTime = totalTime;
@@ -1467,10 +1500,18 @@ class AnimateExecutor {
1467
1500
  if (totalTime) {
1468
1501
  const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
1469
1502
  const scale = totalTime ? totalTime / _totalTime : 1;
1470
- parsedParams.timeSlices.forEach(slice => {
1471
- slice.delay = slice.delay * scale;
1472
- slice.delayAfter = slice.delayAfter * scale;
1473
- slice.duration = slice.duration * scale;
1503
+ parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
1504
+ let effects = slice.effects;
1505
+ if (!Array.isArray(effects)) {
1506
+ effects = [effects];
1507
+ }
1508
+ 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];
1511
+ const customType = custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0;
1512
+ return Object.assign(Object.assign({}, effect), { custom,
1513
+ customType });
1514
+ }) });
1474
1515
  });
1475
1516
  parsedParams.oneByOne = oneByOneTime * scale;
1476
1517
  parsedParams.oneByOneDelay = oneByOneDelay * scale;
@@ -1489,6 +1530,14 @@ class AnimateExecutor {
1489
1530
  }
1490
1531
  parsedParams.oneByOne = oneByOneTime;
1491
1532
  parsedParams.oneByOneDelay = oneByOneDelay;
1533
+ parsedParams.custom =
1534
+ (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[params.type];
1535
+ const customType = parsedParams.custom && isFunction(parsedParams.custom)
1536
+ ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom))
1537
+ ? 1
1538
+ : 2
1539
+ : 0;
1540
+ parsedParams.customType = customType;
1492
1541
  if (totalTime) {
1493
1542
  const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2);
1494
1543
  const scale = totalTime ? totalTime / _totalTime : 1;
@@ -1503,6 +1552,9 @@ class AnimateExecutor {
1503
1552
  return parsedParams;
1504
1553
  }
1505
1554
  execute(params) {
1555
+ if (params.selfOnly) {
1556
+ return this.executeItem(params, this._target, 0, 1);
1557
+ }
1506
1558
  const isTimeline = 'timeSlices' in params;
1507
1559
  let filteredChildren;
1508
1560
  if (isTimeline && params.partitioner) {
@@ -1518,7 +1570,7 @@ class AnimateExecutor {
1518
1570
  return params.sort((_a = a.context) === null || _a === void 0 ? void 0 : _a.data, (_b = b.context) === null || _b === void 0 ? void 0 : _b.data, a, b, {});
1519
1571
  });
1520
1572
  }
1521
- const parsedParams = this.parseParams(params);
1573
+ const parsedParams = this.parseParams(params, isTimeline);
1522
1574
  const cb = isTimeline
1523
1575
  ? (child, index, count) => {
1524
1576
  const animate = this.executeTimelineItem(parsedParams, child, index, count);
@@ -1544,24 +1596,24 @@ class AnimateExecutor {
1544
1596
  return;
1545
1597
  }
1546
1598
  executeTypeConfigItem(params, graphic, index, count) {
1547
- var _a, _b, _c, _d, _e, _f;
1548
- const { type, channel, customParameters, easing = 'linear', delay = 0, delayAfter = 0, duration = 300, startTime = 0, oneByOneDelay = 0, loop, bounce, priority = 0, options, controlOptions } = params;
1549
- const custom = (_a = params.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[type];
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;
1550
1601
  const animate = graphic.animate();
1551
1602
  animate.priority = priority;
1552
1603
  const delayValue = delay;
1553
- const datum = (_c = (_b = graphic.context) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c[0];
1554
- const indexKey = (_d = graphic.context) === null || _d === void 0 ? void 0 : _d.indexKey;
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;
1555
1606
  if (datum && indexKey) {
1556
- index = (_e = datum[indexKey]) !== null && _e !== void 0 ? _e : index;
1607
+ index = (_d = datum[indexKey]) !== null && _d !== void 0 ? _d : index;
1557
1608
  }
1558
1609
  animate.startAt(startTime);
1559
- animate.wait(index * oneByOneDelay);
1610
+ const wait = index * oneByOneDelay;
1611
+ wait > 0 && animate.wait(wait);
1560
1612
  if (delayValue > 0) {
1561
1613
  animate.wait(delayValue);
1562
1614
  }
1563
- const props = (_f = params.to) !== null && _f !== void 0 ? _f : this.createPropsFromChannel(channel, graphic);
1564
- this._handleRunAnimate(animate, custom, props, duration, easing, customParameters, options, type, graphic);
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);
1565
1617
  if (oneByOneDelay) {
1566
1618
  animate.wait(oneByOneDelay * (count - index - 1));
1567
1619
  }
@@ -1576,20 +1628,18 @@ class AnimateExecutor {
1576
1628
  }
1577
1629
  return animate;
1578
1630
  }
1579
- _handleRunAnimate(animate, custom, props, duration, easing, customParameters, options, type, graphic) {
1580
- if (custom) {
1631
+ _handleRunAnimate(animate, custom, customType, props, duration, easing, customParameters, options, type, graphic) {
1632
+ if (custom && customType) {
1581
1633
  const customParams = this.resolveValue(customParameters, graphic, {});
1582
1634
  const objOptions = isFunction(options)
1583
1635
  ? options.call(null, customParameters.data && customParameters.data[0], graphic, customParameters)
1584
1636
  : options;
1585
1637
  customParams.options = objOptions;
1586
- if (isFunction(custom)) {
1587
- if (/^class\s/.test(Function.prototype.toString.call(custom))) {
1588
- this.createCustomAnimation(animate, custom, props, duration, easing, customParams);
1589
- }
1590
- else {
1591
- this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
1592
- }
1638
+ if (customType === 1) {
1639
+ this.createCustomAnimation(animate, custom, props, duration, easing, customParams);
1640
+ }
1641
+ else if (customType === 2) {
1642
+ this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
1593
1643
  }
1594
1644
  }
1595
1645
  else if (type === 'to') {
@@ -1637,9 +1687,8 @@ class AnimateExecutor {
1637
1687
  effectsArray.forEach(effect => {
1638
1688
  var _a;
1639
1689
  const { type = 'to', channel, customParameters, easing = 'linear', options } = effect;
1640
- const custom = (_a = effect.custom) !== null && _a !== void 0 ? _a : AnimateExecutor.builtInAnimateMap[type];
1641
- const props = this.createPropsFromChannel(channel, graphic);
1642
- this._handleRunAnimate(animate, custom, props, duration, easing, customParameters, options, type, graphic);
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);
1643
1692
  });
1644
1693
  if (delayAfterValue > 0) {
1645
1694
  animate.wait(delayAfterValue);
@@ -1656,12 +1705,8 @@ class AnimateExecutor {
1656
1705
  animate.to(props, duration, easing);
1657
1706
  }
1658
1707
  createCustomAnimation(animate, CustomAnimateConstructor, props, duration, easing, customParams) {
1659
- const from = {};
1660
1708
  const to = props;
1661
- Object.keys(to).forEach(key => {
1662
- from[key] = animate.target.getComputedAttribute(key);
1663
- });
1664
- const customAnimate = new CustomAnimateConstructor(from, to, duration, easing, customParams);
1709
+ const customAnimate = new CustomAnimateConstructor(null, to, duration, easing, customParams);
1665
1710
  animate.play(customAnimate);
1666
1711
  }
1667
1712
  createPropsFromChannel(channel, graphic) {
@@ -1700,11 +1745,12 @@ class AnimateExecutor {
1700
1745
  }
1701
1746
  const isTimeline = 'timeSlices' in params;
1702
1747
  let animate = null;
1748
+ const parsedParams = this.parseParams(params, isTimeline);
1703
1749
  if (isTimeline) {
1704
- animate = this.executeTimelineItem(params, graphic, index, count);
1750
+ animate = this.executeTimelineItem(parsedParams, graphic, index, count);
1705
1751
  }
1706
1752
  else {
1707
- animate = this.executeTypeConfigItem(params, graphic, index, count);
1753
+ animate = this.executeTypeConfigItem(parsedParams, graphic, index, count);
1708
1754
  }
1709
1755
  if (animate) {
1710
1756
  this._trackAnimation(animate);
@@ -1726,6 +1772,19 @@ class AnimateExecutor {
1726
1772
  }
1727
1773
  AnimateExecutor.builtInAnimateMap = {};
1728
1774
 
1775
+ const AnimationStates = {
1776
+ APPEAR: 'appear',
1777
+ DISAPPEAR: 'disappear',
1778
+ UPDATE: 'update',
1779
+ HIGHLIGHT: 'highlight',
1780
+ UNHIGHLIGHT: 'unhighlight',
1781
+ SELECT: 'select',
1782
+ UNSELECT: 'unselect',
1783
+ HOVER: 'hover',
1784
+ UNHOVER: 'unhover',
1785
+ ACTIVE: 'active',
1786
+ INACTIVE: 'inactive'
1787
+ };
1729
1788
  class AnimationStateStore {
1730
1789
  constructor(graphic) {
1731
1790
  this.graphic = graphic;
@@ -1814,6 +1873,21 @@ class AnimationStateManager {
1814
1873
  }
1815
1874
  this.stateList.push(...shouldApplyState);
1816
1875
  }
1876
+ applyAppearState(animationConfig, callback) {
1877
+ this.applyState([AnimationStates.APPEAR], [{ name: AnimationStates.APPEAR, animation: animationConfig }], callback);
1878
+ }
1879
+ applyDisappearState(animationConfig, callback) {
1880
+ this.applyState([AnimationStates.DISAPPEAR], [{ name: AnimationStates.DISAPPEAR, animation: animationConfig }], callback);
1881
+ }
1882
+ applyUpdateState(animationConfig, callback) {
1883
+ this.applyState([AnimationStates.UPDATE], [{ name: AnimationStates.UPDATE, animation: animationConfig }], callback);
1884
+ }
1885
+ applyHighlightState(animationConfig, callback) {
1886
+ this.applyState([AnimationStates.HIGHLIGHT], [{ name: AnimationStates.HIGHLIGHT, animation: animationConfig }], callback);
1887
+ }
1888
+ applyUnhighlightState(animationConfig, callback) {
1889
+ this.applyState([AnimationStates.UNHIGHLIGHT], [{ name: AnimationStates.UNHIGHLIGHT, animation: animationConfig }], callback);
1890
+ }
1817
1891
  stopState(state, type) {
1818
1892
  var _a;
1819
1893
  const stateInfo = (_a = this.stateList) === null || _a === void 0 ? void 0 : _a.find(stateInfo => stateInfo.state === state);
@@ -1851,6 +1925,26 @@ class GraphicStateExtension {
1851
1925
  this._getAnimationStateManager(this).applyState(state, animationConfig, callback);
1852
1926
  return this;
1853
1927
  }
1928
+ applyAppearState(animationConfig, callback) {
1929
+ this._getAnimationStateManager(this).applyAppearState(animationConfig, callback);
1930
+ return this;
1931
+ }
1932
+ applyDisappearState(animationConfig, callback) {
1933
+ this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback);
1934
+ return this;
1935
+ }
1936
+ applyUpdateState(animationConfig, callback) {
1937
+ this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback);
1938
+ return this;
1939
+ }
1940
+ applyHighlightState(animationConfig, callback) {
1941
+ this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback);
1942
+ return this;
1943
+ }
1944
+ applyUnhighlightState(animationConfig, callback) {
1945
+ this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback);
1946
+ return this;
1947
+ }
1854
1948
  stopAnimationState(state, type) {
1855
1949
  this._getAnimationStateManager(this).stopState(state, type);
1856
1950
  return this;
@@ -1867,13 +1961,18 @@ class GraphicStateExtension {
1867
1961
  }
1868
1962
 
1869
1963
  class AnimateExtension {
1870
- constructor() {
1871
- this.animatedAttribute = null;
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
+ });
1872
1972
  }
1873
1973
  getAttributes(final = false) {
1874
- if (final) {
1875
- this.computeAnimatedAttribute();
1876
- return this.getFinalAttribute();
1974
+ if (final && this.finalAttribute) {
1975
+ return this.finalAttribute;
1877
1976
  }
1878
1977
  return this.attribute;
1879
1978
  }
@@ -1898,42 +1997,44 @@ class AnimateExtension {
1898
1997
  (_c = this.stage) === null || _c === void 0 ? void 0 : _c.ticker.start();
1899
1998
  return animate;
1900
1999
  }
1901
- computeAnimatedAttribute() {
1902
- if (!this.animatedAttribute) {
1903
- this.animatedAttribute = {};
1904
- this.animates.forEach(animate => {
1905
- if (animate.getLoop() !== Infinity) {
1906
- Object.assign(this.animatedAttribute, animate.getEndProps());
1907
- }
1908
- });
1909
- }
1910
- }
1911
2000
  createTimeline() {
1912
2001
  return new DefaultTimeline();
1913
2002
  }
1914
2003
  createTicker(stage) {
1915
2004
  return new DefaultTicker(stage);
1916
2005
  }
1917
- getFinalAttribute() {
1918
- const finalAttribute = {};
1919
- Object.assign(finalAttribute, this.attribute, this.animatedAttribute);
1920
- return finalAttribute;
2006
+ setFinalAttribute(finalAttribute) {
2007
+ if (!this.finalAttribute) {
2008
+ this.finalAttribute = {};
2009
+ }
2010
+ Object.assign(this.finalAttribute, finalAttribute);
1921
2011
  }
1922
- }
1923
-
1924
- function registerAnimate() {
1925
- if (!Graphic.Animate) {
1926
- Graphic.Animate = Animate;
2012
+ initFinalAttribute(finalAttribute) {
2013
+ this.finalAttribute = finalAttribute;
2014
+ }
2015
+ initAnimateExecutor() {
2016
+ if (!this._animateExecutor) {
2017
+ this._animateExecutor = new AnimateExecutor(this);
2018
+ }
1927
2019
  }
1928
- if (!Graphic.Timeline) {
1929
- Graphic.Timeline = DefaultTimeline;
2020
+ executeAnimation(config) {
2021
+ this.initAnimateExecutor();
2022
+ this._animateExecutor.execute(config);
2023
+ return this;
1930
2024
  }
1931
- if (!Graphic.defaultTimeline) {
1932
- Graphic.defaultTimeline = defaultTimeline;
2025
+ executeAnimations(configs) {
2026
+ this.initAnimateExecutor();
2027
+ configs.forEach(config => {
2028
+ this._animateExecutor.execute(config);
2029
+ });
2030
+ return this;
1933
2031
  }
1934
- if (!Graphic.Ticker) {
1935
- Graphic.Ticker = DefaultTicker;
2032
+ getFinalAttribute() {
2033
+ return this.finalAttribute;
1936
2034
  }
2035
+ }
2036
+
2037
+ function registerAnimate() {
1937
2038
  mixin(Graphic, GraphicStateExtension);
1938
2039
  mixin(Graphic, AnimateExtension);
1939
2040
  }
@@ -1959,6 +2060,14 @@ class ACustomAnimate extends Step {
1959
2060
  this.animate.reSyncProps();
1960
2061
  }
1961
2062
  }
2063
+ class AComponentAnimate extends ACustomAnimate {
2064
+ onFirstRun() {
2065
+ this._animator && this._animator.start();
2066
+ }
2067
+ stop() {
2068
+ this._animator && this._animator.stop();
2069
+ }
2070
+ }
1962
2071
 
1963
2072
  class IncreaseCount extends ACustomAnimate {
1964
2073
  constructor(from, to, duration, easing, params) {
@@ -2625,9 +2734,12 @@ class CommonIn extends ACustomAnimate {
2625
2734
  super(from, to, duration, easing, params);
2626
2735
  }
2627
2736
  onBind() {
2628
- var _a;
2629
- const attrs = this.target.getFinalAttribute();
2630
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : {};
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 : {};
2631
2743
  const to = {};
2632
2744
  const from = {};
2633
2745
  this.keys.forEach(key => {
@@ -2646,10 +2758,12 @@ class CommonIn extends ACustomAnimate {
2646
2758
  super.onEnd(cb);
2647
2759
  }
2648
2760
  onUpdate(end, ratio, out) {
2761
+ const attribute = this.target.attribute;
2649
2762
  this.propKeys.forEach(key => {
2650
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2763
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2651
2764
  });
2652
- this.target.setAttributes(out);
2765
+ this.target.addUpdatePositionTag();
2766
+ this.target.addUpdateShapeAndBoundsTag();
2653
2767
  }
2654
2768
  }
2655
2769
  class CommonOut extends ACustomAnimate {
@@ -2676,10 +2790,12 @@ class CommonOut extends ACustomAnimate {
2676
2790
  super.onEnd(cb);
2677
2791
  }
2678
2792
  onUpdate(end, ratio, out) {
2793
+ const attribute = this.target.attribute;
2679
2794
  this.propKeys.forEach(key => {
2680
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2795
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2681
2796
  });
2682
- this.target.setAttributes(out);
2797
+ this.target.addUpdatePositionTag();
2798
+ this.target.addUpdateShapeAndBoundsTag();
2683
2799
  }
2684
2800
  }
2685
2801
 
@@ -2801,41 +2917,75 @@ const growAngleOut = (graphic, options, animationParameters) => {
2801
2917
  ? growAngleOutOverall(graphic, options)
2802
2918
  : growAngleOutIndividual(graphic, options);
2803
2919
  };
2804
- let GworPointsBase$2 = class GworPointsBase extends ACustomAnimate {
2920
+ class GrowAngleBase extends ACustomAnimate {
2805
2921
  constructor(from, to, duration, easing, params) {
2806
2922
  super(from, to, duration, easing, params);
2807
2923
  }
2924
+ determineUpdateFunction() {
2925
+ if (!this.propKeys) {
2926
+ this.valid = false;
2927
+ }
2928
+ else if (this.propKeys && this.propKeys.length > 1) {
2929
+ this._updateFunction = this.updateAngle;
2930
+ }
2931
+ else if (this.propKeys[0] === 'startAngle') {
2932
+ this._updateFunction = this.updateStartAngle;
2933
+ }
2934
+ else if (this.propKeys[0] === 'endAngle') {
2935
+ this._updateFunction = this.updateEndAngle;
2936
+ }
2937
+ else {
2938
+ this.valid = false;
2939
+ }
2940
+ }
2941
+ updateStartAngle(ratio) {
2942
+ this.target.attribute.startAngle =
2943
+ this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
2944
+ }
2945
+ updateEndAngle(ratio) {
2946
+ this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
2947
+ }
2948
+ updateAngle(ratio) {
2949
+ this.updateStartAngle(ratio);
2950
+ this.updateEndAngle(ratio);
2951
+ }
2808
2952
  onUpdate(end, ratio, out) {
2809
- this.propKeys.forEach(key => {
2810
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
2811
- });
2812
- this.target.setAttributes(out);
2953
+ this._updateFunction(ratio);
2954
+ this.target.addUpdateShapeAndBoundsTag();
2813
2955
  }
2814
- };
2815
- class GrowAngleIn extends GworPointsBase$2 {
2956
+ }
2957
+ class GrowAngleIn extends GrowAngleBase {
2816
2958
  onBind() {
2817
- var _a;
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
+ }
2818
2963
  const { from, to } = growAngleIn(this.target, this.params.options, this.params);
2819
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
2964
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
2820
2965
  this.props = to;
2821
2966
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2822
- this.animate.reSyncProps();
2823
2967
  this.from = fromAttrs;
2824
2968
  this.to = to;
2825
- this.target.setAttributes(fromAttrs);
2969
+ Object.assign(this.target.attribute, fromAttrs);
2970
+ this.target.addUpdatePositionTag();
2971
+ this.target.addUpdateBoundTag();
2972
+ this.determineUpdateFunction();
2826
2973
  }
2827
2974
  }
2828
- class GrowAngleOut extends GworPointsBase$2 {
2975
+ class GrowAngleOut extends GrowAngleBase {
2829
2976
  onBind() {
2830
- var _a;
2977
+ var _a, _b;
2831
2978
  const { from, to } = growAngleOut(this.target, this.params.options, this.params);
2832
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
2979
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
2833
2980
  this.props = to;
2834
2981
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
2835
2982
  this.animate.reSyncProps();
2836
2983
  this.from = fromAttrs;
2837
2984
  this.to = to;
2838
- this.target.setAttributes(fromAttrs);
2985
+ Object.assign(this.target.attribute, fromAttrs);
2986
+ this.target.addUpdatePositionTag();
2987
+ this.target.addUpdateBoundTag();
2988
+ this.determineUpdateFunction();
2839
2989
  }
2840
2990
  }
2841
2991
 
@@ -2995,9 +3145,12 @@ class GrowCenterIn extends ACustomAnimate {
2995
3145
  super(from, to, duration, easing, params);
2996
3146
  }
2997
3147
  onBind() {
2998
- var _a;
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
+ }
2999
3152
  const { from, to } = growCenterIn(this.target, this.params.options, this.params);
3000
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3153
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3001
3154
  this.props = to;
3002
3155
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3003
3156
  this.animate.reSyncProps();
@@ -3009,10 +3162,12 @@ class GrowCenterIn extends ACustomAnimate {
3009
3162
  super.onEnd(cb);
3010
3163
  }
3011
3164
  onUpdate(end, ratio, out) {
3165
+ const attribute = this.target.attribute;
3012
3166
  this.propKeys.forEach(key => {
3013
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3167
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3014
3168
  });
3015
- this.target.setAttributes(out);
3169
+ this.target.addUpdatePositionTag();
3170
+ this.target.addUpdateShapeAndBoundsTag();
3016
3171
  }
3017
3172
  }
3018
3173
  class GrowCenterOut extends ACustomAnimate {
@@ -3032,10 +3187,12 @@ class GrowCenterOut extends ACustomAnimate {
3032
3187
  super.onEnd(cb);
3033
3188
  }
3034
3189
  onUpdate(end, ratio, out) {
3190
+ const attribute = this.target.attribute;
3035
3191
  this.propKeys.forEach(key => {
3036
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3192
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3037
3193
  });
3038
- this.target.setAttributes(out);
3194
+ this.target.addUpdatePositionTag();
3195
+ this.target.addUpdateShapeAndBoundsTag();
3039
3196
  }
3040
3197
  }
3041
3198
 
@@ -3095,24 +3252,30 @@ class GrowHeightIn extends ACustomAnimate {
3095
3252
  super(from, to, duration, easing, params);
3096
3253
  }
3097
3254
  onBind() {
3098
- var _a;
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
+ }
3099
3259
  const { from, to } = growHeightIn(this.target, this.params.options, this.params);
3100
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3260
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3101
3261
  this.props = to;
3102
3262
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3103
- this.animate.reSyncProps();
3104
3263
  this.from = fromAttrs;
3105
3264
  this.to = to;
3106
- this.target.setAttributes(fromAttrs);
3265
+ Object.assign(this.target.attribute, fromAttrs);
3266
+ this.target.addUpdatePositionTag();
3267
+ this.target.addUpdateBoundTag();
3107
3268
  }
3108
3269
  onEnd(cb) {
3109
3270
  super.onEnd(cb);
3110
3271
  }
3111
3272
  onUpdate(end, ratio, out) {
3273
+ const attribute = this.target.attribute;
3112
3274
  this.propKeys.forEach(key => {
3113
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3275
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3114
3276
  });
3115
- this.target.setAttributes(out);
3277
+ this.target.addUpdatePositionTag();
3278
+ this.target.addUpdateShapeAndBoundsTag();
3116
3279
  }
3117
3280
  }
3118
3281
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -3179,10 +3342,12 @@ class GrowHeightOut extends ACustomAnimate {
3179
3342
  super.onEnd(cb);
3180
3343
  }
3181
3344
  onUpdate(end, ratio, out) {
3345
+ const attribute = this.target.attribute;
3182
3346
  this.propKeys.forEach(key => {
3183
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3347
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3184
3348
  });
3185
- this.target.setAttributes(out);
3349
+ this.target.addUpdatePositionTag();
3350
+ this.target.addUpdateShapeAndBoundsTag();
3186
3351
  }
3187
3352
  }
3188
3353
 
@@ -3235,19 +3400,20 @@ let GworPointsBase$1 = class GworPointsBase extends ACustomAnimate {
3235
3400
  if (!fromPoints || !toPoints) {
3236
3401
  return;
3237
3402
  }
3238
- out.points = fromPoints.map((point, index) => {
3403
+ this.target.attribute.points = fromPoints.map((point, index) => {
3239
3404
  const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);
3240
3405
  return newPoint;
3241
3406
  });
3242
- this.target.setAttributes(out);
3407
+ this.target.addUpdatePositionTag();
3408
+ this.target.addUpdateShapeAndBoundsTag();
3243
3409
  }
3244
3410
  };
3245
3411
  class GrowPointsIn extends GworPointsBase$1 {
3246
3412
  onBind() {
3247
- var _a;
3248
- if (['area', 'line'].includes(this.target.type)) {
3413
+ var _a, _b;
3414
+ if (['area', 'line', 'polygon'].includes(this.target.type)) {
3249
3415
  const { from, to } = growPointsIn(this.target, this.params.options, this.params);
3250
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3416
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3251
3417
  this.props = to;
3252
3418
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3253
3419
  this.animate.reSyncProps();
@@ -3308,10 +3474,10 @@ const growPointsXOut = (graphic, options, animationParameters) => {
3308
3474
  };
3309
3475
  class GrowPointsXIn extends GworPointsBase$1 {
3310
3476
  onBind() {
3311
- var _a;
3312
- if (['area', 'line'].includes(this.target.type)) {
3477
+ var _a, _b;
3478
+ if (['area', 'line', 'polygon'].includes(this.target.type)) {
3313
3479
  const { from, to } = growPointsXIn(this.target, this.params.options, this.params);
3314
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3480
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3315
3481
  this.props = to;
3316
3482
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3317
3483
  this.animate.reSyncProps();
@@ -3372,10 +3538,13 @@ const growPointsYOut = (graphic, options, animationParameters) => {
3372
3538
  };
3373
3539
  class GrowPointsYIn extends GworPointsBase$1 {
3374
3540
  onBind() {
3375
- var _a;
3376
- if (['area', 'line'].includes(this.target.type)) {
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
+ if (['area', 'line', 'polygon'].includes(this.target.type)) {
3377
3546
  const { from, to } = growPointsYIn(this.target, this.params.options, this.params);
3378
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3547
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3379
3548
  this.props = to;
3380
3549
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3381
3550
  this.animate.reSyncProps();
@@ -3442,21 +3611,22 @@ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
3442
3611
  const attrs = graphic.getFinalAttribute();
3443
3612
  if (options && options.orient === 'inside') {
3444
3613
  return {
3445
- from: { innerRadius: graphic.getGraphicAttribute('innerRadius', true) },
3614
+ from: { innerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.innerRadius },
3446
3615
  to: { innerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.outerRadius }
3447
3616
  };
3448
3617
  }
3449
3618
  return {
3450
- from: { outerRadius: graphic.getGraphicAttribute('outerRadius', true) },
3619
+ from: { outerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.outerRadius },
3451
3620
  to: { outerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.innerRadius }
3452
3621
  };
3453
3622
  };
3454
3623
  const growRadiusOutOverall = (graphic, options, animationParameters) => {
3624
+ const attrs = graphic.getFinalAttribute();
3455
3625
  const overallValue = isNumber(options === null || options === void 0 ? void 0 : options.overall) ? options.overall : 0;
3456
3626
  return {
3457
3627
  from: {
3458
- innerRadius: graphic.getGraphicAttribute('innerRadius', true),
3459
- outerRadius: graphic.getGraphicAttribute('outerRadius', true)
3628
+ innerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.innerRadius,
3629
+ outerRadius: attrs === null || attrs === void 0 ? void 0 : attrs.outerRadius
3460
3630
  },
3461
3631
  to: {
3462
3632
  innerRadius: overallValue,
@@ -3475,17 +3645,22 @@ class GworPointsBase extends ACustomAnimate {
3475
3645
  super(from, to, duration, easing, params);
3476
3646
  }
3477
3647
  onUpdate(end, ratio, out) {
3648
+ const attribute = this.target.attribute;
3478
3649
  this.propKeys.forEach(key => {
3479
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3650
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3480
3651
  });
3481
- this.target.setAttributes(out);
3652
+ this.target.addUpdatePositionTag();
3653
+ this.target.addUpdateShapeAndBoundsTag();
3482
3654
  }
3483
3655
  }
3484
3656
  class GrowRadiusIn extends GworPointsBase {
3485
3657
  onBind() {
3486
- var _a;
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
+ }
3487
3662
  const { from, to } = growRadiusIn(this.target, this.params.options, this.params);
3488
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3663
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3489
3664
  this.props = to;
3490
3665
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3491
3666
  this.animate.reSyncProps();
@@ -3496,9 +3671,9 @@ class GrowRadiusIn extends GworPointsBase {
3496
3671
  }
3497
3672
  class GrowRadiusOut extends GworPointsBase {
3498
3673
  onBind() {
3499
- var _a;
3674
+ var _a, _b;
3500
3675
  const { from, to } = growRadiusOut(this.target, this.params.options, this.params);
3501
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3676
+ const fromAttrs = (_b = (_a = this.target.context) === null || _a === void 0 ? void 0 : _a.lastAttrs) !== null && _b !== void 0 ? _b : from;
3502
3677
  this.props = to;
3503
3678
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3504
3679
  this.animate.reSyncProps();
@@ -3611,9 +3786,12 @@ class GrowWidthIn extends ACustomAnimate {
3611
3786
  super(from, to, duration, easing, params);
3612
3787
  }
3613
3788
  onBind() {
3614
- var _a;
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
+ }
3615
3793
  const { from, to } = growWidthIn(this.target, this.params.options, this.params);
3616
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : from;
3794
+ const fromAttrs = (_c = (_b = this.target.context) === null || _b === void 0 ? void 0 : _b.lastAttrs) !== null && _c !== void 0 ? _c : from;
3617
3795
  this.props = to;
3618
3796
  this.propKeys = Object.keys(to).filter(key => to[key] != null);
3619
3797
  this.animate.reSyncProps();
@@ -3625,10 +3803,12 @@ class GrowWidthIn extends ACustomAnimate {
3625
3803
  super.onEnd(cb);
3626
3804
  }
3627
3805
  onUpdate(end, ratio, out) {
3806
+ const attribute = this.target.attribute;
3628
3807
  this.propKeys.forEach(key => {
3629
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3808
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3630
3809
  });
3631
- this.target.setAttributes(out);
3810
+ this.target.addUpdatePositionTag();
3811
+ this.target.addUpdateShapeAndBoundsTag();
3632
3812
  }
3633
3813
  }
3634
3814
  class GrowWidthOut extends ACustomAnimate {
@@ -3648,10 +3828,476 @@ class GrowWidthOut extends ACustomAnimate {
3648
3828
  super.onEnd(cb);
3649
3829
  }
3650
3830
  onUpdate(end, ratio, out) {
3831
+ const attribute = this.target.attribute;
3651
3832
  this.propKeys.forEach(key => {
3652
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3833
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3834
+ });
3835
+ this.target.addUpdatePositionTag();
3836
+ this.target.addUpdateShapeAndBoundsTag();
3837
+ }
3838
+ }
3839
+
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
+ class LabelItemAppear extends AComponentAnimate {
4022
+ onBind() {
4023
+ const animator = createComponentAnimator(this.target);
4024
+ this._animator = animator;
4025
+ const duration = this.duration;
4026
+ const easing = this.easing;
4027
+ const target = this.target;
4028
+ const { symbolStartOuterType = 'scale', titleType = 'typewriter', titlePanelType = 'scale' } = this.params;
4029
+ const symbolTime = duration / 10;
4030
+ target._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });
4031
+ animator.animate(target._symbolStart, {
4032
+ type: 'to',
4033
+ to: { scaleX: 1, scaleY: 1 },
4034
+ duration: symbolTime * 5,
4035
+ easing
4036
+ });
4037
+ let symbolStartOuterFrom;
4038
+ let symbolStartOuterTo;
4039
+ if (symbolStartOuterType === 'scale') {
4040
+ symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };
4041
+ symbolStartOuterTo = { scaleX: 1, scaleY: 1 };
4042
+ }
4043
+ else {
4044
+ symbolStartOuterFrom = { clipRange: 0 };
4045
+ symbolStartOuterTo = { clipRange: 1 };
4046
+ }
4047
+ target._symbolStartOuter.setAttributes(symbolStartOuterFrom);
4048
+ animator.animate(target._symbolStartOuter, {
4049
+ type: 'to',
4050
+ to: symbolStartOuterTo,
4051
+ duration: symbolTime * 5,
4052
+ easing
4053
+ });
4054
+ target._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });
4055
+ animator.animate(target._symbolEnd, {
4056
+ type: 'to',
4057
+ to: { scaleX: 1, scaleY: 1 },
4058
+ duration: symbolTime * 2,
4059
+ delay: symbolTime * 8,
4060
+ easing
4061
+ });
4062
+ target._line.setAttributes({ clipRange: 0 });
4063
+ animator.animate(target._line, {
4064
+ type: 'to',
4065
+ to: { clipRange: 1 },
4066
+ duration: symbolTime * 9,
4067
+ easing
4068
+ });
4069
+ if (titleType === 'typewriter') {
4070
+ const titleTopText = target._titleTop.attribute.text;
4071
+ target._titleTop.setAttributes({ text: '' });
4072
+ animator.animate(target._titleTop, {
4073
+ type: 'custom',
4074
+ delay: symbolTime * 5,
4075
+ duration: symbolTime * 4,
4076
+ easing: 'linear',
4077
+ to: { text: titleTopText },
4078
+ custom: InputText
4079
+ });
4080
+ const titleBottomText = target._titleBottom.attribute.text;
4081
+ target._titleBottom.setAttributes({ text: '' });
4082
+ animator.animate(target._titleBottom, {
4083
+ type: 'custom',
4084
+ delay: symbolTime * 5,
4085
+ duration: symbolTime * 4,
4086
+ easing: 'linear',
4087
+ to: { text: titleBottomText },
4088
+ custom: InputText
4089
+ });
4090
+ }
4091
+ else {
4092
+ target._titleTop.setAttributes({ dy: target._titleTop.AABBBounds.height() + 10 });
4093
+ animator.animate(target._titleTop, {
4094
+ type: 'to',
4095
+ to: {
4096
+ dy: 0
4097
+ },
4098
+ delay: symbolTime * 5,
4099
+ duration: symbolTime * 4,
4100
+ easing: 'linear'
4101
+ });
4102
+ target._titleBottom.setAttributes({ dy: -(10 + target._titleBottom.AABBBounds.height()) });
4103
+ animator.animate(target._titleBottom, {
4104
+ type: 'to',
4105
+ to: {
4106
+ dy: 0
4107
+ },
4108
+ delay: symbolTime * 5,
4109
+ duration: symbolTime * 4,
4110
+ easing: 'linear'
4111
+ });
4112
+ }
4113
+ if (titlePanelType === 'scale') {
4114
+ [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
4115
+ var _a;
4116
+ const scaleX = (_a = panel.attribute.scaleX) !== null && _a !== void 0 ? _a : 1;
4117
+ panel.setAttributes({ scaleX: 0 });
4118
+ animator.animate(panel, {
4119
+ type: 'to',
4120
+ to: {
4121
+ scaleX
4122
+ },
4123
+ duration,
4124
+ easing
4125
+ });
4126
+ });
4127
+ }
4128
+ else if (titlePanelType === 'stroke') {
4129
+ [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
4130
+ const b = panel.AABBBounds;
4131
+ const totalLen = (b.width() + b.height()) * 2;
4132
+ panel.setAttributes({ lineDash: [0, totalLen * 10] });
4133
+ animator.animate(panel, {
4134
+ type: 'to',
4135
+ to: {
4136
+ lineDash: [totalLen, totalLen * 10]
4137
+ },
4138
+ duration,
4139
+ easing
4140
+ });
4141
+ });
4142
+ }
4143
+ }
4144
+ }
4145
+ class LabelItemDisappear extends AComponentAnimate {
4146
+ onBind() {
4147
+ const animator = createComponentAnimator(this.target);
4148
+ this._animator = animator;
4149
+ const duration = this.duration;
4150
+ const easing = this.easing;
4151
+ const target = this.target;
4152
+ const { mode } = this.params;
4153
+ if (mode === 'scale') {
4154
+ animator.animate(target._symbolStart, {
4155
+ type: 'to',
4156
+ to: { scaleX: 0, scaleY: 0 },
4157
+ duration,
4158
+ easing
4159
+ });
4160
+ }
4161
+ else {
4162
+ animator.animate(target._line, {
4163
+ type: 'to',
4164
+ to: { clipRange: 0 },
4165
+ duration,
4166
+ easing
4167
+ });
4168
+ animator.animate(target._symbolStart, {
4169
+ type: 'to',
4170
+ to: { scaleX: 0, scaleY: 0 },
4171
+ duration: duration / 2,
4172
+ delay: duration / 2,
4173
+ easing
4174
+ });
4175
+ animator.animate(target._symbolEnd, {
4176
+ type: 'to',
4177
+ to: { scaleX: 0, scaleY: 0 },
4178
+ duration,
4179
+ easing
4180
+ });
4181
+ animator.animate(target._titleTop, {
4182
+ type: 'to',
4183
+ to: { dy: target._titleTop.AABBBounds.height() + 10 },
4184
+ duration: duration / 2,
4185
+ easing
4186
+ });
4187
+ animator.animate(target._titleBottom, {
4188
+ type: 'to',
4189
+ to: { dy: -(10 + target._titleBottom.AABBBounds.height()) },
4190
+ duration: duration / 2,
4191
+ easing
4192
+ });
4193
+ animator.animate(target._symbolStartOuter, {
4194
+ type: 'to',
4195
+ to: { clipRange: 0 },
4196
+ duration: duration / 2,
4197
+ delay: duration / 2,
4198
+ easing
4199
+ });
4200
+ animator.animate(target._titleTopPanel, {
4201
+ type: 'to',
4202
+ to: { scaleX: 0 },
4203
+ duration,
4204
+ easing
4205
+ });
4206
+ animator.animate(target._titleBottomPanel, {
4207
+ type: 'to',
4208
+ to: { scaleX: 0 },
4209
+ duration,
4210
+ easing
4211
+ });
4212
+ }
4213
+ }
4214
+ }
4215
+
4216
+ class PoptipAppear extends AComponentAnimate {
4217
+ onBind() {
4218
+ const animator = createComponentAnimator(this.target);
4219
+ this._animator = animator;
4220
+ const duration = this.duration;
4221
+ const easing = this.easing;
4222
+ const target = this.target;
4223
+ const { wave } = this.params;
4224
+ target.setAttributes({ scaleX: 0, scaleY: 0 });
4225
+ animator.animate(target, {
4226
+ type: 'to',
4227
+ to: { scaleX: 1, scaleY: 1 },
4228
+ duration: (duration / 3) * 2,
4229
+ easing
4230
+ });
4231
+ target.titleShape &&
4232
+ animator.animate(target.titleShape, {
4233
+ type: 'custom',
4234
+ to: { text: target.titleShape.attribute.text },
4235
+ duration,
4236
+ easing,
4237
+ custom: InputText
4238
+ });
4239
+ target.contentShape &&
4240
+ animator.animate(target.contentShape, {
4241
+ type: 'custom',
4242
+ to: { text: target.contentShape.attribute.text },
4243
+ duration,
4244
+ easing,
4245
+ custom: InputText
4246
+ });
4247
+ if (wave) {
4248
+ const dur = duration / 6;
4249
+ animator.animate(target.group, {
4250
+ timeSlices: [
4251
+ {
4252
+ duration: dur,
4253
+ effects: {
4254
+ type: 'to',
4255
+ to: { angle: wave },
4256
+ easing
4257
+ }
4258
+ },
4259
+ {
4260
+ duration: dur * 2,
4261
+ effects: {
4262
+ type: 'to',
4263
+ to: { angle: -wave },
4264
+ easing
4265
+ }
4266
+ },
4267
+ {
4268
+ duration: dur * 2,
4269
+ effects: {
4270
+ type: 'to',
4271
+ to: { angle: wave },
4272
+ easing
4273
+ }
4274
+ },
4275
+ {
4276
+ duration: dur,
4277
+ effects: {
4278
+ type: 'to',
4279
+ to: { angle: 0 },
4280
+ easing
4281
+ }
4282
+ }
4283
+ ]
4284
+ });
4285
+ }
4286
+ }
4287
+ }
4288
+ class PoptipDisappear extends AComponentAnimate {
4289
+ onBind() {
4290
+ const animator = createComponentAnimator(this.target);
4291
+ this._animator = animator;
4292
+ const duration = this.duration;
4293
+ const easing = this.easing;
4294
+ const target = this.target;
4295
+ animator.animate(target, {
4296
+ type: 'to',
4297
+ to: { scaleX: 0, scaleY: 0 },
4298
+ duration,
4299
+ easing
3653
4300
  });
3654
- this.target.setAttributes(out);
3655
4301
  }
3656
4302
  }
3657
4303
 
@@ -3660,43 +4306,60 @@ class ScaleIn extends ACustomAnimate {
3660
4306
  super(from, to, duration, easing, params);
3661
4307
  }
3662
4308
  onBind() {
3663
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4309
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4310
+ if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
4311
+ Object.assign(this.target.attribute, this.params.diffAttrs);
4312
+ }
3664
4313
  let from;
3665
4314
  let to;
3666
4315
  const attrs = this.target.getFinalAttribute();
3667
- const fromAttrs = (_a = this.target.context.lastAttrs) !== null && _a !== void 0 ? _a : {};
3668
- switch ((_b = this.params) === null || _b === void 0 ? void 0 : _b.direction) {
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) {
3669
4318
  case 'x':
3670
- from = { scaleX: (_c = fromAttrs.scaleX) !== null && _c !== void 0 ? _c : 0 };
3671
- to = { scaleX: (_d = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _d !== void 0 ? _d : 1 };
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'];
4322
+ this._updateFunction = this.updateX;
3672
4323
  break;
3673
4324
  case 'y':
3674
- from = { scaleY: (_e = fromAttrs.scaleY) !== null && _e !== void 0 ? _e : 0 };
3675
- to = { scaleY: (_f = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _f !== void 0 ? _f : 1 };
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'];
4328
+ this._updateFunction = this.updateY;
3676
4329
  break;
3677
4330
  case 'xy':
3678
4331
  default:
3679
- from = { scaleX: (_g = fromAttrs.scaleX) !== null && _g !== void 0 ? _g : 0, scaleY: (_h = fromAttrs.scaleY) !== null && _h !== void 0 ? _h : 0 };
4332
+ from = { scaleX: (_j = fromAttrs.scaleX) !== null && _j !== void 0 ? _j : 0, scaleY: (_k = fromAttrs.scaleY) !== null && _k !== void 0 ? _k : 0 };
3680
4333
  to = {
3681
- scaleX: (_j = attrs === null || attrs === void 0 ? void 0 : attrs.scaleX) !== null && _j !== void 0 ? _j : 1,
3682
- scaleY: (_k = attrs === null || attrs === void 0 ? void 0 : attrs.scaleY) !== null && _k !== void 0 ? _k : 1
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
3683
4336
  };
4337
+ this.propKeys = ['scaleX', 'scaleY'];
4338
+ this._updateFunction = this.updateXY;
3684
4339
  }
3685
4340
  this.props = to;
3686
- this.propKeys = Object.keys(to);
3687
- this.animate.reSyncProps();
3688
4341
  this.from = from;
3689
4342
  this.to = to;
3690
- this.target.setAttributes(from);
4343
+ Object.assign(this.target.attribute, from);
4344
+ this.target.addUpdatePositionTag();
4345
+ this.target.addUpdateBoundTag();
3691
4346
  }
3692
4347
  onEnd(cb) {
3693
4348
  super.onEnd(cb);
3694
4349
  }
4350
+ updateX(ratio) {
4351
+ this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
4352
+ }
4353
+ updateY(ratio) {
4354
+ this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
4355
+ }
4356
+ updateXY(ratio) {
4357
+ this.updateX(ratio);
4358
+ this.updateY(ratio);
4359
+ }
3695
4360
  onUpdate(end, ratio, out) {
3696
- this.propKeys.forEach(key => {
3697
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3698
- });
3699
- this.target.setAttributes(out);
4361
+ this._updateFunction(ratio);
4362
+ this.target.addUpdatePositionTag();
3700
4363
  }
3701
4364
  }
3702
4365
  class ScaleOut extends ACustomAnimate {
@@ -3735,10 +4398,11 @@ class ScaleOut extends ACustomAnimate {
3735
4398
  super.onEnd(cb);
3736
4399
  }
3737
4400
  onUpdate(end, ratio, out) {
4401
+ const attribute = this.target.attribute;
3738
4402
  this.propKeys.forEach(key => {
3739
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
4403
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
3740
4404
  });
3741
- this.target.setAttributes(out);
4405
+ this.target.addUpdatePositionTag();
3742
4406
  }
3743
4407
  }
3744
4408
 
@@ -3771,7 +4435,6 @@ class Update extends ACustomAnimate {
3771
4435
  constructor(from, to, duration, easing, params) {
3772
4436
  const { diffAttrs = {} } = params;
3773
4437
  super(from, diffAttrs, duration, easing, params);
3774
- this.params = params;
3775
4438
  }
3776
4439
  update(end, ratio, out) {
3777
4440
  this.onStart();
@@ -3795,6 +4458,7 @@ class Update extends ACustomAnimate {
3795
4458
  }
3796
4459
 
3797
4460
  const registerCustomAnimate = () => {
4461
+ AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
3798
4462
  AnimateExecutor.registerBuiltInAnimate('scaleIn', ScaleIn);
3799
4463
  AnimateExecutor.registerBuiltInAnimate('scaleOut', ScaleOut);
3800
4464
  AnimateExecutor.registerBuiltInAnimate('growHeightIn', GrowHeightIn);
@@ -3819,6 +4483,11 @@ const registerCustomAnimate = () => {
3819
4483
  AnimateExecutor.registerBuiltInAnimate('growRadiusOut', GrowRadiusOut);
3820
4484
  AnimateExecutor.registerBuiltInAnimate('update', Update);
3821
4485
  AnimateExecutor.registerBuiltInAnimate('state', State);
4486
+ AnimateExecutor.registerBuiltInAnimate('labelItemAppear', LabelItemAppear);
4487
+ AnimateExecutor.registerBuiltInAnimate('labelItemDisappear', LabelItemDisappear);
4488
+ AnimateExecutor.registerBuiltInAnimate('poptipAppear', PoptipAppear);
4489
+ AnimateExecutor.registerBuiltInAnimate('poptipDisappear', PoptipDisappear);
4490
+ AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
3822
4491
  };
3823
4492
 
3824
- export { ACustomAnimate, Animate, AnimateExecutor, AnimateMode, AnimateStatus, AnimateStepType, AnimationStateManager, AnimationStateStore, AnimationTransitionRegistry, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, DefaultTicker, DefaultTimeline, GraphicStateExtension, GroupFadeIn, GroupFadeOut, IncreaseCount, InputText, ManualTicker, RotateBySphereAnimate, Step, TagPointsUpdate, generatorPathEasingFunc, registerAnimate, registerCustomAnimate, transitionRegistry };
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 };