@visactor/vrender-animate 0.22.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +177 -0
  2. package/cjs/animate-extension.d.ts +15 -0
  3. package/cjs/animate-extension.js +46 -0
  4. package/cjs/animate-extension.js.map +1 -0
  5. package/cjs/animate.d.ts +71 -0
  6. package/cjs/animate.js +210 -0
  7. package/cjs/animate.js.map +1 -0
  8. package/cjs/custom/clip-graphic.d.ts +53 -0
  9. package/cjs/custom/clip-graphic.js +146 -0
  10. package/cjs/custom/clip-graphic.js.map +1 -0
  11. package/cjs/custom/clip.d.ts +13 -0
  12. package/cjs/custom/clip.js +24 -0
  13. package/cjs/custom/clip.js.map +1 -0
  14. package/cjs/custom/common.d.ts +22 -0
  15. package/cjs/custom/common.js +58 -0
  16. package/cjs/custom/common.js.map +1 -0
  17. package/cjs/custom/custom-animate.d.ts +15 -0
  18. package/cjs/custom/custom-animate.js +25 -0
  19. package/cjs/custom/custom-animate.js.map +1 -0
  20. package/cjs/custom/fade.d.ts +13 -0
  21. package/cjs/custom/fade.js +24 -0
  22. package/cjs/custom/fade.js.map +1 -0
  23. package/cjs/custom/group-fade.d.ts +16 -0
  24. package/cjs/custom/group-fade.js +66 -0
  25. package/cjs/custom/group-fade.js.map +1 -0
  26. package/cjs/custom/growAngle.d.ts +37 -0
  27. package/cjs/custom/growAngle.js +140 -0
  28. package/cjs/custom/growAngle.js.map +1 -0
  29. package/cjs/custom/growCenter.d.ts +17 -0
  30. package/cjs/custom/growCenter.js +161 -0
  31. package/cjs/custom/growCenter.js.map +1 -0
  32. package/cjs/custom/growHeight.d.ts +36 -0
  33. package/cjs/custom/growHeight.js +154 -0
  34. package/cjs/custom/growHeight.js.map +1 -0
  35. package/cjs/custom/growPoints.d.ts +52 -0
  36. package/cjs/custom/growPoints.js +227 -0
  37. package/cjs/custom/growPoints.js.map +1 -0
  38. package/cjs/custom/growRadius.d.ts +41 -0
  39. package/cjs/custom/growRadius.js +113 -0
  40. package/cjs/custom/growRadius.js.map +1 -0
  41. package/cjs/custom/growWidth.d.ts +36 -0
  42. package/cjs/custom/growWidth.js +154 -0
  43. package/cjs/custom/growWidth.js.map +1 -0
  44. package/cjs/custom/input-text.d.ts +29 -0
  45. package/cjs/custom/input-text.js +45 -0
  46. package/cjs/custom/input-text.js.map +1 -0
  47. package/cjs/custom/number.d.ts +25 -0
  48. package/cjs/custom/number.js +102 -0
  49. package/cjs/custom/number.js.map +1 -0
  50. package/cjs/custom/register.d.ts +1 -0
  51. package/cjs/custom/register.js +35 -0
  52. package/cjs/custom/register.js.map +1 -0
  53. package/cjs/custom/scale-in.d.ts +13 -0
  54. package/cjs/custom/scale-in.js +57 -0
  55. package/cjs/custom/scale-in.js.map +1 -0
  56. package/cjs/custom/scale.d.ts +20 -0
  57. package/cjs/custom/scale.js +106 -0
  58. package/cjs/custom/scale.js.map +1 -0
  59. package/cjs/custom/sphere.d.ts +20 -0
  60. package/cjs/custom/sphere.js +26 -0
  61. package/cjs/custom/sphere.js.map +1 -0
  62. package/cjs/custom/state.d.ts +13 -0
  63. package/cjs/custom/state.js +25 -0
  64. package/cjs/custom/state.js.map +1 -0
  65. package/cjs/custom/tag-points.d.ts +26 -0
  66. package/cjs/custom/tag-points.js +81 -0
  67. package/cjs/custom/tag-points.js.map +1 -0
  68. package/cjs/custom/update.d.ts +14 -0
  69. package/cjs/custom/update.js +26 -0
  70. package/cjs/custom/update.js.map +1 -0
  71. package/cjs/executor/animate-executor.d.ts +36 -0
  72. package/cjs/executor/animate-executor.js +177 -0
  73. package/cjs/executor/animate-executor.js.map +1 -0
  74. package/cjs/executor/executor.d.ts +69 -0
  75. package/cjs/executor/executor.js +6 -0
  76. package/cjs/executor/executor.js.map +1 -0
  77. package/cjs/index.d.ts +25 -0
  78. package/cjs/index.js +214 -0
  79. package/cjs/index.js.map +1 -0
  80. package/cjs/interpolate/executor.d.ts +66 -0
  81. package/cjs/interpolate/executor.js +6 -0
  82. package/cjs/interpolate/executor.js.map +1 -0
  83. package/cjs/interpolate/number.d.ts +1 -0
  84. package/cjs/interpolate/number.js +10 -0
  85. package/cjs/interpolate/number.js.map +1 -0
  86. package/cjs/interpolate/store.d.ts +32 -0
  87. package/cjs/interpolate/store.js +96 -0
  88. package/cjs/interpolate/store.js.map +1 -0
  89. package/cjs/intreface/animate.d.ts +91 -0
  90. package/cjs/intreface/animate.js +10 -0
  91. package/cjs/intreface/animate.js.map +1 -0
  92. package/cjs/intreface/easing.d.ts +3 -0
  93. package/cjs/intreface/easing.js +6 -0
  94. package/cjs/intreface/easing.js.map +1 -0
  95. package/cjs/intreface/state.d.ts +35 -0
  96. package/cjs/intreface/state.js +6 -0
  97. package/cjs/intreface/state.js.map +1 -0
  98. package/cjs/intreface/ticker.d.ts +37 -0
  99. package/cjs/intreface/ticker.js +10 -0
  100. package/cjs/intreface/ticker.js.map +1 -0
  101. package/cjs/intreface/timeline.d.ts +17 -0
  102. package/cjs/intreface/timeline.js +6 -0
  103. package/cjs/intreface/timeline.js.map +1 -0
  104. package/cjs/intreface/type.d.ts +13 -0
  105. package/cjs/intreface/type.js +15 -0
  106. package/cjs/intreface/type.js.map +1 -0
  107. package/cjs/register.d.ts +1 -0
  108. package/cjs/register.js +19 -0
  109. package/cjs/register.js.map +1 -0
  110. package/cjs/state/animation-state-machine.d.ts +22 -0
  111. package/cjs/state/animation-state-machine.js +53 -0
  112. package/cjs/state/animation-state-machine.js.map +1 -0
  113. package/cjs/state/animation-state-queue.d.ts +24 -0
  114. package/cjs/state/animation-state-queue.js +66 -0
  115. package/cjs/state/animation-state-queue.js.map +1 -0
  116. package/cjs/state/animation-state-registry.d.ts +14 -0
  117. package/cjs/state/animation-state-registry.js +53 -0
  118. package/cjs/state/animation-state-registry.js.map +1 -0
  119. package/cjs/state/animation-state.d.ts +25 -0
  120. package/cjs/state/animation-state.js +80 -0
  121. package/cjs/state/animation-state.js.map +1 -0
  122. package/cjs/state/animation-states-registry.d.ts +17 -0
  123. package/cjs/state/animation-states-registry.js +95 -0
  124. package/cjs/state/animation-states-registry.js.map +1 -0
  125. package/cjs/state/graphic-extension.d.ts +12 -0
  126. package/cjs/state/graphic-extension.js +37 -0
  127. package/cjs/state/graphic-extension.js.map +1 -0
  128. package/cjs/state/index.d.ts +3 -0
  129. package/cjs/state/index.js +22 -0
  130. package/cjs/state/index.js.map +1 -0
  131. package/cjs/state/types.d.ts +11 -0
  132. package/cjs/state/types.js +6 -0
  133. package/cjs/state/types.js.map +1 -0
  134. package/cjs/step.d.ts +49 -0
  135. package/cjs/step.js +124 -0
  136. package/cjs/step.js.map +1 -0
  137. package/cjs/ticker/default-ticker.d.ts +39 -0
  138. package/cjs/ticker/default-ticker.js +133 -0
  139. package/cjs/ticker/default-ticker.js.map +1 -0
  140. package/cjs/ticker/manual-ticker.d.ts +6 -0
  141. package/cjs/ticker/manual-ticker.js +37 -0
  142. package/cjs/ticker/manual-ticker.js.map +1 -0
  143. package/cjs/timeline.d.ts +34 -0
  144. package/cjs/timeline.js +84 -0
  145. package/cjs/timeline.js.map +1 -0
  146. package/cjs/utils/easing-func.d.ts +1 -0
  147. package/cjs/utils/easing-func.js +16 -0
  148. package/cjs/utils/easing-func.js.map +1 -0
  149. package/cjs/utils/easing.d.ts +49 -0
  150. package/cjs/utils/easing.js +141 -0
  151. package/cjs/utils/easing.js.map +1 -0
  152. package/dist/index.es.js +3824 -0
  153. package/es/animate-extension.d.ts +15 -0
  154. package/es/animate-extension.js +42 -0
  155. package/es/animate-extension.js.map +1 -0
  156. package/es/animate.d.ts +71 -0
  157. package/es/animate.js +207 -0
  158. package/es/animate.js.map +1 -0
  159. package/es/custom/clip-graphic.d.ts +53 -0
  160. package/es/custom/clip-graphic.js +134 -0
  161. package/es/custom/clip-graphic.js.map +1 -0
  162. package/es/custom/clip.d.ts +13 -0
  163. package/es/custom/clip.js +14 -0
  164. package/es/custom/clip.js.map +1 -0
  165. package/es/custom/common.d.ts +22 -0
  166. package/es/custom/common.js +48 -0
  167. package/es/custom/common.js.map +1 -0
  168. package/es/custom/custom-animate.d.ts +15 -0
  169. package/es/custom/custom-animate.js +17 -0
  170. package/es/custom/custom-animate.js.map +1 -0
  171. package/es/custom/fade.d.ts +13 -0
  172. package/es/custom/fade.js +14 -0
  173. package/es/custom/fade.js.map +1 -0
  174. package/es/custom/group-fade.d.ts +16 -0
  175. package/es/custom/group-fade.js +56 -0
  176. package/es/custom/group-fade.js.map +1 -0
  177. package/es/custom/growAngle.d.ts +37 -0
  178. package/es/custom/growAngle.js +132 -0
  179. package/es/custom/growAngle.js.map +1 -0
  180. package/es/custom/growCenter.d.ts +17 -0
  181. package/es/custom/growCenter.js +155 -0
  182. package/es/custom/growCenter.js.map +1 -0
  183. package/es/custom/growHeight.d.ts +36 -0
  184. package/es/custom/growHeight.js +144 -0
  185. package/es/custom/growHeight.js.map +1 -0
  186. package/es/custom/growPoints.d.ts +52 -0
  187. package/es/custom/growPoints.js +219 -0
  188. package/es/custom/growPoints.js.map +1 -0
  189. package/es/custom/growRadius.d.ts +41 -0
  190. package/es/custom/growRadius.js +105 -0
  191. package/es/custom/growRadius.js.map +1 -0
  192. package/es/custom/growWidth.d.ts +36 -0
  193. package/es/custom/growWidth.js +144 -0
  194. package/es/custom/growWidth.js.map +1 -0
  195. package/es/custom/input-text.d.ts +29 -0
  196. package/es/custom/input-text.js +37 -0
  197. package/es/custom/input-text.js.map +1 -0
  198. package/es/custom/number.d.ts +25 -0
  199. package/es/custom/number.js +94 -0
  200. package/es/custom/number.js.map +1 -0
  201. package/es/custom/register.d.ts +1 -0
  202. package/es/custom/register.js +39 -0
  203. package/es/custom/register.js.map +1 -0
  204. package/es/custom/scale-in.d.ts +13 -0
  205. package/es/custom/scale-in.js +49 -0
  206. package/es/custom/scale-in.js.map +1 -0
  207. package/es/custom/scale.d.ts +20 -0
  208. package/es/custom/scale.js +96 -0
  209. package/es/custom/scale.js.map +1 -0
  210. package/es/custom/sphere.d.ts +20 -0
  211. package/es/custom/sphere.js +20 -0
  212. package/es/custom/sphere.js.map +1 -0
  213. package/es/custom/state.d.ts +13 -0
  214. package/es/custom/state.js +17 -0
  215. package/es/custom/state.js.map +1 -0
  216. package/es/custom/tag-points.d.ts +26 -0
  217. package/es/custom/tag-points.js +77 -0
  218. package/es/custom/tag-points.js.map +1 -0
  219. package/es/custom/update.d.ts +14 -0
  220. package/es/custom/update.js +18 -0
  221. package/es/custom/update.js.map +1 -0
  222. package/es/executor/animate-executor.d.ts +36 -0
  223. package/es/executor/animate-executor.js +169 -0
  224. package/es/executor/animate-executor.js.map +1 -0
  225. package/es/executor/executor.d.ts +69 -0
  226. package/es/executor/executor.js +2 -0
  227. package/es/executor/executor.js.map +1 -0
  228. package/es/index.d.ts +25 -0
  229. package/es/index.js +50 -0
  230. package/es/index.js.map +1 -0
  231. package/es/interpolate/executor.d.ts +66 -0
  232. package/es/interpolate/executor.js +2 -0
  233. package/es/interpolate/executor.js.map +1 -0
  234. package/es/interpolate/number.d.ts +1 -0
  235. package/es/interpolate/number.js +4 -0
  236. package/es/interpolate/number.js.map +1 -0
  237. package/es/interpolate/store.d.ts +32 -0
  238. package/es/interpolate/store.js +88 -0
  239. package/es/interpolate/store.js.map +1 -0
  240. package/es/intreface/animate.d.ts +91 -0
  241. package/es/intreface/animate.js +6 -0
  242. package/es/intreface/animate.js.map +1 -0
  243. package/es/intreface/easing.d.ts +3 -0
  244. package/es/intreface/easing.js +2 -0
  245. package/es/intreface/easing.js.map +1 -0
  246. package/es/intreface/state.d.ts +35 -0
  247. package/es/intreface/state.js +2 -0
  248. package/es/intreface/state.js.map +1 -0
  249. package/es/intreface/ticker.d.ts +37 -0
  250. package/es/intreface/ticker.js +6 -0
  251. package/es/intreface/ticker.js.map +1 -0
  252. package/es/intreface/timeline.d.ts +17 -0
  253. package/es/intreface/timeline.js +2 -0
  254. package/es/intreface/timeline.js.map +1 -0
  255. package/es/intreface/type.d.ts +13 -0
  256. package/es/intreface/type.js +14 -0
  257. package/es/intreface/type.js.map +1 -0
  258. package/es/register.d.ts +1 -0
  259. package/es/register.js +20 -0
  260. package/es/register.js.map +1 -0
  261. package/es/state/animation-state-machine.d.ts +22 -0
  262. package/es/state/animation-state-machine.js +47 -0
  263. package/es/state/animation-state-machine.js.map +1 -0
  264. package/es/state/animation-state-queue.d.ts +24 -0
  265. package/es/state/animation-state-queue.js +58 -0
  266. package/es/state/animation-state-queue.js.map +1 -0
  267. package/es/state/animation-state-registry.d.ts +14 -0
  268. package/es/state/animation-state-registry.js +45 -0
  269. package/es/state/animation-state-registry.js.map +1 -0
  270. package/es/state/animation-state.d.ts +25 -0
  271. package/es/state/animation-state.js +72 -0
  272. package/es/state/animation-state.js.map +1 -0
  273. package/es/state/animation-states-registry.d.ts +17 -0
  274. package/es/state/animation-states-registry.js +87 -0
  275. package/es/state/animation-states-registry.js.map +1 -0
  276. package/es/state/graphic-extension.d.ts +12 -0
  277. package/es/state/graphic-extension.js +29 -0
  278. package/es/state/graphic-extension.js.map +1 -0
  279. package/es/state/index.d.ts +3 -0
  280. package/es/state/index.js +6 -0
  281. package/es/state/index.js.map +1 -0
  282. package/es/state/types.d.ts +11 -0
  283. package/es/state/types.js +2 -0
  284. package/es/state/types.js.map +1 -0
  285. package/es/step.d.ts +49 -0
  286. package/es/step.js +120 -0
  287. package/es/step.js.map +1 -0
  288. package/es/ticker/default-ticker.d.ts +39 -0
  289. package/es/ticker/default-ticker.js +129 -0
  290. package/es/ticker/default-ticker.js.map +1 -0
  291. package/es/ticker/manual-ticker.d.ts +6 -0
  292. package/es/ticker/manual-ticker.js +29 -0
  293. package/es/ticker/manual-ticker.js.map +1 -0
  294. package/es/timeline.d.ts +34 -0
  295. package/es/timeline.js +79 -0
  296. package/es/timeline.js.map +1 -0
  297. package/es/utils/easing-func.d.ts +1 -0
  298. package/es/utils/easing-func.js +8 -0
  299. package/es/utils/easing-func.js.map +1 -0
  300. package/es/utils/easing.d.ts +49 -0
  301. package/es/utils/easing.js +134 -0
  302. package/es/utils/easing.js.map +1 -0
  303. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/executor/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 to 配置(和channel互斥,如果同时设置,以to为准) */\n to?: Record<string, any>;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置(如果有循环,只算一个周期) */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
package/cjs/index.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ export * from './intreface/animate';
2
+ export * from './intreface/timeline';
3
+ export * from './intreface/easing';
4
+ export * from './intreface/type';
5
+ export { Animate } from './animate';
6
+ export { DefaultTimeline } from './timeline';
7
+ export { ManualTicker } from './ticker/manual-ticker';
8
+ export { DefaultTicker } from './ticker/default-ticker';
9
+ export { Step } from './step';
10
+ export * from './utils/easing-func';
11
+ export { registerAnimate } from './register';
12
+ export { ACustomAnimate } from './custom/custom-animate';
13
+ export { IncreaseCount } from './custom/number';
14
+ export { InputText } from './custom/input-text';
15
+ export { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';
16
+ export { TagPointsUpdate } from './custom/tag-points';
17
+ export { GroupFadeIn, GroupFadeOut } from './custom/group-fade';
18
+ export { RotateBySphereAnimate } from './custom/sphere';
19
+ export { AnimateExecutor } from './executor/animate-executor';
20
+ export { registerCustomAnimate } from './custom/register';
21
+ export * from './state';
22
+ export { AnimationTransitionRegistry } from './state/animation-states-registry';
23
+ export { transitionRegistry } from './state/animation-states-registry';
24
+ export { AnimationStateManager } from './state/animation-state';
25
+ export { AnimationStateStore } from './state/animation-state';
package/cjs/index.js ADDED
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
4
+ void 0 === k2 && (k2 = k);
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
7
+ enumerable: !0,
8
+ get: function() {
9
+ return m[k];
10
+ }
11
+ }), Object.defineProperty(o, k2, desc);
12
+ } : function(o, m, k, k2) {
13
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
14
+ }), __exportStar = this && this.__exportStar || function(m, exports) {
15
+ for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
16
+ };
17
+
18
+ Object.defineProperty(exports, "__esModule", {
19
+ value: !0
20
+ }), exports.AnimationStateStore = exports.AnimationStateManager = exports.transitionRegistry = exports.AnimationTransitionRegistry = exports.registerCustomAnimate = exports.AnimateExecutor = exports.RotateBySphereAnimate = exports.GroupFadeOut = exports.GroupFadeIn = exports.TagPointsUpdate = exports.ClipDirectionAnimate = exports.ClipRadiusAnimate = exports.ClipAngleAnimate = exports.ClipGraphicAnimate = exports.InputText = exports.IncreaseCount = exports.ACustomAnimate = exports.registerAnimate = exports.Step = exports.DefaultTicker = exports.ManualTicker = exports.DefaultTimeline = exports.Animate = void 0,
21
+ __exportStar(require("./intreface/animate"), exports), __exportStar(require("./intreface/timeline"), exports),
22
+ __exportStar(require("./intreface/easing"), exports), __exportStar(require("./intreface/type"), exports);
23
+
24
+ var animate_1 = require("./animate");
25
+
26
+ Object.defineProperty(exports, "Animate", {
27
+ enumerable: !0,
28
+ get: function() {
29
+ return animate_1.Animate;
30
+ }
31
+ });
32
+
33
+ var timeline_1 = require("./timeline");
34
+
35
+ Object.defineProperty(exports, "DefaultTimeline", {
36
+ enumerable: !0,
37
+ get: function() {
38
+ return timeline_1.DefaultTimeline;
39
+ }
40
+ });
41
+
42
+ var manual_ticker_1 = require("./ticker/manual-ticker");
43
+
44
+ Object.defineProperty(exports, "ManualTicker", {
45
+ enumerable: !0,
46
+ get: function() {
47
+ return manual_ticker_1.ManualTicker;
48
+ }
49
+ });
50
+
51
+ var default_ticker_1 = require("./ticker/default-ticker");
52
+
53
+ Object.defineProperty(exports, "DefaultTicker", {
54
+ enumerable: !0,
55
+ get: function() {
56
+ return default_ticker_1.DefaultTicker;
57
+ }
58
+ });
59
+
60
+ var step_1 = require("./step");
61
+
62
+ Object.defineProperty(exports, "Step", {
63
+ enumerable: !0,
64
+ get: function() {
65
+ return step_1.Step;
66
+ }
67
+ }), __exportStar(require("./utils/easing-func"), exports);
68
+
69
+ var register_1 = require("./register");
70
+
71
+ Object.defineProperty(exports, "registerAnimate", {
72
+ enumerable: !0,
73
+ get: function() {
74
+ return register_1.registerAnimate;
75
+ }
76
+ });
77
+
78
+ var custom_animate_1 = require("./custom/custom-animate");
79
+
80
+ Object.defineProperty(exports, "ACustomAnimate", {
81
+ enumerable: !0,
82
+ get: function() {
83
+ return custom_animate_1.ACustomAnimate;
84
+ }
85
+ });
86
+
87
+ var number_1 = require("./custom/number");
88
+
89
+ Object.defineProperty(exports, "IncreaseCount", {
90
+ enumerable: !0,
91
+ get: function() {
92
+ return number_1.IncreaseCount;
93
+ }
94
+ });
95
+
96
+ var input_text_1 = require("./custom/input-text");
97
+
98
+ Object.defineProperty(exports, "InputText", {
99
+ enumerable: !0,
100
+ get: function() {
101
+ return input_text_1.InputText;
102
+ }
103
+ });
104
+
105
+ var clip_graphic_1 = require("./custom/clip-graphic");
106
+
107
+ Object.defineProperty(exports, "ClipGraphicAnimate", {
108
+ enumerable: !0,
109
+ get: function() {
110
+ return clip_graphic_1.ClipGraphicAnimate;
111
+ }
112
+ }), Object.defineProperty(exports, "ClipAngleAnimate", {
113
+ enumerable: !0,
114
+ get: function() {
115
+ return clip_graphic_1.ClipAngleAnimate;
116
+ }
117
+ }), Object.defineProperty(exports, "ClipRadiusAnimate", {
118
+ enumerable: !0,
119
+ get: function() {
120
+ return clip_graphic_1.ClipRadiusAnimate;
121
+ }
122
+ }), Object.defineProperty(exports, "ClipDirectionAnimate", {
123
+ enumerable: !0,
124
+ get: function() {
125
+ return clip_graphic_1.ClipDirectionAnimate;
126
+ }
127
+ });
128
+
129
+ var tag_points_1 = require("./custom/tag-points");
130
+
131
+ Object.defineProperty(exports, "TagPointsUpdate", {
132
+ enumerable: !0,
133
+ get: function() {
134
+ return tag_points_1.TagPointsUpdate;
135
+ }
136
+ });
137
+
138
+ var group_fade_1 = require("./custom/group-fade");
139
+
140
+ Object.defineProperty(exports, "GroupFadeIn", {
141
+ enumerable: !0,
142
+ get: function() {
143
+ return group_fade_1.GroupFadeIn;
144
+ }
145
+ }), Object.defineProperty(exports, "GroupFadeOut", {
146
+ enumerable: !0,
147
+ get: function() {
148
+ return group_fade_1.GroupFadeOut;
149
+ }
150
+ });
151
+
152
+ var sphere_1 = require("./custom/sphere");
153
+
154
+ Object.defineProperty(exports, "RotateBySphereAnimate", {
155
+ enumerable: !0,
156
+ get: function() {
157
+ return sphere_1.RotateBySphereAnimate;
158
+ }
159
+ });
160
+
161
+ var animate_executor_1 = require("./executor/animate-executor");
162
+
163
+ Object.defineProperty(exports, "AnimateExecutor", {
164
+ enumerable: !0,
165
+ get: function() {
166
+ return animate_executor_1.AnimateExecutor;
167
+ }
168
+ });
169
+
170
+ var register_2 = require("./custom/register");
171
+
172
+ Object.defineProperty(exports, "registerCustomAnimate", {
173
+ enumerable: !0,
174
+ get: function() {
175
+ return register_2.registerCustomAnimate;
176
+ }
177
+ }), __exportStar(require("./state"), exports);
178
+
179
+ var animation_states_registry_1 = require("./state/animation-states-registry");
180
+
181
+ Object.defineProperty(exports, "AnimationTransitionRegistry", {
182
+ enumerable: !0,
183
+ get: function() {
184
+ return animation_states_registry_1.AnimationTransitionRegistry;
185
+ }
186
+ });
187
+
188
+ var animation_states_registry_2 = require("./state/animation-states-registry");
189
+
190
+ Object.defineProperty(exports, "transitionRegistry", {
191
+ enumerable: !0,
192
+ get: function() {
193
+ return animation_states_registry_2.transitionRegistry;
194
+ }
195
+ });
196
+
197
+ var animation_state_1 = require("./state/animation-state");
198
+
199
+ Object.defineProperty(exports, "AnimationStateManager", {
200
+ enumerable: !0,
201
+ get: function() {
202
+ return animation_state_1.AnimationStateManager;
203
+ }
204
+ });
205
+
206
+ var animation_state_2 = require("./state/animation-state");
207
+
208
+ Object.defineProperty(exports, "AnimationStateStore", {
209
+ enumerable: !0,
210
+ get: function() {
211
+ return animation_state_2.AnimationStateStore;
212
+ }
213
+ });
214
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AAGjC,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,wDAAsD;AAA7C,6GAAA,YAAY,OAAA;AACrB,0DAAwD;AAA/C,+GAAA,aAAa,OAAA;AACtB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAGb,sDAAoC;AACpC,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,0DAAyD;AAAhD,gHAAA,cAAc,OAAA;AACvB,0CAAgD;AAAvC,uGAAA,aAAa,OAAA;AACtB,kDAAgD;AAAvC,uGAAA,SAAS,OAAA;AAClB,sDAAsH;AAA7G,kHAAA,kBAAkB,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AACtF,kDAAsD;AAA7C,6GAAA,eAAe,OAAA;AACxB,kDAAgE;AAAvD,yGAAA,WAAW,OAAA;AAAE,0GAAA,YAAY,OAAA;AAClC,0CAAwD;AAA/C,+GAAA,qBAAqB,OAAA;AAC9B,gEAA8D;AAArD,mHAAA,eAAe,OAAA;AACxB,8CAA0D;AAAjD,iHAAA,qBAAqB,OAAA;AAE9B,0CAAwB;AACxB,+EAAgF;AAAvE,wIAAA,2BAA2B,OAAA;AACpC,+EAAuE;AAA9D,+HAAA,kBAAkB,OAAA;AAC3B,2DAAgE;AAAvD,wHAAA,qBAAqB,OAAA;AAC9B,2DAA8D;AAArD,sHAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["// 导出接口\nexport * from './intreface/animate';\nexport * from './intreface/timeline';\nexport * from './intreface/easing';\nexport * from './intreface/type';\n\n// 导出实现\nexport { Animate } from './animate';\nexport { DefaultTimeline } from './timeline';\nexport { ManualTicker } from './ticker/manual-ticker';\nexport { DefaultTicker } from './ticker/default-ticker';\nexport { Step } from './step';\n\n// 导出工具函数\nexport * from './utils/easing-func';\nexport { registerAnimate } from './register';\nexport { ACustomAnimate } from './custom/custom-animate';\nexport { IncreaseCount } from './custom/number';\nexport { InputText } from './custom/input-text';\nexport { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';\nexport { TagPointsUpdate } from './custom/tag-points';\nexport { GroupFadeIn, GroupFadeOut } from './custom/group-fade';\nexport { RotateBySphereAnimate } from './custom/sphere';\nexport { AnimateExecutor } from './executor/animate-executor';\nexport { registerCustomAnimate } from './custom/register';\n// Export animation state modules\nexport * from './state';\nexport { AnimationTransitionRegistry } from './state/animation-states-registry';\nexport { transitionRegistry } from './state/animation-states-registry';\nexport { AnimationStateManager } from './state/animation-state';\nexport { AnimationStateStore } from './state/animation-state';\n"]}
@@ -0,0 +1,66 @@
1
+ import type { IGraphic } from '@visactor/vrender-core';
2
+ import type { EasingType } from '../intreface/easing';
3
+ import type { ACustomAnimate } from '../custom/custom-animate';
4
+ export type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;
5
+ export type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;
6
+ interface IAnimationParameters {
7
+ [key: string]: any;
8
+ }
9
+ export type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;
10
+ export type IAnimationChannelAttrs = Record<string, {
11
+ from?: any | IAnimationChannelFunction;
12
+ to?: any | IAnimationChannelFunction;
13
+ }>;
14
+ export type IAnimationChannelAttributes = string[];
15
+ export type IAnimationChannelInterpolator = (ratio: number, from: any, to: any, nextAttributes: any, datum: any, element: IGraphic, parameters: IAnimationParameters) => boolean | void;
16
+ export interface IAnimationCustomConstructor {
17
+ new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;
18
+ }
19
+ export interface IAnimationEffect {
20
+ type?: string;
21
+ channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
22
+ custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
23
+ customParameters?: MarkFunctionValueType<any>;
24
+ easing?: EasingType;
25
+ options?: MarkFunctionValueType<any>;
26
+ }
27
+ export interface IAnimationTimeSlice {
28
+ effects: IAnimationEffect | IAnimationEffect[];
29
+ duration?: MarkFunctionValueType<number>;
30
+ delay?: MarkFunctionValueType<number>;
31
+ delayAfter?: MarkFunctionValueType<number>;
32
+ }
33
+ export interface IAnimationControlOptions {
34
+ stopWhenStateChange?: boolean;
35
+ immediatelyApply?: boolean;
36
+ ignoreLoopFinalAttributes?: boolean;
37
+ }
38
+ export interface IAnimationTypeConfig {
39
+ type?: string;
40
+ channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
41
+ custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
42
+ customParameters?: MarkFunctionValueType<any>;
43
+ easing?: EasingType;
44
+ delay?: MarkFunctionValueType<number>;
45
+ delayAfter?: MarkFunctionValueType<number>;
46
+ duration?: MarkFunctionValueType<number>;
47
+ oneByOne?: MarkFunctionValueType<boolean | number>;
48
+ startTime?: MarkFunctionValueType<number>;
49
+ totalTime?: MarkFunctionValueType<number>;
50
+ loop?: boolean | number;
51
+ options?: MarkFunctionValueType<any>;
52
+ controlOptions?: IAnimationControlOptions;
53
+ }
54
+ export interface IAnimationTimeline {
55
+ id?: string;
56
+ timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];
57
+ startTime?: MarkFunctionValueType<number>;
58
+ totalTime?: MarkFunctionValueType<number>;
59
+ oneByOne?: MarkFunctionValueType<number | boolean>;
60
+ loop?: MarkFunctionValueType<number | boolean>;
61
+ partitioner?: MarkFunctionCallback<boolean>;
62
+ sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;
63
+ controlOptions?: IAnimationControlOptions;
64
+ }
65
+ export type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;
66
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ });
6
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interpolate/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置 */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
@@ -0,0 +1 @@
1
+ export declare function interpolateNumber(from: number, to: number, ratio: number): number;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ function interpolateNumber(from, to, ratio) {
4
+ return from + (to - from) * ratio;
5
+ }
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: !0
9
+ }), exports.interpolateNumber = void 0, exports.interpolateNumber = interpolateNumber;
10
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interpolate/number.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAC,IAAY,EAAE,EAAU,EAAE,KAAa;IACvE,OAAO,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;AACpC,CAAC;AAFD,8CAEC","file":"number.js","sourcesContent":["export function interpolateNumber(from: number, to: number, ratio: number): number {\n return from + (to - from) * ratio;\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import type { IGraphic } from '@visactor/vrender-core';
2
+ import type { IStep } from '../intreface/animate';
3
+ export declare class InterpolateUpdateStore {
4
+ opacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
5
+ fillOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
6
+ strokeOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
7
+ zIndex: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
8
+ backgroundOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
9
+ shadowOffsetX: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
10
+ shadowOffsetY: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
11
+ shadowBlur: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
12
+ fill: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
13
+ fillPure: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
14
+ stroke: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
15
+ strokePure: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
16
+ width: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
17
+ height: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
18
+ x: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
19
+ y: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
20
+ angle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
21
+ scaleX: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
22
+ scaleY: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
23
+ lineWidth: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
24
+ startAngle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
25
+ endAngle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
26
+ radius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
27
+ outerRadius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
28
+ innerRadius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
29
+ size: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
30
+ }
31
+ export declare const interpolateUpdateStore: InterpolateUpdateStore;
32
+ export declare function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic): boolean;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.commonInterpolateUpdate = exports.interpolateUpdateStore = exports.InterpolateUpdateStore = void 0;
6
+
7
+ const vrender_core_1 = require("@visactor/vrender-core"), number_1 = require("./number");
8
+
9
+ class InterpolateUpdateStore {
10
+ constructor() {
11
+ this.opacity = (key, from, to, ratio, step, target) => {
12
+ target.attribute.opacity = (0, number_1.interpolateNumber)(from, to, ratio);
13
+ }, this.fillOpacity = (key, from, to, ratio, step, target) => {
14
+ target.attribute.fillOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
15
+ }, this.strokeOpacity = (key, from, to, ratio, step, target) => {
16
+ target.attribute.strokeOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
17
+ }, this.zIndex = (key, from, to, ratio, step, target) => {
18
+ target.attribute.zIndex = (0, number_1.interpolateNumber)(from, to, ratio);
19
+ }, this.backgroundOpacity = (key, from, to, ratio, step, target) => {
20
+ target.attribute.backgroundOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
21
+ }, this.shadowOffsetX = (key, from, to, ratio, step, target) => {
22
+ target.attribute.shadowOffsetX = (0, number_1.interpolateNumber)(from, to, ratio);
23
+ }, this.shadowOffsetY = (key, from, to, ratio, step, target) => {
24
+ target.attribute.shadowOffsetY = (0, number_1.interpolateNumber)(from, to, ratio);
25
+ }, this.shadowBlur = (key, from, to, ratio, step, target) => {
26
+ target.attribute.shadowBlur = (0, number_1.interpolateNumber)(from, to, ratio);
27
+ }, this.fill = (key, from, to, ratio, step, target) => {
28
+ target.attribute.fill = (0, vrender_core_1.interpolateColor)(from, to, ratio, !1);
29
+ }, this.fillPure = (key, from, to, ratio, step, target) => {
30
+ target.attribute.fill = (0, vrender_core_1.interpolatePureColorArrayToStr)(step.fromParsedProps.fill, step.toParsedProps.fill, ratio);
31
+ }, this.stroke = (key, from, to, ratio, step, target) => {
32
+ target.attribute.stroke = (0, vrender_core_1.interpolateColor)(from, to, ratio, !1);
33
+ }, this.strokePure = (key, from, to, ratio, step, target) => {
34
+ target.attribute.stroke = (0, vrender_core_1.interpolatePureColorArrayToStr)(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio);
35
+ }, this.width = (key, from, to, ratio, step, target) => {
36
+ target.attribute.width = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
37
+ }, this.height = (key, from, to, ratio, step, target) => {
38
+ target.attribute.height = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
39
+ }, this.x = (key, from, to, ratio, step, target) => {
40
+ target.attribute.x = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
41
+ target.addUpdatePositionTag();
42
+ }, this.y = (key, from, to, ratio, step, target) => {
43
+ target.attribute.y = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
44
+ target.addUpdatePositionTag();
45
+ }, this.angle = (key, from, to, ratio, step, target) => {
46
+ target.attribute.angle = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
47
+ target.addUpdatePositionTag();
48
+ }, this.scaleX = (key, from, to, ratio, step, target) => {
49
+ target.attribute.scaleX = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
50
+ target.addUpdatePositionTag();
51
+ }, this.scaleY = (key, from, to, ratio, step, target) => {
52
+ target.attribute.scaleY = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
53
+ target.addUpdatePositionTag();
54
+ }, this.lineWidth = (key, from, to, ratio, step, target) => {
55
+ target.attribute.lineWidth = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
56
+ }, this.startAngle = (key, from, to, ratio, step, target) => {
57
+ target.attribute.startAngle = (0, number_1.interpolateNumber)(from, to, ratio),
58
+ target.addUpdateBoundTag();
59
+ }, this.endAngle = (key, from, to, ratio, step, target) => {
60
+ target.attribute.endAngle = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
61
+ }, this.radius = (key, from, to, ratio, step, target) => {
62
+ target.attribute.radius = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
63
+ }, this.outerRadius = (key, from, to, ratio, step, target) => {
64
+ target.attribute.outerRadius = (0, number_1.interpolateNumber)(from, to, ratio),
65
+ target.addUpdateBoundTag();
66
+ }, this.innerRadius = (key, from, to, ratio, step, target) => {
67
+ target.attribute.innerRadius = (0, number_1.interpolateNumber)(from, to, ratio),
68
+ target.addUpdateBoundTag();
69
+ }, this.size = (key, from, to, ratio, step, target) => {
70
+ target.attribute.size = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
71
+ };
72
+ }
73
+ }
74
+
75
+ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
76
+ if (Number.isFinite(to) && Number.isFinite(from)) return target.attribute[key] = from + (to - from) * ratio,
77
+ !0;
78
+ if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {
79
+ const nextList = [];
80
+ let valid = !0;
81
+ for (let i = 0; i < to.length; i++) {
82
+ const v = from[i], val = v + (to[i] - v) * ratio;
83
+ if (!Number.isFinite(val)) {
84
+ valid = !1;
85
+ break;
86
+ }
87
+ nextList.push(val);
88
+ }
89
+ return valid && (target.attribute[key] = nextList), !0;
90
+ }
91
+ return !1;
92
+ }
93
+
94
+ exports.InterpolateUpdateStore = InterpolateUpdateStore, exports.interpolateUpdateStore = new InterpolateUpdateStore,
95
+ exports.commonInterpolateUpdate = commonInterpolateUpdate;
96
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interpolate/store.ts"],"names":[],"mappings":";;;AACA,yDAA0F;AAC1F,qCAA6C;AAuD7C,MAAa,sBAAsB;IAAnC;QACE,YAAO,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YAChG,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,gBAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YACpG,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpE,CAAC,CAAC;QACF,kBAAa,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YACt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ACf,CAAC;AAtBD,0DAsBC","file":"store.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport { interpolateColor, interpolatePureColorArrayToStr } from '@visactor/vrender-core';\nimport { interpolateNumber } from './number';\nimport type { IStep } from '../intreface/animate';\n\n// 直接设置,触发 隐藏类(Hidden Class)优化:\n/**\n *\nconst a = { type: 1 };\nconst ITERATIONS = 1e7; // 测试次数\n\n// 动态生成 keys 数组(确保引擎无法静态推断 key)\nconst keys = [];\nfor (let i = 0; i < ITERATIONS; i++) {\n // 通过条件确保 key 动态变化(但实际始终为 'type',避免属性缺失的开销)\n keys.push(Math.random() < 0 ? 'other' : 'type');\n}\n\n// 测试字面量访问\nfunction testLiteral() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与动态测试完全一致)\n sum += a.type; // 差异仅在此处:使用字面量访问\n }\n return sum;\n}\n\n// 测试变量动态访问\nfunction testDynamic() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与字面量测试完全一致)\n sum += a[key]; // 差异仅在此处:使用变量访问\n }\n return sum;\n}\n\n// 预热(避免 JIT 编译影响)\ntestLiteral();\ntestDynamic();\n\n// 正式测试\nconsole.time('literal');\ntestLiteral();\nconsole.timeEnd('literal');\n\nconsole.time('dynamic');\ntestDynamic();\nconsole.timeEnd('dynamic');\n\n\n// out:\n// literal: 7.1259765625 ms\n// dynamic: 9.322998046875 ms\n */\n\nexport class InterpolateUpdateStore {\n opacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.opacity = interpolateNumber(from, to, ratio);\n };\n fillOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.fillOpacity = interpolateNumber(from, to, ratio);\n };\n strokeOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);\n };\n zIndex = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.zIndex = interpolateNumber(from, to, ratio);\n };\n backgroundOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);\n };\n shadowOffsetX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);\n };\n shadowOffsetY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);\n };\n shadowBlur = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowBlur = interpolateNumber(from, to, ratio);\n };\n fill = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolateColor(from, to, ratio, false) as any;\n };\n fillPure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolatePureColorArrayToStr(\n step.fromParsedProps.fill,\n step.toParsedProps.fill,\n ratio\n ) as any;\n };\n stroke = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolateColor(from, to, ratio, false);\n };\n strokePure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolatePureColorArrayToStr(\n step.fromParsedProps.stroke,\n step.toParsedProps.stroke,\n ratio\n ) as any;\n };\n\n // 需要更新Bounds\n width = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).width = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n height = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).height = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n x = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.x = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n y = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.y = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n angle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.angle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleX = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleY = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n lineWidth = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.lineWidth = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n startAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).startAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n endAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).endAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n radius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).radius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n outerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).outerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n innerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).innerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n size = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).size = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n}\n\nexport const interpolateUpdateStore = new InterpolateUpdateStore();\n\nexport function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic) {\n if (Number.isFinite(to) && Number.isFinite(from)) {\n (target.attribute as any)[key] = from + (to - from) * ratio;\n return true;\n } else if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < to.length; i++) {\n const v = from[i];\n const val = v + (to[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n (target.attribute as any)[key] = nextList;\n }\n return true;\n }\n return false;\n}\n"]}
@@ -0,0 +1,91 @@
1
+ import type { IGraphic } from '@visactor/vrender-core';
2
+ import type { EasingType, EasingTypeFunc } from './easing';
3
+ import type { AnimateStatus, IAnimateStepType } from './type';
4
+ import type { ITimeline } from './timeline';
5
+ export interface ICustomAnimate extends IStep {
6
+ type: IAnimateStepType;
7
+ }
8
+ export interface IStep {
9
+ type: IAnimateStepType;
10
+ prev?: IStep;
11
+ duration: number;
12
+ next?: IStep;
13
+ props?: Record<string, any>;
14
+ fromParsedProps?: Record<string, any>;
15
+ toParsedProps?: Record<string, any>;
16
+ fromProps?: Record<string, any>;
17
+ propKeys?: string[];
18
+ easing?: EasingTypeFunc;
19
+ append: (step: IStep) => void;
20
+ getLastProps: () => any;
21
+ animate: IAnimate;
22
+ setDuration: (duration: number, updateDownstream?: boolean) => void;
23
+ getDuration: () => number;
24
+ determineInterpolateUpdateFunction: () => void;
25
+ setStartTime: (time: number, updateDownstream?: boolean) => void;
26
+ getStartTime: () => number;
27
+ bind: (target: IGraphic, animate: IAnimate) => void;
28
+ onBind: () => void;
29
+ onFirstRun: () => void;
30
+ onStart: () => void;
31
+ onEnd: (cb?: (animate: IAnimate, step: IStep) => void) => void;
32
+ update: (end: boolean, ratio: number, out: Record<string, any>) => void;
33
+ onUpdate: (end: boolean, ratio: number, out: Record<string, any>) => void;
34
+ getEndProps: () => Record<string, any> | void;
35
+ getFromProps: () => Record<string, any> | void;
36
+ getMergedEndProps: () => Record<string, any> | void;
37
+ deleteSelfAttr: (key: string) => void;
38
+ }
39
+ export interface IAnimate {
40
+ readonly id: string | number;
41
+ status: AnimateStatus;
42
+ target: IGraphic;
43
+ priority: number;
44
+ interpolateUpdateFunction: ((from: Record<string, any>, to: Record<string, any>, ratio: number, step: IStep, target: IGraphic) => void) | null;
45
+ _onStart?: (() => void)[];
46
+ _onFrame?: ((step: IStep, ratio: number) => void)[];
47
+ _onEnd?: (() => void)[];
48
+ _onRemove?: (() => void)[];
49
+ getStartProps: () => Record<string, any>;
50
+ getEndProps: () => Record<string, any>;
51
+ setTimeline: (timeline: ITimeline) => void;
52
+ getTimeline: () => ITimeline;
53
+ readonly timeline: ITimeline;
54
+ bind: (target: IGraphic) => this;
55
+ to: (props: Record<string, any>, duration: number, easing: EasingType) => this;
56
+ from: (props: Record<string, any>, duration: number, easing: EasingType) => this;
57
+ pause: () => void;
58
+ resume: () => void;
59
+ onStart: (cb?: () => void) => void;
60
+ onEnd: (cb?: () => void) => void;
61
+ onFrame: (cb: (step: IStep, ratio: number) => void) => void;
62
+ onRemove: (cb?: () => void) => void;
63
+ preventAttr: (key: string) => void;
64
+ preventAttrs: (key: string[]) => void;
65
+ validAttr: (key: string) => boolean;
66
+ runCb: (cb: (a: IAnimate, step: IStep) => void) => IAnimate;
67
+ customInterpolate: (key: string, ratio: number, from: any, to: any, target: IGraphic, ret: Record<string, any>) => boolean;
68
+ play: (customAnimate: ICustomAnimate) => this;
69
+ getFromValue: () => Record<string, any>;
70
+ getToValue: () => Record<string, any>;
71
+ stop: (type?: 'start' | 'end' | Record<string, any>) => void;
72
+ release: () => void;
73
+ getDuration: () => number;
74
+ getTotalDuration: () => number;
75
+ getStartTime: () => number;
76
+ wait: (delay: number) => this;
77
+ afterAll: (list: IAnimate[]) => this;
78
+ after: (animate: IAnimate) => this;
79
+ parallel: (animate: IAnimate) => this;
80
+ getLoop: () => number;
81
+ loop: (n: number | boolean) => IAnimate;
82
+ bounce: (b: boolean) => IAnimate;
83
+ advance: (delta: number) => void;
84
+ startAt: (t: number) => IAnimate;
85
+ reSyncProps: () => void;
86
+ updateDuration: () => void;
87
+ }
88
+ export declare enum AnimateMode {
89
+ NORMAL = 0,
90
+ SET_ATTR_IMMEDIATELY = 1
91
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var AnimateMode;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: !0
7
+ }), exports.AnimateMode = void 0, function(AnimateMode) {
8
+ AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
9
+ }(AnimateMode = exports.AnimateMode || (exports.AnimateMode = {}));
10
+ //# sourceMappingURL=animate.js.map