@visactor/vrender-animate 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (134) hide show
  1. package/cjs/custom/clip-graphic.js +1 -1
  2. package/cjs/custom/clip-graphic.js.map +1 -1
  3. package/cjs/custom/common.js +2 -0
  4. package/cjs/custom/common.js.map +1 -1
  5. package/cjs/custom/custom-animate.js +1 -1
  6. package/cjs/custom/custom-animate.js.map +1 -1
  7. package/cjs/custom/{from-to.d.ts → fromTo.d.ts} +1 -0
  8. package/cjs/custom/fromTo.js +44 -0
  9. package/cjs/custom/fromTo.js.map +1 -0
  10. package/cjs/custom/{group-fade.js → groupFade.js} +1 -1
  11. package/cjs/custom/groupFade.js.map +1 -0
  12. package/cjs/custom/growAngle.js +2 -0
  13. package/cjs/custom/growAngle.js.map +1 -1
  14. package/cjs/custom/growCenter.js +2 -0
  15. package/cjs/custom/growCenter.js.map +1 -1
  16. package/cjs/custom/growHeight.js +2 -0
  17. package/cjs/custom/growHeight.js.map +1 -1
  18. package/cjs/custom/growPoints.js +6 -6
  19. package/cjs/custom/growPoints.js.map +1 -1
  20. package/cjs/custom/growRadius.js +2 -0
  21. package/cjs/custom/growRadius.js.map +1 -1
  22. package/cjs/custom/growWidth.js +2 -0
  23. package/cjs/custom/growWidth.js.map +1 -1
  24. package/cjs/custom/label-item-animate.js +2 -0
  25. package/cjs/custom/label-item-animate.js.map +1 -1
  26. package/cjs/custom/motionPath.d.ts +21 -0
  27. package/cjs/custom/motionPath.js +31 -0
  28. package/cjs/custom/motionPath.js.map +1 -0
  29. package/cjs/custom/move.js +2 -0
  30. package/cjs/custom/move.js.map +1 -1
  31. package/cjs/custom/poptip-animate.js +2 -0
  32. package/cjs/custom/poptip-animate.js.map +1 -1
  33. package/cjs/custom/register.d.ts +27 -0
  34. package/cjs/custom/register.js +376 -4
  35. package/cjs/custom/register.js.map +1 -1
  36. package/cjs/custom/richtext/input-richtext.js +2 -1
  37. package/cjs/custom/rotate.js +2 -0
  38. package/cjs/custom/rotate.js.map +1 -1
  39. package/cjs/custom/scale.js +3 -2
  40. package/cjs/custom/scale.js.map +1 -1
  41. package/cjs/custom/sphere.js +5 -2
  42. package/cjs/custom/sphere.js.map +1 -1
  43. package/cjs/custom/state.js +1 -1
  44. package/cjs/custom/state.js.map +1 -1
  45. package/cjs/custom/story.js +5 -0
  46. package/cjs/custom/story.js.map +1 -1
  47. package/cjs/custom/streamLight.d.ts +27 -0
  48. package/cjs/custom/streamLight.js +161 -0
  49. package/cjs/custom/streamLight.js.map +1 -0
  50. package/cjs/custom/tag-points.js +1 -0
  51. package/cjs/custom/tag-points.js.map +1 -1
  52. package/cjs/custom/update.js +1 -0
  53. package/cjs/custom/update.js.map +1 -1
  54. package/cjs/executor/animate-executor.js +8 -3
  55. package/cjs/executor/animate-executor.js.map +1 -1
  56. package/cjs/index.d.ts +2 -2
  57. package/cjs/index.js +5 -14
  58. package/cjs/index.js.map +1 -1
  59. package/cjs/step.d.ts +2 -0
  60. package/cjs/step.js +10 -6
  61. package/cjs/step.js.map +1 -1
  62. package/cjs/utils/easing-func.js +1 -2
  63. package/dist/index.es.js +359 -31
  64. package/es/custom/clip-graphic.js +1 -1
  65. package/es/custom/clip-graphic.js.map +1 -1
  66. package/es/custom/common.js +2 -0
  67. package/es/custom/common.js.map +1 -1
  68. package/es/custom/custom-animate.js +1 -1
  69. package/es/custom/custom-animate.js.map +1 -1
  70. package/es/custom/{from-to.d.ts → fromTo.d.ts} +1 -0
  71. package/es/custom/fromTo.js +36 -0
  72. package/es/custom/fromTo.js.map +1 -0
  73. package/es/custom/{group-fade.js → groupFade.js} +1 -1
  74. package/es/custom/groupFade.js.map +1 -0
  75. package/es/custom/growAngle.js +2 -0
  76. package/es/custom/growAngle.js.map +1 -1
  77. package/es/custom/growCenter.js +2 -0
  78. package/es/custom/growCenter.js.map +1 -1
  79. package/es/custom/growHeight.js +2 -0
  80. package/es/custom/growHeight.js.map +1 -1
  81. package/es/custom/growPoints.js +6 -6
  82. package/es/custom/growPoints.js.map +1 -1
  83. package/es/custom/growRadius.js +2 -0
  84. package/es/custom/growRadius.js.map +1 -1
  85. package/es/custom/growWidth.js +2 -0
  86. package/es/custom/growWidth.js.map +1 -1
  87. package/es/custom/label-item-animate.js +2 -0
  88. package/es/custom/label-item-animate.js.map +1 -1
  89. package/es/custom/motionPath.d.ts +21 -0
  90. package/es/custom/motionPath.js +23 -0
  91. package/es/custom/motionPath.js.map +1 -0
  92. package/es/custom/move.js +2 -0
  93. package/es/custom/move.js.map +1 -1
  94. package/es/custom/poptip-animate.js +2 -0
  95. package/es/custom/poptip-animate.js.map +1 -1
  96. package/es/custom/register.d.ts +27 -0
  97. package/es/custom/register.js +11 -2
  98. package/es/custom/register.js.map +1 -1
  99. package/es/custom/richtext/input-richtext.js +2 -1
  100. package/es/custom/rotate.js +2 -0
  101. package/es/custom/rotate.js.map +1 -1
  102. package/es/custom/scale.js +3 -2
  103. package/es/custom/scale.js.map +1 -1
  104. package/es/custom/sphere.js +5 -2
  105. package/es/custom/sphere.js.map +1 -1
  106. package/es/custom/state.js +1 -1
  107. package/es/custom/state.js.map +1 -1
  108. package/es/custom/story.js +5 -0
  109. package/es/custom/story.js.map +1 -1
  110. package/es/custom/streamLight.d.ts +27 -0
  111. package/es/custom/streamLight.js +157 -0
  112. package/es/custom/streamLight.js.map +1 -0
  113. package/es/custom/tag-points.js +1 -0
  114. package/es/custom/tag-points.js.map +1 -1
  115. package/es/custom/update.js +1 -0
  116. package/es/custom/update.js.map +1 -1
  117. package/es/executor/animate-executor.js +7 -3
  118. package/es/executor/animate-executor.js.map +1 -1
  119. package/es/index.d.ts +2 -2
  120. package/es/index.js +2 -2
  121. package/es/index.js.map +1 -1
  122. package/es/step.d.ts +2 -0
  123. package/es/step.js +10 -6
  124. package/es/step.js.map +1 -1
  125. package/es/utils/easing-func.js +1 -2
  126. package/package.json +3 -3
  127. package/cjs/custom/from-to.js +0 -38
  128. package/cjs/custom/from-to.js.map +0 -1
  129. package/cjs/custom/group-fade.js.map +0 -1
  130. package/es/custom/from-to.js +0 -30
  131. package/es/custom/from-to.js.map +0 -1
  132. package/es/custom/group-fade.js.map +0 -1
  133. /package/cjs/custom/{group-fade.d.ts → groupFade.d.ts} +0 -0
  134. /package/es/custom/{group-fade.d.ts → groupFade.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/growPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+C,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAyBlD,MAAM,eAAe,GAAG,CACtB,OAAiB,EACjB,OAA2C,EAC3C,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAiB,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,MAAM,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAC7B,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7B;QACD,IA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AC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;YAC/D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC;YACnD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF","file":"growPoints.js","sourcesContent":["import { pointInterpolation, type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nconst getCenterPoints = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points: IPointLike[] = attrs.points;\n const center: IPointLike = { x: 0, y: 0 };\n points.forEach(point => {\n center.x += point.x;\n center.y += point.y;\n });\n center.x /= points.length;\n center.y /= points.length;\n\n if (options && options.center) {\n if (isValidNumber(options.center.x)) {\n center.x = options.center.x;\n }\n if (isValidNumber(options.center.y)) {\n center.y = options.center.y;\n }\n }\n\n if (graphic.type === 'area') {\n center.x1 = center.x;\n center.y1 = center.y;\n }\n\n return points.map(point => Object.assign({}, point, center));\n};\n\nexport const growPointsIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: getCenterPoints(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nexport const growPointsOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: getCenterPoints(graphic, options, animationParameters) }\n };\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const fromPoints = this.from?.points as unknown as IPointLike[];\n const toPoints = this.to?.points as unknown as IPointLike[];\n if (!fromPoints || !toPoints) {\n return;\n }\n\n (this.target.attribute as any).points = fromPoints.map((point, index) => {\n const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);\n return newPoint;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowPointsIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsX = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupRight = animationParameters.width;\n\n if (animationParameters.group) {\n groupRight = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = groupRight;\n }\n\n return {\n ...point,\n x: groupRight,\n y: point.y,\n x1: groupRight,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: 0,\n y: point.y,\n x1: 0,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsXIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsX(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsXOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsX(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsXIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsXIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsXOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsXOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsY = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupBottom = animationParameters.height;\n\n if (animationParameters.group) {\n groupBottom = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = groupBottom;\n }\n\n return {\n ...point,\n x: point.x,\n y: groupBottom,\n x1: point.x1,\n y1: groupBottom,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: point.x,\n y: 0,\n x1: point.x1,\n y1: 0,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsYIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsY(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsYOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsY(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsYIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsYOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/growPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+C,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAyBlD,MAAM,eAAe,GAAG,CACtB,OAAiB,EACjB,OAA2C,EAC3C,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAiB,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,MAAM,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,I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AAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;aACtD;YACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACjC;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,cAAc;IAChD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC1D,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;YAC/D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC;YACnD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF","file":"growPoints.js","sourcesContent":["import { pointInterpolation, type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nconst getCenterPoints = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points: IPointLike[] = attrs.points;\n const center: IPointLike = { x: 0, y: 0 };\n points.forEach(point => {\n center.x += point.x;\n center.y += point.y;\n });\n center.x /= points.length;\n center.y /= points.length;\n\n if (options && options.center) {\n if (isValidNumber(options.center.x)) {\n center.x = options.center.x;\n }\n if (isValidNumber(options.center.y)) {\n center.y = options.center.y;\n }\n }\n\n if (graphic.type === 'area') {\n center.x1 = center.x;\n center.y1 = center.y;\n }\n\n return points.map(point => Object.assign({}, point, center));\n};\n\nexport const growPointsIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: getCenterPoints(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nexport const growPointsOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: getCenterPoints(graphic, options, animationParameters) }\n };\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const fromPoints = this.from?.points as unknown as IPointLike[];\n const toPoints = this.to?.points as unknown as IPointLike[];\n if (!fromPoints || !toPoints) {\n return;\n }\n\n (this.target.attribute as any).points = fromPoints.map((point, index) => {\n const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);\n return newPoint;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowPointsIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsX = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupRight = animationParameters.width;\n\n if (animationParameters.group) {\n groupRight = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = groupRight;\n }\n\n return {\n ...point,\n x: groupRight,\n y: point.y,\n x1: groupRight,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: 0,\n y: point.y,\n x1: 0,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsXIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsX(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsXOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsX(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsXIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsXIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsXOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsXOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsY = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupBottom = animationParameters.height;\n\n if (animationParameters.group) {\n groupBottom = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = groupBottom;\n }\n\n return {\n ...point,\n x: point.x,\n y: groupBottom,\n x1: point.x1,\n y1: groupBottom,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: point.x,\n y: 0,\n x1: point.x1,\n y1: 0,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsYIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsY(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsYOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsY(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsYIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsYOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n"]}
@@ -89,6 +89,7 @@ export class GrowPointsBase extends ACustomAnimate {
89
89
  export class GrowRadiusIn extends GrowPointsBase {
90
90
  onBind() {
91
91
  var _a, _b;
92
+ super.onBind();
92
93
  const {from: from, to: to} = growRadiusIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
93
94
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
94
95
  this.from = fromAttrs, this.to = to;
@@ -99,6 +100,7 @@ export class GrowRadiusIn extends GrowPointsBase {
99
100
 
100
101
  export class GrowRadiusOut extends GrowPointsBase {
101
102
  onBind() {
103
+ super.onBind();
102
104
  const {to: to} = (graphic = this.target, options = this.params.options, this.params,
103
105
  !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusOutOverall(graphic, options) : growRadiusOutIndividual(graphic, options));
104
106
  var graphic, options, _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/growRadius.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA2B5C,MAAM,sBAAsB,GAAG,CAC7B,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC1C,OAAO;YACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;YACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;SACxC,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;QACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;KACxC,CAAC;AACJ,CAA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I,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;SACtD;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,cAAc;IAC/C,MAAM;QACJ,MAAM,EAAE,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAgB,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;CACF","file":"growRadius.js","sourcesContent":["import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\nimport { isNumber } from '@visactor/vutils';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nconst growRadiusInIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(graphic, options, animationParameters)\n : growRadiusInIndividual(graphic, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.innerRadius },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.outerRadius },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(graphic, options, animationParameters)\n : growRadiusOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowPointsBase 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 GrowRadiusIn extends GrowPointsBase {\n onBind(): void {\n const { from, to } = growRadiusIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n}\n\nexport class GrowRadiusOut extends GrowPointsBase {\n onBind(): void {\n const { to } = growRadiusOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n\n this.from = this.target.attribute as any;\n this.to = to;\n // this.target.setAttributes(fromAttrs);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/growRadius.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA2B5C,MAAM,sBAAsB,GAAG,CAC7B,OAAiB,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AAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAgB,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;CACF","file":"growRadius.js","sourcesContent":["import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\nimport { isNumber } from '@visactor/vutils';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nconst growRadiusInIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(graphic, options, animationParameters)\n : growRadiusInIndividual(graphic, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.innerRadius },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.outerRadius },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(graphic, options, animationParameters)\n : growRadiusOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowPointsBase 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 GrowRadiusIn extends GrowPointsBase {\n onBind(): void {\n super.onBind();\n const { from, to } = growRadiusIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n}\n\nexport class GrowRadiusOut extends GrowPointsBase {\n onBind(): void {\n super.onBind();\n const { to } = growRadiusOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n\n this.from = this.target.attribute as any;\n this.to = to;\n // this.target.setAttributes(fromAttrs);\n }\n}\n"]}
@@ -107,6 +107,7 @@ export class GrowWidthIn extends ACustomAnimate {
107
107
  }
108
108
  onBind() {
109
109
  var _a, _b;
110
+ super.onBind();
110
111
  const {from: from, to: to} = growWidthIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
111
112
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
112
113
  this.from = fromAttrs, this.to = to;
@@ -129,6 +130,7 @@ export class GrowWidthOut extends ACustomAnimate {
129
130
  super(from, to, duration, easing, params);
130
131
  }
131
132
  onBind() {
133
+ super.onBind();
132
134
  const {from: from, to: to} = (graphic = this.target, options = this.params.options,
133
135
  animationParameters = this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthOutOverall(graphic, options, animationParameters) : growWidthOutIndividual(graphic, options, animationParameters));
134
136
  var graphic, options, animationParameters, _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/growWidth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB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AAM,CAAC,0BAA0B,EAAE,CAAC;IAC3C,CAAC;CACF","file":"growWidth.js","sourcesContent":["import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';\nimport { isNil, isNumber, isValid } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nfunction growWidthInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n from: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n from: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nfunction growWidthInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n // no need to handle the situation where x > x1\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options?.overall : 0;\n }\n return {\n from: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nconst growWidthIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthInOverall(graphic, options, animationParameters)\n : growWidthInIndividual(graphic, options, animationParameters);\n};\n\nfunction growWidthOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n to: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n to: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 }\n };\n}\n\nfunction growWidthOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x1 = attrs.x1;\n const width = attrs.width;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 }\n };\n}\n\nexport const growWidthOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthOutOverall(graphic, options, animationParameters)\n : growWidthOutIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowWidthIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n const { from, to } = growWidthIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n 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\nexport class GrowWidthOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n const { from, to } = growWidthOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\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 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"]}
1
+ {"version":3,"sources":["../src/custom/growWidth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuBlD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7E,OAAO;YACL,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACpG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;SACnC,CAAC;KACH;IAED,MAAM,SAA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AM,SAAS,GAAwB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;QAC7D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,SAAS,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;QAC5E,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;IAC3C,CAAC;CACF","file":"growWidth.js","sourcesContent":["import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';\nimport { isNil, isNumber, isValid } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nfunction growWidthInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n from: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n from: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nfunction growWidthInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n // no need to handle the situation where x > x1\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options?.overall : 0;\n }\n return {\n from: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nconst growWidthIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthInOverall(graphic, options, animationParameters)\n : growWidthInIndividual(graphic, options, animationParameters);\n};\n\nfunction growWidthOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n to: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n to: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 }\n };\n}\n\nfunction growWidthOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x1 = attrs.x1;\n const width = attrs.width;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 }\n };\n}\n\nexport const growWidthOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthOutOverall(graphic, options, animationParameters)\n : growWidthOutIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowWidthIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const { from, to } = growWidthIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n 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\nexport class GrowWidthOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const { from, to } = growWidthOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\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 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"]}
@@ -6,6 +6,7 @@ import { InputText } from "./input-text";
6
6
 
7
7
  export class LabelItemAppear extends AComponentAnimate {
8
8
  onBind() {
9
+ super.onBind();
9
10
  const animator = createComponentAnimator(this.target);
10
11
  this._animator = animator;
11
12
  const duration = this.duration, easing = this.easing, target = this.target, {symbolStartOuterType: symbolStartOuterType = "scale", titleType: titleType = "typewriter", titlePanelType: titlePanelType = "scale"} = this.params, symbolTime = duration / 10;
@@ -136,6 +137,7 @@ export class LabelItemAppear extends AComponentAnimate {
136
137
 
137
138
  export class LabelItemDisappear extends AComponentAnimate {
138
139
  onBind() {
140
+ super.onBind();
139
141
  const animator = createComponentAnimator(this.target);
140
142
  this._animator = animator;
141
143
  const duration = this.duration, easing = this.easing, target = this.target, {mode: mode} = this.params;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/label-item-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAA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ED,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF","file":"label-item-animate.js","sourcesContent":["import { AComponentAnimate } from './custom-animate';\nimport { createComponentAnimator } from '../component';\nimport { InputText } from './input-text';\n\n/**\n * LabelItemAppear class handles the appear animation for StoryLabelItem components\n */\nexport class LabelItemAppear extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { symbolStartOuterType = 'scale', titleType = 'typewriter', titlePanelType = 'scale' } = this.params;\n\n const symbolTime = duration / 10;\n target._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 5,\n easing\n });\n\n let symbolStartOuterFrom: any;\n let symbolStartOuterTo: any;\n if (symbolStartOuterType === 'scale') {\n symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };\n symbolStartOuterTo = { scaleX: 1, scaleY: 1 };\n } else {\n symbolStartOuterFrom = { clipRange: 0 };\n symbolStartOuterTo = { clipRange: 1 };\n }\n target._symbolStartOuter.setAttributes(symbolStartOuterFrom);\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: symbolStartOuterTo,\n duration: symbolTime * 5,\n easing\n });\n\n target._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 2,\n delay: symbolTime * 8,\n easing\n });\n\n target._line.setAttributes({ clipRange: 0 });\n\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 1 },\n duration: symbolTime * 9,\n easing\n });\n\n if (titleType === 'typewriter') {\n const titleTopText = target._titleTop.attribute.text as string;\n target._titleTop.setAttributes({ text: '' });\n\n animator.animate(target._titleTop, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleTopText },\n custom: InputText\n });\n\n const titleBottomText = target._titleBottom.attribute.text as string;\n target._titleBottom.setAttributes({ text: '' });\n\n animator.animate(target._titleBottom, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleBottomText },\n custom: InputText\n });\n } else {\n target._titleTop.setAttributes({ dy: target._titleTop.AABBBounds.height() + 10 });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n\n target._titleBottom.setAttributes({ dy: -(10 + target._titleBottom.AABBBounds.height()) });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n }\n\n if (titlePanelType === 'scale') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const scaleX = panel.attribute.scaleX ?? 1;\n panel.setAttributes({ scaleX: 0 });\n animator.animate(panel, {\n type: 'to',\n to: {\n scaleX\n },\n duration,\n easing\n });\n });\n } else if (titlePanelType === 'stroke') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const b = panel.AABBBounds;\n const totalLen = (b.width() + b.height()) * 2;\n panel.setAttributes({ lineDash: [0, totalLen * 10] });\n animator.animate(panel, {\n type: 'to',\n to: {\n lineDash: [totalLen, totalLen * 10]\n },\n duration,\n easing\n });\n });\n }\n\n this.completeBind(animator);\n }\n}\n\n/**\n * LabelItemDisappear class handles the disappear animation for StoryLabelItem components\n */\nexport class LabelItemDisappear extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { mode } = this.params;\n\n if (mode === 'scale') {\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n } else {\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 0 },\n duration,\n easing\n });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: { dy: target._titleTop.AABBBounds.height() + 10 },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: { dy: -(10 + target._titleBottom.AABBBounds.height()) },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: { clipRange: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._titleTopPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleBottomPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n }\n\n this.completeBind(animator);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/label-item-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,OAAO,eAAgB,SAAQ,iBAAsB;IACzD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAa,CAAC;QAElC,MAAM,EAAE,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tB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;gBACpC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE;gBAC3D,QAAQ,EAAE,QAAQ,GAAG,CAAC;gBACtB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE;gBACzC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;gBACpB,QAAQ,EAAE,QAAQ,GAAG,CAAC;gBACtB,KAAK,EAAE,QAAQ,GAAG,CAAC;gBACnB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;gBACtC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACjB,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE;gBACzC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACjB,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF","file":"label-item-animate.js","sourcesContent":["import { AComponentAnimate } from './custom-animate';\nimport { createComponentAnimator } from '../component';\nimport { InputText } from './input-text';\n\n/**\n * LabelItemAppear class handles the appear animation for StoryLabelItem components\n */\nexport class LabelItemAppear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { symbolStartOuterType = 'scale', titleType = 'typewriter', titlePanelType = 'scale' } = this.params;\n\n const symbolTime = duration / 10;\n target._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 5,\n easing\n });\n\n let symbolStartOuterFrom: any;\n let symbolStartOuterTo: any;\n if (symbolStartOuterType === 'scale') {\n symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };\n symbolStartOuterTo = { scaleX: 1, scaleY: 1 };\n } else {\n symbolStartOuterFrom = { clipRange: 0 };\n symbolStartOuterTo = { clipRange: 1 };\n }\n target._symbolStartOuter.setAttributes(symbolStartOuterFrom);\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: symbolStartOuterTo,\n duration: symbolTime * 5,\n easing\n });\n\n target._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 2,\n delay: symbolTime * 8,\n easing\n });\n\n target._line.setAttributes({ clipRange: 0 });\n\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 1 },\n duration: symbolTime * 9,\n easing\n });\n\n if (titleType === 'typewriter') {\n const titleTopText = target._titleTop.attribute.text as string;\n target._titleTop.setAttributes({ text: '' });\n\n animator.animate(target._titleTop, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleTopText },\n custom: InputText\n });\n\n const titleBottomText = target._titleBottom.attribute.text as string;\n target._titleBottom.setAttributes({ text: '' });\n\n animator.animate(target._titleBottom, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleBottomText },\n custom: InputText\n });\n } else {\n target._titleTop.setAttributes({ dy: target._titleTop.AABBBounds.height() + 10 });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n\n target._titleBottom.setAttributes({ dy: -(10 + target._titleBottom.AABBBounds.height()) });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n }\n\n if (titlePanelType === 'scale') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const scaleX = panel.attribute.scaleX ?? 1;\n panel.setAttributes({ scaleX: 0 });\n animator.animate(panel, {\n type: 'to',\n to: {\n scaleX\n },\n duration,\n easing\n });\n });\n } else if (titlePanelType === 'stroke') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const b = panel.AABBBounds;\n const totalLen = (b.width() + b.height()) * 2;\n panel.setAttributes({ lineDash: [0, totalLen * 10] });\n animator.animate(panel, {\n type: 'to',\n to: {\n lineDash: [totalLen, totalLen * 10]\n },\n duration,\n easing\n });\n });\n }\n\n this.completeBind(animator);\n }\n}\n\n/**\n * LabelItemDisappear class handles the disappear animation for StoryLabelItem components\n */\nexport class LabelItemDisappear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { mode } = this.params;\n\n if (mode === 'scale') {\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n } else {\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 0 },\n duration,\n easing\n });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: { dy: target._titleTop.AABBBounds.height() + 10 },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: { dy: -(10 + target._titleBottom.AABBBounds.height()) },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: { clipRange: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._titleTopPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleBottomPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n }\n\n this.completeBind(animator);\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { CustomPath2D, IGraphic, EasingType } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from './custom-animate';
3
+ export declare class MotionPath extends ACustomAnimate<any> {
4
+ valid: boolean;
5
+ pathLength: number;
6
+ path: CustomPath2D;
7
+ distance: number;
8
+ totalLength: number;
9
+ initAngle: number;
10
+ changeAngle: boolean;
11
+ cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;
12
+ constructor(from: any, to: any, duration: number, easing: EasingType, params?: {
13
+ path: CustomPath2D;
14
+ distance: number;
15
+ cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;
16
+ initAngle?: number;
17
+ changeAngle?: boolean;
18
+ });
19
+ onBind(): void;
20
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
21
+ }
@@ -0,0 +1,23 @@
1
+ import { ACustomAnimate } from "./custom-animate";
2
+
3
+ export class MotionPath extends ACustomAnimate {
4
+ constructor(from, to, duration, easing, params) {
5
+ var _a;
6
+ super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(),
7
+ this.path = params.path, this.distance = params.distance, this.totalLength = this.distance * this.pathLength,
8
+ this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle,
9
+ this.cb = params.cb);
10
+ }
11
+ onBind() {
12
+ this.from = {
13
+ x: 0,
14
+ y: 0
15
+ }, this.to = this.path.getAttrAt(this.totalLength).pos, this.props = this.to;
16
+ }
17
+ onUpdate(end, ratio, out) {
18
+ const attrs = {}, at = this.totalLength * ratio, {pos: pos, angle: angle} = this.path.getAttrAt(at);
19
+ attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle),
20
+ this.cb && this.cb(this.from, this.to, ratio, this.target), this.target.setAttributes(attrs);
21
+ }
22
+ }
23
+ //# sourceMappingURL=motionPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/custom/motionPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,UAAW,SAAQ,cAAmB;IASjD,YACE,IAAS,EACT,EAAO,EACP,QAAgB,EAChB,MAAkB,EAClB,MAMC;;QAED,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;YACnD,IAAI,CAAC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;SACrB;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;IACvB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,MAAM,KAAK,GAAG,EAAS,CAAC;QAExB,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACpC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAChB,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;SACtC;QACD,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACF","file":"motionPath.js","sourcesContent":["import type { CustomPath2D, IGraphic, EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class MotionPath extends ACustomAnimate<any> {\n declare valid: boolean;\n declare pathLength: number;\n declare path: CustomPath2D;\n declare distance: number;\n declare totalLength: number;\n declare initAngle: number;\n declare changeAngle: boolean;\n declare cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;\n constructor(\n from: any,\n to: any,\n duration: number,\n easing: EasingType,\n params?: {\n path: CustomPath2D;\n distance: number;\n cb?: (from: any, to: any, ratio: number, target: IGraphic) => void;\n initAngle?: number;\n changeAngle?: boolean;\n }\n ) {\n super(from, to, duration, easing, params);\n if (params) {\n this.pathLength = params.path.getLength();\n this.path = params.path;\n this.distance = params.distance;\n this.totalLength = this.distance * this.pathLength;\n this.initAngle = params.initAngle ?? 0;\n this.changeAngle = !!params.changeAngle;\n this.cb = params.cb;\n }\n }\n\n onBind(): void {\n this.from = { x: 0, y: 0 };\n this.to = this.path.getAttrAt(this.totalLength).pos;\n this.props = this.to;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attrs = {} as any;\n // 计算位置\n const at = this.totalLength * ratio;\n const { pos, angle } = this.path.getAttrAt(at);\n attrs.x = pos.x;\n attrs.y = pos.y;\n if (this.changeAngle) {\n attrs.angle = angle + this.initAngle;\n }\n this.cb && this.cb(this.from, this.to, ratio, this.target as IGraphic);\n this.target.setAttributes(attrs);\n }\n}\n"]}
package/es/custom/move.js CHANGED
@@ -98,6 +98,7 @@ export class MoveBase extends ACustomAnimate {
98
98
 
99
99
  export class MoveIn extends MoveBase {
100
100
  onBind() {
101
+ super.onBind();
101
102
  const {from: from, to: to} = moveIn(this.target, this.params.options, this.params);
102
103
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
103
104
  this.from = from, this.to = to;
@@ -108,6 +109,7 @@ export class MoveIn extends MoveBase {
108
109
 
109
110
  export class MoveOut extends MoveBase {
110
111
  onBind() {
112
+ super.onBind();
111
113
  const {from: from, to: to} = moveOut(this.target, this.params.options, this.params);
112
114
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
113
115
  this.from = from, this.to = to;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/move.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwBlD,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,OAAiB,EACjB,OAA8B,EAC9B,mBAAyC,EACzC,EAAE;;IACF,MAAM,EAAE,MAAM,GAAG,C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AAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;SACtD;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,OAAQ,SAAQ,QAAQ;IACnC,MAAM;QACJ,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF","file":"move.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isFunction, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport type FunctionCallback<T> = (...args: any[]) => T;\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n excludeChannels?: string[];\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n // consider the offset of group\n if (animationParameters.group) {\n changedX = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n changedY = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupWidth = changedX;\n (animationParameters as any).groupHeight = changedY;\n } else {\n changedX = animationParameters.width;\n changedY = animationParameters.height;\n }\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n const finalAttrs = graphic.getFinalAttribute();\n const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;\n const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: finalAttrsX }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: finalAttrsY }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: finalAttrsX,\n y: finalAttrsY\n }\n };\n }\n};\n\nexport const moveOut = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;\n const groupWidth = groupBounds?.width() ?? animationParameters.width;\n const groupHeight = groupBounds?.height() ?? animationParameters.height;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: graphic.attribute.x },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: graphic.attribute.y },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: graphic.attribute.x,\n y: graphic.attribute.y\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n\nexport class MoveBase 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 MoveIn extends MoveBase {\n onBind(): void {\n const { from, to } = moveIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n }\n}\n\nexport class MoveOut extends MoveBase {\n onBind(): void {\n const { from, to } = moveOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/move.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwBlD,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,OAAiB,EACjB,OAA8B,EAC9B,mBAAyC,EACzC,EAAE;;IACF,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IAC/F,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,IAAI,MAAM,KAAK,UAAU,EAAE;QAEzB,IAAI,mBAAmB,CAAC,KAAK,EAAE;YAC7B,QAAQ,GAAG,MAAC,mBAA2B,CAAC,UAAU,mCAAI,mBAAmB,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC;YACpG,QAAQ,GAAG,MAAC,mBAA2B,CAAC,WAAW,mCAAI,mBAAmB,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC;YAErG,mBAA2B,CAAC,UAAU,GAAG,QAAQ,CAAC;YAClD,mBAA2B,CAAC,WAAW,GAAG,QAAQ,CAAC;SACrD;aAAM;YACL,QAAQ,GAAG,mBAAmB,CAAC,KAAK,CAAC;YACrC,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC;SACvC;KACF;IAED,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,IAAI,MAAM,CAAC;IACnB,MAAM,KAAK,GAAG,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IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF","file":"move.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isFunction, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport type FunctionCallback<T> = (...args: any[]) => T;\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n excludeChannels?: string[];\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt, excludeChannels = [] } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n // consider the offset of group\n if (animationParameters.group) {\n changedX = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n changedY = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupWidth = changedX;\n (animationParameters as any).groupHeight = changedY;\n } else {\n changedX = animationParameters.width;\n changedY = animationParameters.height;\n }\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n const finalAttrs = graphic.getFinalAttribute();\n const finalAttrsX = excludeChannels.includes('x') ? graphic.attribute.x : finalAttrs.x;\n const finalAttrsY = excludeChannels.includes('y') ? graphic.attribute.y : finalAttrs.y;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: finalAttrsX }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: finalAttrsY }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: finalAttrsX,\n y: finalAttrsY\n }\n };\n }\n};\n\nexport const moveOut = (\n graphic: IGraphic,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;\n const groupWidth = groupBounds?.width() ?? animationParameters.width;\n const groupHeight = groupBounds?.height() ?? animationParameters.height;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, graphic.getDatum(), graphic, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: graphic.attribute.x },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: graphic.attribute.y },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: graphic.attribute.x,\n y: graphic.attribute.y\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n\nexport class MoveBase 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 MoveIn extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n this.target.setAttributes(from);\n }\n}\n\nexport class MoveOut extends MoveBase {\n onBind(): void {\n super.onBind();\n const { from, to } = moveOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => (to as any)[key] != null);\n this.from = from;\n this.to = to;\n }\n}\n"]}
@@ -6,6 +6,7 @@ import { InputText } from "./input-text";
6
6
 
7
7
  export class PoptipAppear extends AComponentAnimate {
8
8
  onBind() {
9
+ super.onBind();
9
10
  const animator = createComponentAnimator(this.target);
10
11
  this._animator = animator;
11
12
  const duration = this.duration, easing = this.easing, target = this.target, {wave: wave} = this.params;
@@ -84,6 +85,7 @@ export class PoptipAppear extends AComponentAnimate {
84
85
 
85
86
  export class PoptipDisappear extends AComponentAnimate {
86
87
  onBind() {
88
+ super.onBind();
87
89
  const animator = createComponentAnimator(this.target);
88
90
  this._animator = animator;
89
91
  const duration = this.duration, easing = this.easing, target = this.target;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/poptip-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM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B,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;YAC5B,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF","file":"poptip-animate.js","sourcesContent":["import { AComponentAnimate } from './custom-animate';\nimport { createComponentAnimator } from '../component';\nimport { InputText } from './input-text';\n\n/**\n * PoptipAppear class handles the appear animation for Poptip components\n */\nexport class PoptipAppear extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { wave } = this.params;\n\n target.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: (duration / 3) * 2,\n easing\n });\n\n target.titleShape &&\n animator.animate(target.titleShape, {\n type: 'custom',\n to: { text: target.titleShape.attribute.text as string },\n duration,\n easing,\n custom: InputText\n });\n\n target.contentShape &&\n animator.animate(target.contentShape, {\n type: 'custom',\n to: { text: target.contentShape.attribute.text as string },\n duration,\n easing,\n custom: InputText\n });\n\n if (wave) {\n const dur = duration / 6;\n animator.animate(target.group, {\n timeSlices: [\n {\n duration: dur,\n effects: {\n type: 'to',\n to: { angle: wave },\n easing\n }\n },\n {\n duration: dur * 2,\n effects: {\n type: 'to',\n to: { angle: -wave },\n easing\n }\n },\n {\n duration: dur * 2,\n effects: {\n type: 'to',\n to: { angle: wave },\n easing\n }\n },\n {\n duration: dur,\n effects: {\n type: 'to',\n to: { angle: 0 },\n easing\n }\n }\n ]\n });\n }\n\n this.completeBind(animator);\n }\n}\n\n/**\n * PoptipDisappear class handles the disappear animation for Poptip components\n */\nexport class PoptipDisappear extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n animator.animate(target, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n\n this.completeBind(animator);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/poptip-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,OAAO,YAAa,SAAQ,iBAAsB;IACtD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAa,CAAC;QAElC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAE7B,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAE/C,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;YACvB,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;YAC5B,QAAQ,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;YAC5B,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,CAAC,UAAU;YACf,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;gBAClC,IAAI,EAAE,QAAQ;gBACd,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,S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eAAgB,SAAQ,iBAAsB;IACzD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAa,CAAC;QAElC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;YACvB,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;YAC5B,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF","file":"poptip-animate.js","sourcesContent":["import { AComponentAnimate } from './custom-animate';\nimport { createComponentAnimator } from '../component';\nimport { InputText } from './input-text';\n\n/**\n * PoptipAppear class handles the appear animation for Poptip components\n */\nexport class PoptipAppear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { wave } = this.params;\n\n target.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: (duration / 3) * 2,\n easing\n });\n\n target.titleShape &&\n animator.animate(target.titleShape, {\n type: 'custom',\n to: { text: target.titleShape.attribute.text as string },\n duration,\n easing,\n custom: InputText\n });\n\n target.contentShape &&\n animator.animate(target.contentShape, {\n type: 'custom',\n to: { text: target.contentShape.attribute.text as string },\n duration,\n easing,\n custom: InputText\n });\n\n if (wave) {\n const dur = duration / 6;\n animator.animate(target.group, {\n timeSlices: [\n {\n duration: dur,\n effects: {\n type: 'to',\n to: { angle: wave },\n easing\n }\n },\n {\n duration: dur * 2,\n effects: {\n type: 'to',\n to: { angle: -wave },\n easing\n }\n },\n {\n duration: dur * 2,\n effects: {\n type: 'to',\n to: { angle: wave },\n easing\n }\n },\n {\n duration: dur,\n effects: {\n type: 'to',\n to: { angle: 0 },\n easing\n }\n }\n ]\n });\n }\n\n this.completeBind(animator);\n }\n}\n\n/**\n * PoptipDisappear class handles the disappear animation for Poptip components\n */\nexport class PoptipDisappear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n animator.animate(target, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n\n this.completeBind(animator);\n }\n}\n"]}
@@ -1 +1,28 @@
1
+ import { ClipIn, ClipOut } from './clip';
2
+ import { FadeIn, FadeOut } from './fade';
3
+ import { GrowAngleIn, GrowAngleOut } from './growAngle';
4
+ import { GrowCenterIn, GrowCenterOut } from './growCenter';
5
+ import { GrowHeightIn, GrowHeightOut } from './growHeight';
6
+ import { GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut } from './growPoints';
7
+ import { GrowRadiusIn, GrowRadiusOut } from './growRadius';
8
+ import { GrowWidthIn, GrowWidthOut } from './growWidth';
9
+ import { InputText } from './input-text';
10
+ import { LabelItemAppear, LabelItemDisappear } from './label-item-animate';
11
+ import { IncreaseCount } from './number';
12
+ import { PoptipAppear, PoptipDisappear } from './poptip-animate';
13
+ import { InputRichText } from './richtext/input-richtext';
14
+ import { OutputRichText } from './richtext/output-richtext';
15
+ import { SlideRichText } from './richtext/slide-richtext';
16
+ import { SlideOutRichText } from './richtext/slide-out-richtext';
17
+ import { ScaleIn, ScaleOut } from './scale';
18
+ import { State } from './state';
19
+ import { GrowIn, GrowOut, MoveRotateIn, MoveRotateOut, MoveScaleIn, MoveScaleOut, SlideIn, SlideOut, SpinIn, SpinOut } from './story';
20
+ import { Update } from './update';
21
+ import { MoveIn, MoveOut } from './move';
22
+ import { RotateIn, RotateOut } from './rotate';
23
+ import { MotionPath } from './motionPath';
24
+ import { FromTo } from './fromTo';
25
+ import { GroupFadeIn, GroupFadeOut } from './groupFade';
26
+ import { StreamLight } from './streamLight';
1
27
  export declare const registerCustomAnimate: () => void;
28
+ export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
@@ -44,7 +44,13 @@ import { MoveIn, MoveOut } from "./move";
44
44
 
45
45
  import { RotateIn, RotateOut } from "./rotate";
46
46
 
47
- import { FromTo } from "./from-to";
47
+ import { MotionPath } from "./motionPath";
48
+
49
+ import { FromTo } from "./fromTo";
50
+
51
+ import { GroupFadeIn, GroupFadeOut } from "./groupFade";
52
+
53
+ import { StreamLight } from "./streamLight";
48
54
 
49
55
  export const registerCustomAnimate = () => {
50
56
  AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo),
@@ -71,6 +77,9 @@ export const registerCustomAnimate = () => {
71
77
  AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn),
72
78
  AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut),
73
79
  AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut),
74
- AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut);
80
+ AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath),
81
+ AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
75
82
  };
83
+
84
+ export { ClipIn, ClipOut, FadeIn, FadeOut, GrowAngleIn, GrowAngleOut, GrowCenterIn, GrowCenterOut, GrowHeightIn, GrowHeightOut, GrowPointsIn, GrowPointsOut, GrowPointsXIn, GrowPointsXOut, GrowPointsYIn, GrowPointsYOut, GrowRadiusIn, GrowRadiusOut, GrowWidthIn, GrowWidthOut, IncreaseCount, PoptipAppear, PoptipDisappear, ScaleIn, ScaleOut, MoveIn, MoveOut, RotateIn, RotateOut, State, Update, MotionPath, LabelItemAppear, LabelItemDisappear, InputText, InputRichText, OutputRichText, SlideRichText, SlideOutRichText, SlideIn, GrowIn, SpinIn, MoveScaleIn, MoveRotateIn, SlideOut, GrowOut, SpinOut, MoveScaleOut, MoveRotateOut, GroupFadeIn, GroupFadeOut, FromTo, StreamLight };
76
85
  //# sourceMappingURL=register.js.map