@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,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.GrowAngleOut = exports.GrowAngleIn = exports.GworPointsBase = exports.growAngleOut = exports.growAngleIn = void 0;
6
+
7
+ const custom_animate_1 = require("./custom-animate"), vutils_1 = require("@visactor/vutils"), growAngleInIndividual = (graphic, options, animationParameters) => {
8
+ const attrs = graphic.getFinalAttribute();
9
+ return options && "anticlockwise" === options.orient ? {
10
+ from: {
11
+ startAngle: null == attrs ? void 0 : attrs.endAngle
12
+ },
13
+ to: {
14
+ startAngle: null == attrs ? void 0 : attrs.startAngle
15
+ }
16
+ } : {
17
+ from: {
18
+ endAngle: null == attrs ? void 0 : attrs.startAngle
19
+ },
20
+ to: {
21
+ endAngle: null == attrs ? void 0 : attrs.endAngle
22
+ }
23
+ };
24
+ }, growAngleInOverall = (graphic, options, animationParameters) => {
25
+ const attrs = graphic.getFinalAttribute();
26
+ if (options && "anticlockwise" === options.orient) {
27
+ const overallValue = (0, vutils_1.isNumber)(options.overall) ? options.overall : 2 * Math.PI;
28
+ return {
29
+ from: {
30
+ startAngle: overallValue,
31
+ endAngle: overallValue
32
+ },
33
+ to: {
34
+ startAngle: null == attrs ? void 0 : attrs.startAngle,
35
+ endAngle: null == attrs ? void 0 : attrs.endAngle
36
+ }
37
+ };
38
+ }
39
+ const overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
40
+ return {
41
+ from: {
42
+ startAngle: overallValue,
43
+ endAngle: overallValue
44
+ },
45
+ to: {
46
+ startAngle: null == attrs ? void 0 : attrs.startAngle,
47
+ endAngle: null == attrs ? void 0 : attrs.endAngle
48
+ }
49
+ };
50
+ }, growAngleIn = (graphic, options, animationParameters) => {
51
+ var _a;
52
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleInOverall(graphic, options) : growAngleInIndividual(graphic, options);
53
+ };
54
+
55
+ exports.growAngleIn = growAngleIn;
56
+
57
+ const growAngleOutIndividual = (graphic, options, animationParameters) => {
58
+ const attrs = graphic.getFinalAttribute();
59
+ return options && "anticlockwise" === options.orient ? {
60
+ from: {
61
+ startAngle: attrs.startAngle
62
+ },
63
+ to: {
64
+ startAngle: null == attrs ? void 0 : attrs.endAngle
65
+ }
66
+ } : {
67
+ from: {
68
+ endAngle: attrs.endAngle
69
+ },
70
+ to: {
71
+ endAngle: null == attrs ? void 0 : attrs.startAngle
72
+ }
73
+ };
74
+ }, growAngleOutOverall = (graphic, options, animationParameters) => {
75
+ const attrs = graphic.getFinalAttribute();
76
+ if (options && "anticlockwise" === options.orient) {
77
+ const overallValue = (0, vutils_1.isNumber)(options.overall) ? options.overall : 2 * Math.PI;
78
+ return {
79
+ from: {
80
+ startAngle: attrs.startAngle,
81
+ endAngle: attrs.endAngle
82
+ },
83
+ to: {
84
+ startAngle: overallValue,
85
+ endAngle: overallValue
86
+ }
87
+ };
88
+ }
89
+ const overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
90
+ return {
91
+ from: {
92
+ startAngle: attrs.startAngle,
93
+ endAngle: attrs.endAngle
94
+ },
95
+ to: {
96
+ startAngle: overallValue,
97
+ endAngle: overallValue
98
+ }
99
+ };
100
+ }, growAngleOut = (graphic, options, animationParameters) => {
101
+ var _a;
102
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleOutOverall(graphic, options) : growAngleOutIndividual(graphic, options);
103
+ };
104
+
105
+ exports.growAngleOut = growAngleOut;
106
+
107
+ class GworPointsBase extends custom_animate_1.ACustomAnimate {
108
+ constructor(from, to, duration, easing, params) {
109
+ super(from, to, duration, easing, params);
110
+ }
111
+ onUpdate(end, ratio, out) {
112
+ this.propKeys.forEach((key => {
113
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
114
+ })), this.target.setAttributes(out);
115
+ }
116
+ }
117
+
118
+ exports.GworPointsBase = GworPointsBase;
119
+
120
+ class GrowAngleIn extends GworPointsBase {
121
+ onBind() {
122
+ var _a;
123
+ const {from: from, to: to} = (0, exports.growAngleIn)(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
124
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
125
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
126
+ }
127
+ }
128
+
129
+ exports.GrowAngleIn = GrowAngleIn;
130
+
131
+ class GrowAngleOut extends GworPointsBase {
132
+ onBind() {
133
+ var _a;
134
+ const {from: from, to: to} = (0, exports.growAngleOut)(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
135
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
136
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
137
+ }
138
+ }
139
+
140
+ exports.GrowAngleOut = GrowAngleOut;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/growAngle.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAClD,6CAA4C;AAsB5C,MAAM,qBAAqB,GAAG,CAC5B,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE;YACrC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,EAAE;SACtC,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAA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AM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACjF,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,oCAWC","file":"growAngle.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\nconst growAngleInIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs?.endAngle },\n to: { startAngle: attrs?.startAngle }\n };\n }\n return {\n from: { endAngle: attrs?.startAngle },\n to: { endAngle: attrs?.endAngle }\n };\n};\n\nconst growAngleInOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n};\n\nexport const growAngleIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleInOverall(graphic, options, animationParameters)\n : growAngleInIndividual(graphic, options, animationParameters);\n};\n\nconst growAngleOutIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs.startAngle },\n to: { startAngle: attrs?.endAngle }\n };\n }\n return {\n from: { endAngle: attrs.endAngle },\n to: { endAngle: attrs?.startAngle }\n };\n};\n\nconst growAngleOutOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n};\n\nexport const growAngleOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleOutOverall(graphic, options, animationParameters)\n : growAngleOutIndividual(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 GrowAngleIn extends GworPointsBase {\n onBind(): void {\n const { from, to } = growAngleIn(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 GrowAngleOut extends GworPointsBase {\n onBind(): void {\n const { from, to } = growAngleOut(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,17 @@
1
+ import type { IAnimate, IStep } from '../intreface/animate';
2
+ import type { EasingType } from '../intreface/easing';
3
+ import { ACustomAnimate } from './custom-animate';
4
+ export declare class GrowCenterIn extends ACustomAnimate<Record<string, number>> {
5
+ valid: boolean;
6
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
7
+ onBind(): void;
8
+ onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
9
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
10
+ }
11
+ export declare class GrowCenterOut extends ACustomAnimate<Record<string, number>> {
12
+ valid: boolean;
13
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
14
+ onBind(): void;
15
+ onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
16
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
17
+ }
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.GrowCenterOut = exports.GrowCenterIn = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), growCenterIn = (graphic, options, animationParameters) => {
8
+ const attrs = graphic.getFinalAttribute();
9
+ switch (null == options ? void 0 : options.direction) {
10
+ case "x":
11
+ {
12
+ const x = attrs.x, x1 = attrs.x1, width = attrs.width;
13
+ return {
14
+ from: (0, vutils_1.isValid)(width) ? {
15
+ x: x + width / 2,
16
+ x1: void 0,
17
+ width: 0
18
+ } : {
19
+ x: (x + x1) / 2,
20
+ x1: (x + x1) / 2,
21
+ width: void 0
22
+ },
23
+ to: {
24
+ x: x,
25
+ x1: x1,
26
+ width: width
27
+ }
28
+ };
29
+ }
30
+
31
+ case "y":
32
+ {
33
+ const y = attrs.y, y1 = attrs.y1, height = attrs.height;
34
+ return {
35
+ from: (0, vutils_1.isValid)(height) ? {
36
+ y: y + height / 2,
37
+ y1: void 0,
38
+ height: 0
39
+ } : {
40
+ y: (y + y1) / 2,
41
+ y1: (y + y1) / 2,
42
+ height: void 0
43
+ },
44
+ to: {
45
+ y: y,
46
+ y1: y1,
47
+ height: height
48
+ }
49
+ };
50
+ }
51
+
52
+ default:
53
+ {
54
+ const x = attrs.x, x1 = attrs.x1, width = attrs.width, y = attrs.y, y1 = attrs.y1, height = attrs.height, from = {};
55
+ return (0, vutils_1.isValid)(width) ? (from.x = x + width / 2, from.width = 0, from.x1 = void 0) : (from.x = (x + x1) / 2,
56
+ from.x1 = (x + x1) / 2, from.width = void 0), (0, vutils_1.isValid)(height) ? (from.y = y + height / 2,
57
+ from.height = 0, from.y1 = void 0) : (from.y = (y + y1) / 2, from.y1 = (y + y1) / 2,
58
+ from.height = void 0), {
59
+ from: from,
60
+ to: {
61
+ x: x,
62
+ y: y,
63
+ x1: x1,
64
+ y1: y1,
65
+ width: width,
66
+ height: height
67
+ }
68
+ };
69
+ }
70
+ }
71
+ }, growCenterOut = (graphic, options, animationParameters) => {
72
+ const attrs = graphic.getFinalAttribute();
73
+ switch (null == options ? void 0 : options.direction) {
74
+ case "x":
75
+ {
76
+ const x = attrs.x, x1 = attrs.x1, width = attrs.width;
77
+ return {
78
+ to: (0, vutils_1.isValid)(width) ? {
79
+ x: x + width / 2,
80
+ x1: void 0,
81
+ width: 0
82
+ } : {
83
+ x: (x + x1) / 2,
84
+ x1: (x + x1) / 2,
85
+ width: void 0
86
+ }
87
+ };
88
+ }
89
+
90
+ case "y":
91
+ {
92
+ const y = attrs.y, y1 = attrs.y1, height = attrs.height;
93
+ return {
94
+ to: (0, vutils_1.isValid)(height) ? {
95
+ y: y + height / 2,
96
+ y1: void 0,
97
+ height: 0
98
+ } : {
99
+ y: (y + y1) / 2,
100
+ y1: (y + y1) / 2,
101
+ height: void 0
102
+ }
103
+ };
104
+ }
105
+
106
+ default:
107
+ {
108
+ const x = attrs.x, y = attrs.y, x1 = attrs.x1, y1 = attrs.y1, width = attrs.width, height = attrs.height, to = {};
109
+ return (0, vutils_1.isValid)(width) ? (to.x = x + width / 2, to.width = 0, to.x1 = void 0) : (to.x = (x + x1) / 2,
110
+ to.x1 = (x + x1) / 2, to.width = void 0), (0, vutils_1.isValid)(height) ? (to.y = y + height / 2,
111
+ to.height = 0, to.y1 = void 0) : (to.y = (y + y1) / 2, to.y1 = (y + y1) / 2, to.height = void 0),
112
+ {
113
+ to: to
114
+ };
115
+ }
116
+ }
117
+ };
118
+
119
+ class GrowCenterIn extends custom_animate_1.ACustomAnimate {
120
+ constructor(from, to, duration, easing, params) {
121
+ super(from, to, duration, easing, params);
122
+ }
123
+ onBind() {
124
+ var _a;
125
+ const {from: from, to: to} = growCenterIn(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
+ }
129
+ onEnd(cb) {
130
+ super.onEnd(cb);
131
+ }
132
+ onUpdate(end, ratio, out) {
133
+ this.propKeys.forEach((key => {
134
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
135
+ })), this.target.setAttributes(out);
136
+ }
137
+ }
138
+
139
+ exports.GrowCenterIn = GrowCenterIn;
140
+
141
+ class GrowCenterOut extends custom_animate_1.ACustomAnimate {
142
+ constructor(from, to, duration, easing, params) {
143
+ super(from, to, duration, easing, params);
144
+ }
145
+ onBind() {
146
+ const attrs = this.target.getFinalAttribute(), {from: from, to: to} = growCenterOut(this.target, this.params.options, this.params);
147
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
148
+ this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
149
+ }
150
+ onEnd(cb) {
151
+ super.onEnd(cb);
152
+ }
153
+ onUpdate(end, ratio, out) {
154
+ this.propKeys.forEach((key => {
155
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
156
+ })), this.target.setAttributes(out);
157
+ }
158
+ }
159
+
160
+ exports.GrowCenterOut = GrowCenterOut;
161
+ //# sourceMappingURL=growCenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/growCenter.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAG3C,qDAAkD;AAuBlD,MAAM,YAAY,GAA4B,CAC5C,OAAiB,EACjB,OAAuC,EACvC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,QAAQ,OAAO,aAAP,OAAO,u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C,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AA5BD,sCA4BC","file":"growCenter.js","sourcesContent":["import type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isValid } from '@visactor/vutils';\nimport type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\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\nconst growCenterIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n from: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n },\n to: { x, x1, width }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n from: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n },\n to: { y, y1, height }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n const from: any = {};\n\n if (isValid(width)) {\n from.x = x + width / 2;\n from.width = 0;\n from.x1 = undefined;\n } else {\n from.x = (x + x1) / 2;\n from.x1 = (x + x1) / 2;\n from.width = undefined;\n }\n\n if (isValid(height)) {\n from.y = y + height / 2;\n from.height = 0;\n from.y1 = undefined;\n } else {\n from.y = (y + y1) / 2;\n from.y1 = (y + y1) / 2;\n from.height = undefined;\n }\n\n return {\n from,\n to: { x, y, x1, y1, width, height }\n };\n }\n }\n};\n\nconst growCenterOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n to: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n to: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const y = attrs.y;\n const x1 = attrs.x1;\n const y1 = attrs.y1;\n const width = attrs.width;\n const height = attrs.height;\n const to: any = {};\n\n if (isValid(width)) {\n to.x = x + width / 2;\n to.width = 0;\n to.x1 = undefined;\n } else {\n to.x = (x + x1) / 2;\n to.x1 = (x + x1) / 2;\n to.width = undefined;\n }\n\n if (isValid(height)) {\n to.y = y + height / 2;\n to.height = 0;\n to.y1 = undefined;\n } else {\n to.y = (y + y1) / 2;\n to.y1 = (y + y1) / 2;\n to.height = undefined;\n }\n\n return {\n to\n };\n }\n }\n};\n\n/**\n * 增长渐入\n */\nexport class GrowCenterIn 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 onBind(): void {\n const { from, to } = growCenterIn(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 onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\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\nexport class GrowCenterOut 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 onBind(): void {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growCenterOut(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 // this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\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"]}
@@ -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 class GrowHeightIn extends ACustomAnimate<Record<string, number>> {
22
+ valid: boolean;
23
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
24
+ onBind(): void;
25
+ onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
26
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
27
+ }
28
+ export declare const growHeightOut: TypeAnimation<IGraphic>;
29
+ export declare class GrowHeightOut 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.GrowHeightOut = exports.growHeightOut = exports.GrowHeightIn = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate");
8
+
9
+ function growHeightInIndividual(graphic, options, animationParameters) {
10
+ const attrs = graphic.getFinalAttribute(), y = attrs.y, y1 = attrs.y1, height = attrs.height;
11
+ if (options && "negative" === options.orient) {
12
+ const computedY1 = (0, vutils_1.isValid)(height) ? Math.max(y, y + height) : Math.max(y, y1);
13
+ return {
14
+ from: {
15
+ y: computedY1,
16
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : computedY1,
17
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
18
+ },
19
+ to: {
20
+ y: y,
21
+ y1: y1,
22
+ height: height
23
+ }
24
+ };
25
+ }
26
+ const computedY = (0, vutils_1.isValid)(height) ? Math.min(y, y + height) : Math.min(y, y1);
27
+ return {
28
+ from: {
29
+ y: computedY,
30
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : computedY,
31
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
32
+ },
33
+ to: {
34
+ y: y,
35
+ y1: y1,
36
+ height: height
37
+ }
38
+ };
39
+ }
40
+
41
+ function growHeightInOverall(graphic, options, animationParameters) {
42
+ var _a;
43
+ const attrs = graphic.getFinalAttribute(), y = attrs.y, y1 = attrs.y1, height = attrs.height;
44
+ let overallValue;
45
+ return options && "negative" === options.orient ? (0, vutils_1.isNumber)(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : animationParameters.group.getBounds().height(),
46
+ animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = (0,
47
+ vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0,
48
+ {
49
+ from: {
50
+ y: overallValue,
51
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : overallValue,
52
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
53
+ },
54
+ to: {
55
+ y: y,
56
+ y1: y1,
57
+ height: height
58
+ }
59
+ };
60
+ }
61
+
62
+ const growHeightIn = (graphic, options, animationParameters) => {
63
+ var _a;
64
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growHeightInOverall(graphic, options, animationParameters) : growHeightInIndividual(graphic, options, animationParameters);
65
+ };
66
+
67
+ class GrowHeightIn extends custom_animate_1.ACustomAnimate {
68
+ constructor(from, to, duration, easing, params) {
69
+ super(from, to, duration, easing, params);
70
+ }
71
+ onBind() {
72
+ var _a;
73
+ const {from: from, to: to} = growHeightIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
74
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
75
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
76
+ }
77
+ onEnd(cb) {
78
+ super.onEnd(cb);
79
+ }
80
+ onUpdate(end, ratio, out) {
81
+ this.propKeys.forEach((key => {
82
+ out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
83
+ })), this.target.setAttributes(out);
84
+ }
85
+ }
86
+
87
+ function growHeightOutIndividual(graphic, options, animationParameters) {
88
+ const attrs = graphic.getFinalAttribute(), y = attrs.y, y1 = attrs.y1, height = attrs.height;
89
+ if (options && "negative" === options.orient) {
90
+ const computedY1 = (0, vutils_1.isValid)(height) ? Math.max(y, y + height) : Math.max(y, y1);
91
+ return {
92
+ to: {
93
+ y: computedY1,
94
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : computedY1,
95
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
96
+ }
97
+ };
98
+ }
99
+ const computedY = (0, vutils_1.isValid)(height) ? Math.min(y, y + height) : Math.min(y, y1);
100
+ return {
101
+ to: {
102
+ y: computedY,
103
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : computedY,
104
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
105
+ }
106
+ };
107
+ }
108
+
109
+ function growHeightOutOverall(graphic, options, animationParameters) {
110
+ var _a;
111
+ const attrs = graphic.getFinalAttribute(), y1 = attrs.y1, height = attrs.height;
112
+ let overallValue;
113
+ return options && "negative" === options.orient ? (0, vutils_1.isNumber)(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : animationParameters.group.getBounds().height(),
114
+ animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = (0,
115
+ vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0,
116
+ {
117
+ to: {
118
+ y: overallValue,
119
+ y1: (0, vutils_1.isNil)(y1) ? void 0 : overallValue,
120
+ height: (0, vutils_1.isNil)(height) ? void 0 : 0
121
+ }
122
+ };
123
+ }
124
+
125
+ exports.GrowHeightIn = GrowHeightIn;
126
+
127
+ const growHeightOut = (graphic, options, animationParameters) => {
128
+ var _a;
129
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growHeightOutOverall(graphic, options, animationParameters) : growHeightOutIndividual(graphic, options, animationParameters);
130
+ };
131
+
132
+ exports.growHeightOut = growHeightOut;
133
+
134
+ class GrowHeightOut 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.growHeightOut)(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.GrowHeightOut = GrowHeightOut;
154
+ //# sourceMappingURL=growHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/growHeight.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAG5D,qDAAkD;AAuBlD,SAAS,sBAAsB,CAC7B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG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I,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClF,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,IAAI,IAAI,KAAK,CAAC;QAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;IAED,KAAK,CAAC,EAA6C;QACjD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AA5BD,sCA4BC","file":"growHeight.js","sourcesContent":["import type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isNil, isNumber, isValid } from '@visactor/vutils';\nimport type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\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\nfunction growHeightInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n return {\n from: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n from: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nfunction growHeightInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n from: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nconst growHeightIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightInOverall(graphic, options, animationParameters)\n : growHeightInIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowHeightIn 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 onBind(): void {\n const { from, to } = growHeightIn(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 onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\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\nfunction growHeightOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n\n return {\n to: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n to: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 }\n };\n}\n\nfunction growHeightOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y1 = attrs.y1;\n const height = attrs.height;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 }\n };\n}\n\n/**\n * 增长渐出\n */\nexport const growHeightOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightOutOverall(graphic, options, animationParameters)\n : growHeightOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowHeightOut 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 onBind(): void {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growHeightOut(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 // this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\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"]}
@@ -0,0 +1,52 @@
1
+ import { type IGraphic, type IGroup } from '@visactor/vrender-core';
2
+ import type { IPointLike } from '@visactor/vutils';
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 interface IGrowPointsAnimationOptions {
22
+ orient?: 'positive' | 'negative';
23
+ }
24
+ export interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {
25
+ center?: IPointLike;
26
+ }
27
+ export declare const growPointsIn: TypeAnimation<IGraphic>;
28
+ export declare const growPointsOut: TypeAnimation<IGraphic>;
29
+ export declare class GworPointsBase extends ACustomAnimate<Record<string, number>> {
30
+ valid: boolean;
31
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
32
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
33
+ }
34
+ export declare class GrowPointsIn extends GworPointsBase {
35
+ onBind(): void;
36
+ }
37
+ export declare class GrowPointsOut extends GworPointsBase {
38
+ onBind(): void;
39
+ }
40
+ export declare class GrowPointsXIn extends GworPointsBase {
41
+ onBind(): void;
42
+ }
43
+ export declare class GrowPointsXOut extends GworPointsBase {
44
+ onBind(): void;
45
+ }
46
+ export declare class GrowPointsYIn extends GworPointsBase {
47
+ onBind(): void;
48
+ }
49
+ export declare class GrowPointsYOut extends GworPointsBase {
50
+ onBind(): void;
51
+ }
52
+ export {};