@visactor/vrender-animate 0.22.4 → 0.22.12

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 (376) hide show
  1. package/cjs/animate-extension.d.ts +12 -5
  2. package/cjs/animate-extension.js +23 -12
  3. package/cjs/animate-extension.js.map +1 -1
  4. package/cjs/animate.d.ts +2 -5
  5. package/cjs/animate.js +23 -18
  6. package/cjs/animate.js.map +1 -1
  7. package/cjs/component/component-animate-extension.d.ts +1 -0
  8. package/cjs/component/component-animate-extension.js +1 -0
  9. package/cjs/component/component-animate-extension.js.map +1 -0
  10. package/cjs/component/component-animator.d.ts +22 -0
  11. package/cjs/component/component-animator.js +67 -0
  12. package/cjs/component/component-animator.js.map +1 -0
  13. package/cjs/component/index.d.ts +1 -0
  14. package/cjs/component/index.js +21 -0
  15. package/cjs/component/index.js.map +1 -0
  16. package/cjs/config/morphing.d.ts +2 -0
  17. package/cjs/config/morphing.js +9 -0
  18. package/cjs/config/morphing.js.map +1 -0
  19. package/cjs/custom/clip-graphic.d.ts +1 -1
  20. package/cjs/custom/clip-graphic.js +2 -2
  21. package/cjs/custom/clip-graphic.js.map +1 -1
  22. package/cjs/custom/clip.d.ts +2 -1
  23. package/cjs/custom/clip.js +9 -1
  24. package/cjs/custom/clip.js.map +1 -1
  25. package/cjs/custom/common.d.ts +1 -3
  26. package/cjs/custom/common.js +21 -17
  27. package/cjs/custom/common.js.map +1 -1
  28. package/cjs/custom/custom-animate.d.ts +7 -3
  29. package/cjs/custom/custom-animate.js +13 -2
  30. package/cjs/custom/custom-animate.js.map +1 -1
  31. package/cjs/custom/fade.d.ts +1 -1
  32. package/cjs/custom/fade.js +7 -2
  33. package/cjs/custom/fade.js.map +1 -1
  34. package/cjs/custom/fromTo.d.ts +10 -0
  35. package/cjs/custom/fromTo.js +42 -0
  36. package/cjs/custom/fromTo.js.map +1 -0
  37. package/cjs/custom/groupFade.d.ts +10 -0
  38. package/cjs/custom/groupFade.js +25 -0
  39. package/cjs/custom/groupFade.js.map +1 -0
  40. package/cjs/custom/growAngle.d.ts +10 -5
  41. package/cjs/custom/growAngle.js +38 -17
  42. package/cjs/custom/growAngle.js.map +1 -1
  43. package/cjs/custom/growCenter.d.ts +1 -2
  44. package/cjs/custom/growCenter.js +16 -10
  45. package/cjs/custom/growCenter.js.map +1 -1
  46. package/cjs/custom/growHeight.d.ts +1 -3
  47. package/cjs/custom/growHeight.js +19 -13
  48. package/cjs/custom/growHeight.js.map +1 -1
  49. package/cjs/custom/growPoints.d.ts +1 -2
  50. package/cjs/custom/growPoints.js +41 -36
  51. package/cjs/custom/growPoints.js.map +1 -1
  52. package/cjs/custom/growRadius.d.ts +4 -5
  53. package/cjs/custom/growRadius.js +22 -18
  54. package/cjs/custom/growRadius.js.map +1 -1
  55. package/cjs/custom/growWidth.d.ts +1 -3
  56. package/cjs/custom/growWidth.js +15 -9
  57. package/cjs/custom/growWidth.js.map +1 -1
  58. package/cjs/custom/input-text.d.ts +1 -2
  59. package/cjs/custom/input-text.js.map +1 -1
  60. package/cjs/custom/label-item-animate.d.ts +7 -0
  61. package/cjs/custom/label-item-animate.js +221 -0
  62. package/cjs/custom/label-item-animate.js.map +1 -0
  63. package/cjs/custom/morphing.d.ts +51 -0
  64. package/cjs/custom/morphing.js +298 -0
  65. package/cjs/custom/morphing.js.map +1 -0
  66. package/cjs/custom/motionPath.d.ts +21 -0
  67. package/cjs/custom/motionPath.js +31 -0
  68. package/cjs/custom/motionPath.js.map +1 -0
  69. package/cjs/custom/move.d.ts +96 -0
  70. package/cjs/custom/move.js +133 -0
  71. package/cjs/custom/move.js.map +1 -0
  72. package/cjs/custom/number.d.ts +1 -2
  73. package/cjs/custom/number.js.map +1 -1
  74. package/cjs/custom/poptip-animate.d.ts +7 -0
  75. package/cjs/custom/poptip-animate.js +109 -0
  76. package/cjs/custom/poptip-animate.js.map +1 -0
  77. package/cjs/custom/register.d.ts +27 -0
  78. package/cjs/custom/register.js +418 -3
  79. package/cjs/custom/register.js.map +1 -1
  80. package/cjs/custom/richtext/input-richtext.d.ts +35 -0
  81. package/cjs/custom/richtext/input-richtext.js +80 -0
  82. package/cjs/custom/richtext/input-richtext.js.map +1 -0
  83. package/cjs/custom/richtext/output-richtext.d.ts +37 -0
  84. package/cjs/custom/richtext/output-richtext.js +94 -0
  85. package/cjs/custom/richtext/output-richtext.js.map +1 -0
  86. package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
  87. package/cjs/custom/richtext/slide-out-richtext.js +146 -0
  88. package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
  89. package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
  90. package/cjs/custom/richtext/slide-richtext.js +144 -0
  91. package/cjs/custom/richtext/slide-richtext.js.map +1 -0
  92. package/cjs/custom/rotate.d.ts +33 -0
  93. package/cjs/custom/rotate.js +79 -0
  94. package/cjs/custom/rotate.js.map +1 -0
  95. package/cjs/custom/scale.d.ts +6 -2
  96. package/cjs/custom/scale.js +32 -17
  97. package/cjs/custom/scale.js.map +1 -1
  98. package/cjs/custom/sphere.d.ts +2 -1
  99. package/cjs/custom/sphere.js +14 -5
  100. package/cjs/custom/sphere.js.map +1 -1
  101. package/cjs/custom/state.d.ts +1 -1
  102. package/cjs/custom/state.js +1 -1
  103. package/cjs/custom/state.js.map +1 -1
  104. package/cjs/custom/story.d.ts +196 -0
  105. package/cjs/custom/story.js +497 -0
  106. package/cjs/custom/story.js.map +1 -0
  107. package/cjs/custom/streamLight.d.ts +27 -0
  108. package/cjs/custom/streamLight.js +161 -0
  109. package/cjs/custom/streamLight.js.map +1 -0
  110. package/cjs/custom/tag-points.d.ts +2 -3
  111. package/cjs/custom/tag-points.js +20 -4
  112. package/cjs/custom/tag-points.js.map +1 -1
  113. package/cjs/custom/update.d.ts +2 -2
  114. package/cjs/custom/update.js +10 -2
  115. package/cjs/custom/update.js.map +1 -1
  116. package/cjs/executor/animate-executor.d.ts +7 -6
  117. package/cjs/executor/animate-executor.js +118 -62
  118. package/cjs/executor/animate-executor.js.map +1 -1
  119. package/cjs/executor/executor.d.ts +9 -3
  120. package/cjs/executor/executor.js.map +1 -1
  121. package/cjs/index.d.ts +8 -8
  122. package/cjs/index.js +50 -18
  123. package/cjs/index.js.map +1 -1
  124. package/cjs/interpolate/store.d.ts +6 -2
  125. package/cjs/interpolate/store.js +13 -2
  126. package/cjs/interpolate/store.js.map +1 -1
  127. package/cjs/register.js +1 -5
  128. package/cjs/register.js.map +1 -1
  129. package/cjs/state/animation-state.d.ts +20 -2
  130. package/cjs/state/animation-state.js +48 -4
  131. package/cjs/state/animation-state.js.map +1 -1
  132. package/cjs/state/animation-states-registry.js +18 -0
  133. package/cjs/state/animation-states-registry.js.map +1 -1
  134. package/cjs/state/graphic-extension.d.ts +7 -1
  135. package/cjs/state/graphic-extension.js +20 -0
  136. package/cjs/state/graphic-extension.js.map +1 -1
  137. package/cjs/step.d.ts +7 -4
  138. package/cjs/step.js +33 -15
  139. package/cjs/step.js.map +1 -1
  140. package/cjs/ticker/default-ticker.d.ts +12 -7
  141. package/cjs/ticker/default-ticker.js +38 -33
  142. package/cjs/ticker/default-ticker.js.map +1 -1
  143. package/cjs/ticker/manual-ticker.d.ts +6 -1
  144. package/cjs/ticker/manual-ticker.js +26 -4
  145. package/cjs/ticker/manual-ticker.js.map +1 -1
  146. package/cjs/timeline.d.ts +14 -7
  147. package/cjs/timeline.js +31 -18
  148. package/cjs/timeline.js.map +1 -1
  149. package/cjs/utils/transform.d.ts +2 -0
  150. package/cjs/utils/transform.js +10 -0
  151. package/cjs/utils/transform.js.map +1 -0
  152. package/dist/index.es.js +3765 -527
  153. package/es/animate-extension.d.ts +12 -5
  154. package/es/animate-extension.js +24 -11
  155. package/es/animate-extension.js.map +1 -1
  156. package/es/animate.d.ts +2 -5
  157. package/es/animate.js +14 -11
  158. package/es/animate.js.map +1 -1
  159. package/es/component/component-animate-extension.d.ts +1 -0
  160. package/es/component/component-animate-extension.js +1 -0
  161. package/es/component/component-animate-extension.js.map +1 -0
  162. package/es/component/component-animator.d.ts +22 -0
  163. package/es/component/component-animator.js +59 -0
  164. package/es/component/component-animator.js.map +1 -0
  165. package/es/component/index.d.ts +1 -0
  166. package/es/component/index.js +2 -0
  167. package/es/component/index.js.map +1 -0
  168. package/es/config/morphing.d.ts +2 -0
  169. package/es/config/morphing.js +5 -0
  170. package/es/config/morphing.js.map +1 -0
  171. package/es/custom/clip-graphic.d.ts +1 -1
  172. package/es/custom/clip-graphic.js +2 -2
  173. package/es/custom/clip-graphic.js.map +1 -1
  174. package/es/custom/clip.d.ts +2 -1
  175. package/es/custom/clip.js +9 -1
  176. package/es/custom/clip.js.map +1 -1
  177. package/es/custom/common.d.ts +1 -3
  178. package/es/custom/common.js +21 -17
  179. package/es/custom/common.js.map +1 -1
  180. package/es/custom/custom-animate.d.ts +7 -3
  181. package/es/custom/custom-animate.js +10 -1
  182. package/es/custom/custom-animate.js.map +1 -1
  183. package/es/custom/fade.d.ts +1 -1
  184. package/es/custom/fade.js +7 -2
  185. package/es/custom/fade.js.map +1 -1
  186. package/es/custom/fromTo.d.ts +10 -0
  187. package/es/custom/fromTo.js +34 -0
  188. package/es/custom/fromTo.js.map +1 -0
  189. package/es/custom/groupFade.d.ts +10 -0
  190. package/es/custom/groupFade.js +15 -0
  191. package/es/custom/groupFade.js.map +1 -0
  192. package/es/custom/growAngle.d.ts +10 -5
  193. package/es/custom/growAngle.js +39 -15
  194. package/es/custom/growAngle.js.map +1 -1
  195. package/es/custom/growCenter.d.ts +1 -2
  196. package/es/custom/growCenter.js +16 -10
  197. package/es/custom/growCenter.js.map +1 -1
  198. package/es/custom/growHeight.d.ts +1 -3
  199. package/es/custom/growHeight.js +20 -14
  200. package/es/custom/growHeight.js.map +1 -1
  201. package/es/custom/growPoints.d.ts +1 -2
  202. package/es/custom/growPoints.js +40 -36
  203. package/es/custom/growPoints.js.map +1 -1
  204. package/es/custom/growRadius.d.ts +4 -5
  205. package/es/custom/growRadius.js +22 -16
  206. package/es/custom/growRadius.js.map +1 -1
  207. package/es/custom/growWidth.d.ts +1 -3
  208. package/es/custom/growWidth.js +16 -10
  209. package/es/custom/growWidth.js.map +1 -1
  210. package/es/custom/input-text.d.ts +1 -2
  211. package/es/custom/input-text.js.map +1 -1
  212. package/es/custom/label-item-animate.d.ts +7 -0
  213. package/es/custom/label-item-animate.js +215 -0
  214. package/es/custom/label-item-animate.js.map +1 -0
  215. package/es/custom/morphing.d.ts +51 -0
  216. package/es/custom/morphing.js +289 -0
  217. package/es/custom/morphing.js.map +1 -0
  218. package/es/custom/motionPath.d.ts +21 -0
  219. package/es/custom/motionPath.js +23 -0
  220. package/es/custom/motionPath.js.map +1 -0
  221. package/es/custom/move.d.ts +96 -0
  222. package/es/custom/move.js +118 -0
  223. package/es/custom/move.js.map +1 -0
  224. package/es/custom/number.d.ts +1 -2
  225. package/es/custom/number.js.map +1 -1
  226. package/es/custom/poptip-animate.d.ts +7 -0
  227. package/es/custom/poptip-animate.js +103 -0
  228. package/es/custom/poptip-animate.js.map +1 -0
  229. package/es/custom/register.d.ts +27 -0
  230. package/es/custom/register.js +48 -1
  231. package/es/custom/register.js.map +1 -1
  232. package/es/custom/richtext/input-richtext.d.ts +35 -0
  233. package/es/custom/richtext/input-richtext.js +74 -0
  234. package/es/custom/richtext/input-richtext.js.map +1 -0
  235. package/es/custom/richtext/output-richtext.d.ts +37 -0
  236. package/es/custom/richtext/output-richtext.js +88 -0
  237. package/es/custom/richtext/output-richtext.js.map +1 -0
  238. package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
  239. package/es/custom/richtext/slide-out-richtext.js +140 -0
  240. package/es/custom/richtext/slide-out-richtext.js.map +1 -0
  241. package/es/custom/richtext/slide-richtext.d.ts +36 -0
  242. package/es/custom/richtext/slide-richtext.js +138 -0
  243. package/es/custom/richtext/slide-richtext.js.map +1 -0
  244. package/es/custom/rotate.d.ts +33 -0
  245. package/es/custom/rotate.js +65 -0
  246. package/es/custom/rotate.js.map +1 -0
  247. package/es/custom/scale.d.ts +6 -2
  248. package/es/custom/scale.js +32 -17
  249. package/es/custom/scale.js.map +1 -1
  250. package/es/custom/sphere.d.ts +2 -1
  251. package/es/custom/sphere.js +14 -5
  252. package/es/custom/sphere.js.map +1 -1
  253. package/es/custom/state.d.ts +1 -1
  254. package/es/custom/state.js +1 -1
  255. package/es/custom/state.js.map +1 -1
  256. package/es/custom/story.d.ts +196 -0
  257. package/es/custom/story.js +468 -0
  258. package/es/custom/story.js.map +1 -0
  259. package/es/custom/streamLight.d.ts +27 -0
  260. package/es/custom/streamLight.js +157 -0
  261. package/es/custom/streamLight.js.map +1 -0
  262. package/es/custom/tag-points.d.ts +2 -3
  263. package/es/custom/tag-points.js +21 -5
  264. package/es/custom/tag-points.js.map +1 -1
  265. package/es/custom/update.d.ts +2 -2
  266. package/es/custom/update.js +10 -2
  267. package/es/custom/update.js.map +1 -1
  268. package/es/executor/animate-executor.d.ts +7 -6
  269. package/es/executor/animate-executor.js +116 -61
  270. package/es/executor/animate-executor.js.map +1 -1
  271. package/es/executor/executor.d.ts +9 -3
  272. package/es/executor/executor.js.map +1 -1
  273. package/es/index.d.ts +8 -8
  274. package/es/index.js +10 -12
  275. package/es/index.js.map +1 -1
  276. package/es/interpolate/store.d.ts +6 -2
  277. package/es/interpolate/store.js +13 -3
  278. package/es/interpolate/store.js.map +1 -1
  279. package/es/register.js +0 -8
  280. package/es/register.js.map +1 -1
  281. package/es/state/animation-state.d.ts +20 -2
  282. package/es/state/animation-state.js +48 -2
  283. package/es/state/animation-state.js.map +1 -1
  284. package/es/state/animation-states-registry.js +18 -0
  285. package/es/state/animation-states-registry.js.map +1 -1
  286. package/es/state/graphic-extension.d.ts +7 -1
  287. package/es/state/graphic-extension.js +20 -0
  288. package/es/state/graphic-extension.js.map +1 -1
  289. package/es/step.d.ts +7 -4
  290. package/es/step.js +34 -16
  291. package/es/step.js.map +1 -1
  292. package/es/ticker/default-ticker.d.ts +12 -7
  293. package/es/ticker/default-ticker.js +30 -27
  294. package/es/ticker/default-ticker.js.map +1 -1
  295. package/es/ticker/manual-ticker.d.ts +6 -1
  296. package/es/ticker/manual-ticker.js +27 -3
  297. package/es/ticker/manual-ticker.js.map +1 -1
  298. package/es/timeline.d.ts +14 -7
  299. package/es/timeline.js +33 -18
  300. package/es/timeline.js.map +1 -1
  301. package/es/utils/transform.d.ts +2 -0
  302. package/es/utils/transform.js +4 -0
  303. package/es/utils/transform.js.map +1 -0
  304. package/package.json +16 -16
  305. package/cjs/custom/group-fade.d.ts +0 -16
  306. package/cjs/custom/group-fade.js +0 -66
  307. package/cjs/custom/group-fade.js.map +0 -1
  308. package/cjs/custom/scale-in.d.ts +0 -13
  309. package/cjs/custom/scale-in.js +0 -57
  310. package/cjs/custom/scale-in.js.map +0 -1
  311. package/cjs/interpolate/executor.d.ts +0 -66
  312. package/cjs/interpolate/executor.js +0 -6
  313. package/cjs/interpolate/executor.js.map +0 -1
  314. package/cjs/intreface/animate.d.ts +0 -91
  315. package/cjs/intreface/animate.js +0 -10
  316. package/cjs/intreface/animate.js.map +0 -1
  317. package/cjs/intreface/easing.d.ts +0 -3
  318. package/cjs/intreface/easing.js +0 -6
  319. package/cjs/intreface/easing.js.map +0 -1
  320. package/cjs/intreface/state.d.ts +0 -35
  321. package/cjs/intreface/state.js +0 -6
  322. package/cjs/intreface/state.js.map +0 -1
  323. package/cjs/intreface/ticker.d.ts +0 -37
  324. package/cjs/intreface/ticker.js +0 -10
  325. package/cjs/intreface/ticker.js.map +0 -1
  326. package/cjs/intreface/timeline.d.ts +0 -17
  327. package/cjs/intreface/timeline.js +0 -6
  328. package/cjs/intreface/timeline.js.map +0 -1
  329. package/cjs/intreface/type.d.ts +0 -13
  330. package/cjs/intreface/type.js +0 -15
  331. package/cjs/intreface/type.js.map +0 -1
  332. package/cjs/state/animation-state-machine.d.ts +0 -22
  333. package/cjs/state/animation-state-machine.js +0 -53
  334. package/cjs/state/animation-state-machine.js.map +0 -1
  335. package/cjs/state/animation-state-queue.d.ts +0 -24
  336. package/cjs/state/animation-state-queue.js +0 -66
  337. package/cjs/state/animation-state-queue.js.map +0 -1
  338. package/cjs/state/animation-state-registry.d.ts +0 -14
  339. package/cjs/state/animation-state-registry.js +0 -53
  340. package/cjs/state/animation-state-registry.js.map +0 -1
  341. package/es/custom/group-fade.d.ts +0 -16
  342. package/es/custom/group-fade.js +0 -56
  343. package/es/custom/group-fade.js.map +0 -1
  344. package/es/custom/scale-in.d.ts +0 -13
  345. package/es/custom/scale-in.js +0 -49
  346. package/es/custom/scale-in.js.map +0 -1
  347. package/es/interpolate/executor.d.ts +0 -66
  348. package/es/interpolate/executor.js +0 -2
  349. package/es/interpolate/executor.js.map +0 -1
  350. package/es/intreface/animate.d.ts +0 -91
  351. package/es/intreface/animate.js +0 -6
  352. package/es/intreface/animate.js.map +0 -1
  353. package/es/intreface/easing.d.ts +0 -3
  354. package/es/intreface/easing.js +0 -2
  355. package/es/intreface/easing.js.map +0 -1
  356. package/es/intreface/state.d.ts +0 -35
  357. package/es/intreface/state.js +0 -2
  358. package/es/intreface/state.js.map +0 -1
  359. package/es/intreface/ticker.d.ts +0 -37
  360. package/es/intreface/ticker.js +0 -6
  361. package/es/intreface/ticker.js.map +0 -1
  362. package/es/intreface/timeline.d.ts +0 -17
  363. package/es/intreface/timeline.js +0 -2
  364. package/es/intreface/timeline.js.map +0 -1
  365. package/es/intreface/type.d.ts +0 -13
  366. package/es/intreface/type.js +0 -14
  367. package/es/intreface/type.js.map +0 -1
  368. package/es/state/animation-state-machine.d.ts +0 -22
  369. package/es/state/animation-state-machine.js +0 -47
  370. package/es/state/animation-state-machine.js.map +0 -1
  371. package/es/state/animation-state-queue.d.ts +0 -24
  372. package/es/state/animation-state-queue.js +0 -58
  373. package/es/state/animation-state-queue.js.map +0 -1
  374. package/es/state/animation-state-registry.d.ts +0 -14
  375. package/es/state/animation-state-registry.js +0 -45
  376. package/es/state/animation-state-registry.js.map +0 -1
@@ -0,0 +1,289 @@
1
+ import { splitArc, splitCircle, splitLine, splitRect, splitPolygon, splitArea, splitPath, CustomPath2D, application, interpolateColor, ColorStore, ColorType, alignBezierCurves, applyTransformOnBezierCurves, findBestMorphingRotation, pathToBezierCurves, AttributeUpdateType } from "@visactor/vrender-core";
2
+
3
+ import { isArray, isNil } from "@visactor/vutils";
4
+
5
+ import { ACustomAnimate } from "./custom-animate";
6
+
7
+ import { DefaultMorphingAnimateConfig } from "../config/morphing";
8
+
9
+ import { isTransformKey } from "../utils/transform";
10
+
11
+ const interpolateOtherAttrs = (attrs, out, ratio) => {
12
+ attrs.forEach((entry => {
13
+ if (Number.isFinite(entry.to)) out[entry.key] = entry.from + (entry.to - entry.from) * ratio; else if ("fill" === entry.key || "stroke" === entry.key) {
14
+ const color = interpolateColor(entry.from, entry.to, ratio, !1);
15
+ color && (out[entry.key] = color);
16
+ }
17
+ }));
18
+ }, interpolateMorphingData = (morphingData, path, ratio) => {
19
+ const tmpArr = [], newCp = [];
20
+ path.clear();
21
+ for (let i = 0; i < morphingData.length; i++) {
22
+ const item = morphingData[i], from = item.from, to = item.to, angle = item.rotation * ratio, fromCp = item.fromCp, toCp = item.toCp, sa = Math.sin(angle), ca = Math.cos(angle);
23
+ newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio, newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;
24
+ for (let m = 0; m < from.length; m += 2) {
25
+ const x0 = from[m], y0 = from[m + 1], x = x0 * (1 - ratio) + to[m] * ratio, y = y0 * (1 - ratio) + to[m + 1] * ratio;
26
+ tmpArr[m] = x * ca - y * sa + newCp[0], tmpArr[m + 1] = x * sa + y * ca + newCp[1];
27
+ }
28
+ let x0 = tmpArr[0], y0 = tmpArr[1];
29
+ path.moveTo(x0, y0);
30
+ for (let m = 2; m < from.length; m += 6) {
31
+ const x1 = tmpArr[m], y1 = tmpArr[m + 1], x2 = tmpArr[m + 2], y2 = tmpArr[m + 3], x3 = tmpArr[m + 4], y3 = tmpArr[m + 5];
32
+ x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3 ? path.lineTo(x3, y3) : path.bezierCurveTo(x1, y1, x2, y2, x3, y3),
33
+ x0 = x3, y0 = y3;
34
+ }
35
+ }
36
+ }, parseMorphingData = (fromPath, toPath, config) => {
37
+ const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [], toBezier = pathToBezierCurves(toPath);
38
+ config && fromBezier && (config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse()),
39
+ applyTransformOnBezierCurves(fromBezier, config.toTransfrom));
40
+ const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);
41
+ return fromPath ? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI) : toBezierCurves.map(((to, index) => ({
42
+ from: fromBezierCurves[index],
43
+ to: to,
44
+ fromCp: [ 0, 0 ],
45
+ toCp: [ 0, 0 ],
46
+ rotation: 0
47
+ })));
48
+ }, validateOtherAttrs = [ "fill", "fillOpacity", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "stroke", "strokeOpacity", "lineDashOffset" ], parseOtherAnimateAttrs = (fromAttrs, toAttrs) => {
49
+ if (!fromAttrs || !toAttrs) return null;
50
+ const res = [];
51
+ let hasAttr = !1;
52
+ return Object.keys(fromAttrs).forEach((fromKey => {
53
+ if (!validateOtherAttrs.includes(fromKey)) return;
54
+ const toValue = toAttrs[fromKey];
55
+ if (!isNil(toValue) && !isNil(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {
56
+ if ("fill" === fromKey || "stroke" === fromKey) {
57
+ const parseColor = color => "string" == typeof color ? ColorStore.Get(color, ColorType.Color255) : color;
58
+ res.push({
59
+ from: isArray(fromAttrs[fromKey]) ? fromAttrs[fromKey].map(parseColor) : parseColor(fromAttrs[fromKey]),
60
+ to: isArray(toValue) ? toValue.map(parseColor) : parseColor(toValue),
61
+ key: fromKey
62
+ });
63
+ } else res.push({
64
+ from: fromAttrs[fromKey],
65
+ to: toValue,
66
+ key: fromKey
67
+ });
68
+ hasAttr = !0;
69
+ }
70
+ })), hasAttr ? res : null;
71
+ };
72
+
73
+ export class MorphingPath extends ACustomAnimate {
74
+ constructor(config, duration, easing) {
75
+ super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs,
76
+ this.saveOnEnd = config.saveOnEnd;
77
+ }
78
+ getEndProps() {
79
+ return {};
80
+ }
81
+ onBind() {
82
+ this.target.createPathProxy(), this.onUpdate(!1, 0, this.target.attribute);
83
+ }
84
+ onEnd() {}
85
+ onUpdate(end, ratio, out) {
86
+ const target = this.target, pathProxy = "function" == typeof target.pathProxy ? target.pathProxy(target.attribute) : target.pathProxy;
87
+ interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio),
88
+ this.target.setAttributes(out), end && !this.saveOnEnd && (this.target.pathProxy = null);
89
+ }
90
+ }
91
+
92
+ export const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
93
+ var _a, _b, _c;
94
+ if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) return __DEV__ && console.error(fromGraphic, " is not validate"),
95
+ null;
96
+ if (!toGraphic.valid || !toGraphic.toCustomPath) return __DEV__ && console.error(toGraphic, " is not validate"),
97
+ null;
98
+ let fromTransform = null == fromGraphic ? void 0 : fromGraphic.globalTransMatrix;
99
+ fromGraphicTransform && fromTransform && (fromTransform = fromGraphicTransform.clone().multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f));
100
+ const morphingData = parseMorphingData(null === (_a = null == fromGraphic ? void 0 : fromGraphic.toCustomPath) || void 0 === _a ? void 0 : _a.call(fromGraphic), toGraphic.toCustomPath(), {
101
+ fromTransform: fromTransform,
102
+ toTransfrom: toGraphic.globalTransMatrix
103
+ }), attrs = parseOtherAnimateAttrs(null == fromGraphic ? void 0 : fromGraphic.attribute, toGraphic.attribute), animate = toGraphic.animate(animationConfig);
104
+ (null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay);
105
+ const morphingPath = new MorphingPath({
106
+ morphingData: morphingData,
107
+ otherAttrs: attrs
108
+ }, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing);
109
+ return animate.play(morphingPath), animate;
110
+ };
111
+
112
+ export const oneToMultiMorph = (fromGraphic, toGraphics, animationConfig) => {
113
+ var _a;
114
+ const validateToGraphics = toGraphics.filter((graphic => graphic && graphic.toCustomPath && graphic.valid));
115
+ validateToGraphics.length || __DEV__ && console.error(validateToGraphics, " is not validate"),
116
+ fromGraphic.valid && fromGraphic.toCustomPath || __DEV__ && console.error(fromGraphic, " is not validate");
117
+ const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : splitGraphic)(fromGraphic, validateToGraphics.length, !1), oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd;
118
+ let count = validateToGraphics.length;
119
+ const onEachEnd = () => {
120
+ count--, 0 === count && oldOnEnd && oldOnEnd();
121
+ };
122
+ validateToGraphics.forEach(((toChild, index) => {
123
+ var _a;
124
+ const fromChild = childGraphics[index], delay = (null !== (_a = null == animationConfig ? void 0 : animationConfig.delay) && void 0 !== _a ? _a : 0) + ((null == animationConfig ? void 0 : animationConfig.individualDelay) ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild) : 0);
125
+ morphPath(fromChild, toChild, Object.assign({}, animationConfig, {
126
+ onEnd: onEachEnd,
127
+ delay: delay
128
+ }), fromGraphic.globalTransMatrix);
129
+ }));
130
+ };
131
+
132
+ export class MultiToOneMorphingPath extends ACustomAnimate {
133
+ constructor(config, duration, easing) {
134
+ super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs;
135
+ }
136
+ getEndProps() {
137
+ return {};
138
+ }
139
+ onBind() {
140
+ this.addPathProxy();
141
+ }
142
+ addPathProxy() {
143
+ this.target.shadowRoot.forEachChildren((child => {
144
+ child.createPathProxy();
145
+ })), this.onUpdate(!1, 0, this.target.attribute);
146
+ }
147
+ clearPathProxy() {
148
+ this.target.shadowRoot.forEachChildren((child => {
149
+ child.pathProxy = null;
150
+ }));
151
+ }
152
+ onEnd() {}
153
+ onUpdate(end, ratio, out) {
154
+ this.target.shadowRoot.forEachChildren(((child, index) => {
155
+ var _a;
156
+ interpolateMorphingData(this.morphingData[index], "function" == typeof child.pathProxy ? child.pathProxy(child.attribute) : child.pathProxy, ratio),
157
+ (null === (_a = this.otherAttrs) || void 0 === _a ? void 0 : _a[index]) && this.otherAttrs[index].length && interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);
158
+ })), end && (this.clearPathProxy(), this.morphingData = null);
159
+ }
160
+ }
161
+
162
+ const parseShadowChildAttrs = graphicAttrs => {
163
+ const attrs = {};
164
+ return Object.keys(graphicAttrs).forEach((key => {
165
+ isTransformKey(key) || (attrs[key] = graphicAttrs[key]);
166
+ })), attrs;
167
+ }, appendShadowChildrenToGraphic = (graphic, children, count) => {
168
+ const childAttrs = parseShadowChildAttrs(graphic.attribute), shadowRoot = graphic.attachShadow();
169
+ if (children.length) shadowRoot.setTheme({
170
+ [children[0].type]: childAttrs
171
+ }), children.forEach((element => {
172
+ element.setAttributes({
173
+ pickable: !1
174
+ }), shadowRoot.appendChild(element);
175
+ })); else {
176
+ const box = graphic.AABBBounds, width = box.width(), height = box.height();
177
+ shadowRoot.setTheme({
178
+ rect: childAttrs
179
+ }), new Array(count).fill(0).forEach((el => {
180
+ const child = application.graphicService.creator.rect({
181
+ x: 0,
182
+ y: 0,
183
+ width: width,
184
+ height: height,
185
+ pickable: !1
186
+ });
187
+ shadowRoot.appendChild(child), children.push(child);
188
+ }));
189
+ }
190
+ };
191
+
192
+ export const cloneGraphic = (graphic, count, needAppend) => {
193
+ const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute), path = graphic.toCustomPath();
194
+ for (let i = 0; i < count; i++) {
195
+ const element = {
196
+ path: (new CustomPath2D).fromCustomPath2D(path)
197
+ };
198
+ children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
199
+ }
200
+ return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
201
+ };
202
+
203
+ export const splitGraphic = (graphic, count, needAppend) => {
204
+ const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
205
+ if ("rect" === graphic.type) {
206
+ splitRect(graphic, count).forEach((element => {
207
+ children.push(application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element)));
208
+ }));
209
+ } else if ("arc" === graphic.type) {
210
+ splitArc(graphic, count).forEach((element => {
211
+ children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
212
+ }));
213
+ } else if ("circle" === graphic.type) {
214
+ splitCircle(graphic, count).forEach((element => {
215
+ children.push(application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
216
+ }));
217
+ } else if ("line" === graphic.type) {
218
+ const childrenAttrs = splitLine(graphic, count), defaultSymbol = {
219
+ size: 10,
220
+ symbolType: "circle"
221
+ };
222
+ childrenAttrs.forEach((element => {
223
+ children.push(application.graphicService.creator.symbol(needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)));
224
+ }));
225
+ } else if ("polygon" === graphic.type) {
226
+ splitPolygon(graphic, count).forEach((element => {
227
+ children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
228
+ }));
229
+ } else if ("area" === graphic.type) {
230
+ splitArea(graphic, count).forEach((element => {
231
+ children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
232
+ }));
233
+ } else if ("path" === graphic.type) {
234
+ splitPath(graphic, count).forEach((element => {
235
+ "path" in element ? children.push(application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))) : children.push(application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
236
+ }));
237
+ }
238
+ return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
239
+ };
240
+
241
+ export const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
242
+ var _a, _b, _c;
243
+ const validateFromGraphics = fromGraphics.filter((graphic => graphic.toCustomPath && graphic.valid));
244
+ validateFromGraphics.length || __DEV__ && console.error(fromGraphics, " is not validate"),
245
+ toGraphic.valid && toGraphic.toCustomPath || __DEV__ && console.error(toGraphic, " is not validate");
246
+ const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : splitGraphic)(toGraphic, validateFromGraphics.length, !0), toAttrs = toGraphic.attribute;
247
+ toGraphic.setAttribute("visible", !1);
248
+ const morphingData = validateFromGraphics.map(((graphic, index) => parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {
249
+ fromTransform: graphic.globalTransMatrix,
250
+ toTransfrom: childGraphics[index].globalTransMatrix
251
+ }))), otherAttrs = validateFromGraphics.map(((graphic, index) => parseOtherAnimateAttrs(graphic.attribute, toAttrs)));
252
+ if (null == animationConfig ? void 0 : animationConfig.individualDelay) {
253
+ const oldOnEnd = animationConfig.onEnd;
254
+ let count = validateFromGraphics.length;
255
+ const onEachEnd = () => {
256
+ count--, 0 === count && (toGraphic.setAttributes({
257
+ visible: !0,
258
+ ratio: null
259
+ }, !1, {
260
+ type: AttributeUpdateType.ANIMATE_END
261
+ }), toGraphic.detachShadow(), oldOnEnd && oldOnEnd());
262
+ };
263
+ childGraphics.forEach(((to, index) => {
264
+ var _a, _b, _c;
265
+ const delay = (null !== (_a = animationConfig.delay) && void 0 !== _a ? _a : 0) + animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to), animate = to.animate(Object.assign({}, animationConfig, {
266
+ onEnd: onEachEnd
267
+ }));
268
+ animate.wait(delay), animate.play(new MorphingPath({
269
+ morphingData: morphingData[index],
270
+ saveOnEnd: !0,
271
+ otherAttrs: otherAttrs[index]
272
+ }, null !== (_b = animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing));
273
+ }));
274
+ } else {
275
+ const oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd, config = animationConfig ? Object.assign({}, animationConfig) : {};
276
+ config.onEnd = () => {
277
+ toGraphic.setAttribute("visible", !0, !1, {
278
+ type: AttributeUpdateType.ANIMATE_END
279
+ }), toGraphic.detachShadow(), oldOnEnd && oldOnEnd();
280
+ };
281
+ const animate = toGraphic.animate(config);
282
+ (null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay),
283
+ animate.play(new MultiToOneMorphingPath({
284
+ morphingData: morphingData,
285
+ otherAttrs: otherAttrs
286
+ }, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing));
287
+ }
288
+ };
289
+ //# sourceMappingURL=morphing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/morphing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,SAAS,EACT,SAAS,EACT,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EAClB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C;QAEF,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,KAAK,EAAE;YAC1B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SACrC;QAED,OAAO,CAAC,IAAI,CACV,IAAI,sBAAsB,CACxB,EAAE,YAAY,EAAE,UAAU,EAAE,EAC5B,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,mCAAI,4BAA4B,CAAC,QAAQ,EAClE,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,mCAAI,4BAA4B,CAAC,MAAM,CAC/D,CACF,CAAC;KACH;AACH,CAAC,CAAC","file":"morphing.js","sourcesContent":["import {\n splitArc,\n splitCircle,\n splitLine,\n splitRect,\n splitPolygon,\n splitArea,\n splitPath,\n CustomPath2D,\n application,\n interpolateColor,\n ColorStore,\n ColorType,\n alignBezierCurves,\n applyTransformOnBezierCurves,\n findBestMorphingRotation,\n pathToBezierCurves,\n AttributeUpdateType,\n type MorphingAnimateConfig,\n type MultiMorphingAnimateConfig,\n type ICustomPath2D,\n type IGraphic,\n type IRect,\n type EasingType,\n type IArc,\n type ICircle,\n type IGraphicAttribute,\n type ILine,\n type IPolygon,\n type IArea,\n type IPath\n} from '@visactor/vrender-core';\nimport { isArray, isNil, type IMatrix } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\nimport { DefaultMorphingAnimateConfig } from '../config/morphing';\nimport { isTransformKey } from '../utils/transform';\n\ndeclare const __DEV__: boolean;\n\ninterface MorphingDataItem {\n from: number[];\n to: number[];\n fromCp: number[];\n toCp: number[];\n rotation: number;\n}\n\ninterface OtherAttrItem {\n from: any;\n to: any;\n key: string;\n}\n\n/**\n * 插值计算非路径属性(如颜色、透明度等)\n * @param attrs 要插值的属性数组\n * @param out 输出对象\n * @param ratio 插值比例\n */\nconst interpolateOtherAttrs = (attrs: OtherAttrItem[], out: any, ratio: number) => {\n attrs.forEach(entry => {\n if (Number.isFinite(entry.to)) {\n out[entry.key] = entry.from + (entry.to - entry.from) * ratio;\n } else if (entry.key === 'fill' || entry.key === 'stroke') {\n // 保存解析的结果到step\n const color = interpolateColor(entry.from, entry.to, ratio, false);\n if (color) {\n out[entry.key] = color;\n }\n }\n });\n};\n\n/* Adapted from zrender by ecomfe\n * https://github.com/ecomfe/zrender\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/ecomfe/zrender/blob/master/src/tool/morphPath.ts\n * License: https://github.com/ecomfe/zrender/blob/master/LICENSE\n * @license\n */\n/**\n * 根据给定比例插值计算形变数据并应用到路径\n * @param morphingData 形变数据\n * @param path 目标路径对象\n * @param ratio 插值比例\n */\nconst interpolateMorphingData = (morphingData: MorphingDataItem[], path: ICustomPath2D, ratio: number) => {\n const tmpArr: number[] = [];\n const newCp: number[] = [];\n path.clear();\n\n for (let i = 0; i < morphingData.length; i++) {\n const item = morphingData[i];\n const from = item.from;\n const to = item.to;\n const angle = item.rotation * ratio;\n const fromCp = item.fromCp;\n const toCp = item.toCp;\n const sa = Math.sin(angle);\n const ca = Math.cos(angle);\n\n newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio;\n newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;\n\n for (let m = 0; m < from.length; m += 2) {\n const x0 = from[m];\n const y0 = from[m + 1];\n const x1 = to[m];\n const y1 = to[m + 1];\n\n const x = x0 * (1 - ratio) + x1 * ratio;\n const y = y0 * (1 - ratio) + y1 * ratio;\n\n tmpArr[m] = x * ca - y * sa + newCp[0];\n tmpArr[m + 1] = x * sa + y * ca + newCp[1];\n }\n\n let x0 = tmpArr[0];\n let y0 = tmpArr[1];\n\n path.moveTo(x0, y0);\n\n for (let m = 2; m < from.length; m += 6) {\n const x1 = tmpArr[m];\n const y1 = tmpArr[m + 1];\n const x2 = tmpArr[m + 2];\n const y2 = tmpArr[m + 3];\n const x3 = tmpArr[m + 4];\n const y3 = tmpArr[m + 5];\n\n // Is a line.\n if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {\n path.lineTo(x3, y3);\n } else {\n path.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n x0 = x3;\n y0 = y3;\n }\n }\n};\n\n/**\n * 解析形变数据,将源路径和目标路径转换为贝塞尔曲线并找到最佳旋转角度\n * @param fromPath 源路径\n * @param toPath 目标路径\n * @param config 变换配置\n * @returns 形变数据数组\n */\nconst parseMorphingData = (\n fromPath: ICustomPath2D | null,\n toPath: ICustomPath2D,\n config?: {\n fromTransform?: IMatrix;\n toTransfrom: IMatrix;\n }\n) => {\n // [fromPath, toPath] = [toPath, fromPath];\n const fromBezier = fromPath ? pathToBezierCurves(fromPath) : [];\n const toBezier = pathToBezierCurves(toPath);\n\n if (config && fromBezier) {\n config.fromTransform && applyTransformOnBezierCurves(fromBezier, config.fromTransform.clone().getInverse());\n applyTransformOnBezierCurves(fromBezier, config.toTransfrom);\n // applyTransformOnBezierCurves(toBezier, config.toTransfrom.clone().getInverse());\n }\n\n const [fromBezierCurves, toBezierCurves] = alignBezierCurves(fromBezier, toBezier);\n\n return fromPath\n ? findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI)\n : toBezierCurves.map((to, index) => {\n return {\n from: fromBezierCurves[index],\n to,\n fromCp: [0, 0],\n toCp: [0, 0],\n rotation: 0\n };\n });\n};\n\nconst validateOtherAttrs = [\n 'fill',\n 'fillOpacity',\n 'shadowBlur',\n 'shadowColor',\n 'shadowOffsetX',\n 'shadowOffsetY',\n 'stroke',\n 'strokeOpacity',\n 'lineDashOffset'\n // 'lineWidth'\n];\n\n/**\n * 解析可动画属性,提取源属性和目标属性的差异\n * @param fromAttrs 源属性\n * @param toAttrs 目标属性\n * @returns 可动画属性数组\n */\nconst parseOtherAnimateAttrs = (\n fromAttrs: Partial<IGraphicAttribute> | null,\n toAttrs: Partial<IGraphicAttribute> | null\n) => {\n if (!fromAttrs || !toAttrs) {\n return null;\n }\n const res: OtherAttrItem[] = [];\n let hasAttr = false;\n\n Object.keys(fromAttrs).forEach(fromKey => {\n if (!validateOtherAttrs.includes(fromKey)) {\n return;\n }\n\n const toValue = (toAttrs as any)[fromKey];\n if (!isNil(toValue) && !isNil((fromAttrs as any)[fromKey]) && toValue !== (fromAttrs as any)[fromKey]) {\n if (fromKey === 'fill' || fromKey === 'stroke') {\n const parseColor = (color: string) => {\n return typeof color === 'string' ? ColorStore.Get(color, ColorType.Color255) : color;\n };\n res.push({\n from: isArray(fromAttrs[fromKey])\n ? (fromAttrs[fromKey] as any).map(parseColor)\n : parseColor((fromAttrs as any)[fromKey]),\n to: isArray(toValue) ? toValue.map(parseColor) : parseColor(toValue),\n key: fromKey\n });\n } else {\n res.push({ from: (fromAttrs as any)[fromKey], to: toValue, key: fromKey });\n }\n\n hasAttr = true;\n }\n });\n\n return hasAttr ? res : null;\n};\n\n/**\n * 形变路径动画类,用于处理路径和其他属性的形变\n */\nexport class MorphingPath extends ACustomAnimate<Record<string, any>> {\n declare path: CustomPath2D;\n\n saveOnEnd?: boolean;\n otherAttrs?: OtherAttrItem[];\n\n constructor(\n config: { morphingData: MorphingDataItem[]; otherAttrs?: OtherAttrItem[]; saveOnEnd?: boolean },\n duration: number,\n easing: EasingType\n ) {\n super({}, {}, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n this.saveOnEnd = config.saveOnEnd;\n }\n\n private morphingData?: MorphingDataItem[];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n (this.target as IGraphic).createPathProxy();\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n onEnd(): void {\n return;\n }\n\n /**\n * 更新动画状态\n * @param end 是否结束\n * @param ratio 动画进度比例\n * @param out 输出属性对象\n */\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const target = this.target as IGraphic;\n const pathProxy = typeof target.pathProxy === 'function' ? target.pathProxy(target.attribute) : target.pathProxy;\n interpolateMorphingData(this.morphingData, pathProxy, ratio);\n if (this.otherAttrs && this.otherAttrs.length) {\n interpolateOtherAttrs(this.otherAttrs, out, ratio);\n }\n this.target.setAttributes(out);\n // 计算位置\n if (end && !this.saveOnEnd) {\n (this.target as IGraphic).pathProxy = null;\n }\n }\n}\n\n/**\n * 创建从一个图形到另一个图形的形变动画\n * @param fromGraphic 源图形\n * @param toGraphic 目标图形\n * @param animationConfig 动画配置\n * @param fromGraphicTransform 源图形变换矩阵\n * @returns 动画实例\n */\nexport const morphPath = (\n fromGraphic: IGraphic | null,\n toGraphic: IGraphic,\n animationConfig?: MorphingAnimateConfig,\n fromGraphicTransform?: IMatrix\n) => {\n if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n return null;\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n return null;\n }\n\n let fromTransform = fromGraphic?.globalTransMatrix;\n\n if (fromGraphicTransform && fromTransform) {\n fromTransform = fromGraphicTransform\n .clone()\n .multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f);\n }\n const morphingData = parseMorphingData(fromGraphic?.toCustomPath?.(), toGraphic.toCustomPath(), {\n fromTransform,\n toTransfrom: toGraphic.globalTransMatrix\n });\n\n const attrs = parseOtherAnimateAttrs(fromGraphic?.attribute, toGraphic.attribute);\n const animate = toGraphic.animate(animationConfig);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n const morphingPath = new MorphingPath(\n { morphingData, otherAttrs: attrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n );\n animate.play(morphingPath);\n\n return animate;\n};\n\n/**\n * 创建从一个图形到多个图形的形变动画\n * @param fromGraphic 源图形\n * @param toGraphics 目标图形数组\n * @param animationConfig 动画配置\n */\nexport const oneToMultiMorph = (\n fromGraphic: IGraphic,\n toGraphics: IGraphic[],\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateToGraphics = toGraphics.filter(graphic => graphic && graphic.toCustomPath && graphic.valid);\n if (!validateToGraphics.length) {\n if (__DEV__) {\n console.error(validateToGraphics, ' is not validate');\n }\n }\n\n if (!fromGraphic.valid || !fromGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(fromGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(fromGraphic, validateToGraphics.length, false);\n\n const oldOnEnd = animationConfig?.onEnd;\n let count = validateToGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0 && oldOnEnd) {\n oldOnEnd();\n }\n };\n\n validateToGraphics.forEach((toChild, index) => {\n const fromChild = childGraphics[index];\n const delay =\n (animationConfig?.delay ?? 0) +\n (animationConfig?.individualDelay\n ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild)\n : 0);\n morphPath(\n fromChild,\n toChild,\n Object.assign({}, animationConfig, { onEnd: onEachEnd, delay }),\n fromGraphic.globalTransMatrix\n );\n });\n};\n\n/**\n * 多对一形变路径动画类,用于处理多个路径形变为一个目标路径\n */\nexport class MultiToOneMorphingPath extends ACustomAnimate<Record<string, any>> {\n declare path: CustomPath2D;\n\n otherAttrs?: OtherAttrItem[][];\n\n constructor(\n config: { morphingData: MorphingDataItem[][]; otherAttrs?: OtherAttrItem[][] },\n duration: number,\n easing: EasingType\n ) {\n super({}, {}, duration, easing);\n this.morphingData = config.morphingData;\n this.otherAttrs = config.otherAttrs;\n }\n\n private morphingData?: MorphingDataItem[][];\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.addPathProxy();\n }\n\n /**\n * 为每个子图形添加路径代理\n */\n private addPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).createPathProxy();\n });\n\n this.onUpdate(false, 0, (this.target as IGraphic).attribute);\n }\n\n /**\n * 清除所有子图形的路径代理\n */\n private clearPathProxy() {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren(child => {\n (child as IGraphic).pathProxy = null;\n });\n }\n\n onEnd(): void {\n return;\n }\n\n /**\n * 更新动画状态\n * @param end 是否结束\n * @param ratio 动画进度比例\n * @param out 输出属性对象\n */\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const shadowRoot = (this.target as IGraphic).shadowRoot;\n\n shadowRoot.forEachChildren((child: IGraphic, index) => {\n interpolateMorphingData(\n this.morphingData[index],\n typeof child.pathProxy === 'function' ? child.pathProxy(child.attribute) : child.pathProxy,\n ratio\n );\n\n if (this.otherAttrs?.[index] && this.otherAttrs[index].length) {\n interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);\n }\n });\n\n // 计算位置\n if (end) {\n this.clearPathProxy();\n this.morphingData = null;\n }\n }\n}\n\n/**\n * 解析图形的阴影子元素属性(排除变换相关属性)\n * @param graphicAttrs 图形属性\n * @returns 阴影子元素属性\n */\nconst parseShadowChildAttrs = (graphicAttrs: Partial<IGraphicAttribute>) => {\n const attrs: Partial<IGraphicAttribute> = {};\n\n Object.keys(graphicAttrs).forEach(key => {\n if (!isTransformKey(key)) {\n (attrs as any)[key] = (graphicAttrs as any)[key];\n }\n });\n\n // if (attrs.fill == null) {\n // attrs.fill = !!attrs.fillColor;\n // }\n // if (attrs.stroke == null) {\n // attrs.stroke = !!attrs.strokeColor;\n // }\n\n return attrs;\n};\n\n/**\n * 将阴影子元素添加到图形中\n * @param graphic 目标图形\n * @param children 子元素数组\n * @param count 子元素数量\n */\nconst appendShadowChildrenToGraphic = (graphic: IGraphic, children: IGraphic[], count: number) => {\n const childAttrs = parseShadowChildAttrs(graphic.attribute);\n const shadowRoot = graphic.attachShadow();\n\n if (children.length) {\n shadowRoot.setTheme({\n [children[0].type]: childAttrs\n });\n children.forEach(element => {\n element.setAttributes({ pickable: false });\n shadowRoot.appendChild(element);\n });\n } else {\n const box = graphic.AABBBounds;\n const width = box.width();\n const height = box.height();\n\n shadowRoot.setTheme({\n rect: childAttrs\n });\n new Array(count).fill(0).forEach(el => {\n const child = application.graphicService.creator.rect({\n x: 0,\n y: 0,\n width,\n height: height,\n pickable: false\n });\n shadowRoot.appendChild(child);\n children.push(child);\n });\n }\n};\n\n/**\n * 克隆图形为多个相同的图形\n * @param graphic 源图形\n * @param count 克隆数量\n * @param needAppend 是否需要添加到源图形中\n * @returns 克隆的图形数组\n */\nexport const cloneGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n const path = graphic.toCustomPath();\n\n for (let i = 0; i < count; i++) {\n const element = {\n path: new CustomPath2D().fromCustomPath2D(path)\n };\n\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\n/**\n * 将图形分割为多个子图形\n * @param graphic 源图形\n * @param count 分割数量\n * @param needAppend 是否需要添加到源图形中\n * @returns 分割后的图形数组\n */\nexport const splitGraphic = (graphic: IGraphic, count: number, needAppend?: boolean) => {\n const children: IGraphic[] = [];\n const childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);\n\n if (graphic.type === 'rect') {\n const childrenAttrs = splitRect(graphic as IRect, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'arc') {\n const childrenAttrs = splitArc(graphic as IArc, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'circle') {\n const childrenAttrs = splitCircle(graphic as ICircle, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'line') {\n const childrenAttrs = splitLine(graphic as ILine, count);\n const defaultSymbol = { size: 10, symbolType: 'circle' };\n\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.symbol(\n needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)\n )\n );\n });\n } else if (graphic.type === 'polygon') {\n const childrenAttrs = splitPolygon(graphic as IPolygon, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'area') {\n const childrenAttrs = splitArea(graphic as IArea, count);\n childrenAttrs.forEach(element => {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n });\n } else if (graphic.type === 'path') {\n const childrenAttrs = splitPath(graphic as IPath, count);\n childrenAttrs.forEach(element => {\n if ('path' in element) {\n children.push(\n application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n } else {\n children.push(\n application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element))\n );\n }\n });\n }\n\n if (needAppend) {\n appendShadowChildrenToGraphic(graphic, children, count);\n }\n\n return children;\n};\n\n/**\n * 创建从多个图形到一个图形的形变动画\n * @param fromGraphics 源图形数组\n * @param toGraphic 目标图形\n * @param animationConfig 动画配置\n */\nexport const multiToOneMorph = (\n fromGraphics: IGraphic[],\n toGraphic: IGraphic,\n animationConfig?: MultiMorphingAnimateConfig\n) => {\n const validateFromGraphics = fromGraphics.filter(graphic => graphic.toCustomPath && graphic.valid);\n if (!validateFromGraphics.length) {\n if (__DEV__) {\n console.error(fromGraphics, ' is not validate');\n }\n }\n\n if (!toGraphic.valid || !toGraphic.toCustomPath) {\n if (__DEV__) {\n console.error(toGraphic, ' is not validate');\n }\n }\n\n const childGraphics: IGraphic[] = (\n animationConfig?.splitPath === 'clone' ? cloneGraphic : animationConfig?.splitPath ?? splitGraphic\n )(toGraphic, validateFromGraphics.length, true);\n\n const toAttrs = toGraphic.attribute;\n toGraphic.setAttribute('visible', false);\n\n const morphingData = validateFromGraphics.map((graphic, index) => {\n return parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {\n fromTransform: graphic.globalTransMatrix,\n toTransfrom: childGraphics[index].globalTransMatrix\n });\n });\n const otherAttrs = validateFromGraphics.map((graphic, index) => {\n return parseOtherAnimateAttrs(graphic.attribute, toAttrs);\n });\n\n if (animationConfig?.individualDelay) {\n const oldOnEnd = animationConfig.onEnd;\n let count = validateFromGraphics.length;\n const onEachEnd = () => {\n count--;\n if (count === 0) {\n toGraphic.setAttributes({ visible: true, ratio: null } as any, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n toGraphic.detachShadow();\n if (oldOnEnd) {\n oldOnEnd();\n }\n }\n };\n childGraphics.forEach((to, index) => {\n const delay =\n (animationConfig.delay ?? 0) +\n animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to);\n const animate = to.animate(Object.assign({}, animationConfig, { onEnd: onEachEnd }));\n animate.wait(delay);\n\n animate.play(\n new MorphingPath(\n {\n morphingData: morphingData[index],\n saveOnEnd: true,\n otherAttrs: otherAttrs[index]\n },\n animationConfig.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n });\n } else {\n const oldOnEnd = animationConfig?.onEnd;\n const config = animationConfig ? Object.assign({}, animationConfig) : {};\n\n config.onEnd = () => {\n toGraphic.setAttribute('visible', true, false, { type: AttributeUpdateType.ANIMATE_END });\n toGraphic.detachShadow();\n\n if (oldOnEnd) {\n oldOnEnd();\n }\n };\n\n const animate = toGraphic.animate(config);\n\n if (animationConfig?.delay) {\n animate.wait(animationConfig.delay);\n }\n\n animate.play(\n new MultiToOneMorphingPath(\n { morphingData, otherAttrs },\n animationConfig?.duration ?? DefaultMorphingAnimateConfig.duration,\n animationConfig?.easing ?? DefaultMorphingAnimateConfig.easing\n )\n );\n }\n};\n"]}
@@ -0,0 +1,21 @@
1
+ import type { CustomPath2D, IGraphic, EasingType } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from './custom-animate';
3
+ export declare class MotionPath extends ACustomAnimate<any> {
4
+ valid: boolean;
5
+ pathLength: number;
6
+ path: CustomPath2D;
7
+ distance: number;
8
+ totalLength: number;
9
+ initAngle: number;
10
+ changeAngle: boolean;
11
+ cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;
12
+ constructor(from: any, to: any, duration: number, easing: EasingType, params?: {
13
+ path: CustomPath2D;
14
+ distance: number;
15
+ cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;
16
+ initAngle?: number;
17
+ changeAngle?: boolean;
18
+ });
19
+ onBind(): void;
20
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
21
+ }
@@ -0,0 +1,23 @@
1
+ import { ACustomAnimate } from "./custom-animate";
2
+
3
+ export class MotionPath extends ACustomAnimate {
4
+ constructor(from, to, duration, easing, params) {
5
+ var _a;
6
+ super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(),
7
+ this.path = params.path, this.distance = params.distance, this.totalLength = this.distance * this.pathLength,
8
+ this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle,
9
+ this.cb = params.cb);
10
+ }
11
+ onBind() {
12
+ this.from = {
13
+ x: 0,
14
+ y: 0
15
+ }, this.to = this.path.getAttrAt(this.totalLength).pos, this.props = this.to;
16
+ }
17
+ onUpdate(end, ratio, out) {
18
+ const attrs = {}, at = this.totalLength * ratio, {pos: pos, angle: angle} = this.path.getAttrAt(at);
19
+ attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle),
20
+ this.cb && this.cb(this.from, this.to, ratio, this.target), this.target.setAttributes(attrs);
21
+ }
22
+ }
23
+ //# sourceMappingURL=motionPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/motionPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,UAAW,SAAQ,cAAmB;IASjD,YACE,IAAS,EACT,EAAO,EACP,QAAgB,EAChB,MAAkB,EAClB,MAMC;;QAED,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;YACnD,IAAI,CAAC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;SACrB;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;IACvB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,MAAM,KAAK,GAAG,EAAS,CAAC;QAExB,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACpC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAChB,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;SACtC;QACD,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACF","file":"motionPath.js","sourcesContent":["import type { CustomPath2D, IGraphic, EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class MotionPath extends ACustomAnimate<any> {\n declare valid: boolean;\n declare pathLength: number;\n declare path: CustomPath2D;\n declare distance: number;\n declare totalLength: number;\n declare initAngle: number;\n declare changeAngle: boolean;\n declare cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;\n constructor(\n from: any,\n to: any,\n duration: number,\n easing: EasingType,\n params?: {\n path: CustomPath2D;\n distance: number;\n cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;\n initAngle?: number;\n changeAngle?: boolean;\n }\n ) {\n super(from, to, duration, easing, params);\n if (params) {\n this.pathLength = params.path.getLength();\n this.path = params.path;\n this.distance = params.distance;\n this.totalLength = this.distance * this.pathLength;\n this.initAngle = params.initAngle ?? 0;\n this.changeAngle = !!params.changeAngle;\n this.cb = params.cb;\n }\n }\n\n onBind(): void {\n this.from = { x: 0, y: 0 };\n this.to = this.path.getAttrAt(this.totalLength).pos;\n this.props = this.to;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attrs = {} as any;\n // 计算位置\n const at = this.totalLength * ratio;\n const { pos, angle } = this.path.getAttrAt(at);\n attrs.x = pos.x;\n attrs.y = pos.y;\n if (this.changeAngle) {\n attrs.angle = angle + this.initAngle;\n }\n this.cb && this.cb(this.from, this.to, ratio, this.target as IGraphic);\n this.target.setAttributes(attrs);\n }\n}\n"]}
@@ -0,0 +1,96 @@
1
+ import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from './custom-animate';
3
+ export type FunctionCallback<T> = (...args: any[]) => T;
4
+ export interface IMoveAnimationOptions {
5
+ direction?: 'x' | 'y' | 'xy';
6
+ orient?: 'positive' | 'negative';
7
+ offset?: number;
8
+ point?: {
9
+ x?: number;
10
+ y?: number;
11
+ } | FunctionCallback<{
12
+ x?: number;
13
+ y?: number;
14
+ }>;
15
+ excludeChannels?: string[];
16
+ layoutRect?: {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ }
21
+ interface IAnimationParameters {
22
+ width: number;
23
+ height: number;
24
+ group: IGroup;
25
+ elementIndex: number;
26
+ elementCount: number;
27
+ view: any;
28
+ }
29
+ export declare const moveIn: (graphic: IGraphic, options: IMoveAnimationOptions, animationParameters: IAnimationParameters) => {
30
+ from: {
31
+ x: any;
32
+ y?: undefined;
33
+ };
34
+ to: {
35
+ x: any;
36
+ y?: undefined;
37
+ };
38
+ } | {
39
+ from: {
40
+ y: any;
41
+ x?: undefined;
42
+ };
43
+ to: {
44
+ y: any;
45
+ x?: undefined;
46
+ };
47
+ } | {
48
+ from: {
49
+ x: any;
50
+ y: any;
51
+ };
52
+ to: {
53
+ x: any;
54
+ y: any;
55
+ };
56
+ };
57
+ export declare const moveOut: (graphic: IGraphic, options: IMoveAnimationOptions, animationParameters: IAnimationParameters) => {
58
+ from: {
59
+ x: number;
60
+ y?: undefined;
61
+ };
62
+ to: {
63
+ x: any;
64
+ y?: undefined;
65
+ };
66
+ } | {
67
+ from: {
68
+ y: number;
69
+ x?: undefined;
70
+ };
71
+ to: {
72
+ y: any;
73
+ x?: undefined;
74
+ };
75
+ } | {
76
+ from: {
77
+ x: number;
78
+ y: number;
79
+ };
80
+ to: {
81
+ x: any;
82
+ y: any;
83
+ };
84
+ };
85
+ export declare class MoveBase extends ACustomAnimate<Record<string, number>> {
86
+ valid: boolean;
87
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
88
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
89
+ }
90
+ export declare class MoveIn extends MoveBase {
91
+ onBind(): void;
92
+ }
93
+ export declare class MoveOut extends MoveBase {
94
+ onBind(): void;
95
+ }
96
+ export {};
@@ -0,0 +1,118 @@
1
+ import { isFunction, isValidNumber } from "@visactor/vutils";
2
+
3
+ import { ACustomAnimate } from "./custom-animate";
4
+
5
+ export const moveIn = (graphic, options, animationParameters) => {
6
+ var _a, _b, _c, _d;
7
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt, excludeChannels: excludeChannels = [], layoutRect: layoutRect = {}} = null != options ? options : {};
8
+ let changedX = 0, changedY = 0;
9
+ "negative" === orient && (changedX = null !== (_a = layoutRect.width) && void 0 !== _a ? _a : graphic.stage.viewWidth,
10
+ changedY = null !== (_b = layoutRect.height) && void 0 !== _b ? _b : graphic.stage.viewHeight),
11
+ changedX += offset, changedY += offset;
12
+ const point = isFunction(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt, fromX = point && isValidNumber(point.x) ? point.x : changedX, fromY = point && isValidNumber(point.y) ? point.y : changedY, finalAttrs = graphic.getFinalAttribute(), finalAttrsX = excludeChannels.includes("x") ? graphic.attribute.x : finalAttrs.x, finalAttrsY = excludeChannels.includes("y") ? graphic.attribute.y : finalAttrs.y;
13
+ switch (direction) {
14
+ case "x":
15
+ return {
16
+ from: {
17
+ x: fromX
18
+ },
19
+ to: {
20
+ x: finalAttrsX
21
+ }
22
+ };
23
+
24
+ case "y":
25
+ return {
26
+ from: {
27
+ y: fromY
28
+ },
29
+ to: {
30
+ y: finalAttrsY
31
+ }
32
+ };
33
+
34
+ default:
35
+ return {
36
+ from: {
37
+ x: fromX,
38
+ y: fromY
39
+ },
40
+ to: {
41
+ x: finalAttrsX,
42
+ y: finalAttrsY
43
+ }
44
+ };
45
+ }
46
+ };
47
+
48
+ export const moveOut = (graphic, options, animationParameters) => {
49
+ var _a, _b, _c, _d, _e, _f;
50
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupWidth = null !== (_b = null === (_a = options.layoutRect) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : graphic.stage.viewWidth, groupHeight = null !== (_d = null === (_c = options.layoutRect) || void 0 === _c ? void 0 : _c.height) && void 0 !== _d ? _d : graphic.stage.viewHeight, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = isFunction(pointOpt) ? pointOpt.call(null, null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, animationParameters) : pointOpt, fromX = point && isValidNumber(point.x) ? point.x : changedX, fromY = point && isValidNumber(point.y) ? point.y : changedY;
51
+ switch (direction) {
52
+ case "x":
53
+ return {
54
+ from: {
55
+ x: graphic.attribute.x
56
+ },
57
+ to: {
58
+ x: fromX
59
+ }
60
+ };
61
+
62
+ case "y":
63
+ return {
64
+ from: {
65
+ y: graphic.attribute.y
66
+ },
67
+ to: {
68
+ y: fromY
69
+ }
70
+ };
71
+
72
+ default:
73
+ return {
74
+ from: {
75
+ x: graphic.attribute.x,
76
+ y: graphic.attribute.y
77
+ },
78
+ to: {
79
+ x: fromX,
80
+ y: fromY
81
+ }
82
+ };
83
+ }
84
+ };
85
+
86
+ export class MoveBase extends ACustomAnimate {
87
+ constructor(from, to, duration, easing, params) {
88
+ super(from, to, duration, easing, params);
89
+ }
90
+ onUpdate(end, ratio, out) {
91
+ const attribute = this.target.attribute;
92
+ this.propKeys.forEach((key => {
93
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
94
+ })), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
95
+ }
96
+ }
97
+
98
+ export class MoveIn extends MoveBase {
99
+ onBind() {
100
+ var _a;
101
+ super.onBind();
102
+ const {from: from, to: to} = moveIn(this.target, this.params.options, this.params);
103
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
104
+ this.from = from, this.to = to;
105
+ const finalAttribute = this.target.getFinalAttribute();
106
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
107
+ }
108
+ }
109
+
110
+ export class MoveOut extends MoveBase {
111
+ onBind() {
112
+ super.onBind();
113
+ const {from: from, to: to} = moveOut(this.target, this.params.options, this.params);
114
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
115
+ this.from = from, this.to = to;
116
+ }
117
+ }
118
+ //# sourceMappingURL=move.js.map