@visactor/vrender-core 0.22.12 → 0.22.14

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 (437) hide show
  1. package/cjs/animate/Ticker/default-ticker.d.ts +40 -0
  2. package/cjs/animate/Ticker/default-ticker.js +140 -0
  3. package/cjs/animate/Ticker/default-ticker.js.map +1 -0
  4. package/cjs/animate/Ticker/index.d.ts +5 -0
  5. package/cjs/{interface/animation → animate/Ticker}/index.js +3 -3
  6. package/cjs/animate/Ticker/index.js.map +1 -0
  7. package/cjs/animate/Ticker/manual-ticker-handler.d.ts +15 -0
  8. package/cjs/animate/Ticker/manual-ticker-handler.js +36 -0
  9. package/cjs/animate/Ticker/manual-ticker-handler.js.map +1 -0
  10. package/cjs/animate/Ticker/manual-ticker.d.ts +19 -0
  11. package/cjs/animate/Ticker/manual-ticker.js +37 -0
  12. package/cjs/animate/Ticker/manual-ticker.js.map +1 -0
  13. package/cjs/animate/Ticker/raf-tick-handler.d.ts +9 -0
  14. package/cjs/animate/Ticker/raf-tick-handler.js +30 -0
  15. package/cjs/animate/Ticker/raf-tick-handler.js.map +1 -0
  16. package/cjs/animate/Ticker/timeout-tick-handler.d.ts +9 -0
  17. package/cjs/animate/Ticker/timeout-tick-handler.js +28 -0
  18. package/cjs/animate/Ticker/timeout-tick-handler.js.map +1 -0
  19. package/cjs/animate/Ticker/type.d.ts +6 -0
  20. package/cjs/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
  21. package/cjs/animate/Ticker/type.js.map +1 -0
  22. package/cjs/animate/animate.d.ts +147 -0
  23. package/cjs/animate/animate.js +403 -0
  24. package/cjs/animate/animate.js.map +1 -0
  25. package/cjs/animate/config.d.ts +2 -1
  26. package/cjs/animate/config.js +5 -1
  27. package/cjs/animate/config.js.map +1 -1
  28. package/cjs/animate/custom-animate.d.ts +236 -0
  29. package/cjs/animate/custom-animate.js +726 -0
  30. package/cjs/animate/custom-animate.js.map +1 -0
  31. package/cjs/animate/default-ticker.d.ts +2 -0
  32. package/cjs/animate/default-ticker.js +14 -0
  33. package/cjs/animate/default-ticker.js.map +1 -0
  34. package/cjs/animate/easing-func.d.ts +1 -0
  35. package/cjs/animate/easing-func.js +16 -0
  36. package/cjs/animate/easing-func.js.map +1 -0
  37. package/cjs/animate/easing.d.ts +49 -0
  38. package/cjs/animate/easing.js +141 -0
  39. package/cjs/animate/easing.js.map +1 -0
  40. package/cjs/animate/group-fade.d.ts +16 -0
  41. package/cjs/animate/group-fade.js +66 -0
  42. package/cjs/animate/group-fade.js.map +1 -0
  43. package/cjs/animate/index.d.ts +8 -0
  44. package/cjs/animate/index.js +24 -0
  45. package/cjs/animate/index.js.map +1 -0
  46. package/cjs/animate/morphing.d.ts +52 -0
  47. package/cjs/animate/morphing.js +292 -0
  48. package/cjs/animate/morphing.js.map +1 -0
  49. package/cjs/animate/timeline.d.ts +17 -0
  50. package/cjs/animate/timeline.js +46 -0
  51. package/cjs/animate/timeline.js.map +1 -0
  52. package/cjs/application.d.ts +1 -2
  53. package/cjs/application.js.map +1 -1
  54. package/cjs/canvas/constants.js +2 -1
  55. package/cjs/canvas/empty-context.d.ts +0 -1
  56. package/cjs/canvas/empty-context.js +0 -4
  57. package/cjs/canvas/empty-context.js.map +1 -1
  58. package/cjs/canvas/util.js +1 -2
  59. package/cjs/color-string/interpolate.d.ts +0 -1
  60. package/cjs/color-string/interpolate.js +4 -12
  61. package/cjs/color-string/interpolate.js.map +1 -1
  62. package/cjs/common/custom-path2d.js +2 -2
  63. package/cjs/common/custom-path2d.js.map +1 -1
  64. package/cjs/common/enums.d.ts +16 -0
  65. package/cjs/common/enums.js +11 -2
  66. package/cjs/common/enums.js.map +1 -1
  67. package/cjs/common/morphing-utils.js +124 -32
  68. package/cjs/common/morphing-utils.js.map +1 -1
  69. package/cjs/common/polygon.js +2 -5
  70. package/cjs/common/polygon.js.map +1 -1
  71. package/cjs/common/segment/curve/cubic-bezier.d.ts +2 -1
  72. package/cjs/common/segment/curve/cubic-bezier.js +8 -3
  73. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  74. package/cjs/common/segment/curve/quadratic-bezier.d.ts +0 -1
  75. package/cjs/common/segment/curve/quadratic-bezier.js +3 -10
  76. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  77. package/cjs/common/segment/index.d.ts +0 -1
  78. package/cjs/common/segment/index.js +1 -1
  79. package/cjs/common/segment/index.js.map +1 -1
  80. package/cjs/common/shape/arc.d.ts +1 -1
  81. package/cjs/common/shape/arc.js +3 -7
  82. package/cjs/common/shape/arc.js.map +1 -1
  83. package/cjs/common/simplify.js +2 -1
  84. package/cjs/common/sort.js +1 -1
  85. package/cjs/common/split-path.js +2 -2
  86. package/cjs/common/split-path.js.map +1 -1
  87. package/cjs/common/store.js +1 -1
  88. package/cjs/common/text.js +1 -1
  89. package/cjs/common/utils.d.ts +2 -0
  90. package/cjs/common/utils.js +9 -5
  91. package/cjs/common/utils.js.map +1 -1
  92. package/cjs/core/application.js +1 -1
  93. package/cjs/core/camera.js +1 -1
  94. package/cjs/core/global.d.ts +0 -3
  95. package/cjs/core/global.js +3 -14
  96. package/cjs/core/global.js.map +1 -1
  97. package/cjs/core/stage.d.ts +3 -8
  98. package/cjs/core/stage.js +20 -34
  99. package/cjs/core/stage.js.map +1 -1
  100. package/cjs/graphic/arc.d.ts +2 -1
  101. package/cjs/graphic/arc.js +2 -3
  102. package/cjs/graphic/arc.js.map +1 -1
  103. package/cjs/graphic/area.d.ts +2 -1
  104. package/cjs/graphic/area.js +1 -4
  105. package/cjs/graphic/area.js.map +1 -1
  106. package/cjs/graphic/circle.d.ts +2 -1
  107. package/cjs/graphic/circle.js +2 -5
  108. package/cjs/graphic/circle.js.map +1 -1
  109. package/cjs/graphic/config.js +1 -2
  110. package/cjs/graphic/config.js.map +1 -1
  111. package/cjs/graphic/graphic-service/graphic-module.js +2 -1
  112. package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
  113. package/cjs/graphic/graphic-service/graphic-service.js +3 -2
  114. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  115. package/cjs/graphic/graphic.d.ts +12 -9
  116. package/cjs/graphic/graphic.js +105 -48
  117. package/cjs/graphic/graphic.js.map +1 -1
  118. package/cjs/graphic/group.js +8 -8
  119. package/cjs/graphic/group.js.map +1 -1
  120. package/cjs/graphic/line.d.ts +2 -1
  121. package/cjs/graphic/line.js +1 -5
  122. package/cjs/graphic/line.js.map +1 -1
  123. package/cjs/graphic/rect.js +2 -5
  124. package/cjs/graphic/rect.js.map +1 -1
  125. package/cjs/graphic/richtext/icon.d.ts +1 -1
  126. package/cjs/graphic/richtext/icon.js.map +1 -1
  127. package/cjs/graphic/richtext/paragraph.js +2 -2
  128. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  129. package/cjs/graphic/star.d.ts +2 -1
  130. package/cjs/graphic/star.js +2 -4
  131. package/cjs/graphic/star.js.map +1 -1
  132. package/cjs/index.d.ts +3 -2
  133. package/cjs/index.js +16 -14
  134. package/cjs/index.js.map +1 -1
  135. package/cjs/interface/animate.d.ts +160 -1
  136. package/cjs/interface/animate.js +4 -1
  137. package/cjs/interface/animate.js.map +1 -1
  138. package/cjs/interface/context.d.ts +0 -1
  139. package/cjs/interface/context.js.map +1 -1
  140. package/cjs/interface/global.d.ts +0 -2
  141. package/cjs/interface/global.js.map +1 -1
  142. package/cjs/interface/graphic.d.ts +3 -11
  143. package/cjs/interface/graphic.js.map +1 -1
  144. package/cjs/interface/index.d.ts +1 -1
  145. package/cjs/interface/index.js +9 -9
  146. package/cjs/interface/index.js.map +1 -1
  147. package/cjs/interface/render.d.ts +0 -7
  148. package/cjs/interface/render.js.map +1 -1
  149. package/cjs/interface/stage.d.ts +1 -4
  150. package/cjs/interface/stage.js.map +1 -1
  151. package/cjs/modules.d.ts +1 -2
  152. package/cjs/modules.js +3 -4
  153. package/cjs/modules.js.map +1 -1
  154. package/cjs/plugins/builtin-plugin/auto-render-plugin.js +8 -9
  155. package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  156. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +11 -14
  157. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  158. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +10 -13
  159. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  160. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
  161. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  162. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
  163. package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  164. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  165. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  166. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  167. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
  168. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +5 -6
  169. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  170. package/cjs/render/contributions/render/arc-render.d.ts +2 -4
  171. package/cjs/render/contributions/render/arc-render.js +17 -19
  172. package/cjs/render/contributions/render/arc-render.js.map +1 -1
  173. package/cjs/render/contributions/render/area-render.js +2 -2
  174. package/cjs/render/contributions/render/area-render.js.map +1 -1
  175. package/cjs/render/contributions/render/base-render.d.ts +2 -2
  176. package/cjs/render/contributions/render/base-render.js +2 -2
  177. package/cjs/render/contributions/render/base-render.js.map +1 -1
  178. package/cjs/render/contributions/render/draw-contribution.d.ts +0 -1
  179. package/cjs/render/contributions/render/draw-contribution.js +19 -23
  180. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  181. package/cjs/render/contributions/render/draw-interceptor.js +1 -2
  182. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  183. package/cjs/render/contributions/render/group-render.d.ts +2 -2
  184. package/cjs/render/contributions/render/group-render.js +11 -15
  185. package/cjs/render/contributions/render/group-render.js.map +1 -1
  186. package/cjs/render/contributions/render/line-render.js +1 -1
  187. package/cjs/render/contributions/render/line-render.js.map +1 -1
  188. package/cjs/render/contributions/render/rect-render.d.ts +1 -3
  189. package/cjs/render/contributions/render/rect-render.js +15 -17
  190. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  191. package/cjs/render/contributions/render/symbol-render.d.ts +2 -4
  192. package/cjs/render/contributions/render/symbol-render.js +11 -16
  193. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  194. package/cjs/render/render-service.d.ts +1 -1
  195. package/cjs/render/render-service.js.map +1 -1
  196. package/dist/index.es.js +8867 -6020
  197. package/es/animate/Ticker/default-ticker.d.ts +40 -0
  198. package/es/animate/Ticker/default-ticker.js +138 -0
  199. package/es/animate/Ticker/default-ticker.js.map +1 -0
  200. package/es/animate/Ticker/index.d.ts +5 -0
  201. package/es/animate/Ticker/index.js +10 -0
  202. package/es/animate/Ticker/index.js.map +1 -0
  203. package/es/animate/Ticker/manual-ticker-handler.d.ts +15 -0
  204. package/es/animate/Ticker/manual-ticker-handler.js +28 -0
  205. package/es/animate/Ticker/manual-ticker-handler.js.map +1 -0
  206. package/es/animate/Ticker/manual-ticker.d.ts +19 -0
  207. package/es/animate/Ticker/manual-ticker.js +31 -0
  208. package/es/animate/Ticker/manual-ticker.js.map +1 -0
  209. package/es/animate/Ticker/raf-tick-handler.d.ts +9 -0
  210. package/es/animate/Ticker/raf-tick-handler.js +22 -0
  211. package/es/animate/Ticker/raf-tick-handler.js.map +1 -0
  212. package/es/animate/Ticker/timeout-tick-handler.d.ts +9 -0
  213. package/es/animate/Ticker/timeout-tick-handler.js +20 -0
  214. package/es/animate/Ticker/timeout-tick-handler.js.map +1 -0
  215. package/es/animate/Ticker/type.d.ts +6 -0
  216. package/es/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
  217. package/es/animate/Ticker/type.js.map +1 -0
  218. package/es/animate/animate.d.ts +147 -0
  219. package/es/animate/animate.js +398 -0
  220. package/es/animate/animate.js.map +1 -0
  221. package/es/animate/config.d.ts +2 -1
  222. package/es/animate/config.js +5 -0
  223. package/es/animate/config.js.map +1 -1
  224. package/es/animate/custom-animate.d.ts +236 -0
  225. package/es/animate/custom-animate.js +703 -0
  226. package/es/animate/custom-animate.js.map +1 -0
  227. package/es/animate/default-ticker.d.ts +2 -0
  228. package/es/animate/default-ticker.js +12 -0
  229. package/es/animate/default-ticker.js.map +1 -0
  230. package/es/animate/easing-func.d.ts +1 -0
  231. package/es/animate/easing-func.js +10 -0
  232. package/es/animate/easing-func.js.map +1 -0
  233. package/es/animate/easing.d.ts +49 -0
  234. package/es/animate/easing.js +134 -0
  235. package/es/animate/easing.js.map +1 -0
  236. package/es/animate/group-fade.d.ts +16 -0
  237. package/es/animate/group-fade.js +56 -0
  238. package/es/animate/group-fade.js.map +1 -0
  239. package/es/animate/index.d.ts +8 -0
  240. package/es/animate/index.js +16 -0
  241. package/es/animate/index.js.map +1 -0
  242. package/es/animate/morphing.d.ts +52 -0
  243. package/es/animate/morphing.js +295 -0
  244. package/es/animate/morphing.js.map +1 -0
  245. package/es/animate/timeline.d.ts +17 -0
  246. package/es/animate/timeline.js +42 -0
  247. package/es/animate/timeline.js.map +1 -0
  248. package/es/application.d.ts +1 -2
  249. package/es/application.js.map +1 -1
  250. package/es/canvas/constants.js +2 -1
  251. package/es/canvas/empty-context.d.ts +0 -1
  252. package/es/canvas/empty-context.js +0 -4
  253. package/es/canvas/empty-context.js.map +1 -1
  254. package/es/canvas/util.js +1 -2
  255. package/es/color-string/interpolate.d.ts +0 -1
  256. package/es/color-string/interpolate.js +1 -8
  257. package/es/color-string/interpolate.js.map +1 -1
  258. package/es/common/custom-path2d.js +2 -2
  259. package/es/common/custom-path2d.js.map +1 -1
  260. package/es/common/enums.d.ts +16 -0
  261. package/es/common/enums.js +20 -0
  262. package/es/common/enums.js.map +1 -1
  263. package/es/common/morphing-utils.js +124 -29
  264. package/es/common/morphing-utils.js.map +1 -1
  265. package/es/common/polygon.js +3 -6
  266. package/es/common/polygon.js.map +1 -1
  267. package/es/common/segment/curve/cubic-bezier.d.ts +2 -1
  268. package/es/common/segment/curve/cubic-bezier.js +8 -1
  269. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  270. package/es/common/segment/curve/quadratic-bezier.d.ts +0 -1
  271. package/es/common/segment/curve/quadratic-bezier.js +2 -5
  272. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  273. package/es/common/segment/index.d.ts +0 -1
  274. package/es/common/segment/index.js +0 -2
  275. package/es/common/segment/index.js.map +1 -1
  276. package/es/common/shape/arc.d.ts +1 -1
  277. package/es/common/shape/arc.js +3 -7
  278. package/es/common/shape/arc.js.map +1 -1
  279. package/es/common/simplify.js +2 -1
  280. package/es/common/sort.js +1 -1
  281. package/es/common/split-path.js +2 -2
  282. package/es/common/split-path.js.map +1 -1
  283. package/es/common/store.js +1 -1
  284. package/es/common/text.js +1 -1
  285. package/es/common/utils.d.ts +2 -0
  286. package/es/common/utils.js +5 -1
  287. package/es/common/utils.js.map +1 -1
  288. package/es/core/application.js +1 -1
  289. package/es/core/camera.js +1 -1
  290. package/es/core/global.d.ts +0 -3
  291. package/es/core/global.js +2 -15
  292. package/es/core/global.js.map +1 -1
  293. package/es/core/stage.d.ts +3 -8
  294. package/es/core/stage.js +22 -35
  295. package/es/core/stage.js.map +1 -1
  296. package/es/graphic/arc.d.ts +2 -1
  297. package/es/graphic/arc.js +2 -3
  298. package/es/graphic/arc.js.map +1 -1
  299. package/es/graphic/area.d.ts +2 -1
  300. package/es/graphic/area.js +1 -4
  301. package/es/graphic/area.js.map +1 -1
  302. package/es/graphic/circle.d.ts +2 -1
  303. package/es/graphic/circle.js +2 -4
  304. package/es/graphic/circle.js.map +1 -1
  305. package/es/graphic/config.js +1 -2
  306. package/es/graphic/config.js.map +1 -1
  307. package/es/graphic/graphic-service/graphic-module.js +1 -1
  308. package/es/graphic/graphic-service/graphic-module.js.map +1 -1
  309. package/es/graphic/graphic-service/graphic-service.js +4 -1
  310. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  311. package/es/graphic/graphic.d.ts +12 -9
  312. package/es/graphic/graphic.js +109 -52
  313. package/es/graphic/graphic.js.map +1 -1
  314. package/es/graphic/group.js +7 -7
  315. package/es/graphic/group.js.map +1 -1
  316. package/es/graphic/line.d.ts +2 -1
  317. package/es/graphic/line.js +1 -5
  318. package/es/graphic/line.js.map +1 -1
  319. package/es/graphic/rect.js +2 -5
  320. package/es/graphic/rect.js.map +1 -1
  321. package/es/graphic/richtext/icon.d.ts +1 -1
  322. package/es/graphic/richtext/icon.js.map +1 -1
  323. package/es/graphic/richtext/paragraph.js +2 -2
  324. package/es/graphic/richtext/paragraph.js.map +1 -1
  325. package/es/graphic/star.d.ts +2 -1
  326. package/es/graphic/star.js +2 -4
  327. package/es/graphic/star.js.map +1 -1
  328. package/es/index.d.ts +3 -2
  329. package/es/index.js +6 -4
  330. package/es/index.js.map +1 -1
  331. package/es/interface/animate.d.ts +160 -1
  332. package/es/interface/animate.js +1 -2
  333. package/es/interface/animate.js.map +1 -1
  334. package/es/interface/context.d.ts +0 -1
  335. package/es/interface/context.js.map +1 -1
  336. package/es/interface/global.d.ts +0 -2
  337. package/es/interface/global.js.map +1 -1
  338. package/es/interface/graphic.d.ts +3 -11
  339. package/es/interface/graphic.js.map +1 -1
  340. package/es/interface/index.d.ts +1 -1
  341. package/es/interface/index.js +2 -2
  342. package/es/interface/index.js.map +1 -1
  343. package/es/interface/render.d.ts +0 -7
  344. package/es/interface/render.js.map +1 -1
  345. package/es/interface/stage.d.ts +1 -4
  346. package/es/interface/stage.js.map +1 -1
  347. package/es/modules.d.ts +1 -2
  348. package/es/modules.js +0 -6
  349. package/es/modules.js.map +1 -1
  350. package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
  351. package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
  352. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +12 -13
  353. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  354. package/es/plugins/builtin-plugin/flex-layout-plugin.js +11 -12
  355. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  356. package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
  357. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
  358. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
  359. package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
  360. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
  361. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
  362. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
  363. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
  364. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +5 -4
  365. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  366. package/es/render/contributions/render/arc-render.d.ts +2 -4
  367. package/es/render/contributions/render/arc-render.js +17 -19
  368. package/es/render/contributions/render/arc-render.js.map +1 -1
  369. package/es/render/contributions/render/area-render.js +2 -2
  370. package/es/render/contributions/render/area-render.js.map +1 -1
  371. package/es/render/contributions/render/base-render.d.ts +2 -2
  372. package/es/render/contributions/render/base-render.js +2 -2
  373. package/es/render/contributions/render/base-render.js.map +1 -1
  374. package/es/render/contributions/render/draw-contribution.d.ts +0 -1
  375. package/es/render/contributions/render/draw-contribution.js +19 -23
  376. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  377. package/es/render/contributions/render/draw-interceptor.js +1 -2
  378. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  379. package/es/render/contributions/render/group-render.d.ts +2 -2
  380. package/es/render/contributions/render/group-render.js +11 -15
  381. package/es/render/contributions/render/group-render.js.map +1 -1
  382. package/es/render/contributions/render/line-render.js +1 -1
  383. package/es/render/contributions/render/line-render.js.map +1 -1
  384. package/es/render/contributions/render/rect-render.d.ts +1 -3
  385. package/es/render/contributions/render/rect-render.js +14 -17
  386. package/es/render/contributions/render/rect-render.js.map +1 -1
  387. package/es/render/contributions/render/symbol-render.d.ts +2 -4
  388. package/es/render/contributions/render/symbol-render.js +11 -16
  389. package/es/render/contributions/render/symbol-render.js.map +1 -1
  390. package/es/render/render-service.d.ts +1 -1
  391. package/es/render/render-service.js.map +1 -1
  392. package/package.json +2 -2
  393. package/cjs/common/diff.d.ts +0 -1
  394. package/cjs/common/diff.js +0 -19
  395. package/cjs/common/diff.js.map +0 -1
  396. package/cjs/common/performance-raf.d.ts +0 -8
  397. package/cjs/common/performance-raf.js +0 -32
  398. package/cjs/common/performance-raf.js.map +0 -1
  399. package/cjs/interface/animation/animate.d.ts +0 -117
  400. package/cjs/interface/animation/animate.js +0 -10
  401. package/cjs/interface/animation/animate.js.map +0 -1
  402. package/cjs/interface/animation/easing.d.ts +0 -3
  403. package/cjs/interface/animation/easing.js +0 -6
  404. package/cjs/interface/animation/easing.js.map +0 -1
  405. package/cjs/interface/animation/index.d.ts +0 -5
  406. package/cjs/interface/animation/index.js.map +0 -1
  407. package/cjs/interface/animation/ticker.d.ts +0 -39
  408. package/cjs/interface/animation/ticker.js.map +0 -1
  409. package/cjs/interface/animation/timeline.d.ts +0 -17
  410. package/cjs/interface/animation/timeline.js +0 -6
  411. package/cjs/interface/animation/timeline.js.map +0 -1
  412. package/cjs/interface/animation/type.d.ts +0 -13
  413. package/cjs/interface/animation/type.js +0 -15
  414. package/cjs/interface/animation/type.js.map +0 -1
  415. package/es/common/diff.d.ts +0 -1
  416. package/es/common/diff.js +0 -11
  417. package/es/common/diff.js.map +0 -1
  418. package/es/common/performance-raf.d.ts +0 -8
  419. package/es/common/performance-raf.js +0 -24
  420. package/es/common/performance-raf.js.map +0 -1
  421. package/es/interface/animation/animate.d.ts +0 -117
  422. package/es/interface/animation/animate.js +0 -6
  423. package/es/interface/animation/animate.js.map +0 -1
  424. package/es/interface/animation/easing.d.ts +0 -3
  425. package/es/interface/animation/easing.js +0 -2
  426. package/es/interface/animation/easing.js.map +0 -1
  427. package/es/interface/animation/index.d.ts +0 -5
  428. package/es/interface/animation/index.js +0 -10
  429. package/es/interface/animation/index.js.map +0 -1
  430. package/es/interface/animation/ticker.d.ts +0 -39
  431. package/es/interface/animation/ticker.js.map +0 -1
  432. package/es/interface/animation/timeline.d.ts +0 -17
  433. package/es/interface/animation/timeline.js +0 -2
  434. package/es/interface/animation/timeline.js.map +0 -1
  435. package/es/interface/animation/type.d.ts +0 -13
  436. package/es/interface/animation/type.js +0 -14
  437. package/es/interface/animation/type.js.map +0 -1
@@ -0,0 +1,703 @@
1
+ import { clamp, getDecimalPlaces, isArray, isNumber, isValidNumber, pi, pi2, Point, PointService } from "@visactor/vutils";
2
+
3
+ import { application } from "../application";
4
+
5
+ import { AttributeUpdateType } from "../common/enums";
6
+
7
+ import { CustomPath2D } from "../common/custom-path2d";
8
+
9
+ import { ACustomAnimate } from "./animate";
10
+
11
+ import { Easing } from "./easing";
12
+
13
+ import { pointInterpolation } from "../common/utils";
14
+
15
+ import { divideCubic } from "../common/segment/curve/cubic-bezier";
16
+
17
+ export class IncreaseCount extends ACustomAnimate {
18
+ constructor(from, to, duration, easing, params) {
19
+ super(from, to, duration, easing, params);
20
+ }
21
+ getEndProps() {
22
+ return !1 === this.valid ? {} : {
23
+ text: this.to
24
+ };
25
+ }
26
+ onBind() {
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
28
+ this.fromNumber = isNumber(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text),
29
+ this.toNumber = isNumber(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text),
30
+ Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1),
31
+ !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
32
+ }
33
+ onEnd() {}
34
+ onUpdate(end, ratio, out) {
35
+ var _a;
36
+ !1 !== this.valid && (out.text = end ? null === (_a = this.to) || void 0 === _a ? void 0 : _a.text : (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength));
37
+ }
38
+ }
39
+
40
+ var Direction;
41
+
42
+ !function(Direction) {
43
+ Direction[Direction.LEFT_TO_RIGHT = 0] = "LEFT_TO_RIGHT", Direction[Direction.RIGHT_TO_LEFT = 1] = "RIGHT_TO_LEFT",
44
+ Direction[Direction.TOP_TO_BOTTOM = 2] = "TOP_TO_BOTTOM", Direction[Direction.BOTTOM_TO_TOP = 3] = "BOTTOM_TO_TOP",
45
+ Direction[Direction.STROKE = 4] = "STROKE";
46
+ }(Direction || (Direction = {}));
47
+
48
+ export class FadeInPlus extends ACustomAnimate {
49
+ constructor(from, to, duration, easing, params) {
50
+ super(from, to, duration, easing, params);
51
+ const {direction: direction = Direction.LEFT_TO_RIGHT, fill: fill = !0, stroke: stroke = !0} = params || {};
52
+ this.direction = direction, this.fill = fill, this.stroke = stroke, this.fillGradient = {
53
+ gradient: "linear",
54
+ stops: []
55
+ }, this.strokeGradient = {
56
+ gradient: "linear",
57
+ stops: []
58
+ };
59
+ }
60
+ getEndProps() {
61
+ return {
62
+ fill: this.toFill,
63
+ stroke: this.toStroke
64
+ };
65
+ }
66
+ onBind() {
67
+ this.toFill = this.target.getComputedAttribute("fill"), this.toStroke = this.target.getComputedAttribute("stroke");
68
+ }
69
+ onEnd() {}
70
+ onUpdate(end, ratio, out) {
71
+ if (this.toFill && this.toStroke) switch (this.direction) {
72
+ case Direction.RIGHT_TO_LEFT:
73
+ this.rightToLeft(end, ratio, out);
74
+ break;
75
+
76
+ case Direction.TOP_TO_BOTTOM:
77
+ this.topToBottom(end, ratio, out);
78
+ break;
79
+
80
+ case Direction.BOTTOM_TO_TOP:
81
+ this.bottomToTop(end, ratio, out);
82
+ break;
83
+
84
+ case Direction.STROKE:
85
+ this.strokePath(end, ratio, out);
86
+ break;
87
+
88
+ default:
89
+ this.leftToRight(end, ratio, out);
90
+ }
91
+ }
92
+ leftToRight(end, ratio, out) {
93
+ if (this.fill) {
94
+ const toFillColor = this.toFill;
95
+ this.fillGradient.x0 = 0, this.fillGradient.y0 = 0, this.fillGradient.x1 = 1, this.fillGradient.y1 = 0,
96
+ this.fillGradient.stops = [ {
97
+ offset: 0,
98
+ color: toFillColor
99
+ }, {
100
+ offset: ratio,
101
+ color: toFillColor
102
+ }, {
103
+ offset: Math.min(1, 2 * ratio),
104
+ color: "transparent"
105
+ } ], out.fill = this.fillGradient;
106
+ }
107
+ if (this.stroke) {
108
+ const toStrokeColor = this.toStroke;
109
+ this.strokeGradient.x0 = 0, this.strokeGradient.y0 = 0, this.strokeGradient.x1 = 1,
110
+ this.strokeGradient.y1 = 0, this.strokeGradient.stops = [ {
111
+ offset: 0,
112
+ color: toStrokeColor
113
+ }, {
114
+ offset: ratio,
115
+ color: toStrokeColor
116
+ }, {
117
+ offset: Math.min(1, 6 * ratio),
118
+ color: "transparent"
119
+ } ], out.stroke = this.strokeGradient;
120
+ }
121
+ }
122
+ strokePath(end, ratio, out) {
123
+ if (this.fill) {
124
+ const toFillColor = this.toFill;
125
+ this.fillGradient.x0 = 0, this.fillGradient.y0 = 0, this.fillGradient.x1 = 1, this.fillGradient.y1 = 0,
126
+ this.fillGradient.stops = [ {
127
+ offset: 0,
128
+ color: toFillColor
129
+ }, {
130
+ offset: ratio,
131
+ color: toFillColor
132
+ }, {
133
+ offset: Math.min(1, 2 * ratio),
134
+ color: "transparent"
135
+ } ], out.fill = this.fillGradient;
136
+ }
137
+ if (this.stroke) {
138
+ const dashLen = 300, offset = ratio * dashLen;
139
+ out.lineDash = [ offset, dashLen - offset ];
140
+ }
141
+ }
142
+ rightToLeft(end, ratio, out) {}
143
+ topToBottom(end, ratio, out) {}
144
+ bottomToTop(end, ratio, out) {}
145
+ }
146
+
147
+ export class InputText extends ACustomAnimate {
148
+ constructor() {
149
+ super(...arguments), this.fromText = "", this.toText = "";
150
+ }
151
+ getEndProps() {
152
+ return !1 === this.valid ? {} : {
153
+ text: this.to
154
+ };
155
+ }
156
+ onBind() {
157
+ var _a, _b, _c;
158
+ this.fromText = null !== (_b = null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) && void 0 !== _b ? _b : "",
159
+ this.toText = (null === (_c = this.to) || void 0 === _c ? void 0 : _c.text) || "",
160
+ (!this.toText || isArray(this.toText) && 0 === this.toText.length) && (this.valid = !1),
161
+ isArray(this.toText) && (this.toText = this.toText.map((item => (item || "").toString())));
162
+ }
163
+ onEnd() {
164
+ this.target.detachShadow();
165
+ }
166
+ onUpdate(end, ratio, out) {
167
+ if (!1 === this.valid) return;
168
+ const fromCount = this.fromText.length, toTextIsArray = isArray(this.toText), toCount = toTextIsArray ? this.toText.reduce(((c, t) => c + (t || "").length), 0) : this.toText.length, count = Math.ceil(fromCount + (toCount - fromCount) * ratio);
169
+ if (toTextIsArray) {
170
+ out.text = [];
171
+ let len = 0;
172
+ this.toText.forEach((t => {
173
+ len + t.length > count ? (out.text.push(t.substr(0, count - len)), len = count) : (out.text.push(t),
174
+ len += t.length);
175
+ }));
176
+ } else out.text = this.toText.substr(0, count);
177
+ }
178
+ }
179
+
180
+ export class StreamLight extends ACustomAnimate {
181
+ constructor(from, to, duration, easing, params) {
182
+ super(from, to, duration, easing, params);
183
+ }
184
+ getEndProps() {
185
+ return {};
186
+ }
187
+ onStart() {
188
+ this.target && ("rect" === this.target.type ? this.onStartRect() : "line" === this.target.type ? this.onStartLineOrArea("line") : "area" === this.target.type && this.onStartLineOrArea("area"));
189
+ }
190
+ onStartLineOrArea(type) {
191
+ var _a;
192
+ const root = this.target.attachShadow(), line = application.graphicService.creator[type](Object.assign({}, null === (_a = this.params) || void 0 === _a ? void 0 : _a.attribute));
193
+ this[type] = line, line.pathProxy = new CustomPath2D, root.add(line);
194
+ }
195
+ onStartRect() {
196
+ var _a, _b, _c;
197
+ const root = this.target.attachShadow(), isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b, sizeAttr = isHorizontal ? "height" : "width", otherSizeAttr = isHorizontal ? "width" : "height", size = this.target.AABBBounds[sizeAttr](), y = isHorizontal ? 0 : this.target.AABBBounds.y1, rect = application.graphicService.creator.rect(Object.assign(Object.assign({
198
+ [sizeAttr]: size,
199
+ fill: "#bcdeff",
200
+ shadowBlur: 30,
201
+ shadowColor: "#bcdeff"
202
+ }, null === (_c = this.params) || void 0 === _c ? void 0 : _c.attribute), {
203
+ x: 0,
204
+ y: y,
205
+ [otherSizeAttr]: 0
206
+ }));
207
+ this.rect = rect, root.add(rect);
208
+ }
209
+ onBind() {}
210
+ onEnd() {
211
+ this.target.detachShadow();
212
+ }
213
+ onUpdate(end, ratio, out) {
214
+ return this.rect ? this.onUpdateRect(end, ratio, out) : this.line || this.area ? this.onUpdateLineOrArea(end, ratio, out) : void 0;
215
+ }
216
+ onUpdateRect(end, ratio, out) {
217
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
218
+ const isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b, parentAttr = this.target.attribute;
219
+ if (isHorizontal) {
220
+ const parentWidth = null !== (_d = null !== (_c = parentAttr.width) && void 0 !== _c ? _c : Math.abs(parentAttr.x1 - parentAttr.x)) && void 0 !== _d ? _d : 250, streamLength = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.streamLength) && void 0 !== _f ? _f : parentWidth, maxLength = null !== (_j = null === (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.attribute) || void 0 === _h ? void 0 : _h.width) && void 0 !== _j ? _j : 60, startX = -maxLength, currentX = startX + (streamLength - startX) * ratio, x = Math.max(currentX, 0), w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX), width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
221
+ this.rect.setAttributes({
222
+ x: x,
223
+ width: width,
224
+ dx: Math.min(parentAttr.x1 - parentAttr.x, 0)
225
+ }, !1, {
226
+ type: AttributeUpdateType.ANIMATE_PLAY,
227
+ animationState: {
228
+ ratio: ratio,
229
+ end: end
230
+ }
231
+ });
232
+ } else {
233
+ const parentHeight = null !== (_l = null !== (_k = parentAttr.height) && void 0 !== _k ? _k : Math.abs(parentAttr.y1 - parentAttr.y)) && void 0 !== _l ? _l : 250, streamLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.streamLength) && void 0 !== _o ? _o : parentHeight, maxLength = null !== (_r = null === (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.attribute) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : 60, currentY = parentHeight - (streamLength + maxLength) * ratio;
234
+ let y = Math.min(currentY, parentHeight);
235
+ const h = Math.min(parentHeight - currentY, maxLength);
236
+ let height;
237
+ y <= 0 ? (height = Math.max(y + h, 0), y = 0) : height = h, this.rect.setAttributes({
238
+ y: y,
239
+ height: height,
240
+ dy: Math.min(parentAttr.y1 - parentAttr.y, 0)
241
+ }, !1, {
242
+ type: AttributeUpdateType.ANIMATE_PLAY,
243
+ animationState: {
244
+ ratio: ratio,
245
+ end: end
246
+ }
247
+ });
248
+ }
249
+ }
250
+ onUpdateLineOrArea(end, ratio, out) {
251
+ const target = this.line || this.area;
252
+ if (!target) return;
253
+ const customPath = target.pathProxy, targetLine = this.target;
254
+ targetLine.cache || targetLine.cacheArea ? this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out) : this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
255
+ const targetAttrs = targetLine.attribute;
256
+ target.setAttributes(Object.assign({
257
+ stroke: targetAttrs.stroke
258
+ }, target.attribute)), target.addUpdateBoundTag();
259
+ }
260
+ _onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
261
+ var _a, _b;
262
+ if (customPath.clear(), "line" === g.type) {
263
+ let cache = g.cache;
264
+ Array.isArray(cache) || (cache = [ cache ]);
265
+ const totalLen = cache.reduce(((l, c) => l + c.getLength()), 0), curves = [];
266
+ return cache.forEach((c => {
267
+ c.curves.forEach((ci => curves.push(ci)));
268
+ })), this._updateCurves(customPath, curves, totalLen, ratio);
269
+ }
270
+ if ("area" === g.type && (null === (_b = null === (_a = g.cacheArea) || void 0 === _a ? void 0 : _a.top) || void 0 === _b ? void 0 : _b.curves)) {
271
+ const cache = g.cacheArea, totalLen = cache.top.curves.reduce(((a, b) => a + b.getLength()), 0);
272
+ return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
273
+ }
274
+ }
275
+ _updateCurves(customPath, curves, totalLen, ratio) {
276
+ var _a, _b;
277
+ const startLen = totalLen * ratio, endLen = Math.min(null !== (_b = startLen + (null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength)) && void 0 !== _b ? _b : 10, totalLen);
278
+ let lastLen = 0, start = !1;
279
+ for (let i = 0; i < curves.length; i++) if (!1 !== curves[i].defined) {
280
+ const curveItem = curves[i], len = curveItem.getLength(), startPercent = 1 - (lastLen + len - startLen) / len;
281
+ let curveForStart, endPercent = 1 - (lastLen + len - endLen) / len;
282
+ if (lastLen < startLen && lastLen + len > startLen) if (start = !0, curveItem.p2 && curveItem.p3) {
283
+ const [_, curve2] = divideCubic(curveItem, startPercent);
284
+ customPath.moveTo(curve2.p0.x, curve2.p0.y), curveForStart = curve2;
285
+ } else {
286
+ const p = curveItem.getPointAt(startPercent);
287
+ customPath.moveTo(p.x, p.y);
288
+ }
289
+ if (lastLen < endLen && lastLen + len > endLen) {
290
+ if (curveItem.p2 && curveItem.p3) {
291
+ curveForStart && (endPercent = (endLen - startLen) / curveForStart.getLength());
292
+ const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
293
+ customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
294
+ } else {
295
+ const p = curveItem.getPointAt(endPercent);
296
+ customPath.lineTo(p.x, p.y);
297
+ }
298
+ break;
299
+ }
300
+ if (start) if (curveItem.p2 && curveItem.p3) {
301
+ const curve = curveForStart || curveItem;
302
+ customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
303
+ } else customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
304
+ lastLen += len;
305
+ }
306
+ }
307
+ _onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
308
+ var _a, _b;
309
+ const {points: points, curveType: curveType} = line.attribute;
310
+ if (!points || points.length < 2 || "linear" !== curveType) return;
311
+ let totalLen = 0;
312
+ for (let i = 1; i < points.length; i++) totalLen += PointService.distancePP(points[i], points[i - 1]);
313
+ const startLen = totalLen * ratio, endLen = Math.min(null !== (_b = startLen + (null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength)) && void 0 !== _b ? _b : 10, totalLen), nextPoints = [];
314
+ let lastLen = 0;
315
+ for (let i = 1; i < points.length; i++) {
316
+ const len = PointService.distancePP(points[i], points[i - 1]);
317
+ if (lastLen < startLen && lastLen + len > startLen && nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len)),
318
+ lastLen < endLen && lastLen + len > endLen) {
319
+ nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
320
+ break;
321
+ }
322
+ nextPoints.length && nextPoints.push(points[i]), lastLen += len;
323
+ }
324
+ if (nextPoints.length && !(nextPoints.length < 2)) {
325
+ customPath.clear(), customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
326
+ for (let i = 1; i < nextPoints.length; i++) customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
327
+ }
328
+ }
329
+ }
330
+
331
+ export class Meteor extends ACustomAnimate {
332
+ get lastPos() {
333
+ return this.posList[this.posList.length - 1];
334
+ }
335
+ constructor(size, duration, easing, params) {
336
+ super(null, null, duration, easing, params), this.size = size, this.posList = [];
337
+ }
338
+ onBind() {
339
+ const root = this.target.attachShadow();
340
+ this.root = root;
341
+ for (let i = 0; i < this.size; i++) {
342
+ const g = this.target.clone(), scale = Math.min((this.size - i) / this.size * 3, 1), opacity = Math.min(.2 + .7 / this.size);
343
+ g.setAttributes({
344
+ x: 0,
345
+ y: 0,
346
+ dx: 0,
347
+ dy: 0,
348
+ scaleX: scale,
349
+ scaleY: scale,
350
+ opacity: opacity
351
+ }, !1, {
352
+ type: AttributeUpdateType.ANIMATE_BIND
353
+ }), root.add(g);
354
+ }
355
+ }
356
+ onUpdate(end, ratio, out) {
357
+ if (end) return this.target.detachShadow(), void (this.posList.length = 0);
358
+ const x = this.target.getComputedAttribute("x"), y = this.target.getComputedAttribute("y"), nextPos = new Point(x, y);
359
+ this.posList.length ? (this.target.shadowRoot.forEachChildren(((g, i) => {
360
+ const pos = this.posList[Math.max(this.posList.length - i - 1, 0)];
361
+ g.setAttributes({
362
+ x: pos.x - x,
363
+ y: pos.y - y
364
+ }, !1);
365
+ })), this.posList.push(nextPos)) : this.posList.push(nextPos);
366
+ }
367
+ }
368
+
369
+ export class MotionPath extends ACustomAnimate {
370
+ constructor(from, to, duration, easing, params) {
371
+ var _a;
372
+ super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(),
373
+ this.path = params.path, this.distance = params.distance, this.to = params.distance * this.pathLength,
374
+ this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle,
375
+ this.cb = params.cb);
376
+ }
377
+ onUpdate(end, ratio, out) {
378
+ const at = this.to * ratio, {pos: pos, angle: angle} = this.path.getAttrAt(at);
379
+ out.x = pos.x, out.y = pos.y, this.changeAngle && (out.angle = angle + this.initAngle),
380
+ this.cb && this.cb(this.from, this.to, ratio, this.target);
381
+ }
382
+ }
383
+
384
+ export class TagPointsUpdate extends ACustomAnimate {
385
+ constructor(from, to, duration, easing, params) {
386
+ var _a, _b;
387
+ super(from, to, duration, easing, params), this.newPointAnimateType = null !== (_a = null == params ? void 0 : params.newPointAnimateType) && void 0 !== _a ? _a : "grow",
388
+ this.clipRangeByDimension = null !== (_b = null == params ? void 0 : params.clipRangeByDimension) && void 0 !== _b ? _b : "x";
389
+ }
390
+ getPoints(attribute, cache = !1) {
391
+ if (attribute.points) return attribute.points;
392
+ if (attribute.segments) {
393
+ const points = [];
394
+ return this.segmentsCache || (this.segmentsCache = []), attribute.segments.map((segment => {
395
+ var _a, _b;
396
+ segment.points && points.push(...segment.points), cache && this.segmentsCache.push(null !== (_b = null === (_a = segment.points) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0);
397
+ })), points;
398
+ }
399
+ return [];
400
+ }
401
+ onBind() {
402
+ const originFromPoints = this.getPoints(this.from), originToPoints = this.getPoints(this.to, !0);
403
+ this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [ originFromPoints ] : [],
404
+ this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [ originToPoints ] : [];
405
+ const tagMap = new Map;
406
+ this.fromPoints.forEach((point => {
407
+ point.context && tagMap.set(point.context, point);
408
+ }));
409
+ let firstMatchedPoint, lastMatchedPoint, firstMatchedIndex = 1 / 0, lastMatchedIndex = -1 / 0;
410
+ for (let i = 0; i < this.toPoints.length; i += 1) if (tagMap.has(this.toPoints[i].context)) {
411
+ firstMatchedIndex = i, firstMatchedPoint = tagMap.get(this.toPoints[i].context);
412
+ break;
413
+ }
414
+ for (let i = this.toPoints.length - 1; i >= 0; i -= 1) if (tagMap.has(this.toPoints[i].context)) {
415
+ lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
416
+ break;
417
+ }
418
+ "clip" === this.newPointAnimateType && 0 !== this.toPoints.length && (Number.isFinite(lastMatchedIndex) ? (this.clipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension],
419
+ 1 === this.clipRange && (this.shrinkClipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.fromPoints[this.fromPoints.length - 1][this.clipRangeByDimension]),
420
+ isValidNumber(this.clipRange) ? this.clipRange = clamp(this.clipRange, 0, 1) : this.clipRange = 0) : this.clipRange = 0);
421
+ let prevMatchedPoint = this.toPoints[0];
422
+ this.interpolatePoints = this.toPoints.map(((point, index) => {
423
+ const matchedPoint = tagMap.get(point.context);
424
+ return matchedPoint ? (prevMatchedPoint = matchedPoint, [ matchedPoint, point ]) : "appear" === this.newPointAnimateType || "clip" === this.newPointAnimateType ? [ point, point ] : index < firstMatchedIndex && firstMatchedPoint ? [ firstMatchedPoint, point ] : index > lastMatchedIndex && lastMatchedPoint ? [ lastMatchedPoint, point ] : [ prevMatchedPoint, point ];
425
+ })), this.points = this.interpolatePoints.map((interpolate => {
426
+ const fromPoint = interpolate[0], toPoint = interpolate[1], newPoint = new Point(fromPoint.x, fromPoint.y, fromPoint.x1, fromPoint.y1);
427
+ return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
428
+ }));
429
+ }
430
+ onFirstRun() {
431
+ const lastClipRange = this.target.attribute.clipRange;
432
+ isValidNumber(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
433
+ }
434
+ onUpdate(end, ratio, out) {
435
+ if (end) Object.keys(this.to).forEach((k => {
436
+ out[k] = this.to[k];
437
+ })); else {
438
+ if (this.points = this.points.map(((point, index) => {
439
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
440
+ return newPoint.context = point.context, newPoint;
441
+ })), this.clipRange) {
442
+ if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints,
443
+ out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
444
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
445
+ }
446
+ if (this.segmentsCache && this.to.segments) {
447
+ let start = 0;
448
+ out.segments = this.to.segments.map(((segment, index) => {
449
+ const end = start + this.segmentsCache[index], points = this.points.slice(start, end);
450
+ return start = end, Object.assign(Object.assign({}, segment), {
451
+ points: points
452
+ });
453
+ }));
454
+ } else out.points = this.points;
455
+ }
456
+ }
457
+ }
458
+
459
+ export class GraphicAnimate extends ACustomAnimate {
460
+ constructor(from, to, duration, easing, params) {
461
+ super(from, to, duration, easing, params), this.graphic = null == params ? void 0 : params.graphic;
462
+ }
463
+ onUpdate(end, ratio, out) {
464
+ this.graphic && Object.keys(this.from).forEach((k => {
465
+ out[k] = this.from[k] + (this.to[k] - this.from[k]) * ratio;
466
+ }));
467
+ }
468
+ }
469
+
470
+ export class ClipGraphicAnimate extends ACustomAnimate {
471
+ constructor(from, to, duration, easing, params) {
472
+ super(null, null, duration, easing, params), this.clipFromAttribute = from, this.clipToAttribute = to,
473
+ this._group = null == params ? void 0 : params.group, this._clipGraphic = null == params ? void 0 : params.clipGraphic;
474
+ }
475
+ onBind() {
476
+ this._group && this._clipGraphic && (this._lastClip = this._group.attribute.clip,
477
+ this._lastPath = this._group.attribute.path, this._group.setAttributes({
478
+ clip: !0,
479
+ path: [ this._clipGraphic ]
480
+ }, !1, {
481
+ type: AttributeUpdateType.ANIMATE_BIND
482
+ }));
483
+ }
484
+ onEnd() {
485
+ this._group && this._group.setAttributes({
486
+ clip: this._lastClip,
487
+ path: this._lastPath
488
+ }, !1, {
489
+ type: AttributeUpdateType.ANIMATE_END
490
+ });
491
+ }
492
+ onUpdate(end, ratio, out) {
493
+ if (!this._clipGraphic) return;
494
+ const res = {};
495
+ Object.keys(this.clipFromAttribute).forEach((k => {
496
+ res[k] = this.clipFromAttribute[k] + (this.clipToAttribute[k] - this.clipFromAttribute[k]) * ratio;
497
+ })), this._clipGraphic.setAttributes(res, !1, {
498
+ type: AttributeUpdateType.ANIMATE_UPDATE,
499
+ animationState: {
500
+ ratio: ratio,
501
+ end: end
502
+ }
503
+ });
504
+ }
505
+ }
506
+
507
+ export class ClipAngleAnimate extends ClipGraphicAnimate {
508
+ constructor(from, to, duration, easing, params) {
509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
510
+ const groupAttribute = null !== (_b = null === (_a = null == params ? void 0 : params.group) || void 0 === _a ? void 0 : _a.attribute) && void 0 !== _b ? _b : {}, width = null !== (_c = groupAttribute.width) && void 0 !== _c ? _c : 0, height = null !== (_d = groupAttribute.height) && void 0 !== _d ? _d : 0, animationType = null !== (_e = null == params ? void 0 : params.animationType) && void 0 !== _e ? _e : "in", startAngle = null !== (_f = null == params ? void 0 : params.startAngle) && void 0 !== _f ? _f : 0, orient = null !== (_g = null == params ? void 0 : params.orient) && void 0 !== _g ? _g : "clockwise";
511
+ let arcStartAngle = 0, arcEndAngle = 0;
512
+ "anticlockwise" === orient ? (arcEndAngle = "in" === animationType ? startAngle + 2 * Math.PI : startAngle,
513
+ arcEndAngle = startAngle + 2 * Math.PI) : (arcStartAngle = startAngle, arcEndAngle = "out" === animationType ? startAngle + 2 * Math.PI : startAngle);
514
+ const arc = application.graphicService.creator.arc({
515
+ x: null !== (_j = null === (_h = null == params ? void 0 : params.center) || void 0 === _h ? void 0 : _h.x) && void 0 !== _j ? _j : width / 2,
516
+ y: null !== (_l = null === (_k = null == params ? void 0 : params.center) || void 0 === _k ? void 0 : _k.y) && void 0 !== _l ? _l : height / 2,
517
+ outerRadius: null !== (_m = null == params ? void 0 : params.radius) && void 0 !== _m ? _m : (width + height) / 2,
518
+ innerRadius: 0,
519
+ startAngle: arcStartAngle,
520
+ endAngle: arcEndAngle,
521
+ fill: !0
522
+ });
523
+ let fromAttributes, toAttributes;
524
+ "anticlockwise" === orient ? (fromAttributes = {
525
+ startAngle: startAngle + 2 * Math.PI
526
+ }, toAttributes = {
527
+ startAngle: startAngle
528
+ }) : (fromAttributes = {
529
+ endAngle: startAngle
530
+ }, toAttributes = {
531
+ endAngle: startAngle + 2 * Math.PI
532
+ }), super("in" === animationType ? fromAttributes : toAttributes, "in" === animationType ? toAttributes : fromAttributes, duration, easing, {
533
+ group: null == params ? void 0 : params.group,
534
+ clipGraphic: arc
535
+ });
536
+ }
537
+ }
538
+
539
+ export class ClipRadiusAnimate extends ClipGraphicAnimate {
540
+ constructor(from, to, duration, easing, params) {
541
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
542
+ const groupAttribute = null !== (_b = null === (_a = null == params ? void 0 : params.group) || void 0 === _a ? void 0 : _a.attribute) && void 0 !== _b ? _b : {}, width = null !== (_c = groupAttribute.width) && void 0 !== _c ? _c : 0, height = null !== (_d = groupAttribute.height) && void 0 !== _d ? _d : 0, animationType = null !== (_e = null == params ? void 0 : params.animationType) && void 0 !== _e ? _e : "in", startRadius = null !== (_f = null == params ? void 0 : params.startRadius) && void 0 !== _f ? _f : 0, endRadius = null !== (_g = null == params ? void 0 : params.endRadius) && void 0 !== _g ? _g : Math.sqrt((width / 2) ** 2 + (height / 2) ** 2), arc = application.graphicService.creator.arc({
543
+ x: null !== (_j = null === (_h = null == params ? void 0 : params.center) || void 0 === _h ? void 0 : _h.x) && void 0 !== _j ? _j : width / 2,
544
+ y: null !== (_l = null === (_k = null == params ? void 0 : params.center) || void 0 === _k ? void 0 : _k.y) && void 0 !== _l ? _l : height / 2,
545
+ outerRadius: "out" === animationType ? endRadius : startRadius,
546
+ innerRadius: 0,
547
+ startAngle: 0,
548
+ endAngle: 2 * Math.PI,
549
+ fill: !0
550
+ }), fromAttributes = {
551
+ outerRadius: startRadius
552
+ }, toAttributes = {
553
+ outerRadius: endRadius
554
+ };
555
+ super("in" === animationType ? fromAttributes : toAttributes, "in" === animationType ? toAttributes : fromAttributes, duration, easing, {
556
+ group: null == params ? void 0 : params.group,
557
+ clipGraphic: arc
558
+ });
559
+ }
560
+ }
561
+
562
+ export class ClipDirectionAnimate extends ClipGraphicAnimate {
563
+ constructor(from, to, duration, easing, params) {
564
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
565
+ const groupAttribute = null !== (_b = null === (_a = null == params ? void 0 : params.group) || void 0 === _a ? void 0 : _a.attribute) && void 0 !== _b ? _b : {}, width = null !== (_d = null !== (_c = null == params ? void 0 : params.width) && void 0 !== _c ? _c : groupAttribute.width) && void 0 !== _d ? _d : 0, height = null !== (_f = null !== (_e = null == params ? void 0 : params.height) && void 0 !== _e ? _e : groupAttribute.height) && void 0 !== _f ? _f : 0, animationType = null !== (_g = null == params ? void 0 : params.animationType) && void 0 !== _g ? _g : "in", direction = null !== (_h = null == params ? void 0 : params.direction) && void 0 !== _h ? _h : "x", orient = null !== (_j = null == params ? void 0 : params.orient) && void 0 !== _j ? _j : "positive", rect = application.graphicService.creator.rect({
566
+ x: 0,
567
+ y: 0,
568
+ width: "in" === animationType && "x" === direction ? 0 : width,
569
+ height: "in" === animationType && "y" === direction ? 0 : height,
570
+ fill: !0
571
+ });
572
+ let fromAttributes = {}, toAttributes = {};
573
+ "y" === direction ? "negative" === orient ? (fromAttributes = {
574
+ y: height,
575
+ height: 0
576
+ }, toAttributes = {
577
+ y: 0,
578
+ height: height
579
+ }) : (fromAttributes = {
580
+ height: 0
581
+ }, toAttributes = {
582
+ height: height
583
+ }) : "negative" === orient ? (fromAttributes = {
584
+ x: width,
585
+ width: 0
586
+ }, toAttributes = {
587
+ x: 0,
588
+ width: width
589
+ }) : (fromAttributes = {
590
+ width: 0
591
+ }, toAttributes = {
592
+ width: width
593
+ }), super("in" === animationType ? fromAttributes : toAttributes, "in" === animationType ? toAttributes : fromAttributes, duration, easing, {
594
+ group: null == params ? void 0 : params.group,
595
+ clipGraphic: rect
596
+ });
597
+ }
598
+ }
599
+
600
+ export class RotateBySphereAnimate extends ACustomAnimate {
601
+ onStart() {
602
+ const {center: center, r: r} = "function" == typeof this.params ? this.params() : this.params, startX = this.target.getComputedAttribute("x"), startY = this.target.getComputedAttribute("y"), startZ = this.target.getComputedAttribute("z"), phi = Math.acos((startY - center.y) / r);
603
+ let theta = Math.acos((startX - center.x) / r / Math.sin(phi));
604
+ startZ - center.z < 0 && (theta = pi2 - theta), this.theta = theta, this.phi = phi;
605
+ }
606
+ onBind() {}
607
+ onEnd() {}
608
+ onUpdate(end, ratio, out) {
609
+ if (null == this.phi || null == this.theta) return;
610
+ const {center: center, r: r, cb: cb} = "function" == typeof this.params ? this.params() : this.params, deltaAngle = 2 * Math.PI * ratio, theta = this.theta + deltaAngle, phi = this.phi, x = r * Math.sin(phi) * Math.cos(theta) + center.x, y = r * Math.cos(phi) + center.y, z = r * Math.sin(phi) * Math.sin(theta) + center.z;
611
+ for (out.x = x, out.y = y, out.z = z, out.alpha = theta + pi / 2; out.alpha > pi2; ) out.alpha -= pi2;
612
+ out.alpha = pi2 - out.alpha, out.zIndex = -1e4 * out.z, cb && cb(out);
613
+ }
614
+ }
615
+
616
+ export class AttributeAnimate extends ACustomAnimate {
617
+ constructor(to, duration, easing) {
618
+ super({}, to, duration, easing);
619
+ }
620
+ getEndProps() {
621
+ return this.to;
622
+ }
623
+ onBind() {
624
+ Object.keys(this.to).forEach((k => {
625
+ this.from[k] = this.target.getComputedAttribute(k);
626
+ }));
627
+ }
628
+ onEnd() {}
629
+ onUpdate(end, ratio, out) {
630
+ this.target.stepInterpolate(this.subAnimate, this.subAnimate.animate, out, this.step, ratio, end, this.to, this.from);
631
+ }
632
+ }
633
+
634
+ export class AnimateGroup extends ACustomAnimate {
635
+ constructor(duration, customAnimates) {
636
+ super(null, null, duration, "linear"), this.customAnimates = customAnimates;
637
+ }
638
+ initAnimates() {
639
+ this.customAnimates.forEach((a => {
640
+ a.step = this.step, a.subAnimate = this.subAnimate, a.target = this.target;
641
+ }));
642
+ }
643
+ getEndProps() {
644
+ const props = {};
645
+ return this.customAnimates.forEach((a => {
646
+ Object.assign(props, a.getEndProps());
647
+ })), props;
648
+ }
649
+ onBind() {
650
+ this.initAnimates(), this.customAnimates.forEach((a => {
651
+ a.onBind();
652
+ }));
653
+ }
654
+ onEnd() {
655
+ this.customAnimates.forEach((a => {
656
+ a.onEnd();
657
+ }));
658
+ }
659
+ onStart() {
660
+ this.customAnimates.forEach((a => {
661
+ a.onStart();
662
+ }));
663
+ }
664
+ onUpdate(end, ratio, out) {
665
+ this.updating || (this.updating = !0, this.customAnimates.forEach((a => {
666
+ const easing = a.easing, easingFunc = "string" == typeof easing ? Easing[easing] : easing;
667
+ ratio = easingFunc(ratio), a.onUpdate(end, ratio, out);
668
+ })), this.updating = !1);
669
+ }
670
+ }
671
+
672
+ export class AnimateGroup1 extends ACustomAnimate {
673
+ constructor(duration, customAnimates) {
674
+ super(null, null, duration, "linear"), this.customAnimates = customAnimates;
675
+ }
676
+ initAnimates() {
677
+ this.customAnimates.forEach((a => {
678
+ a.step = this.step, a.subAnimate = this.subAnimate, a.target = this.target;
679
+ }));
680
+ }
681
+ getEndProps() {
682
+ const props = {};
683
+ return this.customAnimates.forEach((a => {
684
+ Object.assign(props, a.getEndProps());
685
+ })), props;
686
+ }
687
+ onBind() {
688
+ this.initAnimates(), this.customAnimates.forEach((a => {
689
+ a.onBind();
690
+ }));
691
+ }
692
+ onEnd() {
693
+ this.customAnimates.forEach((a => {
694
+ a.onEnd();
695
+ }));
696
+ }
697
+ onUpdate(end, ratio, out) {
698
+ this.updating || (this.updating = !0, this.customAnimates.forEach((a => {
699
+ const easing = a.easing, easingFunc = "string" == typeof easing ? Easing[easing] : easing;
700
+ ratio = easingFunc(ratio), a.onUpdate(end, ratio, out);
701
+ })), this.updating = !1);
702
+ }
703
+ }