@visactor/vrender-animate 1.0.8-alpha.2 → 1.0.8

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 (74) hide show
  1. package/cjs/animate-extension.d.ts +3 -0
  2. package/cjs/animate-extension.js +16 -4
  3. package/cjs/animate-extension.js.map +1 -1
  4. package/cjs/animate.js +4 -1
  5. package/cjs/animate.js.map +1 -1
  6. package/cjs/custom/custom-animate.js +1 -1
  7. package/cjs/custom/custom-animate.js.map +1 -1
  8. package/cjs/custom/fromTo.d.ts +1 -0
  9. package/cjs/custom/fromTo.js +3 -0
  10. package/cjs/custom/fromTo.js.map +1 -1
  11. package/cjs/custom/growCenter.js +2 -2
  12. package/cjs/custom/growCenter.js.map +1 -1
  13. package/cjs/custom/growHeight.js +2 -2
  14. package/cjs/custom/growHeight.js.map +1 -1
  15. package/cjs/custom/move.d.ts +4 -4
  16. package/cjs/custom/move.js +11 -10
  17. package/cjs/custom/move.js.map +1 -1
  18. package/cjs/custom/streamLight.js +4 -6
  19. package/cjs/custom/streamLight.js.map +1 -1
  20. package/cjs/executor/animate-executor.js +4 -3
  21. package/cjs/executor/animate-executor.js.map +1 -1
  22. package/cjs/index.d.ts +1 -0
  23. package/cjs/index.js +1 -1
  24. package/cjs/index.js.map +1 -1
  25. package/cjs/state/animation-state.d.ts +1 -0
  26. package/cjs/state/animation-state.js +8 -0
  27. package/cjs/state/animation-state.js.map +1 -1
  28. package/cjs/state/graphic-extension.d.ts +2 -1
  29. package/cjs/state/graphic-extension.js +12 -3
  30. package/cjs/state/graphic-extension.js.map +1 -1
  31. package/cjs/ticker/default-ticker.d.ts +2 -2
  32. package/cjs/ticker/default-ticker.js +9 -7
  33. package/cjs/ticker/default-ticker.js.map +1 -1
  34. package/cjs/timeline.d.ts +1 -0
  35. package/cjs/timeline.js +4 -2
  36. package/cjs/timeline.js.map +1 -1
  37. package/dist/index.es.js +115 -46
  38. package/es/animate-extension.d.ts +3 -0
  39. package/es/animate-extension.js +16 -4
  40. package/es/animate-extension.js.map +1 -1
  41. package/es/animate.js +4 -1
  42. package/es/animate.js.map +1 -1
  43. package/es/custom/custom-animate.js +1 -1
  44. package/es/custom/custom-animate.js.map +1 -1
  45. package/es/custom/fromTo.d.ts +1 -0
  46. package/es/custom/fromTo.js +3 -0
  47. package/es/custom/fromTo.js.map +1 -1
  48. package/es/custom/growCenter.js +2 -2
  49. package/es/custom/growCenter.js.map +1 -1
  50. package/es/custom/growHeight.js +2 -2
  51. package/es/custom/growHeight.js.map +1 -1
  52. package/es/custom/move.d.ts +4 -4
  53. package/es/custom/move.js +8 -8
  54. package/es/custom/move.js.map +1 -1
  55. package/es/custom/streamLight.js +4 -6
  56. package/es/custom/streamLight.js.map +1 -1
  57. package/es/executor/animate-executor.js +4 -3
  58. package/es/executor/animate-executor.js.map +1 -1
  59. package/es/index.d.ts +1 -0
  60. package/es/index.js +2 -0
  61. package/es/index.js.map +1 -1
  62. package/es/state/animation-state.d.ts +1 -0
  63. package/es/state/animation-state.js +8 -0
  64. package/es/state/animation-state.js.map +1 -1
  65. package/es/state/graphic-extension.d.ts +2 -1
  66. package/es/state/graphic-extension.js +12 -3
  67. package/es/state/graphic-extension.js.map +1 -1
  68. package/es/ticker/default-ticker.d.ts +2 -2
  69. package/es/ticker/default-ticker.js +9 -7
  70. package/es/ticker/default-ticker.js.map +1 -1
  71. package/es/timeline.d.ts +1 -0
  72. package/es/timeline.js +3 -2
  73. package/es/timeline.js.map +1 -1
  74. package/package.json +2 -2
@@ -19,4 +19,7 @@ export declare class AnimateExtension {
19
19
  executeAnimations(configs: IAnimationConfig[]): this;
20
20
  protected getFinalAttribute(): Record<string, any>;
21
21
  getGraphicAttribute(key: string, prev?: boolean): any;
22
+ pauseAnimation(deep?: boolean): void;
23
+ resumeAnimation(deep?: boolean): void;
24
+ stopAnimation(deep?: boolean): void;
22
25
  }
@@ -12,16 +12,13 @@ class AnimateExtension {
12
12
  }
13
13
  animate(params) {
14
14
  var _a, _b, _c;
15
- this.animates || (this.animates = new Map);
16
15
  const animate = new animate_1.Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : timeline_1.defaultTimeline, null == params ? void 0 : params.slience);
17
16
  if (animate.bind(this), params) {
18
17
  const {onStart: onStart, onEnd: onEnd, onRemove: onRemove} = params;
19
18
  null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd),
20
19
  null != onRemove && animate.onRemove(onRemove);
21
20
  }
22
- return this.animates.set(animate.id, animate), animate.onRemove((() => {
23
- animate.stop(), this.animates.delete(animate.id);
24
- })), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
21
+ return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
25
22
  }
26
23
  createTimeline() {
27
24
  return new timeline_1.DefaultTimeline;
@@ -52,6 +49,21 @@ class AnimateExtension {
52
49
  getGraphicAttribute(key, prev = !1) {
53
50
  return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
54
51
  }
52
+ pauseAnimation(deep = !1) {
53
+ this.animates && this.animates.forEach((animate => animate.pause())), deep && this.isContainer && this.forEachChildren((child => {
54
+ child.pauseAnimation(deep);
55
+ }));
56
+ }
57
+ resumeAnimation(deep = !1) {
58
+ this.animates && this.animates.forEach((animate => animate.resume())), deep && this.isContainer && this.forEachChildren((child => {
59
+ child.resumeAnimation(deep);
60
+ }));
61
+ }
62
+ stopAnimation(deep = !1) {
63
+ this.animates && this.animates.forEach((animate => animate.stop())), deep && this.isContainer && this.forEachChildren((child => {
64
+ child.stopAnimation(deep);
65
+ }));
66
+ }
55
67
  }
56
68
 
57
69
  exports.AnimateExtension = AnimateExtension;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/animate-extension.ts"],"names":[],"mappings":";;;AAQA,uCAAoC;AACpC,yCAA8D;AAC9D,4DAAwD;AAExD,kEAA8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CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;SACjC;QACD,OAAQ,IAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACF;AAtGD,4CAsGC","file":"animate-extension.js","sourcesContent":["// 1. 支持animate函数\n// 2. 支持animates map\n// 2. 支持animatedAttribute 为所有动画的最终结果(loop为INFINITY的动画不算)\n// 3. 支持finalAttribute 为所有动画的最终结果(animatedAttribute 合并了 graphic.attribute之后的最终结果)\n// 3. 重载Graphic的getAttributes方法,根据参数getAttributes(final = true)返回finalAttribute = {}; merge(finalAttribute, graphic.attribute, animatedAttribute),\n// animatedAttribute为所有动画的最终结果(loop为INFINITY的动画不算)\n\nimport type { IGraphicAnimateParams, IAnimate } from '@visactor/vrender-core';\nimport { Animate } from './animate';\nimport { DefaultTimeline, defaultTimeline } from './timeline';\nimport { DefaultTicker } from './ticker/default-ticker';\nimport type { IAnimationConfig } from './executor/executor';\nimport { AnimateExecutor } from './executor/animate-executor';\n\n// 基于性能考虑,每次调用animate函数,都会设置animatedAttribute为null,每次getAttributes(true)会根据animatedAttribute属性判断是否需要重新计算animatedAttribute。\nexport class AnimateExtension {\n declare finalAttribute: Record<string, any>;\n _animateExecutor: AnimateExecutor | null;\n\n declare animates: Map<string | number, IAnimate>;\n\n getAttributes(final: boolean = false) {\n if (final && this.finalAttribute) {\n return this.finalAttribute;\n }\n return (this as any).attribute;\n }\n\n animate(params?: IGraphicAnimateParams) {\n if (!this.animates) {\n this.animates = new Map();\n }\n const animate = new Animate(\n params?.id,\n params?.timeline ?? ((this as any).stage && (this as any).stage.getTimeline()) ?? defaultTimeline,\n params?.slience\n );\n\n animate.bind(this as any);\n if (params) {\n const { onStart, onEnd, onRemove } = params;\n onStart != null && animate.onStart(onStart);\n onEnd != null && animate.onEnd(onEnd);\n onRemove != null && animate.onRemove(onRemove);\n }\n this.animates.set(animate.id, animate);\n animate.onRemove(() => {\n animate.stop();\n this.animates.delete(animate.id);\n });\n\n // TODO 考虑性能问题\n (this as any).stage?.ticker.start();\n\n return animate;\n }\n\n createTimeline() {\n return new DefaultTimeline();\n }\n\n createTicker(stage: any) {\n return new DefaultTicker(stage);\n }\n\n setFinalAttributes(finalAttribute: Record<string, any>) {\n if (!this.finalAttribute) {\n this.finalAttribute = {};\n }\n Object.assign(this.finalAttribute, finalAttribute);\n }\n\n initFinalAttributes(finalAttribute: Record<string, any>) {\n this.finalAttribute = finalAttribute;\n }\n\n initAnimateExecutor(): void {\n if (!this._animateExecutor) {\n this._animateExecutor = new AnimateExecutor(this as any);\n }\n }\n\n /**\n * Apply animation configuration to the component\n * @param config Animation configuration\n * @returns This component instance\n */\n executeAnimation(config: IAnimationConfig): this {\n this.initAnimateExecutor();\n this._animateExecutor.execute(config);\n return this;\n }\n\n /**\n * Apply animations to multiple components\n * @param configs Animation configurations\n * @returns This component instance\n */\n executeAnimations(configs: IAnimationConfig[]): this {\n this.initAnimateExecutor();\n configs.forEach(config => {\n this._animateExecutor.execute(config);\n });\n return this;\n }\n\n protected getFinalAttribute() {\n return this.finalAttribute;\n }\n\n // TODO prev是兼容原本VGrammar函数的一个参数,用于动画中获取上一次属性,目前的逻辑中应该不需要,直接去当前帧的属性即可\n getGraphicAttribute(key: string, prev: boolean = false) {\n if (!prev && this.finalAttribute) {\n return this.finalAttribute[key];\n }\n return (this as any).attribute[key];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/animate-extension.ts"],"names":[],"mappings":";;;AAQA,uCAAoC;AACpC,yCAA8D;AAC9D,4DAAwD;AAExD,kEAA8D;AAG9D,MAAa,gBAAgB;IAM3B,aAAa,CAAC,QAAiB,KAAK;QAClC,IAAI,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE;YAChC,OAAO,IAAI,CAAC,cAAc,CAAC;SAC5B;QACD,OAAQ,IAAY,CAAC,SAAS,CAAC;IACjC,CAAC;IAED,OAAO,CAAC,MAA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I,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,IAAI,IAAI,IAAK,IAAY,CAAC,WAAW,EAAE;YACpC,IAAY,CAAC,eAAe,CAAC,CAAC,KAAU,EAAE,EAAE;gBAC3C,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,aAAa,CAAC,OAAgB,KAAK;QACjC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,IAAI,IAAI,IAAK,IAAY,CAAC,WAAW,EAAE;YACpC,IAAY,CAAC,eAAe,CAAC,CAAC,KAAU,EAAE,EAAE;gBAC3C,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AAzHD,4CAyHC","file":"animate-extension.js","sourcesContent":["// 1. 支持animate函数\n// 2. 支持animates map\n// 2. 支持animatedAttribute 为所有动画的最终结果(loop为INFINITY的动画不算)\n// 3. 支持finalAttribute 为所有动画的最终结果(animatedAttribute 合并了 graphic.attribute之后的最终结果)\n// 3. 重载Graphic的getAttributes方法,根据参数getAttributes(final = true)返回finalAttribute = {}; merge(finalAttribute, graphic.attribute, animatedAttribute),\n// animatedAttribute为所有动画的最终结果(loop为INFINITY的动画不算)\n\nimport type { IGraphicAnimateParams, IAnimate } from '@visactor/vrender-core';\nimport { Animate } from './animate';\nimport { DefaultTimeline, defaultTimeline } from './timeline';\nimport { DefaultTicker } from './ticker/default-ticker';\nimport type { IAnimationConfig } from './executor/executor';\nimport { AnimateExecutor } from './executor/animate-executor';\n\n// 基于性能考虑,每次调用animate函数,都会设置animatedAttribute为null,每次getAttributes(true)会根据animatedAttribute属性判断是否需要重新计算animatedAttribute。\nexport class AnimateExtension {\n declare finalAttribute: Record<string, any>;\n _animateExecutor: AnimateExecutor | null;\n\n declare animates: Map<string | number, IAnimate>;\n\n getAttributes(final: boolean = false) {\n if (final && this.finalAttribute) {\n return this.finalAttribute;\n }\n return (this as any).attribute;\n }\n\n animate(params?: IGraphicAnimateParams) {\n const animate = new Animate(\n params?.id,\n params?.timeline ?? ((this as any).stage && (this as any).stage.getTimeline()) ?? defaultTimeline,\n params?.slience\n );\n\n animate.bind(this as any);\n if (params) {\n const { onStart, onEnd, onRemove } = params;\n onStart != null && animate.onStart(onStart);\n onEnd != null && animate.onEnd(onEnd);\n onRemove != null && animate.onRemove(onRemove);\n }\n\n // TODO 考虑性能问题\n (this as any).stage?.ticker.start();\n\n return animate;\n }\n\n createTimeline() {\n return new DefaultTimeline();\n }\n\n createTicker(stage: any) {\n return new DefaultTicker(stage);\n }\n\n setFinalAttributes(finalAttribute: Record<string, any>) {\n if (!this.finalAttribute) {\n this.finalAttribute = {};\n }\n Object.assign(this.finalAttribute, finalAttribute);\n }\n\n initFinalAttributes(finalAttribute: Record<string, any>) {\n this.finalAttribute = finalAttribute;\n }\n\n initAnimateExecutor(): void {\n if (!this._animateExecutor) {\n this._animateExecutor = new AnimateExecutor(this as any);\n }\n }\n\n /**\n * Apply animation configuration to the component\n * @param config Animation configuration\n * @returns This component instance\n */\n executeAnimation(config: IAnimationConfig): this {\n this.initAnimateExecutor();\n this._animateExecutor.execute(config);\n return this;\n }\n\n /**\n * Apply animations to multiple components\n * @param configs Animation configurations\n * @returns This component instance\n */\n executeAnimations(configs: IAnimationConfig[]): this {\n this.initAnimateExecutor();\n configs.forEach(config => {\n this._animateExecutor.execute(config);\n });\n return this;\n }\n\n protected getFinalAttribute() {\n return this.finalAttribute;\n }\n\n // TODO prev是兼容原本VGrammar函数的一个参数,用于动画中获取上一次属性,目前的逻辑中应该不需要,直接去当前帧的属性即可\n getGraphicAttribute(key: string, prev: boolean = false) {\n if (!prev && this.finalAttribute) {\n return this.finalAttribute[key];\n }\n return (this as any).attribute[key];\n }\n\n pauseAnimation(deep: boolean = false) {\n this.animates && this.animates.forEach(animate => animate.pause());\n if (deep && (this as any).isContainer) {\n (this as any).forEachChildren((child: any) => {\n child.pauseAnimation(deep);\n });\n }\n }\n\n resumeAnimation(deep: boolean = false) {\n this.animates && this.animates.forEach(animate => animate.resume());\n if (deep && (this as any).isContainer) {\n (this as any).forEachChildren((child: any) => {\n child.resumeAnimation(deep);\n });\n }\n }\n\n stopAnimation(deep: boolean = false) {\n this.animates && this.animates.forEach(animate => animate.stop());\n if (deep && (this as any).isContainer) {\n (this as any).forEachChildren((child: any) => {\n child.stopAnimation(deep);\n });\n }\n }\n}\n"]}
package/cjs/animate.js CHANGED
@@ -31,7 +31,10 @@ class Animate {
31
31
  return this._timeline;
32
32
  }
33
33
  bind(target) {
34
- return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this),
34
+ return this.target = target, this.target.animates || (this.target.animates = new Map),
35
+ this.target.animates.set(this.id, this), this.onRemove((() => {
36
+ this.stop(), this.target.animates.delete(this.id);
37
+ })), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this),
35
38
  this.target.animationAttribute || (this.target.animationAttribute = {}), this;
36
39
  }
37
40
  to(props, duration = 300, easing = "linear") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/animate.ts"],"names":[],"mappings":";;;AAAA,iCAAwC;AACxC,yDAUgC;AAChC,yCAA6C;AAE7C,MAAa,OAAO;IA4ClB,YACE,KAAsB,wBAAS,CAAC,kBAAkB,EAAE,EACpD,WAAsB,0BAAe,EACrC,OAAiB;QAEjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,4BAAa,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,OA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,EAAE,EAAE,CAAC,CAAC;QAGpC,IAAI,KAAK,EAAE;YACT,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SAEzB;IAMH,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;YACnB,OAAO;SACR;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC9E,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAvrBD,0BAurBC","file":"animate.js","sourcesContent":["import { Step, WaitStep } from './step';\nimport {\n Generator,\n AnimateStatus,\n AnimateStepType,\n type IGraphic,\n type IAnimate,\n type IStep,\n type ICustomAnimate,\n type EasingType,\n type ITimeline\n} from '@visactor/vrender-core';\nimport { defaultTimeline } from './timeline';\n\nexport class Animate implements IAnimate {\n readonly id: string | number;\n status: AnimateStatus;\n target: IGraphic;\n\n // 回调函数列表\n _onStart?: (() => void)[];\n _onFrame?: ((step: IStep, ratio: number) => void)[];\n _onEnd?: (() => void)[];\n _onRemove?: (() => void)[];\n\n // 时间控制\n private _timeline: ITimeline;\n private _startTime: number;\n private _duration: number;\n private _totalDuration: number;\n\n // 动画控制\n // private _reversed: boolean;\n private _loopCount: number;\n private _currentLoop: number;\n private _bounce: boolean;\n\n // 链表头节点和尾节点\n private _firstStep: IStep | null;\n private _lastStep: IStep | null;\n\n // 初始属性和屏蔽的属性\n private _startProps: Record<string, any>;\n private _endProps: Record<string, any>;\n private _preventAttrs: Set<string>;\n // 优先级,用于判定是否能被后续的动画preventAttr\n declare priority: number;\n\n protected currentTime: number;\n slience?: boolean;\n\n // 临时变量\n lastRunStep?: IStep;\n\n interpolateUpdateFunction:\n | ((from: Record<string, any>, to: Record<string, any>, ratio: number, step: IStep, target: IGraphic) => void)\n | null;\n\n constructor(\n id: string | number = Generator.GenAutoIncrementId(),\n timeline: ITimeline = defaultTimeline,\n slience?: boolean\n ) {\n this.id = id;\n this.status = AnimateStatus.INITIAL;\n this._timeline = timeline;\n timeline.addAnimate(this);\n this.slience = slience;\n this._startTime = 0;\n this._duration = 0;\n this._totalDuration = 0;\n // this._reversed = false;\n this._loopCount = 0;\n this._currentLoop = 0;\n this._bounce = false;\n this._firstStep = null;\n this._lastStep = null;\n this._startProps = {};\n this._endProps = {};\n this._preventAttrs = new Set();\n this.currentTime = 0;\n this.interpolateUpdateFunction = null;\n this.priority = 0;\n }\n\n /**\n * 获取开始属性\n */\n getStartProps(): Record<string, any> {\n return this._startProps;\n }\n\n /**\n * 获取结束属性\n */\n getEndProps(): Record<string, any> {\n return this._endProps;\n }\n\n /**\n * 设置时间线\n */\n setTimeline(timeline: ITimeline): void {\n this._timeline = timeline;\n }\n\n /**\n * 获取时间线\n */\n getTimeline(): ITimeline {\n return this._timeline;\n }\n\n /**\n * 时间线属性访问器\n */\n get timeline(): ITimeline {\n return this._timeline;\n }\n\n /**\n * 绑定目标图形\n */\n bind(target: IGraphic): this {\n this.target = target;\n\n if (this.target.onAnimateBind && !this.slience) {\n this.target.onAnimateBind(this as any);\n }\n // 添加一个animationAttribute属性,用于存储动画过程中的属性\n if (!this.target.animationAttribute) {\n this.target.animationAttribute = {};\n }\n return this;\n }\n\n /**\n * 动画步骤:to\n * 添加一个to步骤,这会在当前状态到指定状态间进行插值\n */\n to(props: Record<string, any>, duration: number = 300, easing: EasingType = 'linear'): this {\n // 创建新的step\n const step = new Step(AnimateStepType.to, props, duration, easing);\n\n step.bind(this.target, this);\n\n this.updateStepAfterAppend(step);\n\n return this;\n }\n\n /**\n * 等待延迟\n */\n wait(delay: number): this {\n // 创建新的wait step\n const step = new WaitStep(AnimateStepType.wait, {}, delay, 'linear');\n\n step.bind(this.target, this);\n\n this.updateStepAfterAppend(step);\n\n return this;\n }\n\n protected updateStepAfterAppend(step: IStep): void {\n // 如果是第一个step\n if (!this._firstStep) {\n this._firstStep = step;\n this._lastStep = step;\n } else {\n // 添加到链表末尾\n this._lastStep.append(step);\n this._lastStep = step;\n }\n\n this.parseStepProps(step);\n\n this.updateDuration();\n }\n\n /**\n * 解析step的props\n * 1. 预先获取step的propKeys并保存\n * 2. 将截止目前的最新props设置到step.props中,这样该props上的属性就是最终的属性了,跳帧时直接设置即可\n * 3. 同步到_endProps中,保存这个Animate实例的最终props\n * 4. 给step的props的原型链上绑定Animate的_startProps,这样在下一个step查找fromProps的时候,一定能拿得到值\n */\n parseStepProps(step: IStep) {\n if (!this._lastStep) {\n return;\n }\n\n /* 预设置step的属性,基于性能考虑,实现比较复杂 */\n // step.propKeys为真实的props属性的key\n step.propKeys = step.propKeys || Object.keys(step.props);\n // step.props为包含前序step的props的最终props,用于跳帧等场景,可以直接设置\n Object.keys(this._endProps).forEach(key => {\n step.props[key] = step.props[key] ?? this._endProps[key];\n });\n // 将最终的props设置到step.props中\n step.propKeys.forEach(key => {\n this._endProps[key] = step.props[key];\n });\n // 给step的props的原型链上绑定Animate的_startProps\n // 下一个step在查找上一个step.props(也就是找到它的fromProps)的时候,就能拿到初始的props了\n // 比如:\n // rect.animate().to({ x: 100 }, 1000, 'linear').to({ y: 100 }, 1000, 'linear');\n // 在第二个step查找fromProps的时候,就能拿到第一个step的endProps中的y值(在原型链上)\n // TODO 由于会有其他animate的干扰,所以不能直接设置原型链\n // Object.setPrototypeOf(step.props, this._startProps);\n }\n\n /**\n * 重新同步和计算props,用于内部某些step发生了变更后,重新计算自身\n * 性能较差,不要频繁调用\n * @returns\n */\n reSyncProps() {\n if (!this._lastStep) {\n return;\n }\n this._endProps = {};\n let currentStep: IStep = this._firstStep;\n // 从前向后寻找当前时间所在的step\n while (currentStep) {\n // step.props为包含前序step的props的最终props,用于跳帧等场景,可以直接设置\n // eslint-disable-next-line no-loop-func\n Object.keys(this._endProps).forEach(key => {\n currentStep.props[key] = currentStep.props[key] ?? this._endProps[key];\n });\n // 将最终的props设置到step.props中\n // eslint-disable-next-line no-loop-func\n currentStep.propKeys.forEach(key => {\n this._endProps[key] = currentStep.props[key];\n });\n // 给step的props的原型链上绑定Animate的_startProps\n // 下一个step在查找上一个step.props(也就是找到它的fromProps)的时候,就能拿到初始的props了\n // 比如:\n // rect.animate().to({ x: 100 }, 1000, 'linear').to({ y: 100 }, 1000, 'linear');\n // 在第二个step查找fromProps的时候,就能拿到第一个step的endProps中的y值(在原型链上)\n // TODO 由于会有其他animate的干扰,所以不能直接设置原型链\n // Object.setPrototypeOf(currentStep.props, this._startProps);\n currentStep = currentStep.next;\n }\n }\n\n /**\n * 动画步骤:from\n * 添加一个from步骤,这会将目标属性先设置为指定值,然后过渡到当前状态\n * 【注意】这可能会导致动画跳变,请谨慎使用\n */\n from(props: Record<string, any>, duration: number = 300, easing: EasingType = 'linear'): this {\n // 创建新的step\n const step = new Step(AnimateStepType.from, props, duration, easing);\n\n // 如果是第一个step\n if (!this._firstStep) {\n this._firstStep = step;\n this._lastStep = step;\n } else {\n // 添加到链表末尾\n this._lastStep.append(step);\n this._lastStep = step;\n }\n\n this.updateDuration();\n\n return this;\n }\n\n /**\n * 自定义动画\n */\n play(customAnimate: ICustomAnimate): this {\n customAnimate.bind(this.target, this);\n this.updateStepAfterAppend(customAnimate);\n\n return this;\n }\n\n /**\n * 暂停动画\n */\n pause(): void {\n if (this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.PAUSED;\n }\n }\n\n /**\n * 恢复动画\n */\n resume(): void {\n if (this.status === AnimateStatus.PAUSED) {\n this.status = AnimateStatus.RUNNING;\n }\n }\n\n /**\n * 注册开始回调\n */\n onStart(cb?: () => void): void {\n if (cb) {\n if (!this._onStart) {\n this._onStart = [];\n }\n this._onStart.push(cb);\n } else {\n this._onStart?.forEach(cb => cb());\n // 设置开始属性,Animate不会重复执行start所以不需要判断firstStart\n Object.keys(this._endProps).forEach(key => {\n this._startProps[key] = this.target.getComputedAttribute(key);\n });\n }\n }\n\n /**\n * 注册结束回调\n */\n onEnd(cb?: () => void): void {\n if (cb) {\n if (!this._onEnd) {\n this._onEnd = [];\n }\n this._onEnd.push(cb);\n } else {\n this._onEnd?.forEach(cb => cb());\n }\n }\n\n /**\n * 注册帧回调\n */\n onFrame(cb?: (step: IStep, ratio: number) => void): void {\n if (cb) {\n if (!this._onFrame) {\n this._onFrame = [];\n }\n this._onFrame.push(cb);\n }\n }\n\n /**\n * 注册移除回调\n */\n onRemove(cb?: () => void): void {\n if (cb) {\n if (!this._onRemove) {\n this._onRemove = [];\n }\n this._onRemove.push(cb);\n } else {\n this._onRemove?.forEach(cb => cb());\n }\n }\n\n /**\n * 屏蔽单个属性\n */\n preventAttr(key: string): void {\n this._preventAttrs.add(key);\n // 从所有step中移除该属性,并从自身的_startProps和_endProps中移除该属性\n delete this._startProps[key];\n delete this._endProps[key];\n let step = this._firstStep;\n while (step) {\n step.deleteSelfAttr(key);\n step = step.next;\n }\n }\n\n /**\n * 屏蔽多个属性\n */\n preventAttrs(keys: string[]): void {\n keys.forEach(key => this._preventAttrs.add(key));\n }\n\n /**\n * 检查属性是否合法(未被屏蔽)\n */\n validAttr(key: string): boolean {\n return !this._preventAttrs.has(key);\n }\n\n /**\n * 运行自定义回调\n */\n runCb(cb: (a: IAnimate, step: IStep) => void): IAnimate {\n this._lastStep?.onEnd(cb);\n return this;\n }\n\n /**\n * 设置动画开始时间\n */\n startAt(t: number): this {\n this._startTime = t;\n\n return this;\n }\n\n /**\n * 自定义插值函数,返回false表示没有匹配上\n */\n customInterpolate(\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IGraphic,\n ret: Record<string, any>\n ): boolean {\n // 默认无自定义插值,可由子类重写\n return false;\n }\n\n /**\n * 获取起始值,该起始值为animate的起始值,并不一定为step的起始值\n */\n getFromValue(): Record<string, any> {\n return this._startProps;\n }\n\n /**\n * 获取结束值\n */\n getToValue(): Record<string, any> {\n return this._endProps;\n }\n\n /**\n * 停止动画\n */\n stop(type?: 'start' | 'end' | Record<string, any>): void {\n // TODO 有些动画可能一添加就被删除\n // if (this.status === AnimateStatus.END) {\n // return;\n // }\n // 遍历step,调用其stop\n let step = this._firstStep;\n while (step) {\n step.stop();\n step = step.next;\n }\n\n if (this.status !== AnimateStatus.END) {\n this.onEnd();\n }\n\n this.status = AnimateStatus.END;\n\n if (!this.target) {\n return;\n }\n\n if (type === 'start') {\n // 设置为开始状态\n this.target.setAttributes(this._startProps);\n } else if (type === 'end') {\n // 设置为结束状态\n this.target.setAttributes(this._endProps);\n } else if (type) {\n // 设置为自定义状态\n this.target.setAttributes(type);\n }\n }\n\n /**\n * 释放动画资源\n */\n release(): void {\n this.status = AnimateStatus.END;\n\n // 触发移除回调\n if (this._onRemove) {\n this._onRemove.forEach(cb => cb());\n }\n\n // 清空回调\n this._onStart = [];\n this._onFrame = [];\n this._onEnd = [];\n this._onRemove = [];\n }\n\n /**\n * 获取动画持续时间\n */\n getDuration(): number {\n return this._duration;\n }\n\n /**\n * 获取动画开始时间\n */\n getStartTime(): number {\n return this._startTime;\n }\n\n /**\n * 在所有动画完成后执行\n */\n afterAll(list: IAnimate[]): this {\n if (!list || list.length === 0) {\n return this;\n }\n\n // 计算所有动画结束的最大时间点\n let maxEndTime = 0;\n list.forEach(animate => {\n const endTime = animate.getStartTime() + animate.getTotalDuration();\n maxEndTime = Math.max(maxEndTime, endTime);\n });\n\n // 设置当前动画的开始时间为最大结束时间\n return this.startAt(maxEndTime);\n }\n\n /**\n * 在指定动画完成后执行\n */\n after(animate: IAnimate): this {\n if (!animate) {\n return this;\n }\n\n // 计算指定动画结束的时间点\n const endTime = animate.getStartTime() + animate.getTotalDuration();\n\n // 设置当前动画的开始时间为结束时间\n return this.startAt(endTime);\n }\n\n /**\n * 并行执行动画\n */\n parallel(animate: IAnimate): this {\n if (!animate) {\n return this;\n }\n\n // 设置指定动画的开始时间为当前动画的开始时间\n this.startAt(animate.getStartTime());\n\n return this;\n }\n\n // /**\n // * 设置动画是否反转\n // */\n // reversed(r: boolean): this {\n // this._reversed = r;\n // return this;\n // }\n\n /**\n * 设置动画循环次数,如果传入true,则无限循环,如果传入false,则不循环\n */\n loop(n: number | boolean): this {\n if (n === true) {\n n = Infinity;\n } else if (n === false) {\n n = 0;\n }\n this._loopCount = n;\n this.updateDuration();\n return this;\n }\n\n /**\n * 设置动画是否反弹\n */\n bounce(b: boolean): this {\n this._bounce = b;\n return this;\n }\n\n /**\n * 推进动画\n */\n advance(delta: number): void {\n if (this.status === AnimateStatus.END) {\n console.warn('aaa 动画已经结束,不能推进');\n return;\n }\n const nextTime = this.currentTime + delta;\n // 如果还没开始,直接return\n if (nextTime < this._startTime) {\n this.currentTime = nextTime;\n return;\n }\n // 如果已经结束,设置状态后return\n if (nextTime >= this._startTime + this._totalDuration) {\n this._lastStep?.onUpdate(true, 1, {});\n this._lastStep?.onEnd();\n this.onEnd();\n this.status = AnimateStatus.END;\n return;\n }\n\n this.status = AnimateStatus.RUNNING;\n\n // 如果是第一次运行,触发开始回调\n if (this.currentTime <= this._startTime) {\n this.onStart();\n }\n this.currentTime = nextTime;\n\n let cycleTime = nextTime - this._startTime;\n let newLoop = false;\n let bounceTime = false;\n if (this._loopCount > 0) {\n cycleTime = (nextTime - this._startTime) % this._duration;\n const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);\n newLoop = currentLoop > this._currentLoop;\n this._currentLoop = currentLoop;\n\n bounceTime = this._bounce && currentLoop % 2 === 1;\n if (bounceTime) {\n cycleTime = this._duration - cycleTime;\n }\n }\n\n // 如果是新的循环,重置为初始状态\n if (newLoop && !bounceTime) {\n this.target.setAttributes(this._startProps);\n }\n\n // 选择起始步骤和遍历方向\n let targetStep: IStep | null = null;\n\n if (this._lastStep === this._firstStep) {\n targetStep = this._firstStep;\n } else {\n let currentStep: IStep = this._firstStep;\n // 从前向后寻找当前时间所在的step\n while (currentStep) {\n const stepStartTime = currentStep.getStartTime();\n const stepDuration = currentStep.getDuration();\n const stepEndTime = stepStartTime + stepDuration;\n\n // 找到当前周期时间所在的step\n if (cycleTime >= stepStartTime && cycleTime <= stepEndTime) {\n targetStep = currentStep;\n break;\n }\n\n currentStep = currentStep.next;\n }\n }\n\n // 如果没找到目标step(可能是所有step都执行完了,但整体动画还没结束,这正常是不存在的)\n if (!targetStep) {\n // this.currentTime = nextTime;\n // console.warn('动画出现问题');\n return;\n }\n\n // 如果当前step和上一次执行的step不一样,则调用上一次step的onEnd,确保所有完成的step都调用了结束\n // 如果上一次的step已经调用了onEnd,在下面的onEnd那里会将lastRunStep设置为null\n if (targetStep !== this.lastRunStep) {\n this.lastRunStep?.onEnd();\n }\n\n this.lastRunStep = targetStep;\n\n // 计算当前step的进度比例(基于当前step内的相对时间)\n const stepStartTime = targetStep.getStartTime();\n const stepDuration = targetStep.getDuration();\n\n const ratio = (cycleTime - stepStartTime) / stepDuration;\n // // 限制ratio在0-1之间\n // ratio = Math.max(0, Math.min(1, ratio));\n\n const isEnd = ratio >= 1;\n targetStep.update(isEnd, ratio, {});\n\n // 如果step执行完毕\n if (isEnd) {\n targetStep.onEnd();\n this.lastRunStep = null;\n // 不立即调用onFinish,让动画系统来决定何时结束\n }\n\n // 触发帧回调\n // if (this._onFrame) {\n // this._onFrame.forEach(cb => cb(targetStep, ratio));\n // }\n }\n\n updateDuration(): void {\n if (!this._lastStep) {\n this._duration = 0;\n return;\n }\n\n this._duration = this._lastStep.getStartTime() + this._lastStep.getDuration();\n this._totalDuration = this._duration * (this._loopCount + 1);\n }\n\n getTotalDuration(): number {\n return this._totalDuration;\n }\n\n getLoop(): number {\n return this._loopCount;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/animate.ts"],"names":[],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GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAhsBD,0BAgsBC","file":"animate.js","sourcesContent":["import { Step, WaitStep } from './step';\nimport {\n Generator,\n AnimateStatus,\n AnimateStepType,\n type IGraphic,\n type IAnimate,\n type IStep,\n type ICustomAnimate,\n type EasingType,\n type ITimeline\n} from '@visactor/vrender-core';\nimport { defaultTimeline } from './timeline';\n\nexport class Animate implements IAnimate {\n readonly id: string | number;\n status: AnimateStatus;\n target: IGraphic;\n\n // 回调函数列表\n _onStart?: (() => void)[];\n _onFrame?: ((step: IStep, ratio: number) => void)[];\n _onEnd?: (() => void)[];\n _onRemove?: (() => void)[];\n\n // 时间控制\n private _timeline: ITimeline;\n private _startTime: number;\n private _duration: number;\n private _totalDuration: number;\n\n // 动画控制\n // private _reversed: boolean;\n private _loopCount: number;\n private _currentLoop: number;\n private _bounce: boolean;\n\n // 链表头节点和尾节点\n private _firstStep: IStep | null;\n private _lastStep: IStep | null;\n\n // 初始属性和屏蔽的属性\n private _startProps: Record<string, any>;\n private _endProps: Record<string, any>;\n private _preventAttrs: Set<string>;\n // 优先级,用于判定是否能被后续的动画preventAttr\n declare priority: number;\n\n protected currentTime: number;\n slience?: boolean;\n\n // 临时变量\n lastRunStep?: IStep;\n\n interpolateUpdateFunction:\n | ((from: Record<string, any>, to: Record<string, any>, ratio: number, step: IStep, target: IGraphic) => void)\n | null;\n\n constructor(\n id: string | number = Generator.GenAutoIncrementId(),\n timeline: ITimeline = defaultTimeline,\n slience?: boolean\n ) {\n this.id = id;\n this.status = AnimateStatus.INITIAL;\n this._timeline = timeline;\n timeline.addAnimate(this);\n this.slience = slience;\n this._startTime = 0;\n this._duration = 0;\n this._totalDuration = 0;\n // this._reversed = false;\n this._loopCount = 0;\n this._currentLoop = 0;\n this._bounce = false;\n this._firstStep = null;\n this._lastStep = null;\n this._startProps = {};\n this._endProps = {};\n this._preventAttrs = new Set();\n this.currentTime = 0;\n this.interpolateUpdateFunction = null;\n this.priority = 0;\n }\n\n /**\n * 获取开始属性\n */\n getStartProps(): Record<string, any> {\n return this._startProps;\n }\n\n /**\n * 获取结束属性\n */\n getEndProps(): Record<string, any> {\n return this._endProps;\n }\n\n /**\n * 设置时间线\n */\n setTimeline(timeline: ITimeline): void {\n this._timeline = timeline;\n }\n\n /**\n * 获取时间线\n */\n getTimeline(): ITimeline {\n return this._timeline;\n }\n\n /**\n * 时间线属性访问器\n */\n get timeline(): ITimeline {\n return this._timeline;\n }\n\n /**\n * 绑定目标图形\n */\n bind(target: IGraphic): this {\n this.target = target;\n\n if (!this.target.animates) {\n this.target.animates = new Map();\n }\n this.target.animates.set(this.id, this);\n this.onRemove(() => {\n this.stop();\n this.target.animates.delete(this.id);\n });\n\n if (this.target.onAnimateBind && !this.slience) {\n this.target.onAnimateBind(this as any);\n }\n // 添加一个animationAttribute属性,用于存储动画过程中的属性\n if (!this.target.animationAttribute) {\n this.target.animationAttribute = {};\n }\n return this;\n }\n\n /**\n * 动画步骤:to\n * 添加一个to步骤,这会在当前状态到指定状态间进行插值\n */\n to(props: Record<string, any>, duration: number = 300, easing: EasingType = 'linear'): this {\n // 创建新的step\n const step = new Step(AnimateStepType.to, props, duration, easing);\n\n step.bind(this.target, this);\n\n this.updateStepAfterAppend(step);\n\n return this;\n }\n\n /**\n * 等待延迟\n */\n wait(delay: number): this {\n // 创建新的wait step\n const step = new WaitStep(AnimateStepType.wait, {}, delay, 'linear');\n\n step.bind(this.target, this);\n\n this.updateStepAfterAppend(step);\n\n return this;\n }\n\n protected updateStepAfterAppend(step: IStep): void {\n // 如果是第一个step\n if (!this._firstStep) {\n this._firstStep = step;\n this._lastStep = step;\n } else {\n // 添加到链表末尾\n this._lastStep.append(step);\n this._lastStep = step;\n }\n\n this.parseStepProps(step);\n\n this.updateDuration();\n }\n\n /**\n * 解析step的props\n * 1. 预先获取step的propKeys并保存\n * 2. 将截止目前的最新props设置到step.props中,这样该props上的属性就是最终的属性了,跳帧时直接设置即可\n * 3. 同步到_endProps中,保存这个Animate实例的最终props\n * 4. 给step的props的原型链上绑定Animate的_startProps,这样在下一个step查找fromProps的时候,一定能拿得到值\n */\n parseStepProps(step: IStep) {\n if (!this._lastStep) {\n return;\n }\n\n /* 预设置step的属性,基于性能考虑,实现比较复杂 */\n // step.propKeys为真实的props属性的key\n step.propKeys = step.propKeys || Object.keys(step.props);\n // step.props为包含前序step的props的最终props,用于跳帧等场景,可以直接设置\n Object.keys(this._endProps).forEach(key => {\n step.props[key] = step.props[key] ?? this._endProps[key];\n });\n // 将最终的props设置到step.props中\n step.propKeys.forEach(key => {\n this._endProps[key] = step.props[key];\n });\n // 给step的props的原型链上绑定Animate的_startProps\n // 下一个step在查找上一个step.props(也就是找到它的fromProps)的时候,就能拿到初始的props了\n // 比如:\n // rect.animate().to({ x: 100 }, 1000, 'linear').to({ y: 100 }, 1000, 'linear');\n // 在第二个step查找fromProps的时候,就能拿到第一个step的endProps中的y值(在原型链上)\n // TODO 由于会有其他animate的干扰,所以不能直接设置原型链\n // Object.setPrototypeOf(step.props, this._startProps);\n }\n\n /**\n * 重新同步和计算props,用于内部某些step发生了变更后,重新计算自身\n * 性能较差,不要频繁调用\n * @returns\n */\n reSyncProps() {\n if (!this._lastStep) {\n return;\n }\n this._endProps = {};\n let currentStep: IStep = this._firstStep;\n // 从前向后寻找当前时间所在的step\n while (currentStep) {\n // step.props为包含前序step的props的最终props,用于跳帧等场景,可以直接设置\n // eslint-disable-next-line no-loop-func\n Object.keys(this._endProps).forEach(key => {\n currentStep.props[key] = currentStep.props[key] ?? this._endProps[key];\n });\n // 将最终的props设置到step.props中\n // eslint-disable-next-line no-loop-func\n currentStep.propKeys.forEach(key => {\n this._endProps[key] = currentStep.props[key];\n });\n // 给step的props的原型链上绑定Animate的_startProps\n // 下一个step在查找上一个step.props(也就是找到它的fromProps)的时候,就能拿到初始的props了\n // 比如:\n // rect.animate().to({ x: 100 }, 1000, 'linear').to({ y: 100 }, 1000, 'linear');\n // 在第二个step查找fromProps的时候,就能拿到第一个step的endProps中的y值(在原型链上)\n // TODO 由于会有其他animate的干扰,所以不能直接设置原型链\n // Object.setPrototypeOf(currentStep.props, this._startProps);\n currentStep = currentStep.next;\n }\n }\n\n /**\n * 动画步骤:from\n * 添加一个from步骤,这会将目标属性先设置为指定值,然后过渡到当前状态\n * 【注意】这可能会导致动画跳变,请谨慎使用\n */\n from(props: Record<string, any>, duration: number = 300, easing: EasingType = 'linear'): this {\n // 创建新的step\n const step = new Step(AnimateStepType.from, props, duration, easing);\n\n // 如果是第一个step\n if (!this._firstStep) {\n this._firstStep = step;\n this._lastStep = step;\n } else {\n // 添加到链表末尾\n this._lastStep.append(step);\n this._lastStep = step;\n }\n\n this.updateDuration();\n\n return this;\n }\n\n /**\n * 自定义动画\n */\n play(customAnimate: ICustomAnimate): this {\n customAnimate.bind(this.target, this);\n this.updateStepAfterAppend(customAnimate);\n\n return this;\n }\n\n /**\n * 暂停动画\n */\n pause(): void {\n if (this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.PAUSED;\n }\n }\n\n /**\n * 恢复动画\n */\n resume(): void {\n if (this.status === AnimateStatus.PAUSED) {\n this.status = AnimateStatus.RUNNING;\n }\n }\n\n /**\n * 注册开始回调\n */\n onStart(cb?: () => void): void {\n if (cb) {\n if (!this._onStart) {\n this._onStart = [];\n }\n this._onStart.push(cb);\n } else {\n this._onStart?.forEach(cb => cb());\n // 设置开始属性,Animate不会重复执行start所以不需要判断firstStart\n Object.keys(this._endProps).forEach(key => {\n this._startProps[key] = this.target.getComputedAttribute(key);\n });\n }\n }\n\n /**\n * 注册结束回调\n */\n onEnd(cb?: () => void): void {\n if (cb) {\n if (!this._onEnd) {\n this._onEnd = [];\n }\n this._onEnd.push(cb);\n } else {\n this._onEnd?.forEach(cb => cb());\n }\n }\n\n /**\n * 注册帧回调\n */\n onFrame(cb?: (step: IStep, ratio: number) => void): void {\n if (cb) {\n if (!this._onFrame) {\n this._onFrame = [];\n }\n this._onFrame.push(cb);\n }\n }\n\n /**\n * 注册移除回调\n */\n onRemove(cb?: () => void): void {\n if (cb) {\n if (!this._onRemove) {\n this._onRemove = [];\n }\n this._onRemove.push(cb);\n } else {\n this._onRemove?.forEach(cb => cb());\n }\n }\n\n /**\n * 屏蔽单个属性\n */\n preventAttr(key: string): void {\n this._preventAttrs.add(key);\n // 从所有step中移除该属性,并从自身的_startProps和_endProps中移除该属性\n delete this._startProps[key];\n delete this._endProps[key];\n let step = this._firstStep;\n while (step) {\n step.deleteSelfAttr(key);\n step = step.next;\n }\n }\n\n /**\n * 屏蔽多个属性\n */\n preventAttrs(keys: string[]): void {\n keys.forEach(key => this._preventAttrs.add(key));\n }\n\n /**\n * 检查属性是否合法(未被屏蔽)\n */\n validAttr(key: string): boolean {\n return !this._preventAttrs.has(key);\n }\n\n /**\n * 运行自定义回调\n */\n runCb(cb: (a: IAnimate, step: IStep) => void): IAnimate {\n this._lastStep?.onEnd(cb);\n return this;\n }\n\n /**\n * 设置动画开始时间\n */\n startAt(t: number): this {\n this._startTime = t;\n\n return this;\n }\n\n /**\n * 自定义插值函数,返回false表示没有匹配上\n */\n customInterpolate(\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IGraphic,\n ret: Record<string, any>\n ): boolean {\n // 默认无自定义插值,可由子类重写\n return false;\n }\n\n /**\n * 获取起始值,该起始值为animate的起始值,并不一定为step的起始值\n */\n getFromValue(): Record<string, any> {\n return this._startProps;\n }\n\n /**\n * 获取结束值\n */\n getToValue(): Record<string, any> {\n return this._endProps;\n }\n\n /**\n * 停止动画\n */\n stop(type?: 'start' | 'end' | Record<string, any>): void {\n // TODO 有些动画可能一添加就被删除\n // if (this.status === AnimateStatus.END) {\n // return;\n // }\n // 遍历step,调用其stop\n let step = this._firstStep;\n while (step) {\n step.stop();\n step = step.next;\n }\n\n if (this.status !== AnimateStatus.END) {\n this.onEnd();\n }\n\n this.status = AnimateStatus.END;\n\n if (!this.target) {\n return;\n }\n\n if (type === 'start') {\n // 设置为开始状态\n this.target.setAttributes(this._startProps);\n } else if (type === 'end') {\n // 设置为结束状态\n this.target.setAttributes(this._endProps);\n } else if (type) {\n // 设置为自定义状态\n this.target.setAttributes(type);\n }\n }\n\n /**\n * 释放动画资源\n */\n release(): void {\n this.status = AnimateStatus.END;\n\n // 触发移除回调\n if (this._onRemove) {\n this._onRemove.forEach(cb => cb());\n }\n\n // 清空回调\n this._onStart = [];\n this._onFrame = [];\n this._onEnd = [];\n this._onRemove = [];\n }\n\n /**\n * 获取动画持续时间\n */\n getDuration(): number {\n return this._duration;\n }\n\n /**\n * 获取动画开始时间\n */\n getStartTime(): number {\n return this._startTime;\n }\n\n /**\n * 在所有动画完成后执行\n */\n afterAll(list: IAnimate[]): this {\n if (!list || list.length === 0) {\n return this;\n }\n\n // 计算所有动画结束的最大时间点\n let maxEndTime = 0;\n list.forEach(animate => {\n const endTime = animate.getStartTime() + animate.getTotalDuration();\n maxEndTime = Math.max(maxEndTime, endTime);\n });\n\n // 设置当前动画的开始时间为最大结束时间\n return this.startAt(maxEndTime);\n }\n\n /**\n * 在指定动画完成后执行\n */\n after(animate: IAnimate): this {\n if (!animate) {\n return this;\n }\n\n // 计算指定动画结束的时间点\n const endTime = animate.getStartTime() + animate.getTotalDuration();\n\n // 设置当前动画的开始时间为结束时间\n return this.startAt(endTime);\n }\n\n /**\n * 并行执行动画\n */\n parallel(animate: IAnimate): this {\n if (!animate) {\n return this;\n }\n\n // 设置指定动画的开始时间为当前动画的开始时间\n this.startAt(animate.getStartTime());\n\n return this;\n }\n\n // /**\n // * 设置动画是否反转\n // */\n // reversed(r: boolean): this {\n // this._reversed = r;\n // return this;\n // }\n\n /**\n * 设置动画循环次数,如果传入true,则无限循环,如果传入false,则不循环\n */\n loop(n: number | boolean): this {\n if (n === true) {\n n = Infinity;\n } else if (n === false) {\n n = 0;\n }\n this._loopCount = n;\n this.updateDuration();\n return this;\n }\n\n /**\n * 设置动画是否反弹\n */\n bounce(b: boolean): this {\n this._bounce = b;\n return this;\n }\n\n /**\n * 推进动画\n */\n advance(delta: number): void {\n if (this.status === AnimateStatus.END) {\n console.warn('aaa 动画已经结束,不能推进');\n return;\n }\n const nextTime = this.currentTime + delta;\n // 如果还没开始,直接return\n if (nextTime < this._startTime) {\n this.currentTime = nextTime;\n return;\n }\n // 如果已经结束,设置状态后return\n if (nextTime >= this._startTime + this._totalDuration) {\n this._lastStep?.onUpdate(true, 1, {});\n this._lastStep?.onEnd();\n this.onEnd();\n this.status = AnimateStatus.END;\n return;\n }\n\n this.status = AnimateStatus.RUNNING;\n\n // 如果是第一次运行,触发开始回调\n if (this.currentTime <= this._startTime) {\n this.onStart();\n }\n this.currentTime = nextTime;\n\n let cycleTime = nextTime - this._startTime;\n let newLoop = false;\n let bounceTime = false;\n if (this._loopCount > 0) {\n cycleTime = (nextTime - this._startTime) % this._duration;\n const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);\n newLoop = currentLoop > this._currentLoop;\n this._currentLoop = currentLoop;\n\n bounceTime = this._bounce && currentLoop % 2 === 1;\n if (bounceTime) {\n cycleTime = this._duration - cycleTime;\n }\n }\n\n // 如果是新的循环,重置为初始状态\n if (newLoop && !bounceTime) {\n this.target.setAttributes(this._startProps);\n }\n\n // 选择起始步骤和遍历方向\n let targetStep: IStep | null = null;\n\n if (this._lastStep === this._firstStep) {\n targetStep = this._firstStep;\n } else {\n let currentStep: IStep = this._firstStep;\n // 从前向后寻找当前时间所在的step\n while (currentStep) {\n const stepStartTime = currentStep.getStartTime();\n const stepDuration = currentStep.getDuration();\n const stepEndTime = stepStartTime + stepDuration;\n\n // 找到当前周期时间所在的step\n if (cycleTime >= stepStartTime && cycleTime <= stepEndTime) {\n targetStep = currentStep;\n break;\n }\n\n currentStep = currentStep.next;\n }\n }\n\n // 如果没找到目标step(可能是所有step都执行完了,但整体动画还没结束,这正常是不存在的)\n if (!targetStep) {\n // this.currentTime = nextTime;\n // console.warn('动画出现问题');\n return;\n }\n\n // 如果当前step和上一次执行的step不一样,则调用上一次step的onEnd,确保所有完成的step都调用了结束\n // 如果上一次的step已经调用了onEnd,在下面的onEnd那里会将lastRunStep设置为null\n if (targetStep !== this.lastRunStep) {\n this.lastRunStep?.onEnd();\n }\n\n this.lastRunStep = targetStep;\n\n // 计算当前step的进度比例(基于当前step内的相对时间)\n const stepStartTime = targetStep.getStartTime();\n const stepDuration = targetStep.getDuration();\n\n const ratio = (cycleTime - stepStartTime) / stepDuration;\n // // 限制ratio在0-1之间\n // ratio = Math.max(0, Math.min(1, ratio));\n\n const isEnd = ratio >= 1;\n targetStep.update(isEnd, ratio, {});\n\n // 如果step执行完毕\n if (isEnd) {\n targetStep.onEnd();\n this.lastRunStep = null;\n // 不立即调用onFinish,让动画系统来决定何时结束\n }\n\n // 触发帧回调\n // if (this._onFrame) {\n // this._onFrame.forEach(cb => cb(targetStep, ratio));\n // }\n }\n\n updateDuration(): void {\n if (!this._lastStep) {\n this._duration = 0;\n return;\n }\n\n this._duration = this._lastStep.getStartTime() + this._lastStep.getDuration();\n this._totalDuration = this._duration * (this._loopCount + 1);\n }\n\n getTotalDuration(): number {\n return this._totalDuration;\n }\n\n getLoop(): number {\n return this._loopCount;\n }\n}\n"]}
@@ -9,7 +9,7 @@ const step_1 = require("../step");
9
9
  class ACustomAnimate extends step_1.Step {
10
10
  constructor(customFrom, customTo, duration, easing, params) {
11
11
  super("customAnimate", customTo, duration, easing), this.type = "customAnimate",
12
- this.customFrom = customFrom, this.params = params;
12
+ this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
13
13
  }
14
14
  update(end, ratio, out) {
15
15
  if (this.onStart(), !this.props || !this.propKeys) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/custom-animate.ts"],"names":[],"mappings":";;;AAEA,kCAA+B;AAE/B,MAAsB,cAAkB,SA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ACF;AAZD,8CAYC","file":"custom-animate.js","sourcesContent":["import type { ComponentAnimator } from '../component';\nimport type { EasingType, IAnimateStepType, ICustomAnimate } from '@visactor/vrender-core';\nimport { Step } from '../step';\n\nexport abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {\n type: IAnimateStepType = 'customAnimate';\n declare customFrom: T;\n declare params?: any;\n declare props?: T;\n declare from?: T;\n declare to?: T;\n\n // 为了兼容旧的api,from和to是可选的,且尽量不需要From,因为为了避免突变,From都应该从当前位置开始\n // 所以From并不会真正设置到fromProps中,而是作为customFrom参数\n constructor(customFrom: T, customTo: T, duration: number, easing: EasingType, params?: any) {\n super('customAnimate', customTo, duration, easing);\n this.customFrom = customFrom;\n this.params = params;\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n\n protected setProps(props: T) {\n this.props = props;\n this.propKeys = Object.keys(props);\n this.animate.reSyncProps();\n }\n}\n\nexport abstract class AComponentAnimate<T> extends ACustomAnimate<T> {\n protected _animator: ComponentAnimator;\n\n completeBind(animator: ComponentAnimator): void {\n this.setStartTime(0);\n this._animator && this._animator.start();\n this.setDuration(animator.getDuration());\n }\n\n stop(): void {\n this._animator && this._animator.stop();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/custom-animate.ts"],"names":[],"mappings":";;;AAEA,kCAA+B;AAE/B,MAAsB,cAAkB,SAAQ,WAAI;IAUlD,YAAY,UAAa,EAAE,QAAW,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QACxF,KAAK,CAAC,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAVrD,SAAI,GAAqB,eAAe,CAAC;QAWvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAE1D,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO;SACR;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAES,QAAQ,CAAC,KAAQ;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;CACF;AAnCD,wCAmCC;AAED,MAAsB,iBAAqB,SAAQ,cAAiB;IAGlE,YAAY,CAAC,QAA2B;QACtC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI;QACF,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;AAZD,8CAYC","file":"custom-animate.js","sourcesContent":["import type { ComponentAnimator } from '../component';\nimport type { EasingType, IAnimateStepType, ICustomAnimate } from '@visactor/vrender-core';\nimport { Step } from '../step';\n\nexport abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {\n type: IAnimateStepType = 'customAnimate';\n declare customFrom: T;\n declare params?: any;\n declare props?: T;\n declare from?: T;\n declare to?: T;\n\n // 为了兼容旧的api,from和to是可选的,且尽量不需要From,因为为了避免突变,From都应该从当前位置开始\n // 所以From并不会真正设置到fromProps中,而是作为customFrom参数\n constructor(customFrom: T, customTo: T, duration: number, easing: EasingType, params?: any) {\n super('customAnimate', customTo, duration, easing);\n this.customFrom = customFrom;\n this.params = params;\n this.from = customFrom;\n this.to = customTo;\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n\n protected setProps(props: T) {\n this.props = props;\n this.propKeys = Object.keys(props);\n this.animate.reSyncProps();\n }\n}\n\nexport abstract class AComponentAnimate<T> extends ACustomAnimate<T> {\n protected _animator: ComponentAnimator;\n\n completeBind(animator: ComponentAnimator): void {\n this.setStartTime(0);\n this._animator && this._animator.start();\n this.setDuration(animator.getDuration());\n }\n\n stop(): void {\n this._animator && this._animator.stop();\n }\n}\n"]}
@@ -6,5 +6,6 @@ export declare class FromTo extends ACustomAnimate<Record<string, number>> {
6
6
  constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
7
7
  onBind(): void;
8
8
  onFirstRun(): void;
9
+ deleteSelfAttr(key: string): void;
9
10
  update(end: boolean, ratio: number, out: Record<string, any>): void;
10
11
  }
@@ -27,6 +27,9 @@ class FromTo extends custom_animate_1.ACustomAnimate {
27
27
  this.from[key] = null !== (_a = this.from[key]) && void 0 !== _a ? _a : startProps[key];
28
28
  })), this.target.setAttributes(this.from);
29
29
  }
30
+ deleteSelfAttr(key) {
31
+ super.deleteSelfAttr(key), delete this.from[key];
32
+ }
30
33
  update(end, ratio, out) {
31
34
  if (this.onStart(), !this.props || !this.propKeys) return;
32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AAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF;AA7ED,wBA6EC","file":"fromTo.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class FromTo extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n keys: string[];\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n this.from = from ?? {};\n }\n\n onBind(): void {\n super.onBind();\n\n // 如果存在from,不存在to,那么需要设置给props\n Object.keys(this.from).forEach(key => {\n if (this.props[key] == null) {\n this.props[key] = this.target.getGraphicAttribute(key);\n }\n });\n\n const finalAttribute = this.target.getFinalAttribute();\n // 如果入场动画,那么需要设置属性\n if (this.target.context?.animationState === 'appear') {\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n }\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(this.from);\n }\n }\n\n onFirstRun(): void {\n // 获取上一步的属性值作为起始值\n this.from = { ...this.getLastProps(), ...this.from };\n const startProps = this.animate.getStartProps();\n this.propKeys &&\n this.propKeys.forEach(key => {\n this.from[key] = this.from[key] ?? startProps[key];\n });\n // TODO:比较hack\n // 如果是入场动画,那么还需要设置属性\n // if (this.target.context?.animationState === 'appear') {\n // // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n // const finalAttribute = this.target.getFinalAttribute();\n // this.target.setAttributes(finalAttribute);\n // }\n this.target.setAttributes(this.from);\n }\n\n /**\n * 更新执行的时候调用\n * 如果跳帧了就不一定会执行\n */\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.animate.interpolateUpdateFunction\n ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target)\n : this.interpolateUpdateFunctions.forEach((func, index) => {\n // 如果这个属性被屏蔽了,直接跳过\n if (!this.animate.validAttr(this.propKeys[index])) {\n return;\n }\n const key = this.propKeys[index];\n const fromValue = this.from[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/custom/fromTo.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAElD,MAAa,MAAO,SAAQ,+BAAsC;IAKhE,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QAClF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IACzB,CAAC;IAED,MAAM;;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QAGf,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACnC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;aACxD;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAEvD,IAAI,CAAA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C,OAAO,CAAC,yBAAyB;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAC9F,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;oBACjD,OAAO;iBACR;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF;AAlFD,wBAkFC","file":"fromTo.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class FromTo extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n keys: string[];\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n this.from = from ?? {};\n }\n\n onBind(): void {\n super.onBind();\n\n // 如果存在from,不存在to,那么需要设置给props\n Object.keys(this.from).forEach(key => {\n if (this.props[key] == null) {\n this.props[key] = this.target.getGraphicAttribute(key);\n }\n });\n\n const finalAttribute = this.target.getFinalAttribute();\n // 如果入场动画,那么需要设置属性\n if (this.target.context?.animationState === 'appear') {\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n }\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(this.from);\n }\n }\n\n onFirstRun(): void {\n // 获取上一步的属性值作为起始值\n this.from = { ...this.getLastProps(), ...this.from };\n const startProps = this.animate.getStartProps();\n this.propKeys &&\n this.propKeys.forEach(key => {\n this.from[key] = this.from[key] ?? startProps[key];\n });\n // TODO:比较hack\n // 如果是入场动画,那么还需要设置属性\n // if (this.target.context?.animationState === 'appear') {\n // // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n // const finalAttribute = this.target.getFinalAttribute();\n // this.target.setAttributes(finalAttribute);\n // }\n this.target.setAttributes(this.from);\n }\n\n deleteSelfAttr(key: string): void {\n super.deleteSelfAttr(key);\n delete this.from[key];\n }\n\n /**\n * 更新执行的时候调用\n * 如果跳帧了就不一定会执行\n */\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.animate.interpolateUpdateFunction\n ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target)\n : this.interpolateUpdateFunctions.forEach((func, index) => {\n // 如果这个属性被屏蔽了,直接跳过\n if (!this.animate.validAttr(this.propKeys[index])) {\n return;\n }\n const key = this.propKeys[index];\n const fromValue = this.from[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n}\n"]}
@@ -121,13 +121,13 @@ class GrowCenterIn extends custom_animate_1.ACustomAnimate {
121
121
  super(from, to, duration, easing, params);
122
122
  }
123
123
  onBind() {
124
- var _a, _b;
124
+ var _a, _b, _c;
125
125
  super.onBind();
126
126
  const {from: from, to: to} = growCenterIn(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;
127
127
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
128
128
  this.from = fromAttrs, this.to = to;
129
129
  const finalAttribute = this.target.getFinalAttribute();
130
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
130
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
131
131
  }
132
132
  onEnd(cb) {
133
133
  super.onEnd(cb);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/growCenter.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAC3C,qDAAkD;AAuBlD,MAAM,YAAY,GAA4B,CAC5C,OAAiB,EACjB,OAAuC,EACvC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,QAAQ,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE;QAC1B,KAAK,GAAG,CAAC,CAAC;YACR,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAE1B,OAAO;gBACL,IAAI,EAAE,IAAA,gBAAO,EAAC,KAAK,CAAC;oBAClB,CAAC,CAAC;wBACE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC;wBAChB,EAAE,EAAE,SAAS;wBACb,KAAK,EAAE,CAAC;qBACT;oBACH,CAAC,CAAC;wBACE,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC;wBACf,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC;wBAChB,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G,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;AA9BD,sCA8BC","file":"growCenter.js","sourcesContent":["import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';\nimport { 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\nconst growCenterIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n from: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n },\n to: { x, x1, width }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n from: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n },\n to: { y, y1, height }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n const from: any = {};\n\n if (isValid(width)) {\n from.x = x + width / 2;\n from.width = 0;\n from.x1 = undefined;\n } else {\n from.x = (x + x1) / 2;\n from.x1 = (x + x1) / 2;\n from.width = undefined;\n }\n\n if (isValid(height)) {\n from.y = y + height / 2;\n from.height = 0;\n from.y1 = undefined;\n } else {\n from.y = (y + y1) / 2;\n from.y1 = (y + y1) / 2;\n from.height = undefined;\n }\n\n return {\n from,\n to: { x, y, x1, y1, width, height }\n };\n }\n }\n};\n\nconst growCenterOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.attribute as any;\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n to: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n to: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const y = attrs.y;\n const x1 = attrs.x1;\n const y1 = attrs.y1;\n const width = attrs.width;\n const height = attrs.height;\n const to: any = {};\n\n if (isValid(width)) {\n to.x = x + width / 2;\n to.width = 0;\n to.x1 = undefined;\n } else {\n to.x = (x + x1) / 2;\n to.x1 = (x + x1) / 2;\n to.width = undefined;\n }\n\n if (isValid(height)) {\n to.y = y + height / 2;\n to.height = 0;\n to.y1 = undefined;\n } else {\n to.y = (y + y1) / 2;\n to.y1 = (y + y1) / 2;\n to.height = undefined;\n }\n\n return {\n to\n };\n }\n }\n};\n\n/**\n * 增长渐入\n */\nexport class GrowCenterIn 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 } = growCenterIn(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 this.target.setAttributes(finalAttribute);\n }\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 GrowCenterOut 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 } = growCenterOut(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 = 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/growCenter.ts"],"names":[],"mappings":";;;AACA,6CAA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AI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClF,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,aAAJ,IAAI,cAAJ,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC;QACnD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;IAED,KAAK,CAAC,EAA6C;QACjD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,MAAM,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;AA9BD,sCA8BC","file":"growCenter.js","sourcesContent":["import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';\nimport { 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\nconst growCenterIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n from: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n },\n to: { x, x1, width }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n from: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n },\n to: { y, y1, height }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n const from: any = {};\n\n if (isValid(width)) {\n from.x = x + width / 2;\n from.width = 0;\n from.x1 = undefined;\n } else {\n from.x = (x + x1) / 2;\n from.x1 = (x + x1) / 2;\n from.width = undefined;\n }\n\n if (isValid(height)) {\n from.y = y + height / 2;\n from.height = 0;\n from.y1 = undefined;\n } else {\n from.y = (y + y1) / 2;\n from.y1 = (y + y1) / 2;\n from.height = undefined;\n }\n\n return {\n from,\n to: { x, y, x1, y1, width, height }\n };\n }\n }\n};\n\nconst growCenterOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.attribute as any;\n switch (options?.direction) {\n case 'x': {\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n return {\n to: isValid(width)\n ? {\n x: x + width / 2,\n x1: undefined,\n width: 0\n }\n : {\n x: (x + x1) / 2,\n x1: (x + x1) / 2,\n width: undefined\n }\n };\n }\n case 'y': {\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n return {\n to: isValid(height)\n ? {\n y: y + height / 2,\n y1: undefined,\n height: 0\n }\n : {\n y: (y + y1) / 2,\n y1: (y + y1) / 2,\n height: undefined\n }\n };\n }\n case 'xy':\n default: {\n const x = attrs.x;\n const y = attrs.y;\n const x1 = attrs.x1;\n const y1 = attrs.y1;\n const width = attrs.width;\n const height = attrs.height;\n const to: any = {};\n\n if (isValid(width)) {\n to.x = x + width / 2;\n to.width = 0;\n to.x1 = undefined;\n } else {\n to.x = (x + x1) / 2;\n to.x1 = (x + x1) / 2;\n to.width = undefined;\n }\n\n if (isValid(height)) {\n to.y = y + height / 2;\n to.height = 0;\n to.y1 = undefined;\n } else {\n to.y = (y + y1) / 2;\n to.y1 = (y + y1) / 2;\n to.height = undefined;\n }\n\n return {\n to\n };\n }\n }\n};\n\n/**\n * 增长渐入\n */\nexport class GrowCenterIn 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 } = growCenterIn(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 this.target.setAttributes(finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(fromAttrs);\n }\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 GrowCenterOut 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 } = growCenterOut(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 = 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"]}
@@ -69,13 +69,13 @@ class GrowHeightIn extends custom_animate_1.ACustomAnimate {
69
69
  super(from, to, duration, easing, params);
70
70
  }
71
71
  onBind() {
72
- var _a, _b;
72
+ var _a, _b, _c;
73
73
  super.onBind();
74
74
  const {from: from, to: to} = growHeightIn(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;
75
75
  this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
76
76
  this.from = fromAttrs, this.to = to;
77
77
  const finalAttribute = this.target.getFinalAttribute();
78
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
78
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
79
79
  }
80
80
  onEnd(cb) {
81
81
  super.onEnd(cb);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/custom/growHeight.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAC5D,qDAAkD;AAwBlD,SAAS,sBAAsB,CAC7B,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,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAE5B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAA,gBAAO,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/E,OAAO;YACL,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACtG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;SACrC,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,C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AC,EAA6C;QACjD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,MAAM,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;AA7BD,sCA6BC","file":"growHeight.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 layoutRect?: { width: number; height: number };\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 growHeightInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n return {\n from: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n from: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nfunction growHeightInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\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 =\n (animationParameters as any).groupHeight ??\n options.layoutRect?.height ??\n animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n from: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nconst growHeightIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightInOverall(graphic, options, animationParameters)\n : growHeightInIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowHeightIn 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 } = growHeightIn(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 this.target.setAttributes(finalAttribute);\n }\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\nfunction growHeightOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n\n return {\n to: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n to: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 }\n };\n}\n\nfunction growHeightOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y1 = attrs.y1;\n const height = attrs.height;\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 =\n (animationParameters as any).groupHeight ??\n options.layoutRect?.height ??\n animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 }\n };\n}\n\n/**\n * 增长渐出\n */\nexport const growHeightOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightOutOverall(graphic, options, animationParameters)\n : growHeightOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowHeightOut 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 } = growHeightOut(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/growHeight.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAC5D,qDAAkD;AAwBlD,SAAS,sBAAsB,CAC7B,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,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAE5B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAA,gBAAO,E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,MAAM,CAAC,0BAA0B,EAAE,CAAC;IAC3C,CAAC;CACF;AA7BD,sCA6BC","file":"growHeight.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 layoutRect?: { width: number; height: number };\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 growHeightInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n return {\n from: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n from: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nfunction growHeightInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\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 =\n (animationParameters as any).groupHeight ??\n options.layoutRect?.height ??\n animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n from: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 },\n to: { y: y, y1: y1, height: height }\n };\n}\n\nconst growHeightIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightInOverall(graphic, options, animationParameters)\n : growHeightInIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowHeightIn 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 } = growHeightIn(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 this.target.setAttributes(finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(fromAttrs);\n }\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\nfunction growHeightOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y = attrs.y;\n const y1 = attrs.y1;\n const height = attrs.height;\n\n if (options && options.orient === 'negative') {\n const computedY1 = isValid(height) ? Math.max(y, y + height) : Math.max(y, y1);\n\n return {\n to: { y: computedY1, y1: isNil(y1) ? undefined : computedY1, height: isNil(height) ? undefined : 0 }\n };\n }\n\n const computedY = isValid(height) ? Math.min(y, y + height) : Math.min(y, y1);\n return {\n to: { y: computedY, y1: isNil(y1) ? undefined : computedY, height: isNil(height) ? undefined : 0 }\n };\n}\n\nfunction growHeightOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const y1 = attrs.y1;\n const height = attrs.height;\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 =\n (animationParameters as any).groupHeight ??\n options.layoutRect?.height ??\n animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = overallValue;\n } else {\n overallValue = animationParameters.height;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { y: overallValue, y1: isNil(y1) ? undefined : overallValue, height: isNil(height) ? undefined : 0 }\n };\n}\n\n/**\n * 增长渐出\n */\nexport const growHeightOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growHeightOutOverall(graphic, options, animationParameters)\n : growHeightOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowHeightOut 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 } = growHeightOut(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"]}
@@ -56,7 +56,7 @@ export declare const moveIn: (graphic: IGraphic, options: IMoveAnimationOptions,
56
56
  };
57
57
  export declare const moveOut: (graphic: IGraphic, options: IMoveAnimationOptions, animationParameters: IAnimationParameters) => {
58
58
  from: {
59
- x: number;
59
+ x: any;
60
60
  y?: undefined;
61
61
  };
62
62
  to: {
@@ -65,7 +65,7 @@ export declare const moveOut: (graphic: IGraphic, options: IMoveAnimationOptions
65
65
  };
66
66
  } | {
67
67
  from: {
68
- y: number;
68
+ y: any;
69
69
  x?: undefined;
70
70
  };
71
71
  to: {
@@ -74,8 +74,8 @@ export declare const moveOut: (graphic: IGraphic, options: IMoveAnimationOptions
74
74
  };
75
75
  } | {
76
76
  from: {
77
- x: number;
78
- y: number;
77
+ x: any;
78
+ y: any;
79
79
  };
80
80
  to: {
81
81
  x: any;
@@ -11,13 +11,14 @@ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./cust
11
11
  "negative" === orient && (changedX = null !== (_a = layoutRect.width) && void 0 !== _a ? _a : graphic.stage.viewWidth,
12
12
  changedY = null !== (_b = layoutRect.height) && void 0 !== _b ? _b : graphic.stage.viewHeight),
13
13
  changedX += offset, changedY += offset;
14
- const point = (0, vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
15
- vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y) ? point.y : changedY, finalAttrs = graphic.getFinalAttribute(), finalAttrsX = excludeChannels.includes("x") ? graphic.attribute.x : finalAttrs.x, finalAttrsY = excludeChannels.includes("y") ? graphic.attribute.y : finalAttrs.y;
14
+ const point = (0, vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt, finalAttrsX = graphic.getGraphicAttribute("x"), finalAttrsY = graphic.getGraphicAttribute("y"), fromX = excludeChannels.includes("x") ? finalAttrsX : point && (0,
15
+ vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = excludeChannels.includes("y") ? finalAttrsY : point && (0,
16
+ vutils_1.isValidNumber)(point.y) ? point.y : changedY;
16
17
  switch (direction) {
17
18
  case "x":
18
19
  return {
19
20
  from: {
20
- x: fromX
21
+ x: excludeChannels.includes("x") ? finalAttrsX : fromX
21
22
  },
22
23
  to: {
23
24
  x: finalAttrsX
@@ -51,15 +52,15 @@ const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./cust
51
52
  exports.moveIn = moveIn;
52
53
 
53
54
  const moveOut = (graphic, options, animationParameters) => {
54
- var _a, _b, _c, _d, _e, _f;
55
- const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupWidth = null !== (_b = null === (_a = options.layoutRect) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : graphic.stage.viewWidth, groupHeight = null !== (_d = null === (_c = options.layoutRect) || void 0 === _c ? void 0 : _c.height) && void 0 !== _d ? _d : graphic.stage.viewHeight, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = (0,
56
- vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
55
+ var _a, _b, _c, _d;
56
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupBounds = animationParameters.group ? animationParameters.group.AABBBounds : null, groupWidth = null !== (_a = groupBounds.width()) && void 0 !== _a ? _a : animationParameters.width, groupHeight = null !== (_b = groupBounds.height()) && void 0 !== _b ? _b : animationParameters.height, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = (0,
57
+ vutils_1.isFunction)(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt, fromX = point && (0,
57
58
  vutils_1.isValidNumber)(point.x) ? point.x : changedX, fromY = point && (0, vutils_1.isValidNumber)(point.y) ? point.y : changedY;
58
59
  switch (direction) {
59
60
  case "x":
60
61
  return {
61
62
  from: {
62
- x: graphic.attribute.x
63
+ x: graphic.getGraphicAttribute("x")
63
64
  },
64
65
  to: {
65
66
  x: fromX
@@ -69,7 +70,7 @@ const moveOut = (graphic, options, animationParameters) => {
69
70
  case "y":
70
71
  return {
71
72
  from: {
72
- y: graphic.attribute.y
73
+ y: graphic.getGraphicAttribute("y")
73
74
  },
74
75
  to: {
75
76
  y: fromY
@@ -79,8 +80,8 @@ const moveOut = (graphic, options, animationParameters) => {
79
80
  default:
80
81
  return {
81
82
  from: {
82
- x: graphic.attribute.x,
83
- y: graphic.attribute.y
83
+ x: graphic.getGraphicAttribute("x"),
84
+ y: graphic.getGraphicAttribute("y")
84
85
  },
85
86
  to: {
86
87
  x: fromX,