@visactor/vrender-animate 0.22.4 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate-extension.d.ts +12 -5
- package/cjs/animate-extension.js +23 -12
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +2 -5
- package/cjs/animate.js +23 -18
- package/cjs/animate.js.map +1 -1
- package/cjs/component/component-animate-extension.d.ts +1 -0
- package/cjs/component/component-animate-extension.js +1 -0
- package/cjs/component/component-animate-extension.js.map +1 -0
- package/cjs/component/component-animator.d.ts +22 -0
- package/cjs/component/component-animator.js +67 -0
- package/cjs/component/component-animator.js.map +1 -0
- package/cjs/component/index.d.ts +1 -0
- package/cjs/component/index.js +21 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/config/morphing.d.ts +2 -0
- package/cjs/config/morphing.js +9 -0
- package/cjs/config/morphing.js.map +1 -0
- package/cjs/custom/clip-graphic.d.ts +1 -1
- package/cjs/custom/clip-graphic.js +2 -2
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +2 -1
- package/cjs/custom/clip.js +9 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +1 -3
- package/cjs/custom/common.js +21 -17
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.d.ts +7 -3
- package/cjs/custom/custom-animate.js +13 -2
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/fade.d.ts +1 -1
- package/cjs/custom/fade.js +7 -2
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/fromTo.d.ts +10 -0
- package/cjs/custom/fromTo.js +42 -0
- package/cjs/custom/fromTo.js.map +1 -0
- package/cjs/custom/groupFade.d.ts +10 -0
- package/cjs/custom/groupFade.js +25 -0
- package/cjs/custom/groupFade.js.map +1 -0
- package/cjs/custom/growAngle.d.ts +10 -5
- package/cjs/custom/growAngle.js +38 -17
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.d.ts +1 -2
- package/cjs/custom/growCenter.js +16 -10
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.d.ts +1 -3
- package/cjs/custom/growHeight.js +19 -13
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.d.ts +1 -2
- package/cjs/custom/growPoints.js +41 -36
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.d.ts +4 -5
- package/cjs/custom/growRadius.js +22 -18
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.d.ts +1 -3
- package/cjs/custom/growWidth.js +15 -9
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/input-text.d.ts +1 -2
- package/cjs/custom/input-text.js.map +1 -1
- package/cjs/custom/label-item-animate.d.ts +7 -0
- package/cjs/custom/label-item-animate.js +221 -0
- package/cjs/custom/label-item-animate.js.map +1 -0
- package/cjs/custom/morphing.d.ts +51 -0
- package/cjs/custom/morphing.js +298 -0
- package/cjs/custom/morphing.js.map +1 -0
- package/cjs/custom/motionPath.d.ts +21 -0
- package/cjs/custom/motionPath.js +31 -0
- package/cjs/custom/motionPath.js.map +1 -0
- package/cjs/custom/move.d.ts +96 -0
- package/cjs/custom/move.js +133 -0
- package/cjs/custom/move.js.map +1 -0
- package/cjs/custom/number.d.ts +1 -2
- package/cjs/custom/number.js.map +1 -1
- package/cjs/custom/poptip-animate.d.ts +7 -0
- package/cjs/custom/poptip-animate.js +109 -0
- package/cjs/custom/poptip-animate.js.map +1 -0
- package/cjs/custom/register.d.ts +27 -0
- package/cjs/custom/register.js +418 -3
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +35 -0
- package/cjs/custom/richtext/input-richtext.js +80 -0
- package/cjs/custom/richtext/input-richtext.js.map +1 -0
- package/cjs/custom/richtext/output-richtext.d.ts +37 -0
- package/cjs/custom/richtext/output-richtext.js +94 -0
- package/cjs/custom/richtext/output-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/cjs/custom/richtext/slide-out-richtext.js +146 -0
- package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
- package/cjs/custom/richtext/slide-richtext.js +144 -0
- package/cjs/custom/richtext/slide-richtext.js.map +1 -0
- package/cjs/custom/rotate.d.ts +33 -0
- package/cjs/custom/rotate.js +79 -0
- package/cjs/custom/rotate.js.map +1 -0
- package/cjs/custom/scale.d.ts +6 -2
- package/cjs/custom/scale.js +32 -17
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.d.ts +2 -1
- package/cjs/custom/sphere.js +14 -5
- package/cjs/custom/sphere.js.map +1 -1
- package/cjs/custom/state.d.ts +1 -1
- package/cjs/custom/state.js +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.d.ts +196 -0
- package/cjs/custom/story.js +497 -0
- package/cjs/custom/story.js.map +1 -0
- package/cjs/custom/streamLight.d.ts +27 -0
- package/cjs/custom/streamLight.js +161 -0
- package/cjs/custom/streamLight.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +2 -3
- package/cjs/custom/tag-points.js +20 -4
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.d.ts +2 -2
- package/cjs/custom/update.js +10 -2
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +7 -6
- package/cjs/executor/animate-executor.js +118 -62
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/executor/executor.d.ts +9 -3
- package/cjs/executor/executor.js.map +1 -1
- package/cjs/index.d.ts +8 -8
- package/cjs/index.js +50 -18
- package/cjs/index.js.map +1 -1
- package/cjs/interpolate/store.d.ts +6 -2
- package/cjs/interpolate/store.js +13 -2
- package/cjs/interpolate/store.js.map +1 -1
- package/cjs/register.js +1 -5
- package/cjs/register.js.map +1 -1
- package/cjs/state/animation-state.d.ts +20 -2
- package/cjs/state/animation-state.js +48 -4
- package/cjs/state/animation-state.js.map +1 -1
- package/cjs/state/animation-states-registry.js +18 -0
- package/cjs/state/animation-states-registry.js.map +1 -1
- package/cjs/state/graphic-extension.d.ts +7 -1
- package/cjs/state/graphic-extension.js +20 -0
- package/cjs/state/graphic-extension.js.map +1 -1
- package/cjs/step.d.ts +7 -4
- package/cjs/step.js +33 -15
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +12 -7
- package/cjs/ticker/default-ticker.js +38 -33
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +6 -1
- package/cjs/ticker/manual-ticker.js +26 -4
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +14 -7
- package/cjs/timeline.js +31 -18
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/transform.d.ts +2 -0
- package/cjs/utils/transform.js +10 -0
- package/cjs/utils/transform.js.map +1 -0
- package/dist/index.es.js +3765 -527
- package/es/animate-extension.d.ts +12 -5
- package/es/animate-extension.js +24 -11
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +2 -5
- package/es/animate.js +14 -11
- package/es/animate.js.map +1 -1
- package/es/component/component-animate-extension.d.ts +1 -0
- package/es/component/component-animate-extension.js +1 -0
- package/es/component/component-animate-extension.js.map +1 -0
- package/es/component/component-animator.d.ts +22 -0
- package/es/component/component-animator.js +59 -0
- package/es/component/component-animator.js.map +1 -0
- package/es/component/index.d.ts +1 -0
- package/es/component/index.js +2 -0
- package/es/component/index.js.map +1 -0
- package/es/config/morphing.d.ts +2 -0
- package/es/config/morphing.js +5 -0
- package/es/config/morphing.js.map +1 -0
- package/es/custom/clip-graphic.d.ts +1 -1
- package/es/custom/clip-graphic.js +2 -2
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +2 -1
- package/es/custom/clip.js +9 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +1 -3
- package/es/custom/common.js +21 -17
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.d.ts +7 -3
- package/es/custom/custom-animate.js +10 -1
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/fade.d.ts +1 -1
- package/es/custom/fade.js +7 -2
- package/es/custom/fade.js.map +1 -1
- package/es/custom/fromTo.d.ts +10 -0
- package/es/custom/fromTo.js +34 -0
- package/es/custom/fromTo.js.map +1 -0
- package/es/custom/groupFade.d.ts +10 -0
- package/es/custom/groupFade.js +15 -0
- package/es/custom/groupFade.js.map +1 -0
- package/es/custom/growAngle.d.ts +10 -5
- package/es/custom/growAngle.js +39 -15
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.d.ts +1 -2
- package/es/custom/growCenter.js +16 -10
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.d.ts +1 -3
- package/es/custom/growHeight.js +20 -14
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.d.ts +1 -2
- package/es/custom/growPoints.js +40 -36
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.d.ts +4 -5
- package/es/custom/growRadius.js +22 -16
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.d.ts +1 -3
- package/es/custom/growWidth.js +16 -10
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/input-text.d.ts +1 -2
- package/es/custom/input-text.js.map +1 -1
- package/es/custom/label-item-animate.d.ts +7 -0
- package/es/custom/label-item-animate.js +215 -0
- package/es/custom/label-item-animate.js.map +1 -0
- package/es/custom/morphing.d.ts +51 -0
- package/es/custom/morphing.js +289 -0
- package/es/custom/morphing.js.map +1 -0
- package/es/custom/motionPath.d.ts +21 -0
- package/es/custom/motionPath.js +23 -0
- package/es/custom/motionPath.js.map +1 -0
- package/es/custom/move.d.ts +96 -0
- package/es/custom/move.js +118 -0
- package/es/custom/move.js.map +1 -0
- package/es/custom/number.d.ts +1 -2
- package/es/custom/number.js.map +1 -1
- package/es/custom/poptip-animate.d.ts +7 -0
- package/es/custom/poptip-animate.js +103 -0
- package/es/custom/poptip-animate.js.map +1 -0
- package/es/custom/register.d.ts +27 -0
- package/es/custom/register.js +48 -1
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +35 -0
- package/es/custom/richtext/input-richtext.js +74 -0
- package/es/custom/richtext/input-richtext.js.map +1 -0
- package/es/custom/richtext/output-richtext.d.ts +37 -0
- package/es/custom/richtext/output-richtext.js +88 -0
- package/es/custom/richtext/output-richtext.js.map +1 -0
- package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/es/custom/richtext/slide-out-richtext.js +140 -0
- package/es/custom/richtext/slide-out-richtext.js.map +1 -0
- package/es/custom/richtext/slide-richtext.d.ts +36 -0
- package/es/custom/richtext/slide-richtext.js +138 -0
- package/es/custom/richtext/slide-richtext.js.map +1 -0
- package/es/custom/rotate.d.ts +33 -0
- package/es/custom/rotate.js +65 -0
- package/es/custom/rotate.js.map +1 -0
- package/es/custom/scale.d.ts +6 -2
- package/es/custom/scale.js +32 -17
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.d.ts +2 -1
- package/es/custom/sphere.js +14 -5
- package/es/custom/sphere.js.map +1 -1
- package/es/custom/state.d.ts +1 -1
- package/es/custom/state.js +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.d.ts +196 -0
- package/es/custom/story.js +468 -0
- package/es/custom/story.js.map +1 -0
- package/es/custom/streamLight.d.ts +27 -0
- package/es/custom/streamLight.js +157 -0
- package/es/custom/streamLight.js.map +1 -0
- package/es/custom/tag-points.d.ts +2 -3
- package/es/custom/tag-points.js +21 -5
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.d.ts +2 -2
- package/es/custom/update.js +10 -2
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +7 -6
- package/es/executor/animate-executor.js +116 -61
- package/es/executor/animate-executor.js.map +1 -1
- package/es/executor/executor.d.ts +9 -3
- package/es/executor/executor.js.map +1 -1
- package/es/index.d.ts +8 -8
- package/es/index.js +10 -12
- package/es/index.js.map +1 -1
- package/es/interpolate/store.d.ts +6 -2
- package/es/interpolate/store.js +13 -3
- package/es/interpolate/store.js.map +1 -1
- package/es/register.js +0 -8
- package/es/register.js.map +1 -1
- package/es/state/animation-state.d.ts +20 -2
- package/es/state/animation-state.js +48 -2
- package/es/state/animation-state.js.map +1 -1
- package/es/state/animation-states-registry.js +18 -0
- package/es/state/animation-states-registry.js.map +1 -1
- package/es/state/graphic-extension.d.ts +7 -1
- package/es/state/graphic-extension.js +20 -0
- package/es/state/graphic-extension.js.map +1 -1
- package/es/step.d.ts +7 -4
- package/es/step.js +34 -16
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +12 -7
- package/es/ticker/default-ticker.js +30 -27
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +6 -1
- package/es/ticker/manual-ticker.js +27 -3
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +14 -7
- package/es/timeline.js +33 -18
- package/es/timeline.js.map +1 -1
- package/es/utils/transform.d.ts +2 -0
- package/es/utils/transform.js +4 -0
- package/es/utils/transform.js.map +1 -0
- package/package.json +16 -16
- package/cjs/custom/group-fade.d.ts +0 -16
- package/cjs/custom/group-fade.js +0 -66
- package/cjs/custom/group-fade.js.map +0 -1
- package/cjs/custom/scale-in.d.ts +0 -13
- package/cjs/custom/scale-in.js +0 -57
- package/cjs/custom/scale-in.js.map +0 -1
- package/cjs/interpolate/executor.d.ts +0 -66
- package/cjs/interpolate/executor.js +0 -6
- package/cjs/interpolate/executor.js.map +0 -1
- package/cjs/intreface/animate.d.ts +0 -91
- package/cjs/intreface/animate.js +0 -10
- package/cjs/intreface/animate.js.map +0 -1
- package/cjs/intreface/easing.d.ts +0 -3
- package/cjs/intreface/easing.js +0 -6
- package/cjs/intreface/easing.js.map +0 -1
- package/cjs/intreface/state.d.ts +0 -35
- package/cjs/intreface/state.js +0 -6
- package/cjs/intreface/state.js.map +0 -1
- package/cjs/intreface/ticker.d.ts +0 -37
- package/cjs/intreface/ticker.js +0 -10
- package/cjs/intreface/ticker.js.map +0 -1
- package/cjs/intreface/timeline.d.ts +0 -17
- package/cjs/intreface/timeline.js +0 -6
- package/cjs/intreface/timeline.js.map +0 -1
- package/cjs/intreface/type.d.ts +0 -13
- package/cjs/intreface/type.js +0 -15
- package/cjs/intreface/type.js.map +0 -1
- package/cjs/state/animation-state-machine.d.ts +0 -22
- package/cjs/state/animation-state-machine.js +0 -53
- package/cjs/state/animation-state-machine.js.map +0 -1
- package/cjs/state/animation-state-queue.d.ts +0 -24
- package/cjs/state/animation-state-queue.js +0 -66
- package/cjs/state/animation-state-queue.js.map +0 -1
- package/cjs/state/animation-state-registry.d.ts +0 -14
- package/cjs/state/animation-state-registry.js +0 -53
- package/cjs/state/animation-state-registry.js.map +0 -1
- package/es/custom/group-fade.d.ts +0 -16
- package/es/custom/group-fade.js +0 -56
- package/es/custom/group-fade.js.map +0 -1
- package/es/custom/scale-in.d.ts +0 -13
- package/es/custom/scale-in.js +0 -49
- package/es/custom/scale-in.js.map +0 -1
- package/es/interpolate/executor.d.ts +0 -66
- package/es/interpolate/executor.js +0 -2
- package/es/interpolate/executor.js.map +0 -1
- package/es/intreface/animate.d.ts +0 -91
- package/es/intreface/animate.js +0 -6
- package/es/intreface/animate.js.map +0 -1
- package/es/intreface/easing.d.ts +0 -3
- package/es/intreface/easing.js +0 -2
- package/es/intreface/easing.js.map +0 -1
- package/es/intreface/state.d.ts +0 -35
- package/es/intreface/state.js +0 -2
- package/es/intreface/state.js.map +0 -1
- package/es/intreface/ticker.d.ts +0 -37
- package/es/intreface/ticker.js +0 -6
- package/es/intreface/ticker.js.map +0 -1
- package/es/intreface/timeline.d.ts +0 -17
- package/es/intreface/timeline.js +0 -2
- package/es/intreface/timeline.js.map +0 -1
- package/es/intreface/type.d.ts +0 -13
- package/es/intreface/type.js +0 -14
- package/es/intreface/type.js.map +0 -1
- package/es/state/animation-state-machine.d.ts +0 -22
- package/es/state/animation-state-machine.js +0 -47
- package/es/state/animation-state-machine.js.map +0 -1
- package/es/state/animation-state-queue.d.ts +0 -24
- package/es/state/animation-state-queue.js +0 -58
- package/es/state/animation-state-queue.js.map +0 -1
- package/es/state/animation-state-registry.d.ts +0 -14
- package/es/state/animation-state-registry.js +0 -45
- package/es/state/animation-state-registry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/growPoints.ts"],"names":[],"mappings":";;;AAAA,yDAAwF;AAExF,6CAAiD;AAGjD,qDAAkD;AAyBlD,MAAM,eAAe,GAAG,CACtB,OAAiB,EACjB,OAA2C,EAC3C,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAiB,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,MAAM,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAC7B,IAAI,IAAA,sBAAa,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7B;QACD,IAAI,IAAA,sBAAa,EAAC,OAAO,CAAC,MAAM,CA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,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;YAC/D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF;AAdD,wCAcC","file":"growPoints.js","sourcesContent":["import { pointInterpolation, type IGraphic, type IGroup } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nconst getCenterPoints = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points: IPointLike[] = attrs.points;\n const center: IPointLike = { x: 0, y: 0 };\n points.forEach(point => {\n center.x += point.x;\n center.y += point.y;\n });\n center.x /= points.length;\n center.y /= points.length;\n\n if (options && options.center) {\n if (isValidNumber(options.center.x)) {\n center.x = options.center.x;\n }\n if (isValidNumber(options.center.y)) {\n center.y = options.center.y;\n }\n }\n\n if (graphic.type === 'area') {\n center.x1 = center.x;\n center.y1 = center.y;\n }\n\n return points.map(point => Object.assign({}, point, center));\n};\n\nexport const growPointsIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: getCenterPoints(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nexport const growPointsOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: getCenterPoints(graphic, options, animationParameters) }\n };\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const fromPoints = this.from?.points as unknown as IPointLike[];\n const toPoints = this.to?.points as unknown as IPointLike[];\n if (!fromPoints || !toPoints) {\n return;\n }\n\n out.points = fromPoints.map((point, index) => {\n const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);\n return newPoint;\n });\n this.target.setAttributes(out);\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowPointsIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsIn(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.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsX = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupRight = animationParameters.width;\n\n if (animationParameters.group) {\n groupRight = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = groupRight;\n }\n\n return {\n ...point,\n x: groupRight,\n y: point.y,\n x1: groupRight,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: 0,\n y: point.y,\n x1: 0,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsXIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsX(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsXOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsX(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsXIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsXIn(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.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsXOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsXOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsY = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupBottom = animationParameters.height;\n\n if (animationParameters.group) {\n groupBottom = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupHeight = groupBottom;\n }\n\n return {\n ...point,\n x: point.x,\n y: groupBottom,\n x1: point.x1,\n y1: groupBottom,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: point.x,\n y: 0,\n x1: point.x1,\n y1: 0,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsYIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsY(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsYOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsY(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsYIn extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const { from, to } = growPointsYIn(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.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsYOut extends GworPointsBase {\n onBind(): void {\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsYOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/custom/growPoints.ts"],"names":[],"mappings":";;;AAAA,yDAAyG;AAEzG,6CAAiD;AACjD,qDAAkD;AAyBlD,MAAM,eAAe,GAAG,CACtB,OAAiB,EACjB,OAA2C,EAC3C,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAiB,KAAK,CAAC,MAAM,CAAC;IAC1C,MAAM,MAAM,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAC7B,IAAI,IAAA,sBAAa,EAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,CAAC,GAAG,OAA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AA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,gBAAgB,MAAK,KAAK,EAAE;gBAC1D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;aACjC;SACF;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF;AAvBD,sCAuBC;AAED,MAAa,cAAe,SAAQ,cAAc;IAChD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC1D,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;YAC/D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAK,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC;YACnD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACpB;IACH,CAAC;CACF;AAbD,wCAaC","file":"growPoints.js","sourcesContent":["import { pointInterpolation, type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport { isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nconst getCenterPoints = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points: IPointLike[] = attrs.points;\n const center: IPointLike = { x: 0, y: 0 };\n points.forEach(point => {\n center.x += point.x;\n center.y += point.y;\n });\n center.x /= points.length;\n center.y /= points.length;\n\n if (options && options.center) {\n if (isValidNumber(options.center.x)) {\n center.x = options.center.x;\n }\n if (isValidNumber(options.center.y)) {\n center.y = options.center.y;\n }\n }\n\n if (graphic.type === 'area') {\n center.x1 = center.x;\n center.y1 = center.y;\n }\n\n return points.map(point => Object.assign({}, point, center));\n};\n\nexport const growPointsIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: getCenterPoints(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nexport const growPointsOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsOverallAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: getCenterPoints(graphic, options, animationParameters) }\n };\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const fromPoints = this.from?.points as unknown as IPointLike[];\n const toPoints = this.to?.points as unknown as IPointLike[];\n if (!fromPoints || !toPoints) {\n return;\n }\n\n (this.target.attribute as any).points = fromPoints.map((point, index) => {\n const newPoint = pointInterpolation(fromPoints[index], toPoints[index], ratio);\n return newPoint;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowPointsIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsX = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupRight = graphic.stage.viewWidth;\n\n if (graphic.parent.parent.parent) {\n groupRight = graphic.parent.parent.parent.AABBBounds.width();\n }\n\n return {\n ...point,\n x: groupRight,\n y: point.y,\n x1: groupRight,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: 0,\n y: point.y,\n x1: 0,\n y1: point.y1,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsXIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsX(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsXOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsX(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsXIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsXIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsXOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line'].includes(this.target.type)) {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growPointsXOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from || attrs;\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n\nconst changePointsY = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const points = attrs.points;\n return points.map((point: IPointLike) => {\n if (options && options.orient === 'negative') {\n let groupBottom = graphic.stage.viewHeight;\n if (graphic.parent.parent.parent) {\n groupBottom = graphic.parent.parent.parent.AABBBounds.height();\n }\n\n return {\n ...point,\n x: point.x,\n y: groupBottom,\n x1: point.x1,\n y1: groupBottom,\n defined: point.defined !== false\n } as IPointLike;\n }\n return {\n ...point,\n x: point.x,\n y: 0,\n x1: point.x1,\n y1: 0,\n defined: point.defined !== false\n } as IPointLike;\n });\n};\n\nconst growPointsYIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: changePointsY(graphic, options, animationParameters) },\n to: { points: attrs.points }\n };\n};\n\nconst growPointsYOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowPointsAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n return {\n from: { points: attrs.points },\n to: { points: changePointsY(graphic, options, animationParameters) }\n };\n};\n\nexport class GrowPointsYIn extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYIn(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n } else {\n this.valid = false;\n }\n }\n}\n\nexport class GrowPointsYOut extends GworPointsBase {\n onBind(): void {\n super.onBind();\n if (['area', 'line', 'polygon'].includes(this.target.type)) {\n const { from, to } = growPointsYOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\n this.to = to;\n } else {\n this.valid = false;\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type IGraphic, type IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';
|
|
3
2
|
import { ACustomAnimate } from './custom-animate';
|
|
4
3
|
interface IAnimationParameters {
|
|
5
4
|
width: number;
|
|
@@ -27,15 +26,15 @@ export interface IGrowRadiusAnimationOptions {
|
|
|
27
26
|
}
|
|
28
27
|
export declare const growRadiusIn: TypeAnimation<IGraphic>;
|
|
29
28
|
export declare const growRadiusOut: TypeAnimation<IGraphic>;
|
|
30
|
-
export declare class
|
|
29
|
+
export declare class GrowPointsBase extends ACustomAnimate<Record<string, number>> {
|
|
31
30
|
valid: boolean;
|
|
32
31
|
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
33
32
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
34
33
|
}
|
|
35
|
-
export declare class GrowRadiusIn extends
|
|
34
|
+
export declare class GrowRadiusIn extends GrowPointsBase {
|
|
36
35
|
onBind(): void;
|
|
37
36
|
}
|
|
38
|
-
export declare class GrowRadiusOut extends
|
|
37
|
+
export declare class GrowRadiusOut extends GrowPointsBase {
|
|
39
38
|
onBind(): void;
|
|
40
39
|
}
|
|
41
40
|
export {};
|
package/cjs/custom/growRadius.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.GrowRadiusOut = exports.GrowRadiusIn = exports.
|
|
5
|
+
}), exports.GrowRadiusOut = exports.GrowRadiusIn = exports.GrowPointsBase = exports.growRadiusOut = exports.growRadiusIn = void 0;
|
|
6
6
|
|
|
7
7
|
const custom_animate_1 = require("./custom-animate"), vutils_1 = require("@visactor/vutils"), growRadiusInIndividual = (graphic, options, animationParameters) => {
|
|
8
8
|
const attrs = graphic.getFinalAttribute();
|
|
@@ -44,25 +44,25 @@ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
|
|
|
44
44
|
const attrs = graphic.getFinalAttribute();
|
|
45
45
|
return options && "inside" === options.orient ? {
|
|
46
46
|
from: {
|
|
47
|
-
innerRadius:
|
|
47
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
48
48
|
},
|
|
49
49
|
to: {
|
|
50
50
|
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
51
51
|
}
|
|
52
52
|
} : {
|
|
53
53
|
from: {
|
|
54
|
-
outerRadius:
|
|
54
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
55
55
|
},
|
|
56
56
|
to: {
|
|
57
57
|
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}, growRadiusOutOverall = (graphic, options, animationParameters) => {
|
|
61
|
-
const overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
61
|
+
const attrs = graphic.getFinalAttribute(), overallValue = (0, vutils_1.isNumber)(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
62
62
|
return {
|
|
63
63
|
from: {
|
|
64
|
-
innerRadius:
|
|
65
|
-
outerRadius:
|
|
64
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius,
|
|
65
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
66
66
|
},
|
|
67
67
|
to: {
|
|
68
68
|
innerRadius: overallValue,
|
|
@@ -76,36 +76,40 @@ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
|
|
|
76
76
|
|
|
77
77
|
exports.growRadiusOut = growRadiusOut;
|
|
78
78
|
|
|
79
|
-
class
|
|
79
|
+
class GrowPointsBase extends custom_animate_1.ACustomAnimate {
|
|
80
80
|
constructor(from, to, duration, easing, params) {
|
|
81
81
|
super(from, to, duration, easing, params);
|
|
82
82
|
}
|
|
83
83
|
onUpdate(end, ratio, out) {
|
|
84
|
+
const attribute = this.target.attribute;
|
|
84
85
|
this.propKeys.forEach((key => {
|
|
85
|
-
|
|
86
|
-
})), this.target.
|
|
86
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
87
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
exports.
|
|
91
|
+
exports.GrowPointsBase = GrowPointsBase;
|
|
91
92
|
|
|
92
|
-
class GrowRadiusIn extends
|
|
93
|
+
class GrowRadiusIn extends GrowPointsBase {
|
|
93
94
|
onBind() {
|
|
94
|
-
var _a;
|
|
95
|
-
|
|
95
|
+
var _a, _b;
|
|
96
|
+
super.onBind();
|
|
97
|
+
const {from: from, to: to} = (0, exports.growRadiusIn)(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
96
98
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
97
|
-
this.
|
|
99
|
+
this.from = fromAttrs, this.to = to;
|
|
100
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
101
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
exports.GrowRadiusIn = GrowRadiusIn;
|
|
102
106
|
|
|
103
|
-
class GrowRadiusOut extends
|
|
107
|
+
class GrowRadiusOut extends GrowPointsBase {
|
|
104
108
|
onBind() {
|
|
105
|
-
|
|
106
|
-
const {
|
|
109
|
+
super.onBind();
|
|
110
|
+
const {to: to} = (0, exports.growRadiusOut)(this.target, this.params.options, this.params);
|
|
107
111
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
108
|
-
this.
|
|
112
|
+
this.from = this.target.attribute, this.to = to;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["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,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAgB,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;CACF;AAXD,sCAWC","file":"growRadius.js","sourcesContent":["import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\nimport { isNumber } from '@visactor/vutils';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nconst growRadiusInIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(graphic, options, animationParameters)\n : growRadiusInIndividual(graphic, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.innerRadius },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.outerRadius },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(graphic, options, animationParameters)\n : growRadiusOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowRadiusIn extends GrowPointsBase {\n onBind(): void {\n super.onBind();\n const { from, to } = growRadiusIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n}\n\nexport class GrowRadiusOut extends GrowPointsBase {\n onBind(): void {\n super.onBind();\n const { to } = growRadiusOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n\n this.from = this.target.attribute as any;\n this.to = to;\n // this.target.setAttributes(fromAttrs);\n }\n}\n"]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { IGraphic, IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { IAnimate, IStep } from '../intreface/animate';
|
|
3
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';
|
|
4
2
|
import { ACustomAnimate } from './custom-animate';
|
|
5
3
|
interface IAnimationParameters {
|
|
6
4
|
width: number;
|
package/cjs/custom/growWidth.js
CHANGED
|
@@ -114,18 +114,22 @@ class GrowWidthIn extends custom_animate_1.ACustomAnimate {
|
|
|
114
114
|
super(from, to, duration, easing, params);
|
|
115
115
|
}
|
|
116
116
|
onBind() {
|
|
117
|
-
var _a;
|
|
118
|
-
|
|
117
|
+
var _a, _b;
|
|
118
|
+
super.onBind();
|
|
119
|
+
const {from: from, to: to} = growWidthIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
119
120
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
120
|
-
this.
|
|
121
|
+
this.from = fromAttrs, this.to = to;
|
|
122
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
123
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
121
124
|
}
|
|
122
125
|
onEnd(cb) {
|
|
123
126
|
super.onEnd(cb);
|
|
124
127
|
}
|
|
125
128
|
onUpdate(end, ratio, out) {
|
|
129
|
+
const attribute = this.target.attribute;
|
|
126
130
|
this.propKeys.forEach((key => {
|
|
127
|
-
|
|
128
|
-
})), this.target.
|
|
131
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
132
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
|
|
@@ -136,17 +140,19 @@ class GrowWidthOut extends custom_animate_1.ACustomAnimate {
|
|
|
136
140
|
super(from, to, duration, easing, params);
|
|
137
141
|
}
|
|
138
142
|
onBind() {
|
|
139
|
-
|
|
143
|
+
super.onBind();
|
|
144
|
+
const {from: from, to: to} = (0, exports.growWidthOut)(this.target, this.params.options, this.params);
|
|
140
145
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
141
|
-
this.
|
|
146
|
+
this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
142
147
|
}
|
|
143
148
|
onEnd(cb) {
|
|
144
149
|
super.onEnd(cb);
|
|
145
150
|
}
|
|
146
151
|
onUpdate(end, ratio, out) {
|
|
152
|
+
const attribute = this.target.attribute;
|
|
147
153
|
this.propKeys.forEach((key => {
|
|
148
|
-
|
|
149
|
-
})), this.target.
|
|
154
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
155
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/growWidth.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAG5D,qDAAkD;AAuBlD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7E,OAAO;YACL,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACpG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;SACnC,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAA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AC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AA5BD,oCA4BC","file":"growWidth.js","sourcesContent":["import type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport { isNil, isNumber, isValid } from '@visactor/vutils';\nimport type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nfunction growWidthInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n from: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n from: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nfunction growWidthInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n // no need to handle the situation where x > x1\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options?.overall : 0;\n }\n return {\n from: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nconst growWidthIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthInOverall(graphic, options, animationParameters)\n : growWidthInIndividual(graphic, options, animationParameters);\n};\n\nfunction growWidthOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n to: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n to: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 }\n };\n}\n\nfunction growWidthOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x1 = attrs.x1;\n const width = attrs.width;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 }\n };\n}\n\nexport const growWidthOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthOutOverall(graphic, options, animationParameters)\n : growWidthOutIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowWidthIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n const { from, to } = growWidthIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\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 this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n\nexport class GrowWidthOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n const attrs = this.target.getFinalAttribute();\n const { from, to } = growWidthOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from || attrs;\n this.to = to;\n // this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/custom/growWidth.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAC5D,qDAAkD;AAuBlD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7E,OAAO;YACL,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACpG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;SACnC,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,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B,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,oCA6BC","file":"growWidth.js","sourcesContent":["import type { IGraphic, IGroup, IAnimate, IStep, EasingType } from '@visactor/vrender-core';\nimport { isNil, isNumber, isValid } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ninterface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nfunction growWidthInIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n from: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n from: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nfunction growWidthInOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n // no need to handle the situation where x > x1\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options?.overall : 0;\n }\n return {\n from: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 },\n to: { x: x, x1: x1, width: width }\n };\n}\n\nconst growWidthIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthInOverall(graphic, options, animationParameters)\n : growWidthInIndividual(graphic, options, animationParameters);\n};\n\nfunction growWidthOutIndividual(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x = attrs.x;\n const x1 = attrs.x1;\n const width = attrs.width;\n\n if (options && options.orient === 'negative') {\n const computedX1 = isValid(width) ? Math.max(x, x + width) : Math.max(x, x1);\n\n return {\n to: { x: computedX1, x1: isNil(x1) ? undefined : computedX1, width: isNil(width) ? undefined : 0 }\n };\n }\n\n const computedX = isValid(width) ? Math.min(x, x + width) : Math.min(x, x1);\n return {\n to: { x: computedX, x1: isNil(x1) ? undefined : computedX, width: isNil(width) ? undefined : 0 }\n };\n}\n\nfunction growWidthOutOverall(\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) {\n const attrs = graphic.getFinalAttribute();\n const x1 = attrs.x1;\n const width = attrs.width;\n\n let overallValue: number;\n if (options && options.orient === 'negative') {\n if (isNumber(options.overall)) {\n overallValue = options.overall;\n } else if (animationParameters.group) {\n overallValue = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n\n (animationParameters as any).groupWidth = overallValue;\n } else {\n overallValue = animationParameters.width;\n }\n } else {\n overallValue = isNumber(options?.overall) ? options.overall : 0;\n }\n return {\n to: { x: overallValue, x1: isNil(x1) ? undefined : overallValue, width: isNil(width) ? undefined : 0 }\n };\n}\n\nexport const growWidthOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowCartesianAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growWidthOutOverall(graphic, options, animationParameters)\n : growWidthOutIndividual(graphic, options, animationParameters);\n};\n\n/**\n * 增长渐入\n */\nexport class GrowWidthIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const { from, to } = growWidthIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n this.target.setAttributes(fromAttrs);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\nexport class GrowWidthOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const { from, to } = growWidthOut(this.target, this.params.options, this.params);\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = from ?? (this.target.attribute as any);\n this.to = to;\n // this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { IAnimate, IStep } from '
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';
|
|
3
2
|
import { ACustomAnimate } from './custom-animate';
|
|
4
3
|
export declare class InputText extends ACustomAnimate<{
|
|
5
4
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/input-text.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/custom/input-text.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAOlD,MAAa,SAAU,SAAQ,+BAAgC;IAW7D,YACE,IAAsB,EACtB,EAAoB,EACpB,QAAgB,EAChB,MAAkB,EAClB,MAMC;QAED,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QArBpC,aAAQ,GAAW,EAAE,CAAC;QACtB,WAAM,GAAW,EAAE,CAAC;QACpB,eAAU,GAAY,KAAK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"input-text.js","sourcesContent":["import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\n/**\n * 文本输入动画,实现类似打字机的字符逐个显示效果\n * 支持通过beforeText和afterText参数添加前缀和后缀\n * 支持通过showCursor参数显示光标,cursorChar自定义光标字符\n */\nexport class InputText extends ACustomAnimate<{ text: string }> {\n declare valid: boolean;\n\n private fromText: string = '';\n private toText: string = '';\n private showCursor: boolean = false;\n private cursorChar: string = '|';\n private blinkCursor: boolean = true;\n private beforeText: string = '';\n private afterText: string = '';\n\n constructor(\n from: { text: string },\n to: { text: string },\n duration: number,\n easing: EasingType,\n params?: {\n showCursor?: boolean;\n cursorChar?: string;\n blinkCursor?: boolean;\n beforeText?: string;\n afterText?: string;\n }\n ) {\n super(from, to, duration, easing, params);\n\n // 配置光标相关选项\n if (params?.showCursor !== undefined) {\n this.showCursor = params.showCursor;\n }\n if (params?.cursorChar !== undefined) {\n this.cursorChar = params.cursorChar;\n }\n if (params?.blinkCursor !== undefined) {\n this.blinkCursor = params.blinkCursor;\n }\n\n // 配置前缀和后缀文本\n if (params?.beforeText !== undefined) {\n this.beforeText = params.beforeText;\n }\n if (params?.afterText !== undefined) {\n this.afterText = params.afterText;\n }\n }\n\n onFirstRun(): void {\n const fromProps = this.getLastProps();\n const toProps = this.getEndProps();\n const fromText = fromProps.text ?? '';\n const toText = toProps.text ?? '';\n\n // 初始化解析结果\n this.valid = true;\n\n // 存储文本用于动画\n this.fromText = fromText.toString();\n this.toText = toText.toString();\n\n // 确保to不为空\n if (!this.toText && this.toText !== '') {\n this.valid = false;\n return;\n }\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n if (!cb) {\n // 动画结束时,显示完整文本(不带闪烁光标)\n if (this.showCursor && !this.blinkCursor) {\n // 如果有光标但不闪烁,保留光标\n this.target.setAttribute('text', this.beforeText + this.toText + this.cursorChar + this.afterText);\n } else {\n // 不显示光标\n this.target.setAttribute('text', this.beforeText + this.toText + this.afterText);\n }\n }\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (!this.valid) {\n return;\n }\n\n // 计算当前应该显示的字符数量\n const totalChars = this.toText.length;\n const fromChars = this.fromText.length;\n\n // 如果fromText比toText长,则是删除动画\n // 否则是添加动画\n let currentLength: number;\n let currentText: string;\n\n if (fromChars > totalChars) {\n // 删除文本动画(从多到少)\n currentLength = Math.round(fromChars - (fromChars - totalChars) * ratio);\n currentText = this.fromText.substring(0, currentLength);\n } else {\n // 添加文本动画(从少到多)\n currentLength = Math.round(fromChars + (totalChars - fromChars) * ratio);\n\n // 如果fromText是toText的前缀,则直接使用toText的子串\n if (this.toText.startsWith(this.fromText)) {\n currentText = this.toText.substring(0, currentLength);\n } else {\n // 否则需要在fromText和toText之间进行过渡\n if (currentLength <= fromChars) {\n currentText = this.fromText.substring(0, currentLength);\n } else {\n currentText = this.toText.substring(0, currentLength - fromChars + Math.min(fromChars, currentLength));\n }\n }\n }\n\n // 构建最终显示的文本\n let displayText = this.beforeText + currentText + this.afterText;\n\n // 添加光标效果\n if (this.showCursor) {\n if (this.blinkCursor) {\n // 闪烁效果:在动画期间,光标每半个周期闪烁一次\n const blinkRate = 0.1; // 光标闪烁频率(每10%动画进度闪烁一次)\n const showCursorNow = Math.floor(ratio / blinkRate) % 2 === 0;\n\n if (showCursorNow) {\n displayText = this.beforeText + currentText + this.cursorChar + this.afterText;\n }\n } else {\n // 固定光标(不闪烁)\n displayText = this.beforeText + currentText + this.cursorChar + this.afterText;\n }\n }\n\n // 更新图形的text属性\n this.target.setAttribute('text', displayText);\n }\n}\n"]}
|