@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
package/es/custom/growRadius.js
CHANGED
|
@@ -42,25 +42,25 @@ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
|
|
|
42
42
|
const attrs = graphic.getFinalAttribute();
|
|
43
43
|
return options && "inside" === options.orient ? {
|
|
44
44
|
from: {
|
|
45
|
-
innerRadius:
|
|
45
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
46
46
|
},
|
|
47
47
|
to: {
|
|
48
48
|
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
49
49
|
}
|
|
50
50
|
} : {
|
|
51
51
|
from: {
|
|
52
|
-
outerRadius:
|
|
52
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
53
53
|
},
|
|
54
54
|
to: {
|
|
55
55
|
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
}, growRadiusOutOverall = (graphic, options, animationParameters) => {
|
|
59
|
-
const overallValue = isNumber(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
59
|
+
const attrs = graphic.getFinalAttribute(), overallValue = isNumber(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
60
60
|
return {
|
|
61
61
|
from: {
|
|
62
|
-
innerRadius:
|
|
63
|
-
outerRadius:
|
|
62
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius,
|
|
63
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
64
64
|
},
|
|
65
65
|
to: {
|
|
66
66
|
innerRadius: overallValue,
|
|
@@ -74,32 +74,38 @@ export const growRadiusOut = (graphic, options, animationParameters) => {
|
|
|
74
74
|
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusOutOverall(graphic, options) : growRadiusOutIndividual(graphic, options);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
export class
|
|
77
|
+
export class GrowPointsBase extends ACustomAnimate {
|
|
78
78
|
constructor(from, to, duration, easing, params) {
|
|
79
79
|
super(from, to, duration, easing, params);
|
|
80
80
|
}
|
|
81
81
|
onUpdate(end, ratio, out) {
|
|
82
|
+
const attribute = this.target.attribute;
|
|
82
83
|
this.propKeys.forEach((key => {
|
|
83
|
-
|
|
84
|
-
})), this.target.
|
|
84
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
85
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
export class GrowRadiusIn extends
|
|
89
|
+
export class GrowRadiusIn extends GrowPointsBase {
|
|
89
90
|
onBind() {
|
|
90
|
-
var _a;
|
|
91
|
-
|
|
91
|
+
var _a, _b;
|
|
92
|
+
super.onBind();
|
|
93
|
+
const {from: from, to: to} = growRadiusIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
92
94
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
93
|
-
this.
|
|
95
|
+
this.from = fromAttrs, this.to = to;
|
|
96
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
97
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
export class GrowRadiusOut extends
|
|
101
|
+
export class GrowRadiusOut extends GrowPointsBase {
|
|
98
102
|
onBind() {
|
|
99
|
-
|
|
100
|
-
const {
|
|
103
|
+
super.onBind();
|
|
104
|
+
const {to: to} = (graphic = this.target, options = this.params.options, this.params,
|
|
105
|
+
!1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusOutOverall(graphic, options) : growRadiusOutIndividual(graphic, options));
|
|
106
|
+
var graphic, options, _a;
|
|
101
107
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
102
|
-
this.
|
|
108
|
+
this.from = this.target.attribute, this.to = to;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
//# sourceMappingURL=growRadius.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/growRadius.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/custom/growRadius.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA2B5C,MAAM,sBAAsB,GAAG,CAC7B,OAAiB,EACjB,OAAoC,EACpC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC1C,OAAO;YACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;YACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;SACxC,CAAC;KACH;IACD,OAAO;QACL,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;QACzC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE;KACxC,CAAC;AACJ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CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,cAAc;IAC/C,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAgB,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,CAAC;CACF","file":"growRadius.js","sourcesContent":["import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\nimport { isNumber } from '@visactor/vutils';\n\ninterface IAnimationParameters {\n width: number;\n height: number;\n group: IGroup;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nconst growRadiusInIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.outerRadius },\n to: { innerRadius: attrs?.innerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.innerRadius },\n to: { outerRadius: attrs?.outerRadius }\n };\n};\n\nconst growRadiusInOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: overallValue,\n outerRadius: overallValue\n },\n to: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n }\n };\n};\n\nexport const growRadiusIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusInOverall(graphic, options, animationParameters)\n : growRadiusInIndividual(graphic, options, animationParameters);\n};\n\nconst growRadiusOutIndividual = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'inside') {\n return {\n from: { innerRadius: attrs?.innerRadius },\n to: { innerRadius: attrs?.outerRadius }\n };\n }\n return {\n from: { outerRadius: attrs?.outerRadius },\n to: { outerRadius: attrs?.innerRadius }\n };\n};\n\nconst growRadiusOutOverall = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n innerRadius: attrs?.innerRadius,\n outerRadius: attrs?.outerRadius\n },\n to: {\n innerRadius: overallValue,\n outerRadius: overallValue\n }\n };\n};\n\nexport const growRadiusOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowRadiusAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growRadiusOutOverall(graphic, options, animationParameters)\n : growRadiusOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowRadiusIn extends GrowPointsBase {\n onBind(): void {\n 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"]}
|
package/es/custom/growWidth.d.ts
CHANGED
|
@@ -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/es/custom/growWidth.js
CHANGED
|
@@ -106,18 +106,22 @@ export class GrowWidthIn extends ACustomAnimate {
|
|
|
106
106
|
super(from, to, duration, easing, params);
|
|
107
107
|
}
|
|
108
108
|
onBind() {
|
|
109
|
-
var _a;
|
|
110
|
-
|
|
109
|
+
var _a, _b;
|
|
110
|
+
super.onBind();
|
|
111
|
+
const {from: from, to: to} = growWidthIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
111
112
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
112
|
-
this.
|
|
113
|
+
this.from = fromAttrs, this.to = to;
|
|
114
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
115
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
113
116
|
}
|
|
114
117
|
onEnd(cb) {
|
|
115
118
|
super.onEnd(cb);
|
|
116
119
|
}
|
|
117
120
|
onUpdate(end, ratio, out) {
|
|
121
|
+
const attribute = this.target.attribute;
|
|
118
122
|
this.propKeys.forEach((key => {
|
|
119
|
-
|
|
120
|
-
})), this.target.
|
|
123
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
124
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
|
|
@@ -126,19 +130,21 @@ export class GrowWidthOut extends ACustomAnimate {
|
|
|
126
130
|
super(from, to, duration, easing, params);
|
|
127
131
|
}
|
|
128
132
|
onBind() {
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
super.onBind();
|
|
134
|
+
const {from: from, to: to} = (graphic = this.target, options = this.params.options,
|
|
135
|
+
animationParameters = this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthOutOverall(graphic, options, animationParameters) : growWidthOutIndividual(graphic, options, animationParameters));
|
|
131
136
|
var graphic, options, animationParameters, _a;
|
|
132
137
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
133
|
-
this.
|
|
138
|
+
this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
134
139
|
}
|
|
135
140
|
onEnd(cb) {
|
|
136
141
|
super.onEnd(cb);
|
|
137
142
|
}
|
|
138
143
|
onUpdate(end, ratio, out) {
|
|
144
|
+
const attribute = this.target.attribute;
|
|
139
145
|
this.propKeys.forEach((key => {
|
|
140
|
-
|
|
141
|
-
})), this.target.
|
|
146
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
147
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
//# sourceMappingURL=growWidth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/growWidth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuBlD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,IAAI,OAAO,IAAI,OAA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,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;QAC1B,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,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF","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,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuBlD,SAAS,qBAAqB,CAC5B,OAAiB,EACjB,OAAuC,EACvC,mBAAyC;IAEzC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAE1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI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AAE,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;QAC/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","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,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,MAAM,OAAO,SAAU,SAAQ,cAAgC;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,CAAC;QAC5B,eAAU,GAAW,GAAG,CAAC;QACzB,gBAAW,GAAY,IAAI,CAAC;QAC5B,eAAU,GAAW,EAAE,CAAC;QACxB,cAAS,GAAW,EAAE,CAAC;QAkB7B,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,MAAK,SAAS,EAAE;YACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;SACrC;QACD,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,MAAK,SAAS,EAAE;YACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;SACrC;QACD,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,MAAK,SAAS,EAAE;YACrC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;SACvC;QAGD,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,MAAK,SAAS,EAAE;YACpC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;SACrC;QACD,IAAI,CAAA,MAAM,aAAN,MAAM,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EpB,MAAM,SAAS,GAAG,GAAG,CAAC;gBACtB,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAE9D,IAAI,aAAa,EAAE;oBACjB,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;iBAChF;aACF;iBAAM;gBAEL,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;aAChF;SACF;QAGD,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;CACF","file":"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"]}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { AComponentAnimate } from "./custom-animate";
|
|
2
|
+
|
|
3
|
+
import { createComponentAnimator } from "../component";
|
|
4
|
+
|
|
5
|
+
import { InputText } from "./input-text";
|
|
6
|
+
|
|
7
|
+
export class LabelItemAppear extends AComponentAnimate {
|
|
8
|
+
onBind() {
|
|
9
|
+
super.onBind();
|
|
10
|
+
const animator = createComponentAnimator(this.target);
|
|
11
|
+
this._animator = animator;
|
|
12
|
+
const duration = this.duration, easing = this.easing, target = this.target, {symbolStartOuterType: symbolStartOuterType = "scale", titleType: titleType = "typewriter", titlePanelType: titlePanelType = "scale"} = this.params, symbolTime = duration / 10;
|
|
13
|
+
let symbolStartOuterFrom, symbolStartOuterTo;
|
|
14
|
+
if (target._symbolStart.setAttributes({
|
|
15
|
+
scaleX: 0,
|
|
16
|
+
scaleY: 0
|
|
17
|
+
}), animator.animate(target._symbolStart, {
|
|
18
|
+
type: "to",
|
|
19
|
+
to: {
|
|
20
|
+
scaleX: 1,
|
|
21
|
+
scaleY: 1
|
|
22
|
+
},
|
|
23
|
+
duration: 5 * symbolTime,
|
|
24
|
+
easing: easing
|
|
25
|
+
}), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
|
|
26
|
+
scaleX: 0,
|
|
27
|
+
scaleY: 0
|
|
28
|
+
}, symbolStartOuterTo = {
|
|
29
|
+
scaleX: 1,
|
|
30
|
+
scaleY: 1
|
|
31
|
+
}) : (symbolStartOuterFrom = {
|
|
32
|
+
clipRange: 0
|
|
33
|
+
}, symbolStartOuterTo = {
|
|
34
|
+
clipRange: 1
|
|
35
|
+
}), target._symbolStartOuter.setAttributes(symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
|
|
36
|
+
type: "to",
|
|
37
|
+
to: symbolStartOuterTo,
|
|
38
|
+
duration: 5 * symbolTime,
|
|
39
|
+
easing: easing
|
|
40
|
+
}), target._symbolEnd.setAttributes({
|
|
41
|
+
scaleX: 0,
|
|
42
|
+
scaleY: 0
|
|
43
|
+
}), animator.animate(target._symbolEnd, {
|
|
44
|
+
type: "to",
|
|
45
|
+
to: {
|
|
46
|
+
scaleX: 1,
|
|
47
|
+
scaleY: 1
|
|
48
|
+
},
|
|
49
|
+
duration: 2 * symbolTime,
|
|
50
|
+
delay: 8 * symbolTime,
|
|
51
|
+
easing: easing
|
|
52
|
+
}), target._line.setAttributes({
|
|
53
|
+
clipRange: 0
|
|
54
|
+
}), animator.animate(target._line, {
|
|
55
|
+
type: "to",
|
|
56
|
+
to: {
|
|
57
|
+
clipRange: 1
|
|
58
|
+
},
|
|
59
|
+
duration: 9 * symbolTime,
|
|
60
|
+
easing: easing
|
|
61
|
+
}), "typewriter" === titleType) {
|
|
62
|
+
const titleTopText = target._titleTop.attribute.text;
|
|
63
|
+
target._titleTop.setAttributes({
|
|
64
|
+
text: ""
|
|
65
|
+
}), animator.animate(target._titleTop, {
|
|
66
|
+
type: "custom",
|
|
67
|
+
delay: 5 * symbolTime,
|
|
68
|
+
duration: 4 * symbolTime,
|
|
69
|
+
easing: "linear",
|
|
70
|
+
to: {
|
|
71
|
+
text: titleTopText
|
|
72
|
+
},
|
|
73
|
+
custom: InputText
|
|
74
|
+
});
|
|
75
|
+
const titleBottomText = target._titleBottom.attribute.text;
|
|
76
|
+
target._titleBottom.setAttributes({
|
|
77
|
+
text: ""
|
|
78
|
+
}), animator.animate(target._titleBottom, {
|
|
79
|
+
type: "custom",
|
|
80
|
+
delay: 5 * symbolTime,
|
|
81
|
+
duration: 4 * symbolTime,
|
|
82
|
+
easing: "linear",
|
|
83
|
+
to: {
|
|
84
|
+
text: titleBottomText
|
|
85
|
+
},
|
|
86
|
+
custom: InputText
|
|
87
|
+
});
|
|
88
|
+
} else target._titleTop.setAttributes({
|
|
89
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
90
|
+
}), animator.animate(target._titleTop, {
|
|
91
|
+
type: "to",
|
|
92
|
+
to: {
|
|
93
|
+
dy: 0
|
|
94
|
+
},
|
|
95
|
+
delay: 5 * symbolTime,
|
|
96
|
+
duration: 4 * symbolTime,
|
|
97
|
+
easing: "linear"
|
|
98
|
+
}), target._titleBottom.setAttributes({
|
|
99
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
100
|
+
}), animator.animate(target._titleBottom, {
|
|
101
|
+
type: "to",
|
|
102
|
+
to: {
|
|
103
|
+
dy: 0
|
|
104
|
+
},
|
|
105
|
+
delay: 5 * symbolTime,
|
|
106
|
+
duration: 4 * symbolTime,
|
|
107
|
+
easing: "linear"
|
|
108
|
+
});
|
|
109
|
+
"scale" === titlePanelType ? [ target._titleTopPanel, target._titleBottomPanel ].forEach((panel => {
|
|
110
|
+
var _a;
|
|
111
|
+
const scaleX = null !== (_a = panel.attribute.scaleX) && void 0 !== _a ? _a : 1;
|
|
112
|
+
panel.setAttributes({
|
|
113
|
+
scaleX: 0
|
|
114
|
+
}), animator.animate(panel, {
|
|
115
|
+
type: "to",
|
|
116
|
+
to: {
|
|
117
|
+
scaleX: scaleX
|
|
118
|
+
},
|
|
119
|
+
duration: duration,
|
|
120
|
+
easing: easing
|
|
121
|
+
});
|
|
122
|
+
})) : "stroke" === titlePanelType && [ target._titleTopPanel, target._titleBottomPanel ].forEach((panel => {
|
|
123
|
+
const b = panel.AABBBounds, totalLen = 2 * (b.width() + b.height());
|
|
124
|
+
panel.setAttributes({
|
|
125
|
+
lineDash: [ 0, 10 * totalLen ]
|
|
126
|
+
}), animator.animate(panel, {
|
|
127
|
+
type: "to",
|
|
128
|
+
to: {
|
|
129
|
+
lineDash: [ totalLen, 10 * totalLen ]
|
|
130
|
+
},
|
|
131
|
+
duration: duration,
|
|
132
|
+
easing: easing
|
|
133
|
+
});
|
|
134
|
+
})), this.completeBind(animator);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export class LabelItemDisappear extends AComponentAnimate {
|
|
139
|
+
onBind() {
|
|
140
|
+
super.onBind();
|
|
141
|
+
const animator = createComponentAnimator(this.target);
|
|
142
|
+
this._animator = animator;
|
|
143
|
+
const duration = this.duration, easing = this.easing, target = this.target, {mode: mode} = this.params;
|
|
144
|
+
"scale" === mode ? animator.animate(target._symbolStart, {
|
|
145
|
+
type: "to",
|
|
146
|
+
to: {
|
|
147
|
+
scaleX: 0,
|
|
148
|
+
scaleY: 0
|
|
149
|
+
},
|
|
150
|
+
duration: duration,
|
|
151
|
+
easing: easing
|
|
152
|
+
}) : (animator.animate(target._line, {
|
|
153
|
+
type: "to",
|
|
154
|
+
to: {
|
|
155
|
+
clipRange: 0
|
|
156
|
+
},
|
|
157
|
+
duration: duration,
|
|
158
|
+
easing: easing
|
|
159
|
+
}), animator.animate(target._symbolStart, {
|
|
160
|
+
type: "to",
|
|
161
|
+
to: {
|
|
162
|
+
scaleX: 0,
|
|
163
|
+
scaleY: 0
|
|
164
|
+
},
|
|
165
|
+
duration: duration / 2,
|
|
166
|
+
delay: duration / 2,
|
|
167
|
+
easing: easing
|
|
168
|
+
}), animator.animate(target._symbolEnd, {
|
|
169
|
+
type: "to",
|
|
170
|
+
to: {
|
|
171
|
+
scaleX: 0,
|
|
172
|
+
scaleY: 0
|
|
173
|
+
},
|
|
174
|
+
duration: duration,
|
|
175
|
+
easing: easing
|
|
176
|
+
}), animator.animate(target._titleTop, {
|
|
177
|
+
type: "to",
|
|
178
|
+
to: {
|
|
179
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
180
|
+
},
|
|
181
|
+
duration: duration / 2,
|
|
182
|
+
easing: easing
|
|
183
|
+
}), animator.animate(target._titleBottom, {
|
|
184
|
+
type: "to",
|
|
185
|
+
to: {
|
|
186
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
187
|
+
},
|
|
188
|
+
duration: duration / 2,
|
|
189
|
+
easing: easing
|
|
190
|
+
}), animator.animate(target._symbolStartOuter, {
|
|
191
|
+
type: "to",
|
|
192
|
+
to: {
|
|
193
|
+
clipRange: 0
|
|
194
|
+
},
|
|
195
|
+
duration: duration / 2,
|
|
196
|
+
delay: duration / 2,
|
|
197
|
+
easing: easing
|
|
198
|
+
}), animator.animate(target._titleTopPanel, {
|
|
199
|
+
type: "to",
|
|
200
|
+
to: {
|
|
201
|
+
scaleX: 0
|
|
202
|
+
},
|
|
203
|
+
duration: duration,
|
|
204
|
+
easing: easing
|
|
205
|
+
}), animator.animate(target._titleBottomPanel, {
|
|
206
|
+
type: "to",
|
|
207
|
+
to: {
|
|
208
|
+
scaleX: 0
|
|
209
|
+
},
|
|
210
|
+
duration: duration,
|
|
211
|
+
easing: easing
|
|
212
|
+
})), this.completeBind(animator);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=label-item-animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/label-item-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,OAAO,eAAgB,SAAQ,iBAAsB;IACzD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B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,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;gBACrD,QAAQ,EAAE,QAAQ,GAAG,CAAC;gBACtB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;gBACpC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE;gBAC3D,QAAQ,EAAE,QAAQ,GAAG,CAAC;gBACtB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE;gBACzC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;gBACpB,QAAQ,EAAE,QAAQ,GAAG,CAAC;gBACtB,KAAK,EAAE,QAAQ,GAAG,CAAC;gBACnB,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;gBACtC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACjB,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE;gBACzC,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACjB,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF","file":"label-item-animate.js","sourcesContent":["import { AComponentAnimate } from './custom-animate';\nimport { createComponentAnimator } from '../component';\nimport { InputText } from './input-text';\n\n/**\n * LabelItemAppear class handles the appear animation for StoryLabelItem components\n */\nexport class LabelItemAppear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { symbolStartOuterType = 'scale', titleType = 'typewriter', titlePanelType = 'scale' } = this.params;\n\n const symbolTime = duration / 10;\n target._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 5,\n easing\n });\n\n let symbolStartOuterFrom: any;\n let symbolStartOuterTo: any;\n if (symbolStartOuterType === 'scale') {\n symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };\n symbolStartOuterTo = { scaleX: 1, scaleY: 1 };\n } else {\n symbolStartOuterFrom = { clipRange: 0 };\n symbolStartOuterTo = { clipRange: 1 };\n }\n target._symbolStartOuter.setAttributes(symbolStartOuterFrom);\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: symbolStartOuterTo,\n duration: symbolTime * 5,\n easing\n });\n\n target._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 1, scaleY: 1 },\n duration: symbolTime * 2,\n delay: symbolTime * 8,\n easing\n });\n\n target._line.setAttributes({ clipRange: 0 });\n\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 1 },\n duration: symbolTime * 9,\n easing\n });\n\n if (titleType === 'typewriter') {\n const titleTopText = target._titleTop.attribute.text as string;\n target._titleTop.setAttributes({ text: '' });\n\n animator.animate(target._titleTop, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleTopText },\n custom: InputText\n });\n\n const titleBottomText = target._titleBottom.attribute.text as string;\n target._titleBottom.setAttributes({ text: '' });\n\n animator.animate(target._titleBottom, {\n type: 'custom',\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear',\n to: { text: titleBottomText },\n custom: InputText\n });\n } else {\n target._titleTop.setAttributes({ dy: target._titleTop.AABBBounds.height() + 10 });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n\n target._titleBottom.setAttributes({ dy: -(10 + target._titleBottom.AABBBounds.height()) });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: {\n dy: 0\n },\n delay: symbolTime * 5,\n duration: symbolTime * 4,\n easing: 'linear'\n });\n }\n\n if (titlePanelType === 'scale') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const scaleX = panel.attribute.scaleX ?? 1;\n panel.setAttributes({ scaleX: 0 });\n animator.animate(panel, {\n type: 'to',\n to: {\n scaleX\n },\n duration,\n easing\n });\n });\n } else if (titlePanelType === 'stroke') {\n [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {\n const b = panel.AABBBounds;\n const totalLen = (b.width() + b.height()) * 2;\n panel.setAttributes({ lineDash: [0, totalLen * 10] });\n animator.animate(panel, {\n type: 'to',\n to: {\n lineDash: [totalLen, totalLen * 10]\n },\n duration,\n easing\n });\n });\n }\n\n this.completeBind(animator);\n }\n}\n\n/**\n * LabelItemDisappear class handles the disappear animation for StoryLabelItem components\n */\nexport class LabelItemDisappear extends AComponentAnimate<any> {\n onBind(): void {\n super.onBind();\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n\n const duration = this.duration;\n const easing = this.easing;\n const target = this.target as any;\n\n const { mode } = this.params;\n\n if (mode === 'scale') {\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n } else {\n animator.animate(target._line, {\n type: 'to',\n to: { clipRange: 0 },\n duration,\n easing\n });\n\n animator.animate(target._symbolStart, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._symbolEnd, {\n type: 'to',\n to: { scaleX: 0, scaleY: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleTop, {\n type: 'to',\n to: { dy: target._titleTop.AABBBounds.height() + 10 },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._titleBottom, {\n type: 'to',\n to: { dy: -(10 + target._titleBottom.AABBBounds.height()) },\n duration: duration / 2,\n easing\n });\n\n animator.animate(target._symbolStartOuter, {\n type: 'to',\n to: { clipRange: 0 },\n duration: duration / 2,\n delay: duration / 2,\n easing\n });\n\n animator.animate(target._titleTopPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n\n animator.animate(target._titleBottomPanel, {\n type: 'to',\n to: { scaleX: 0 },\n duration,\n easing\n });\n }\n\n this.completeBind(animator);\n }\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CustomPath2D, type MorphingAnimateConfig, type MultiMorphingAnimateConfig, type IGraphic, type EasingType, type IGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import { type IMatrix } from '@visactor/vutils';
|
|
3
|
+
import { ACustomAnimate } from './custom-animate';
|
|
4
|
+
interface MorphingDataItem {
|
|
5
|
+
from: number[];
|
|
6
|
+
to: number[];
|
|
7
|
+
fromCp: number[];
|
|
8
|
+
toCp: number[];
|
|
9
|
+
rotation: number;
|
|
10
|
+
}
|
|
11
|
+
interface OtherAttrItem {
|
|
12
|
+
from: any;
|
|
13
|
+
to: any;
|
|
14
|
+
key: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class MorphingPath extends ACustomAnimate<Record<string, any>> {
|
|
17
|
+
path: CustomPath2D;
|
|
18
|
+
saveOnEnd?: boolean;
|
|
19
|
+
otherAttrs?: OtherAttrItem[];
|
|
20
|
+
constructor(config: {
|
|
21
|
+
morphingData: MorphingDataItem[];
|
|
22
|
+
otherAttrs?: OtherAttrItem[];
|
|
23
|
+
saveOnEnd?: boolean;
|
|
24
|
+
}, duration: number, easing: EasingType);
|
|
25
|
+
private morphingData?;
|
|
26
|
+
getEndProps(): Record<string, any>;
|
|
27
|
+
onBind(): void;
|
|
28
|
+
onEnd(): void;
|
|
29
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
30
|
+
}
|
|
31
|
+
export declare const morphPath: (fromGraphic: IGraphic | null, toGraphic: IGraphic, animationConfig?: MorphingAnimateConfig, fromGraphicTransform?: IMatrix) => import("@visactor/vrender-core").IAnimate;
|
|
32
|
+
export declare const oneToMultiMorph: (fromGraphic: IGraphic, toGraphics: IGraphic[], animationConfig?: MultiMorphingAnimateConfig) => void;
|
|
33
|
+
export declare class MultiToOneMorphingPath extends ACustomAnimate<Record<string, any>> {
|
|
34
|
+
path: CustomPath2D;
|
|
35
|
+
otherAttrs?: OtherAttrItem[][];
|
|
36
|
+
constructor(config: {
|
|
37
|
+
morphingData: MorphingDataItem[][];
|
|
38
|
+
otherAttrs?: OtherAttrItem[][];
|
|
39
|
+
}, duration: number, easing: EasingType);
|
|
40
|
+
private morphingData?;
|
|
41
|
+
getEndProps(): Record<string, any>;
|
|
42
|
+
onBind(): void;
|
|
43
|
+
private addPathProxy;
|
|
44
|
+
private clearPathProxy;
|
|
45
|
+
onEnd(): void;
|
|
46
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
47
|
+
}
|
|
48
|
+
export declare const cloneGraphic: (graphic: IGraphic, count: number, needAppend?: boolean) => IGraphic<Partial<IGraphicAttribute>>[];
|
|
49
|
+
export declare const splitGraphic: (graphic: IGraphic, count: number, needAppend?: boolean) => IGraphic<Partial<IGraphicAttribute>>[];
|
|
50
|
+
export declare const multiToOneMorph: (fromGraphics: IGraphic[], toGraphic: IGraphic, animationConfig?: MultiMorphingAnimateConfig) => void;
|
|
51
|
+
export {};
|