@visactor/vrender-animate 0.22.4

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 (303) hide show
  1. package/README.md +177 -0
  2. package/cjs/animate-extension.d.ts +15 -0
  3. package/cjs/animate-extension.js +46 -0
  4. package/cjs/animate-extension.js.map +1 -0
  5. package/cjs/animate.d.ts +71 -0
  6. package/cjs/animate.js +210 -0
  7. package/cjs/animate.js.map +1 -0
  8. package/cjs/custom/clip-graphic.d.ts +53 -0
  9. package/cjs/custom/clip-graphic.js +146 -0
  10. package/cjs/custom/clip-graphic.js.map +1 -0
  11. package/cjs/custom/clip.d.ts +13 -0
  12. package/cjs/custom/clip.js +24 -0
  13. package/cjs/custom/clip.js.map +1 -0
  14. package/cjs/custom/common.d.ts +22 -0
  15. package/cjs/custom/common.js +58 -0
  16. package/cjs/custom/common.js.map +1 -0
  17. package/cjs/custom/custom-animate.d.ts +15 -0
  18. package/cjs/custom/custom-animate.js +25 -0
  19. package/cjs/custom/custom-animate.js.map +1 -0
  20. package/cjs/custom/fade.d.ts +13 -0
  21. package/cjs/custom/fade.js +24 -0
  22. package/cjs/custom/fade.js.map +1 -0
  23. package/cjs/custom/group-fade.d.ts +16 -0
  24. package/cjs/custom/group-fade.js +66 -0
  25. package/cjs/custom/group-fade.js.map +1 -0
  26. package/cjs/custom/growAngle.d.ts +37 -0
  27. package/cjs/custom/growAngle.js +140 -0
  28. package/cjs/custom/growAngle.js.map +1 -0
  29. package/cjs/custom/growCenter.d.ts +17 -0
  30. package/cjs/custom/growCenter.js +161 -0
  31. package/cjs/custom/growCenter.js.map +1 -0
  32. package/cjs/custom/growHeight.d.ts +36 -0
  33. package/cjs/custom/growHeight.js +154 -0
  34. package/cjs/custom/growHeight.js.map +1 -0
  35. package/cjs/custom/growPoints.d.ts +52 -0
  36. package/cjs/custom/growPoints.js +227 -0
  37. package/cjs/custom/growPoints.js.map +1 -0
  38. package/cjs/custom/growRadius.d.ts +41 -0
  39. package/cjs/custom/growRadius.js +113 -0
  40. package/cjs/custom/growRadius.js.map +1 -0
  41. package/cjs/custom/growWidth.d.ts +36 -0
  42. package/cjs/custom/growWidth.js +154 -0
  43. package/cjs/custom/growWidth.js.map +1 -0
  44. package/cjs/custom/input-text.d.ts +29 -0
  45. package/cjs/custom/input-text.js +45 -0
  46. package/cjs/custom/input-text.js.map +1 -0
  47. package/cjs/custom/number.d.ts +25 -0
  48. package/cjs/custom/number.js +102 -0
  49. package/cjs/custom/number.js.map +1 -0
  50. package/cjs/custom/register.d.ts +1 -0
  51. package/cjs/custom/register.js +35 -0
  52. package/cjs/custom/register.js.map +1 -0
  53. package/cjs/custom/scale-in.d.ts +13 -0
  54. package/cjs/custom/scale-in.js +57 -0
  55. package/cjs/custom/scale-in.js.map +1 -0
  56. package/cjs/custom/scale.d.ts +20 -0
  57. package/cjs/custom/scale.js +106 -0
  58. package/cjs/custom/scale.js.map +1 -0
  59. package/cjs/custom/sphere.d.ts +20 -0
  60. package/cjs/custom/sphere.js +26 -0
  61. package/cjs/custom/sphere.js.map +1 -0
  62. package/cjs/custom/state.d.ts +13 -0
  63. package/cjs/custom/state.js +25 -0
  64. package/cjs/custom/state.js.map +1 -0
  65. package/cjs/custom/tag-points.d.ts +26 -0
  66. package/cjs/custom/tag-points.js +81 -0
  67. package/cjs/custom/tag-points.js.map +1 -0
  68. package/cjs/custom/update.d.ts +14 -0
  69. package/cjs/custom/update.js +26 -0
  70. package/cjs/custom/update.js.map +1 -0
  71. package/cjs/executor/animate-executor.d.ts +36 -0
  72. package/cjs/executor/animate-executor.js +177 -0
  73. package/cjs/executor/animate-executor.js.map +1 -0
  74. package/cjs/executor/executor.d.ts +69 -0
  75. package/cjs/executor/executor.js +6 -0
  76. package/cjs/executor/executor.js.map +1 -0
  77. package/cjs/index.d.ts +25 -0
  78. package/cjs/index.js +214 -0
  79. package/cjs/index.js.map +1 -0
  80. package/cjs/interpolate/executor.d.ts +66 -0
  81. package/cjs/interpolate/executor.js +6 -0
  82. package/cjs/interpolate/executor.js.map +1 -0
  83. package/cjs/interpolate/number.d.ts +1 -0
  84. package/cjs/interpolate/number.js +10 -0
  85. package/cjs/interpolate/number.js.map +1 -0
  86. package/cjs/interpolate/store.d.ts +32 -0
  87. package/cjs/interpolate/store.js +96 -0
  88. package/cjs/interpolate/store.js.map +1 -0
  89. package/cjs/intreface/animate.d.ts +91 -0
  90. package/cjs/intreface/animate.js +10 -0
  91. package/cjs/intreface/animate.js.map +1 -0
  92. package/cjs/intreface/easing.d.ts +3 -0
  93. package/cjs/intreface/easing.js +6 -0
  94. package/cjs/intreface/easing.js.map +1 -0
  95. package/cjs/intreface/state.d.ts +35 -0
  96. package/cjs/intreface/state.js +6 -0
  97. package/cjs/intreface/state.js.map +1 -0
  98. package/cjs/intreface/ticker.d.ts +37 -0
  99. package/cjs/intreface/ticker.js +10 -0
  100. package/cjs/intreface/ticker.js.map +1 -0
  101. package/cjs/intreface/timeline.d.ts +17 -0
  102. package/cjs/intreface/timeline.js +6 -0
  103. package/cjs/intreface/timeline.js.map +1 -0
  104. package/cjs/intreface/type.d.ts +13 -0
  105. package/cjs/intreface/type.js +15 -0
  106. package/cjs/intreface/type.js.map +1 -0
  107. package/cjs/register.d.ts +1 -0
  108. package/cjs/register.js +19 -0
  109. package/cjs/register.js.map +1 -0
  110. package/cjs/state/animation-state-machine.d.ts +22 -0
  111. package/cjs/state/animation-state-machine.js +53 -0
  112. package/cjs/state/animation-state-machine.js.map +1 -0
  113. package/cjs/state/animation-state-queue.d.ts +24 -0
  114. package/cjs/state/animation-state-queue.js +66 -0
  115. package/cjs/state/animation-state-queue.js.map +1 -0
  116. package/cjs/state/animation-state-registry.d.ts +14 -0
  117. package/cjs/state/animation-state-registry.js +53 -0
  118. package/cjs/state/animation-state-registry.js.map +1 -0
  119. package/cjs/state/animation-state.d.ts +25 -0
  120. package/cjs/state/animation-state.js +80 -0
  121. package/cjs/state/animation-state.js.map +1 -0
  122. package/cjs/state/animation-states-registry.d.ts +17 -0
  123. package/cjs/state/animation-states-registry.js +95 -0
  124. package/cjs/state/animation-states-registry.js.map +1 -0
  125. package/cjs/state/graphic-extension.d.ts +12 -0
  126. package/cjs/state/graphic-extension.js +37 -0
  127. package/cjs/state/graphic-extension.js.map +1 -0
  128. package/cjs/state/index.d.ts +3 -0
  129. package/cjs/state/index.js +22 -0
  130. package/cjs/state/index.js.map +1 -0
  131. package/cjs/state/types.d.ts +11 -0
  132. package/cjs/state/types.js +6 -0
  133. package/cjs/state/types.js.map +1 -0
  134. package/cjs/step.d.ts +49 -0
  135. package/cjs/step.js +124 -0
  136. package/cjs/step.js.map +1 -0
  137. package/cjs/ticker/default-ticker.d.ts +39 -0
  138. package/cjs/ticker/default-ticker.js +133 -0
  139. package/cjs/ticker/default-ticker.js.map +1 -0
  140. package/cjs/ticker/manual-ticker.d.ts +6 -0
  141. package/cjs/ticker/manual-ticker.js +37 -0
  142. package/cjs/ticker/manual-ticker.js.map +1 -0
  143. package/cjs/timeline.d.ts +34 -0
  144. package/cjs/timeline.js +84 -0
  145. package/cjs/timeline.js.map +1 -0
  146. package/cjs/utils/easing-func.d.ts +1 -0
  147. package/cjs/utils/easing-func.js +16 -0
  148. package/cjs/utils/easing-func.js.map +1 -0
  149. package/cjs/utils/easing.d.ts +49 -0
  150. package/cjs/utils/easing.js +141 -0
  151. package/cjs/utils/easing.js.map +1 -0
  152. package/dist/index.es.js +3824 -0
  153. package/es/animate-extension.d.ts +15 -0
  154. package/es/animate-extension.js +42 -0
  155. package/es/animate-extension.js.map +1 -0
  156. package/es/animate.d.ts +71 -0
  157. package/es/animate.js +207 -0
  158. package/es/animate.js.map +1 -0
  159. package/es/custom/clip-graphic.d.ts +53 -0
  160. package/es/custom/clip-graphic.js +134 -0
  161. package/es/custom/clip-graphic.js.map +1 -0
  162. package/es/custom/clip.d.ts +13 -0
  163. package/es/custom/clip.js +14 -0
  164. package/es/custom/clip.js.map +1 -0
  165. package/es/custom/common.d.ts +22 -0
  166. package/es/custom/common.js +48 -0
  167. package/es/custom/common.js.map +1 -0
  168. package/es/custom/custom-animate.d.ts +15 -0
  169. package/es/custom/custom-animate.js +17 -0
  170. package/es/custom/custom-animate.js.map +1 -0
  171. package/es/custom/fade.d.ts +13 -0
  172. package/es/custom/fade.js +14 -0
  173. package/es/custom/fade.js.map +1 -0
  174. package/es/custom/group-fade.d.ts +16 -0
  175. package/es/custom/group-fade.js +56 -0
  176. package/es/custom/group-fade.js.map +1 -0
  177. package/es/custom/growAngle.d.ts +37 -0
  178. package/es/custom/growAngle.js +132 -0
  179. package/es/custom/growAngle.js.map +1 -0
  180. package/es/custom/growCenter.d.ts +17 -0
  181. package/es/custom/growCenter.js +155 -0
  182. package/es/custom/growCenter.js.map +1 -0
  183. package/es/custom/growHeight.d.ts +36 -0
  184. package/es/custom/growHeight.js +144 -0
  185. package/es/custom/growHeight.js.map +1 -0
  186. package/es/custom/growPoints.d.ts +52 -0
  187. package/es/custom/growPoints.js +219 -0
  188. package/es/custom/growPoints.js.map +1 -0
  189. package/es/custom/growRadius.d.ts +41 -0
  190. package/es/custom/growRadius.js +105 -0
  191. package/es/custom/growRadius.js.map +1 -0
  192. package/es/custom/growWidth.d.ts +36 -0
  193. package/es/custom/growWidth.js +144 -0
  194. package/es/custom/growWidth.js.map +1 -0
  195. package/es/custom/input-text.d.ts +29 -0
  196. package/es/custom/input-text.js +37 -0
  197. package/es/custom/input-text.js.map +1 -0
  198. package/es/custom/number.d.ts +25 -0
  199. package/es/custom/number.js +94 -0
  200. package/es/custom/number.js.map +1 -0
  201. package/es/custom/register.d.ts +1 -0
  202. package/es/custom/register.js +39 -0
  203. package/es/custom/register.js.map +1 -0
  204. package/es/custom/scale-in.d.ts +13 -0
  205. package/es/custom/scale-in.js +49 -0
  206. package/es/custom/scale-in.js.map +1 -0
  207. package/es/custom/scale.d.ts +20 -0
  208. package/es/custom/scale.js +96 -0
  209. package/es/custom/scale.js.map +1 -0
  210. package/es/custom/sphere.d.ts +20 -0
  211. package/es/custom/sphere.js +20 -0
  212. package/es/custom/sphere.js.map +1 -0
  213. package/es/custom/state.d.ts +13 -0
  214. package/es/custom/state.js +17 -0
  215. package/es/custom/state.js.map +1 -0
  216. package/es/custom/tag-points.d.ts +26 -0
  217. package/es/custom/tag-points.js +77 -0
  218. package/es/custom/tag-points.js.map +1 -0
  219. package/es/custom/update.d.ts +14 -0
  220. package/es/custom/update.js +18 -0
  221. package/es/custom/update.js.map +1 -0
  222. package/es/executor/animate-executor.d.ts +36 -0
  223. package/es/executor/animate-executor.js +169 -0
  224. package/es/executor/animate-executor.js.map +1 -0
  225. package/es/executor/executor.d.ts +69 -0
  226. package/es/executor/executor.js +2 -0
  227. package/es/executor/executor.js.map +1 -0
  228. package/es/index.d.ts +25 -0
  229. package/es/index.js +50 -0
  230. package/es/index.js.map +1 -0
  231. package/es/interpolate/executor.d.ts +66 -0
  232. package/es/interpolate/executor.js +2 -0
  233. package/es/interpolate/executor.js.map +1 -0
  234. package/es/interpolate/number.d.ts +1 -0
  235. package/es/interpolate/number.js +4 -0
  236. package/es/interpolate/number.js.map +1 -0
  237. package/es/interpolate/store.d.ts +32 -0
  238. package/es/interpolate/store.js +88 -0
  239. package/es/interpolate/store.js.map +1 -0
  240. package/es/intreface/animate.d.ts +91 -0
  241. package/es/intreface/animate.js +6 -0
  242. package/es/intreface/animate.js.map +1 -0
  243. package/es/intreface/easing.d.ts +3 -0
  244. package/es/intreface/easing.js +2 -0
  245. package/es/intreface/easing.js.map +1 -0
  246. package/es/intreface/state.d.ts +35 -0
  247. package/es/intreface/state.js +2 -0
  248. package/es/intreface/state.js.map +1 -0
  249. package/es/intreface/ticker.d.ts +37 -0
  250. package/es/intreface/ticker.js +6 -0
  251. package/es/intreface/ticker.js.map +1 -0
  252. package/es/intreface/timeline.d.ts +17 -0
  253. package/es/intreface/timeline.js +2 -0
  254. package/es/intreface/timeline.js.map +1 -0
  255. package/es/intreface/type.d.ts +13 -0
  256. package/es/intreface/type.js +14 -0
  257. package/es/intreface/type.js.map +1 -0
  258. package/es/register.d.ts +1 -0
  259. package/es/register.js +20 -0
  260. package/es/register.js.map +1 -0
  261. package/es/state/animation-state-machine.d.ts +22 -0
  262. package/es/state/animation-state-machine.js +47 -0
  263. package/es/state/animation-state-machine.js.map +1 -0
  264. package/es/state/animation-state-queue.d.ts +24 -0
  265. package/es/state/animation-state-queue.js +58 -0
  266. package/es/state/animation-state-queue.js.map +1 -0
  267. package/es/state/animation-state-registry.d.ts +14 -0
  268. package/es/state/animation-state-registry.js +45 -0
  269. package/es/state/animation-state-registry.js.map +1 -0
  270. package/es/state/animation-state.d.ts +25 -0
  271. package/es/state/animation-state.js +72 -0
  272. package/es/state/animation-state.js.map +1 -0
  273. package/es/state/animation-states-registry.d.ts +17 -0
  274. package/es/state/animation-states-registry.js +87 -0
  275. package/es/state/animation-states-registry.js.map +1 -0
  276. package/es/state/graphic-extension.d.ts +12 -0
  277. package/es/state/graphic-extension.js +29 -0
  278. package/es/state/graphic-extension.js.map +1 -0
  279. package/es/state/index.d.ts +3 -0
  280. package/es/state/index.js +6 -0
  281. package/es/state/index.js.map +1 -0
  282. package/es/state/types.d.ts +11 -0
  283. package/es/state/types.js +2 -0
  284. package/es/state/types.js.map +1 -0
  285. package/es/step.d.ts +49 -0
  286. package/es/step.js +120 -0
  287. package/es/step.js.map +1 -0
  288. package/es/ticker/default-ticker.d.ts +39 -0
  289. package/es/ticker/default-ticker.js +129 -0
  290. package/es/ticker/default-ticker.js.map +1 -0
  291. package/es/ticker/manual-ticker.d.ts +6 -0
  292. package/es/ticker/manual-ticker.js +29 -0
  293. package/es/ticker/manual-ticker.js.map +1 -0
  294. package/es/timeline.d.ts +34 -0
  295. package/es/timeline.js +79 -0
  296. package/es/timeline.js.map +1 -0
  297. package/es/utils/easing-func.d.ts +1 -0
  298. package/es/utils/easing-func.js +8 -0
  299. package/es/utils/easing-func.js.map +1 -0
  300. package/es/utils/easing.d.ts +49 -0
  301. package/es/utils/easing.js +134 -0
  302. package/es/utils/easing.js.map +1 -0
  303. package/package.json +72 -0
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.GrowPointsYOut = exports.GrowPointsYIn = exports.GrowPointsXOut = exports.GrowPointsXIn = exports.GrowPointsOut = exports.GrowPointsIn = exports.GworPointsBase = exports.growPointsOut = exports.growPointsIn = void 0;
6
+
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), getCenterPoints = (graphic, options, animationParameters) => {
8
+ const points = graphic.getFinalAttribute().points, center = {
9
+ x: 0,
10
+ y: 0
11
+ };
12
+ return points.forEach((point => {
13
+ center.x += point.x, center.y += point.y;
14
+ })), center.x /= points.length, center.y /= points.length, options && options.center && ((0,
15
+ vutils_1.isValidNumber)(options.center.x) && (center.x = options.center.x), (0,
16
+ vutils_1.isValidNumber)(options.center.y) && (center.y = options.center.y)), "area" === graphic.type && (center.x1 = center.x,
17
+ center.y1 = center.y), points.map((point => Object.assign({}, point, center)));
18
+ }, growPointsIn = (graphic, options, animationParameters) => {
19
+ const attrs = graphic.getFinalAttribute();
20
+ return {
21
+ from: {
22
+ points: getCenterPoints(graphic, options)
23
+ },
24
+ to: {
25
+ points: attrs.points
26
+ }
27
+ };
28
+ };
29
+
30
+ exports.growPointsIn = growPointsIn;
31
+
32
+ const growPointsOut = (graphic, options, animationParameters) => ({
33
+ from: {
34
+ points: graphic.getFinalAttribute().points
35
+ },
36
+ to: {
37
+ points: getCenterPoints(graphic, options)
38
+ }
39
+ });
40
+
41
+ exports.growPointsOut = growPointsOut;
42
+
43
+ class GworPointsBase extends custom_animate_1.ACustomAnimate {
44
+ constructor(from, to, duration, easing, params) {
45
+ super(from, to, duration, easing, params);
46
+ }
47
+ onUpdate(end, ratio, out) {
48
+ var _a, _b;
49
+ const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points, toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
50
+ fromPoints && toPoints && (out.points = fromPoints.map(((point, index) => (0, vrender_core_1.pointInterpolation)(fromPoints[index], toPoints[index], ratio))),
51
+ this.target.setAttributes(out));
52
+ }
53
+ }
54
+
55
+ exports.GworPointsBase = GworPointsBase;
56
+
57
+ class GrowPointsIn extends GworPointsBase {
58
+ onBind() {
59
+ var _a;
60
+ if ([ "area", "line" ].includes(this.target.type)) {
61
+ const {from: from, to: to} = (0, exports.growPointsIn)(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
62
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
63
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
64
+ } else this.valid = !1;
65
+ }
66
+ }
67
+
68
+ exports.GrowPointsIn = GrowPointsIn;
69
+
70
+ class GrowPointsOut extends GworPointsBase {
71
+ onBind() {
72
+ if ([ "area", "line" ].includes(this.target.type)) {
73
+ const attrs = this.target.getFinalAttribute(), {from: from, to: to} = (0, exports.growPointsOut)(this.target, this.params.options, this.params);
74
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
75
+ this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
76
+ } else this.valid = !1;
77
+ }
78
+ }
79
+
80
+ exports.GrowPointsOut = GrowPointsOut;
81
+
82
+ const changePointsX = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map((point => {
83
+ var _a;
84
+ if (options && "negative" === options.orient) {
85
+ let groupRight = animationParameters.width;
86
+ return animationParameters.group && (groupRight = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(),
87
+ animationParameters.groupWidth = groupRight), Object.assign(Object.assign({}, point), {
88
+ x: groupRight,
89
+ y: point.y,
90
+ x1: groupRight,
91
+ y1: point.y1,
92
+ defined: !1 !== point.defined
93
+ });
94
+ }
95
+ return Object.assign(Object.assign({}, point), {
96
+ x: 0,
97
+ y: point.y,
98
+ x1: 0,
99
+ y1: point.y1,
100
+ defined: !1 !== point.defined
101
+ });
102
+ })), growPointsXIn = (graphic, options, animationParameters) => {
103
+ const attrs = graphic.getFinalAttribute();
104
+ return {
105
+ from: {
106
+ points: changePointsX(graphic, options, animationParameters)
107
+ },
108
+ to: {
109
+ points: attrs.points
110
+ }
111
+ };
112
+ }, growPointsXOut = (graphic, options, animationParameters) => ({
113
+ from: {
114
+ points: graphic.getFinalAttribute().points
115
+ },
116
+ to: {
117
+ points: changePointsX(graphic, options, animationParameters)
118
+ }
119
+ });
120
+
121
+ class GrowPointsXIn extends GworPointsBase {
122
+ onBind() {
123
+ var _a;
124
+ if ([ "area", "line" ].includes(this.target.type)) {
125
+ const {from: from, to: to} = growPointsXIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
126
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
127
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
128
+ } else this.valid = !1;
129
+ }
130
+ }
131
+
132
+ exports.GrowPointsXIn = GrowPointsXIn;
133
+
134
+ class GrowPointsXOut extends GworPointsBase {
135
+ onBind() {
136
+ if ([ "area", "line" ].includes(this.target.type)) {
137
+ const attrs = this.target.getFinalAttribute(), {from: from, to: to} = (graphic = this.target,
138
+ options = this.params.options, animationParameters = this.params, {
139
+ from: {
140
+ points: graphic.getFinalAttribute().points
141
+ },
142
+ to: {
143
+ points: changePointsX(graphic, options, animationParameters)
144
+ }
145
+ });
146
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
147
+ this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
148
+ } else this.valid = !1;
149
+ var graphic, options, animationParameters;
150
+ }
151
+ }
152
+
153
+ exports.GrowPointsXOut = GrowPointsXOut;
154
+
155
+ const changePointsY = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map((point => {
156
+ var _a;
157
+ if (options && "negative" === options.orient) {
158
+ let groupBottom = animationParameters.height;
159
+ return animationParameters.group && (groupBottom = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : animationParameters.group.getBounds().height(),
160
+ animationParameters.groupHeight = groupBottom), Object.assign(Object.assign({}, point), {
161
+ x: point.x,
162
+ y: groupBottom,
163
+ x1: point.x1,
164
+ y1: groupBottom,
165
+ defined: !1 !== point.defined
166
+ });
167
+ }
168
+ return Object.assign(Object.assign({}, point), {
169
+ x: point.x,
170
+ y: 0,
171
+ x1: point.x1,
172
+ y1: 0,
173
+ defined: !1 !== point.defined
174
+ });
175
+ })), growPointsYIn = (graphic, options, animationParameters) => {
176
+ const attrs = graphic.getFinalAttribute();
177
+ return {
178
+ from: {
179
+ points: changePointsY(graphic, options, animationParameters)
180
+ },
181
+ to: {
182
+ points: attrs.points
183
+ }
184
+ };
185
+ }, growPointsYOut = (graphic, options, animationParameters) => ({
186
+ from: {
187
+ points: graphic.getFinalAttribute().points
188
+ },
189
+ to: {
190
+ points: changePointsY(graphic, options, animationParameters)
191
+ }
192
+ });
193
+
194
+ class GrowPointsYIn extends GworPointsBase {
195
+ onBind() {
196
+ var _a;
197
+ if ([ "area", "line" ].includes(this.target.type)) {
198
+ const {from: from, to: to} = growPointsYIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
199
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
200
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
201
+ } else this.valid = !1;
202
+ }
203
+ }
204
+
205
+ exports.GrowPointsYIn = GrowPointsYIn;
206
+
207
+ class GrowPointsYOut extends GworPointsBase {
208
+ onBind() {
209
+ if ([ "area", "line" ].includes(this.target.type)) {
210
+ const attrs = this.target.getFinalAttribute(), {from: from, to: to} = (graphic = this.target,
211
+ options = this.params.options, animationParameters = this.params, {
212
+ from: {
213
+ points: graphic.getFinalAttribute().points
214
+ },
215
+ to: {
216
+ points: changePointsY(graphic, options, animationParameters)
217
+ }
218
+ });
219
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
220
+ this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
221
+ } else this.valid = !1;
222
+ var graphic, options, animationParameters;
223
+ }
224
+ }
225
+
226
+ exports.GrowPointsYOut = GrowPointsYOut;
227
+ //# sourceMappingURL=growPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/growPoints.ts"],"names":[],"mappings":";;;AAAA,yDAAwF;AAExF,6CAAiD;AAGjD,qDAAkD;AAyBlD,MAAM,eAAe,GAAG,CACtB,OAAiB,EACjB,OAA2C,EAC3C,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAiB,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,MAAM,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAC7B,IAAI,IAAA,sBAAa,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7B;QACD,IAAI,IAAA,sBAAa,EAAC,OAAO,CAA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CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;YAC/D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF;AAdD,wCAcC","file":"growPoints.js","sourcesContent":["import { pointInterpolation, type IGraphic, type IGroup } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nconst getCenterPoints = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points: IPointLike[] = attrs.points;\n const center: IPointLike = { x: 0, y: 0 };\n points.forEach(point => {\n center.x += point.x;\n center.y += point.y;\n });\n center.x /= points.length;\n center.y /= points.length;\n\n if (options && options.center) {\n if (isValidNumber(options.center.x)) {\n center.x = options.center.x;\n }\n if (isValidNumber(options.center.y)) {\n center.y = options.center.y;\n }\n }\n\n if (graphic.type === 'area') {\n center.x1 = center.x;\n center.y1 = center.y;\n }\n\n return points.map(point => Object.assign({}, point, center));\n};\n\nexport const growPointsIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: getCenterPoints(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nexport const growPointsOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: getCenterPoints(graphic, options, animationParameters) }\n };\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const fromPoints = this.from?.points as unknown as IPointLike[];\n const toPoints = this.to?.points as unknown as IPointLike[];\n if (!fromPoints || !toPoints) {\n return;\n }\n\n out.points = fromPoints.map((point, index) => {\n const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);\n return newPoint;\n });\n this.target.setAttributes(out);\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowPointsIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsX = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupRight = animationParameters.width;\n\n if (animationParameters.group) {\n groupRight = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = groupRight;\n }\n\n return {\n ...point,\n x: groupRight,\n y: point.y,\n x1: groupRight,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: 0,\n y: point.y,\n x1: 0,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsXIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsX(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsXOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsX(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsXIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsXIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsXOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsXOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsY = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupBottom = animationParameters.height;\n\n if (animationParameters.group) {\n groupBottom = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = groupBottom;\n }\n\n return {\n ...point,\n x: point.x,\n y: groupBottom,\n x1: point.x1,\n y1: groupBottom,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: point.x,\n y: 0,\n x1: point.x1,\n y1: 0,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsYIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsY(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsYOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsY(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsYIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsYIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsYOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsYOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import { type IGraphic, type IGroup } from '@visactor/vrender-core';
2
+ import type { EasingType } from '../intreface/easing';
3
+ import { ACustomAnimate } from './custom-animate';
4
+ interface IAnimationParameters {
5
+ width: number;
6
+ height: number;
7
+ group: IGroup;
8
+ elementIndex: number;
9
+ elementCount: number;
10
+ view: any;
11
+ }
12
+ type TypeAnimation<T extends IGraphic> = (graphic: T, options: any, animationParameters: IAnimationParameters) => {
13
+ from?: {
14
+ [channel: string]: any;
15
+ };
16
+ to?: {
17
+ [channel: string]: any;
18
+ };
19
+ };
20
+ export interface IGrowAngleAnimationOptions {
21
+ orient?: 'clockwise' | 'anticlockwise';
22
+ overall?: boolean | number;
23
+ }
24
+ export interface IGrowRadiusAnimationOptions {
25
+ orient?: 'inside' | 'outside';
26
+ overall?: boolean | number;
27
+ }
28
+ export declare const growRadiusIn: TypeAnimation<IGraphic>;
29
+ export declare const growRadiusOut: TypeAnimation<IGraphic>;
30
+ export declare class GworPointsBase extends ACustomAnimate<Record<string, number>> {
31
+ valid: boolean;
32
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
33
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
34
+ }
35
+ export declare class GrowRadiusIn extends GworPointsBase {
36
+ onBind(): void;
37
+ }
38
+ export declare class GrowRadiusOut extends GworPointsBase {
39
+ onBind(): void;
40
+ }
41
+ export {};
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.GrowRadiusOut = exports.GrowRadiusIn = exports.GworPointsBase = exports.growRadiusOut = exports.growRadiusIn = void 0;
6
+
7
+ const custom_animate_1 = require("./custom-animate"), vutils_1 = require("@visactor/vutils"), growRadiusInIndividual = (graphic, options, animationParameters) => {
8
+ const attrs = graphic.getFinalAttribute();
9
+ return options && "inside" === options.orient ? {
10
+ from: {
11
+ innerRadius: null == attrs ? void 0 : attrs.outerRadius
12
+ },
13
+ to: {
14
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius
15
+ }
16
+ } : {
17
+ from: {
18
+ outerRadius: null == attrs ? void 0 : attrs.innerRadius
19
+ },
20
+ to: {
21
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
22
+ }
23
+ };
24
+ }, growRadiusInOverall = (graphic, options, animationParameters) => {
25
+ const attrs = graphic.getFinalAttribute(), overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
26
+ return {
27
+ from: {
28
+ innerRadius: overallValue,
29
+ outerRadius: overallValue
30
+ },
31
+ to: {
32
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius,
33
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
34
+ }
35
+ };
36
+ }, growRadiusIn = (graphic, options, animationParameters) => {
37
+ var _a;
38
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusInOverall(graphic, options) : growRadiusInIndividual(graphic, options);
39
+ };
40
+
41
+ exports.growRadiusIn = growRadiusIn;
42
+
43
+ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
44
+ const attrs = graphic.getFinalAttribute();
45
+ return options && "inside" === options.orient ? {
46
+ from: {
47
+ innerRadius: graphic.getGraphicAttribute("innerRadius", !0)
48
+ },
49
+ to: {
50
+ innerRadius: null == attrs ? void 0 : attrs.outerRadius
51
+ }
52
+ } : {
53
+ from: {
54
+ outerRadius: graphic.getGraphicAttribute("outerRadius", !0)
55
+ },
56
+ to: {
57
+ outerRadius: null == attrs ? void 0 : attrs.innerRadius
58
+ }
59
+ };
60
+ }, growRadiusOutOverall = (graphic, options, animationParameters) => {
61
+ const overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
62
+ return {
63
+ from: {
64
+ innerRadius: graphic.getGraphicAttribute("innerRadius", !0),
65
+ outerRadius: graphic.getGraphicAttribute("outerRadius", !0)
66
+ },
67
+ to: {
68
+ innerRadius: overallValue,
69
+ outerRadius: overallValue
70
+ }
71
+ };
72
+ }, growRadiusOut = (graphic, options, animationParameters) => {
73
+ var _a;
74
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusOutOverall(graphic, options) : growRadiusOutIndividual(graphic, options);
75
+ };
76
+
77
+ exports.growRadiusOut = growRadiusOut;
78
+
79
+ class GworPointsBase extends custom_animate_1.ACustomAnimate {
80
+ constructor(from, to, duration, easing, params) {
81
+ super(from, to, duration, easing, params);
82
+ }
83
+ onUpdate(end, ratio, out) {
84
+ this.propKeys.forEach((key => {
85
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
86
+ })), this.target.setAttributes(out);
87
+ }
88
+ }
89
+
90
+ exports.GworPointsBase = GworPointsBase;
91
+
92
+ class GrowRadiusIn extends GworPointsBase {
93
+ onBind() {
94
+ var _a;
95
+ const {from: from, to: to} = (0, exports.growRadiusIn)(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
96
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
97
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
98
+ }
99
+ }
100
+
101
+ exports.GrowRadiusIn = GrowRadiusIn;
102
+
103
+ class GrowRadiusOut extends GworPointsBase {
104
+ onBind() {
105
+ var _a;
106
+ const {from: from, to: to} = (0, exports.growRadiusOut)(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
107
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
108
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
109
+ }
110
+ }
111
+
112
+ exports.GrowRadiusOut = GrowRadiusOut;
113
+ //# sourceMappingURL=growRadius.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/growRadius.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAClD,6CAA4C;AA2B5C,MAAM,sBAAsB,GAAG,CAC7B,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC1C,OAAO;YACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;YACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;SACxC,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;QACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;KACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC1B,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,YAAY,GAAG,IAAA,iBAAQ,EAA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AAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,mCAAI,IAAI,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;CACF;AAXD,sCAWC","file":"growRadius.js","sourcesContent":["import { type IGraphic, type IGroup } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\nimport { isNumber } from '@visactor/vutils';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nconst growRadiusInIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(graphic, options, animationParameters)\n : growRadiusInIndividual(graphic, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: graphic.getGraphicAttribute('innerRadius', true) },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: graphic.getGraphicAttribute('outerRadius', true) },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: graphic.getGraphicAttribute('innerRadius', true),\n outerRadius: graphic.getGraphicAttribute('outerRadius', true)\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(graphic, options, animationParameters)\n : growRadiusOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowRadiusIn extends GworPointsBase {\n onBind(): void {\n const { from, to } = growRadiusIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n }\n}\n\nexport class GrowRadiusOut extends GworPointsBase {\n onBind(): void {\n const { from, to } = growRadiusOut(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import type { IGraphic, IGroup } from '@visactor/vrender-core';
2
+ import type { IAnimate, IStep } from '../intreface/animate';
3
+ import type { EasingType } from '../intreface/easing';
4
+ import { ACustomAnimate } from './custom-animate';
5
+ interface IAnimationParameters {
6
+ width: number;
7
+ height: number;
8
+ group: IGroup;
9
+ elementIndex: number;
10
+ elementCount: number;
11
+ view: any;
12
+ }
13
+ type TypeAnimation<T extends IGraphic> = (graphic: T, options: any, animationParameters: IAnimationParameters) => {
14
+ from?: {
15
+ [channel: string]: any;
16
+ };
17
+ to?: {
18
+ [channel: string]: any;
19
+ };
20
+ };
21
+ export declare const growWidthOut: TypeAnimation<IGraphic>;
22
+ export declare class GrowWidthIn extends ACustomAnimate<Record<string, number>> {
23
+ valid: boolean;
24
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
25
+ onBind(): void;
26
+ onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
27
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
28
+ }
29
+ export declare class GrowWidthOut extends ACustomAnimate<Record<string, number>> {
30
+ valid: boolean;
31
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
32
+ onBind(): void;
33
+ onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
34
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
35
+ }
36
+ export {};
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.GrowWidthOut = exports.GrowWidthIn = exports.growWidthOut = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate");
8
+
9
+ function growWidthInIndividual(graphic, options, animationParameters) {
10
+ const attrs = graphic.getFinalAttribute(), x = attrs.x, x1 = attrs.x1, width = attrs.width;
11
+ if (options && "negative" === options.orient) {
12
+ const computedX1 = (0, vutils_1.isValid)(width) ? Math.max(x, x + width) : Math.max(x, x1);
13
+ return {
14
+ from: {
15
+ x: computedX1,
16
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : computedX1,
17
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
18
+ },
19
+ to: {
20
+ x: x,
21
+ x1: x1,
22
+ width: width
23
+ }
24
+ };
25
+ }
26
+ const computedX = (0, vutils_1.isValid)(width) ? Math.min(x, x + width) : Math.min(x, x1);
27
+ return {
28
+ from: {
29
+ x: computedX,
30
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : computedX,
31
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
32
+ },
33
+ to: {
34
+ x: x,
35
+ x1: x1,
36
+ width: width
37
+ }
38
+ };
39
+ }
40
+
41
+ function growWidthInOverall(graphic, options, animationParameters) {
42
+ var _a;
43
+ const attrs = graphic.getFinalAttribute(), x = attrs.x, x1 = attrs.x1, width = attrs.width;
44
+ let overallValue;
45
+ return options && "negative" === options.orient ? (0, vutils_1.isNumber)(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(),
46
+ animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = (0,
47
+ vutils_1.isNumber)(null == options ? void 0 : options.overall) ? null == options ? void 0 : options.overall : 0,
48
+ {
49
+ from: {
50
+ x: overallValue,
51
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : overallValue,
52
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
53
+ },
54
+ to: {
55
+ x: x,
56
+ x1: x1,
57
+ width: width
58
+ }
59
+ };
60
+ }
61
+
62
+ const growWidthIn = (graphic, options, animationParameters) => {
63
+ var _a;
64
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthInOverall(graphic, options, animationParameters) : growWidthInIndividual(graphic, options, animationParameters);
65
+ };
66
+
67
+ function growWidthOutIndividual(graphic, options, animationParameters) {
68
+ const attrs = graphic.getFinalAttribute(), x = attrs.x, x1 = attrs.x1, width = attrs.width;
69
+ if (options && "negative" === options.orient) {
70
+ const computedX1 = (0, vutils_1.isValid)(width) ? Math.max(x, x + width) : Math.max(x, x1);
71
+ return {
72
+ to: {
73
+ x: computedX1,
74
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : computedX1,
75
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
76
+ }
77
+ };
78
+ }
79
+ const computedX = (0, vutils_1.isValid)(width) ? Math.min(x, x + width) : Math.min(x, x1);
80
+ return {
81
+ to: {
82
+ x: computedX,
83
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : computedX,
84
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
85
+ }
86
+ };
87
+ }
88
+
89
+ function growWidthOutOverall(graphic, options, animationParameters) {
90
+ var _a;
91
+ const attrs = graphic.getFinalAttribute(), x1 = attrs.x1, width = attrs.width;
92
+ let overallValue;
93
+ return options && "negative" === options.orient ? (0, vutils_1.isNumber)(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(),
94
+ animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = (0,
95
+ vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0,
96
+ {
97
+ to: {
98
+ x: overallValue,
99
+ x1: (0, vutils_1.isNil)(x1) ? void 0 : overallValue,
100
+ width: (0, vutils_1.isNil)(width) ? void 0 : 0
101
+ }
102
+ };
103
+ }
104
+
105
+ const growWidthOut = (graphic, options, animationParameters) => {
106
+ var _a;
107
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthOutOverall(graphic, options, animationParameters) : growWidthOutIndividual(graphic, options, animationParameters);
108
+ };
109
+
110
+ exports.growWidthOut = growWidthOut;
111
+
112
+ class GrowWidthIn extends custom_animate_1.ACustomAnimate {
113
+ constructor(from, to, duration, easing, params) {
114
+ super(from, to, duration, easing, params);
115
+ }
116
+ onBind() {
117
+ var _a;
118
+ const {from: from, to: to} = growWidthIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
119
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
120
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
121
+ }
122
+ onEnd(cb) {
123
+ super.onEnd(cb);
124
+ }
125
+ onUpdate(end, ratio, out) {
126
+ this.propKeys.forEach((key => {
127
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
128
+ })), this.target.setAttributes(out);
129
+ }
130
+ }
131
+
132
+ exports.GrowWidthIn = GrowWidthIn;
133
+
134
+ class GrowWidthOut extends custom_animate_1.ACustomAnimate {
135
+ constructor(from, to, duration, easing, params) {
136
+ super(from, to, duration, easing, params);
137
+ }
138
+ onBind() {
139
+ const attrs = this.target.getFinalAttribute(), {from: from, to: to} = (0, exports.growWidthOut)(this.target, this.params.options, this.params);
140
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
141
+ this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
142
+ }
143
+ onEnd(cb) {
144
+ super.onEnd(cb);
145
+ }
146
+ onUpdate(end, ratio, out) {
147
+ this.propKeys.forEach((key => {
148
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
149
+ })), this.target.setAttributes(out);
150
+ }
151
+ }
152
+
153
+ exports.GrowWidthOut = GrowWidthOut;
154
+ //# sourceMappingURL=growWidth.js.map