@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,33 @@
1
+ import type { EasingType, IGraphic } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from './custom-animate';
3
+ export interface IRotateAnimationOptions {
4
+ orient?: 'clockwise' | 'anticlockwise';
5
+ angle?: number;
6
+ }
7
+ export declare const rotateIn: (graphic: IGraphic, options: IRotateAnimationOptions) => {
8
+ from: {
9
+ angle: number;
10
+ };
11
+ to: {
12
+ angle: any;
13
+ };
14
+ };
15
+ export declare const rotateOut: (graphic: IGraphic, options: IRotateAnimationOptions) => {
16
+ from: {
17
+ angle: any;
18
+ };
19
+ to: {
20
+ angle: number;
21
+ };
22
+ };
23
+ export declare class RotateBase extends ACustomAnimate<Record<string, number>> {
24
+ valid: boolean;
25
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
26
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
27
+ }
28
+ export declare class RotateIn extends RotateBase {
29
+ onBind(): void;
30
+ }
31
+ export declare class RotateOut extends RotateBase {
32
+ onBind(): void;
33
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.RotateOut = exports.RotateIn = exports.RotateBase = exports.rotateOut = exports.rotateIn = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), rotateIn = (graphic, options) => {
8
+ var _a;
9
+ const attributeAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
10
+ let angle = 0;
11
+ return angle = (0, vutils_1.isNumberClose)(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
12
+ vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(attributeAngle / (2 * Math.PI)) * Math.PI * 2,
13
+ {
14
+ from: {
15
+ angle: angle
16
+ },
17
+ to: {
18
+ angle: attributeAngle
19
+ }
20
+ };
21
+ };
22
+
23
+ exports.rotateIn = rotateIn;
24
+
25
+ const rotateOut = (graphic, options) => {
26
+ var _a;
27
+ const finalAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
28
+ let angle = 0;
29
+ return angle = (0, vutils_1.isNumberClose)(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
30
+ vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2,
31
+ {
32
+ from: {
33
+ angle: finalAngle
34
+ },
35
+ to: {
36
+ angle: angle
37
+ }
38
+ };
39
+ };
40
+
41
+ exports.rotateOut = rotateOut;
42
+
43
+ class RotateBase extends custom_animate_1.ACustomAnimate {
44
+ constructor(from, to, duration, easing, params) {
45
+ super(from, to, duration, easing, params);
46
+ }
47
+ onUpdate(end, ratio, out) {
48
+ const attribute = this.target.attribute;
49
+ this.propKeys.forEach((key => {
50
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
51
+ })), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
52
+ }
53
+ }
54
+
55
+ exports.RotateBase = RotateBase;
56
+
57
+ class RotateIn extends RotateBase {
58
+ onBind() {
59
+ var _a;
60
+ super.onBind();
61
+ const {from: from, to: to} = (0, exports.rotateIn)(this.target, this.params.options);
62
+ this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;
63
+ const finalAttribute = this.target.getFinalAttribute();
64
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
65
+ }
66
+ }
67
+
68
+ exports.RotateIn = RotateIn;
69
+
70
+ class RotateOut extends RotateBase {
71
+ onBind() {
72
+ super.onBind();
73
+ const {from: from, to: to} = (0, exports.rotateOut)(this.target, this.params.options);
74
+ this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;
75
+ }
76
+ }
77
+
78
+ exports.RotateOut = RotateOut;
79
+ //# sourceMappingURL=rotate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/rotate.ts"],"names":[],"mappings":";;;AACA,6CAAgE;AAChE,qDAAkD;AAO3C,MAAM,QAAQ,GAAG,CAAC,OAAiB,EAAE,OAAgC,EAAE,EAAE;;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAA,UAAU,CAAC,KAAK,mCAAI,CAAC,CAAC;IAE7C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAA,sBAAa,EAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACpD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAClE;SAAM,IAAI,IAAA,sBAAa,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,EAAE;QACxC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;SAAM,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,eAAe,EAAE;QAC9C,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACjE;SAAM;QACL,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,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,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;SAC3C;QAED,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,gBAAgB,MAAK,KAAK,EAAE;YAC1D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArBD,4BAqBC;AAED,MAAa,SAAU,SAAQ,UAAU;IACvC,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAA,iBAAS,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC;QAE1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AAVD,8BAUC","file":"rotate.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender-core';\nimport { isNumberClose, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IRotateAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n angle?: number;\n}\n\nexport const rotateIn = (graphic: IGraphic, options: IRotateAnimationOptions) => {\n const finalAttrs = graphic.getFinalAttribute();\n const attributeAngle = finalAttrs.angle ?? 0;\n\n let angle = 0;\n if (isNumberClose(attributeAngle / (Math.PI * 2), 0)) {\n angle = Math.round(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle },\n to: { angle: attributeAngle }\n };\n};\n\nexport const rotateOut = (graphic: IGraphic, options: IRotateAnimationOptions) => {\n const finalAttrs = graphic.getFinalAttribute();\n const finalAngle = finalAttrs.angle ?? 0;\n let angle = 0;\n if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {\n angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle: finalAngle },\n to: { angle }\n };\n};\n\nexport class RotateBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class RotateIn extends RotateBase {\n onBind(): void {\n super.onBind();\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const { from, to } = rotateIn(this.target, this.params.options);\n\n this.props = to;\n this.propKeys = ['angle'];\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n }\n}\n\nexport class RotateOut extends RotateBase {\n onBind(): void {\n super.onBind();\n const { from, to } = rotateOut(this.target, this.params.options);\n this.props = to;\n this.propKeys = ['angle'];\n\n this.from = from;\n this.to = to;\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
- import type { IAnimate, IStep } from '../intreface/animate';
2
- import type { EasingType } from '../intreface/easing';
1
+ import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';
3
2
  import { ACustomAnimate } from './custom-animate';
4
3
  export interface IScaleAnimationOptions {
5
4
  direction?: 'x' | 'y' | 'xy';
@@ -7,8 +6,13 @@ export interface IScaleAnimationOptions {
7
6
  export declare class ScaleIn extends ACustomAnimate<Record<string, number>> {
8
7
  valid: boolean;
9
8
  constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
9
+ _updateFunction: (ratio: number) => void;
10
10
  onBind(): void;
11
11
  onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
12
+ updateX(ratio: number): void;
13
+ updateY(ratio: number): void;
14
+ updateXY(ratio: number): void;
15
+ deleteSelfAttr(key: string): void;
12
16
  onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
13
17
  }
14
18
  export declare class ScaleOut extends ACustomAnimate<Record<string, number>> {
@@ -11,16 +11,17 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
11
11
  super(from, to, duration, easing, params);
12
12
  }
13
13
  onBind() {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
15
15
  let from, to;
16
- const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : {};
16
+ super.onBind();
17
+ const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
17
18
  switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
18
19
  case "x":
19
20
  from = {
20
21
  scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
21
22
  }, to = {
22
23
  scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
23
- };
24
+ }, this._updateFunction = this.updateX;
24
25
  break;
25
26
 
26
27
  case "y":
@@ -28,7 +29,7 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
28
29
  scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
29
30
  }, to = {
30
31
  scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
31
- };
32
+ }, this._updateFunction = this.updateY;
32
33
  break;
33
34
 
34
35
  default:
@@ -38,18 +39,32 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
38
39
  }, to = {
39
40
  scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
40
41
  scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
41
- };
42
+ }, this._updateFunction = this.updateXY;
42
43
  }
43
- this.props = to, this.propKeys = Object.keys(to), this.animate.reSyncProps(), this.from = from,
44
- this.to = to, this.target.setAttributes(from);
44
+ const finalAttribute = this.target.getFinalAttribute();
45
+ finalAttribute && this.target.setAttributes(finalAttribute), this.props = to, this.from = from,
46
+ this.to = to, !1 !== (null === (_l = this.params.controlOptions) || void 0 === _l ? void 0 : _l.immediatelyApply) && this.target.setAttributes(from);
45
47
  }
46
48
  onEnd(cb) {
47
49
  super.onEnd(cb);
48
50
  }
51
+ updateX(ratio) {
52
+ this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
53
+ }
54
+ updateY(ratio) {
55
+ this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
56
+ }
57
+ updateXY(ratio) {
58
+ this.updateX(ratio), this.updateY(ratio);
59
+ }
60
+ deleteSelfAttr(key) {
61
+ delete this.props[key], this.fromProps && delete this.fromProps[key];
62
+ const index = this.propKeys.indexOf(key);
63
+ -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : "scaleX" === this.propKeys[0] ? this._updateFunction = this.updateX : "scaleY" === this.propKeys[0] ? this._updateFunction = this.updateY : this._updateFunction = null;
64
+ }
49
65
  onUpdate(end, ratio, out) {
50
- this.propKeys.forEach((key => {
51
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
52
- })), this.target.setAttributes(out);
66
+ this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(),
67
+ this.target.addUpdateBoundTag());
53
68
  }
54
69
  }
55
70
 
@@ -62,7 +77,8 @@ class ScaleOut extends custom_animate_1.ACustomAnimate {
62
77
  onBind() {
63
78
  var _a, _b, _c, _d, _e;
64
79
  let from, to;
65
- const attrs = this.target.getFinalAttribute();
80
+ super.onBind();
81
+ const attrs = this.target.attribute;
66
82
  switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
67
83
  case "x":
68
84
  from = {
@@ -89,18 +105,17 @@ class ScaleOut extends custom_animate_1.ACustomAnimate {
89
105
  scaleY: 0
90
106
  };
91
107
  }
92
- this.props = to, this.propKeys = Object.keys(to), this.animate.reSyncProps(), this.from = from,
93
- this.to = to;
108
+ this.props = to, this.from = from, this.to = to;
94
109
  }
95
110
  onEnd(cb) {
96
111
  super.onEnd(cb);
97
112
  }
98
113
  onUpdate(end, ratio, out) {
114
+ const attribute = this.target.attribute;
99
115
  this.propKeys.forEach((key => {
100
- out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
101
- })), this.target.setAttributes(out);
116
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
117
+ })), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
102
118
  }
103
119
  }
104
120
 
105
- exports.ScaleOut = ScaleOut;
106
- //# sourceMappingURL=scale.js.map
121
+ exports.ScaleOut = ScaleOut;
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QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AA9CD,4BA8CC","file":"scale.js","sourcesContent":["import type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport class ScaleIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n let from: Record<string, number>;\n let to: Record<string, number>;\n const attrs = this.target.getFinalAttribute();\n const fromAttrs = this.target.context.lastAttrs ?? {};\n\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: fromAttrs.scaleX ?? 0 };\n to = { scaleX: attrs?.scaleX ?? 1 };\n break;\n case 'y':\n from = { scaleY: fromAttrs.scaleY ?? 0 };\n to = { scaleY: attrs?.scaleY ?? 1 };\n break;\n case 'xy':\n default:\n from = { scaleX: fromAttrs.scaleX ?? 0, scaleY: fromAttrs.scaleY ?? 0 };\n to = {\n scaleX: attrs?.scaleX ?? 1,\n scaleY: attrs?.scaleY ?? 1\n };\n }\n this.props = to;\n this.propKeys = Object.keys(to);\n this.animate.reSyncProps();\n this.from = from;\n this.to = to;\n this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n\nexport class ScaleOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n let from: Record<string, number>;\n let to: Record<string, number>;\n // 获取当前的数据\n const attrs = this.target.getFinalAttribute();\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: attrs?.scaleX ?? 1 };\n to = { scaleX: 0 };\n break;\n case 'y':\n from = { scaleY: attrs?.scaleY ?? 1 };\n to = { scaleY: 0 };\n break;\n case 'xy':\n default:\n from = { scaleX: attrs?.scaleX ?? 1, scaleY: attrs?.scaleY ?? 1 };\n to = {\n scaleX: 0,\n scaleY: 0\n };\n }\n this.props = to;\n this.propKeys = Object.keys(to);\n this.animate.reSyncProps();\n this.from = from;\n this.to = to;\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/scale.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAMlD,MAAa,OAAQ,SAAQ,+BAAsC;IAGjE,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAID,MAAM;;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,IAA4B,CAAC;QACjC,IAAI,EAA0B,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,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IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAC5E,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;CACF;AA/CD,4BA+CC","file":"scale.js","sourcesContent":["import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport class ScaleIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n declare _updateFunction: (ratio: number) => void;\n\n onBind(): void {\n super.onBind();\n let from: Record<string, number>;\n let to: Record<string, number>;\n const attrs = this.target.getFinalAttribute();\n const fromAttrs = this.target.attribute ?? {};\n\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: fromAttrs.scaleX ?? 0 };\n to = { scaleX: attrs?.scaleX ?? 1 };\n this._updateFunction = this.updateX;\n break;\n case 'y':\n from = { scaleY: fromAttrs.scaleY ?? 0 };\n to = { scaleY: attrs?.scaleY ?? 1 };\n this._updateFunction = this.updateY;\n break;\n case 'xy':\n default:\n from = { scaleX: fromAttrs.scaleX ?? 0, scaleY: fromAttrs.scaleY ?? 0 };\n to = {\n scaleX: attrs?.scaleX ?? 1,\n scaleY: attrs?.scaleY ?? 1\n };\n this._updateFunction = this.updateXY;\n }\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n\n this.props = to;\n this.from = from;\n this.to = to;\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n updateX(ratio: number): void {\n this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;\n }\n\n updateY(ratio: number): void {\n this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;\n }\n\n updateXY(ratio: number): void {\n this.updateX(ratio);\n this.updateY(ratio);\n }\n\n /**\n * 删除自身属性,会直接从props等内容里删除掉\n */\n deleteSelfAttr(key: string): void {\n delete this.props[key];\n // fromProps在动画开始时才会计算,这时可能不在\n this.fromProps && delete this.fromProps[key];\n const index = this.propKeys.indexOf(key);\n if (index !== -1) {\n this.propKeys.splice(index, 1);\n }\n\n if (this.propKeys && this.propKeys.length > 1) {\n this._updateFunction = this.updateXY;\n } else if (this.propKeys[0] === 'scaleX') {\n this._updateFunction = this.updateX;\n } else if (this.propKeys[0] === 'scaleY') {\n this._updateFunction = this.updateY;\n } else {\n this._updateFunction = null;\n }\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this._updateFunction) {\n this._updateFunction(ratio);\n this.target.addUpdatePositionTag();\n this.target.addUpdateBoundTag();\n }\n }\n}\n\nexport class ScaleOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n let from: Record<string, number>;\n let to: Record<string, number>;\n // 获取当前的数据\n const attrs = this.target.attribute;\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: attrs?.scaleX ?? 1 };\n to = { scaleX: 0 };\n break;\n case 'y':\n from = { scaleY: attrs?.scaleY ?? 1 };\n to = { scaleY: 0 };\n break;\n case 'xy':\n default:\n from = { scaleX: attrs?.scaleX ?? 1, scaleY: attrs?.scaleY ?? 1 };\n to = {\n scaleX: 0,\n scaleY: 0\n };\n }\n this.props = to;\n this.from = from;\n this.to = to;\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateBoundTag();\n }\n}\n"]}
@@ -12,8 +12,9 @@ export declare class RotateBySphereAnimate extends ACustomAnimate<any> {
12
12
  params: RotateSphereParams;
13
13
  theta: number;
14
14
  phi: number;
15
- onStart(): void;
16
15
  onBind(): void;
16
+ onFirstRun(): void;
17
+ onStart(): void;
17
18
  onEnd(): void;
18
19
  onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
19
20
  }
@@ -7,18 +7,27 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate");
8
8
 
9
9
  class RotateBySphereAnimate extends custom_animate_1.ACustomAnimate {
10
+ onBind() {
11
+ super.onBind(), this.propKeys = [ "x", "y", "z", "alpha", "zIndex" ];
12
+ }
13
+ onFirstRun() {
14
+ super.onFirstRun();
15
+ const finalAttribute = this.target.getFinalAttribute();
16
+ finalAttribute && this.target.setAttributes(finalAttribute);
17
+ }
10
18
  onStart() {
11
- 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);
19
+ super.onStart();
20
+ const {center: center, r: r} = "function" == typeof this.params ? this.params() : this.params, startX = this.target.finalAttribute.x, startY = this.target.finalAttribute.y, startZ = this.target.finalAttribute.z, phi = Math.acos((startY - center.y) / r);
12
21
  let theta = Math.acos((startX - center.x) / r / Math.sin(phi));
13
22
  startZ - center.z < 0 && (theta = vutils_1.pi2 - theta), this.theta = theta, this.phi = phi;
14
23
  }
15
- onBind() {}
16
24
  onEnd() {}
17
25
  onUpdate(end, ratio, out) {
18
26
  if (null == this.phi || null == this.theta) return;
19
- 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;
20
- for (out.x = x, out.y = y, out.z = z, out.alpha = theta + vutils_1.pi / 2; out.alpha > vutils_1.pi2; ) out.alpha -= vutils_1.pi2;
21
- out.alpha = vutils_1.pi2 - out.alpha, out.zIndex = -1e4 * out.z, cb && cb(out);
27
+ const target = this.target, {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;
28
+ for (target.attribute.x = x, target.attribute.y = y, target.attribute.z = z, target.attribute.alpha = theta + vutils_1.pi / 2; target.attribute.alpha > vutils_1.pi2; ) target.attribute.alpha -= vutils_1.pi2;
29
+ target.attribute.alpha = vutils_1.pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z,
30
+ cb && cb(out);
22
31
  }
23
32
  }
24
33
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/sphere.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,qDAAkD;AAUlD,MAAa,qBAAsB,SAAQ,+BAAmB;IAK5D,OAAO;QACL,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC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,GAAG,UAAU,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACzD,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACV,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACV,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QAEV,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,WAAE,GAAG,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,KAAK,GAAG,YAAG,EAAE;YACtB,GAAG,CAAC,KAAK,IAAI,YAAG,CAAC;SAClB;QACD,GAAG,CAAC,KAAK,GAAG,YAAG,GAAG,GAAG,CAAC,KAAK,CAAC;QAE5B,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;QAE5B,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;CACF;AApDD,sDAoDC","file":"sphere.js","sourcesContent":["import { pi, pi2 } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ntype RotateSphereParams =\n | {\n center: { x: number; y: number; z: number };\n r: number;\n cb?: (out: any) => void;\n }\n | (() => any);\n\nexport class RotateBySphereAnimate extends ACustomAnimate<any> {\n declare params: RotateSphereParams;\n declare theta: number;\n declare phi: number;\n\n onStart(): void {\n const { center, r } = typeof this.params === 'function' ? this.params() : this.params;\n const startX = this.target.getComputedAttribute('x');\n const startY = this.target.getComputedAttribute('y');\n const startZ = this.target.getComputedAttribute('z');\n const phi = Math.acos((startY - center.y) / r);\n let theta = Math.acos((startX - center.x) / r / Math.sin(phi));\n if (startZ - center.z < 0) {\n theta = pi2 - theta;\n }\n this.theta = theta;\n this.phi = phi;\n }\n\n onBind() {\n return;\n }\n\n onEnd() {\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.phi == null || this.theta == null) {\n return;\n }\n const { center, r, cb } = typeof this.params === 'function' ? this.params() : this.params;\n const deltaAngle = Math.PI * 2 * ratio;\n const theta = this.theta + deltaAngle;\n const phi = this.phi;\n const x = r * Math.sin(phi) * Math.cos(theta) + center.x;\n const y = r * Math.cos(phi) + center.y;\n const z = r * Math.sin(phi) * Math.sin(theta) + center.z;\n out.x = x;\n out.y = y;\n out.z = z;\n // out.beta = phi;\n out.alpha = theta + pi / 2;\n while (out.alpha > pi2) {\n out.alpha -= pi2;\n }\n out.alpha = pi2 - out.alpha;\n\n out.zIndex = out.z * -10000;\n\n cb && cb(out);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/sphere.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,qDAAkD;AAUlD,MAAa,qBAAsB,SAAQ,+BAAmB;IAK5D,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QAQf,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAGrD,CAAC;IAED,UAAU;QACR,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,OAAO;QACL,KA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,CAAC,CAAC;IAChB,CAAC;CACF;AAvED,sDAuEC","file":"sphere.js","sourcesContent":["import { pi, pi2 } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ntype RotateSphereParams =\n | {\n center: { x: number; y: number; z: number };\n r: number;\n cb?: (out: any) => void;\n }\n | (() => any);\n\nexport class RotateBySphereAnimate extends ACustomAnimate<any> {\n declare params: RotateSphereParams;\n declare theta: number;\n declare phi: number;\n\n onBind(): void {\n super.onBind();\n\n // const to: Record<string, number> = {};\n // const from: Record<string, number> = this.from ?? {};\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n\n // this.props = to;\n this.propKeys = ['x', 'y', 'z', 'alpha', 'zIndex'];\n // this.from = from;\n // this.to = to;\n }\n\n onFirstRun(): void {\n super.onFirstRun();\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n }\n\n onStart(): void {\n super.onStart();\n const { center, r } = typeof this.params === 'function' ? this.params() : this.params;\n const startX = this.target.finalAttribute.x;\n const startY = this.target.finalAttribute.y;\n const startZ = this.target.finalAttribute.z;\n const phi = Math.acos((startY - center.y) / r);\n let theta = Math.acos((startX - center.x) / r / Math.sin(phi));\n if (startZ - center.z < 0) {\n theta = pi2 - theta;\n }\n this.theta = theta;\n this.phi = phi;\n }\n\n onEnd() {\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.phi == null || this.theta == null) {\n return;\n }\n const target = this.target;\n const { center, r, cb } = typeof this.params === 'function' ? this.params() : this.params;\n const deltaAngle = Math.PI * 2 * ratio;\n const theta = this.theta + deltaAngle;\n const phi = this.phi;\n const x = r * Math.sin(phi) * Math.cos(theta) + center.x;\n const y = r * Math.cos(phi) + center.y;\n const z = r * Math.sin(phi) * Math.sin(theta) + center.z;\n target.attribute.x = x;\n target.attribute.y = y;\n target.attribute.z = z;\n // out.beta = phi;\n target.attribute.alpha = theta + pi / 2;\n while (target.attribute.alpha > pi2) {\n target.attribute.alpha -= pi2;\n }\n target.attribute.alpha = pi2 - target.attribute.alpha;\n\n target.attribute.zIndex = target.attribute.z * -10000;\n cb && cb(out);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { EasingType } from '../intreface/easing';
1
+ import type { EasingType } from '@visactor/vrender-core';
2
2
  import { ACustomAnimate } from './custom-animate';
3
3
  export interface IUpdateAnimationOptions {
4
4
  diffAttrs: Record<string, any>;
@@ -17,7 +17,7 @@ class State extends custom_animate_1.ACustomAnimate {
17
17
  if (!this.animate.validAttr(this.propKeys[index])) return;
18
18
  const key = this.propKeys[index];
19
19
  func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
20
- })), this.onUpdate(end, easedRatio, out);
20
+ })), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
21
21
  }
22
22
  }
23
23
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/state.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAclD,MAAa,KAAM,SAAQ,+BAAsC;IAG/D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAgC;QACtG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO;SACR;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,yBAAyB;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACnG,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;oBACjD,OAAO;iBACR;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AA5BD,sBA4BC","file":"state.js","sourcesContent":["import type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IUpdateAnimationOptions {\n diffAttrs: Record<string, any>;\n animationState: string;\n diffState: string;\n data: Record<string, any>[];\n}\n\n/**\n * 文本输入动画,实现类似打字机的字符逐个显示效果\n * 支持通过beforeText和afterText参数添加前缀和后缀\n * 支持通过showCursor参数显示光标,cursorChar自定义光标字符\n */\nexport class State extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IUpdateAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.animate.interpolateUpdateFunction\n ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)\n : this.interpolateUpdateFunctions.forEach((func, index) => {\n // 如果这个属性被屏蔽了,直接跳过\n if (!this.animate.validAttr(this.propKeys[index])) {\n return;\n }\n const key = this.propKeys[index];\n const fromValue = this.fromProps[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/state.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAclD,MAAa,KAAM,SAAQ,+BAAsC;IAG/D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAgC;QACtG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO;SACR;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,yBAAyB;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACnG,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;oBACjD,OAAO;iBACR;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF;AA7BD,sBA6BC","file":"state.js","sourcesContent":["import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IUpdateAnimationOptions {\n diffAttrs: Record<string, any>;\n animationState: string;\n diffState: string;\n data: Record<string, any>[];\n}\n\n/**\n * 文本输入动画,实现类似打字机的字符逐个显示效果\n * 支持通过beforeText和afterText参数添加前缀和后缀\n * 支持通过showCursor参数显示光标,cursorChar自定义光标字符\n */\nexport class State extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IUpdateAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.animate.interpolateUpdateFunction\n ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target)\n : this.interpolateUpdateFunctions.forEach((func, index) => {\n // 如果这个属性被屏蔽了,直接跳过\n if (!this.animate.validAttr(this.propKeys[index])) {\n return;\n }\n const key = this.propKeys[index];\n const fromValue = this.fromProps[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n}\n"]}
@@ -0,0 +1,196 @@
1
+ import { FadeIn } from './fade';
2
+ import type { EasingType } from '@visactor/vrender-core';
3
+ import { ACustomAnimate } from './custom-animate';
4
+ export declare class StoryFadeIn extends FadeIn {
5
+ }
6
+ export interface ISlideAnimationOptions {
7
+ direction?: 'top' | 'bottom' | 'left' | 'right';
8
+ distance?: number;
9
+ fromOpacity?: number;
10
+ }
11
+ export interface IGrowAnimationOptions {
12
+ fromScale?: number;
13
+ direction?: 'x' | 'y' | 'xy';
14
+ fromOpacity?: number;
15
+ }
16
+ export interface ISpinAnimationOptions {
17
+ fromAngle?: number;
18
+ fromScale?: number;
19
+ fromOpacity?: number;
20
+ }
21
+ export interface IStrokeAnimationOptions {
22
+ lineWidth?: number;
23
+ strokeColor?: string;
24
+ fromOpacity?: number;
25
+ dashLength?: number;
26
+ showFill?: boolean;
27
+ fillOpacity?: number;
28
+ }
29
+ export interface IPulseAnimationOptions {
30
+ pulseCount?: number;
31
+ pulseOpacity?: number;
32
+ pulseScale?: number;
33
+ pulseColor?: string;
34
+ pulseColorIntensity?: number;
35
+ strokeOnly?: boolean;
36
+ fillOnly?: boolean;
37
+ useScale?: boolean;
38
+ useOpacity?: boolean;
39
+ useColor?: boolean;
40
+ useStroke?: boolean;
41
+ useFill?: boolean;
42
+ }
43
+ export declare class SlideIn extends ACustomAnimate<Record<string, number>> {
44
+ valid: boolean;
45
+ propKeys: string[];
46
+ from: Record<string, number>;
47
+ to: Record<string, number>;
48
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions);
49
+ onBind(): void;
50
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
51
+ }
52
+ export declare class GrowIn extends ACustomAnimate<Record<string, number>> {
53
+ valid: boolean;
54
+ propKeys: string[];
55
+ from: Record<string, number>;
56
+ to: Record<string, number>;
57
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions);
58
+ onBind(): void;
59
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
60
+ }
61
+ export declare class SpinIn extends ACustomAnimate<Record<string, number>> {
62
+ valid: boolean;
63
+ propKeys: string[];
64
+ from: Record<string, number>;
65
+ to: Record<string, number>;
66
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions);
67
+ onBind(): void;
68
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
69
+ }
70
+ export declare class StrokeIn extends ACustomAnimate<Record<string, any>> {
71
+ valid: boolean;
72
+ propKeys: string[];
73
+ from: Record<string, any>;
74
+ to: Record<string, any>;
75
+ private perimeter;
76
+ private originalAttributes;
77
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IStrokeAnimationOptions);
78
+ onBind(): void;
79
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
80
+ onEnd(): void;
81
+ }
82
+ export declare class StrokeOut extends ACustomAnimate<Record<string, any>> {
83
+ valid: boolean;
84
+ propKeys: string[];
85
+ from: Record<string, any>;
86
+ to: Record<string, any>;
87
+ private perimeter;
88
+ private originalAttributes;
89
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IStrokeAnimationOptions);
90
+ onFirstRun(): void;
91
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
92
+ }
93
+ export interface IMoveScaleAnimationOptions {
94
+ slideDirection?: 'top' | 'bottom' | 'left' | 'right';
95
+ slideDistance?: number;
96
+ fromScale?: number;
97
+ scaleDirection?: 'x' | 'y' | 'xy';
98
+ slideRatio?: number;
99
+ fromOpacity?: number;
100
+ }
101
+ export declare class MoveScaleIn extends ACustomAnimate<any> {
102
+ valid: boolean;
103
+ private readonly slideInDuration;
104
+ private readonly growInDuration;
105
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
106
+ onBind(): void;
107
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
108
+ }
109
+ export interface IMoveRotateAnimationOptions {
110
+ slideDirection?: 'top' | 'bottom' | 'left' | 'right';
111
+ slideDistance?: number;
112
+ fromAngle?: number;
113
+ fromScale?: number;
114
+ slideRatio?: number;
115
+ fromOpacity?: number;
116
+ }
117
+ export declare class MoveRotateIn extends ACustomAnimate<any> {
118
+ valid: boolean;
119
+ private readonly slideInDuration;
120
+ private readonly spinInDuration;
121
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
122
+ onBind(): void;
123
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
124
+ }
125
+ export declare class SlideOut extends ACustomAnimate<Record<string, number>> {
126
+ valid: boolean;
127
+ propKeys: string[];
128
+ from: Record<string, number>;
129
+ to: Record<string, number>;
130
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions & {
131
+ toOpacity?: number;
132
+ });
133
+ onFirstRun(): void;
134
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
135
+ }
136
+ export declare class GrowOut extends ACustomAnimate<Record<string, number>> {
137
+ valid: boolean;
138
+ propKeys: string[];
139
+ from: Record<string, number>;
140
+ to: Record<string, number>;
141
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions & {
142
+ toOpacity?: number;
143
+ });
144
+ onFirstRun(): void;
145
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
146
+ }
147
+ export declare class SpinOut extends ACustomAnimate<Record<string, number>> {
148
+ valid: boolean;
149
+ propKeys: string[];
150
+ from: Record<string, number>;
151
+ to: Record<string, number>;
152
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions & {
153
+ toOpacity?: number;
154
+ });
155
+ onFirstRun(): void;
156
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
157
+ }
158
+ export declare class MoveScaleOut extends ACustomAnimate<any> {
159
+ valid: boolean;
160
+ private readonly growOutDuration;
161
+ private readonly slideOutDuration;
162
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
163
+ onFirstRun(): void;
164
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
165
+ }
166
+ export declare class MoveRotateOut extends ACustomAnimate<any> {
167
+ valid: boolean;
168
+ private readonly spinOutDuration;
169
+ private readonly slideOutDuration;
170
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
171
+ onFirstRun(): void;
172
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
173
+ }
174
+ export declare class PulseAnimate extends ACustomAnimate<Record<string, any>> {
175
+ valid: boolean;
176
+ private originalAttributes;
177
+ private pulseCount;
178
+ private pulseOpacity;
179
+ private pulseScale;
180
+ private pulseColor;
181
+ private pulseColorIntensity;
182
+ private strokeOnly;
183
+ private fillOnly;
184
+ private useScale;
185
+ private useOpacity;
186
+ private useStroke;
187
+ private useFill;
188
+ private useColor;
189
+ private originalFill;
190
+ private originalStroke;
191
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: IPulseAnimationOptions);
192
+ onBind(): void;
193
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
194
+ private applyColorPulse;
195
+ onEnd(): void;
196
+ }