@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
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.LabelItemDisappear = exports.LabelItemAppear = void 0;
|
|
6
|
+
|
|
7
|
+
const custom_animate_1 = require("./custom-animate"), component_1 = require("../component"), input_text_1 = require("./input-text");
|
|
8
|
+
|
|
9
|
+
class LabelItemAppear extends custom_animate_1.AComponentAnimate {
|
|
10
|
+
onBind() {
|
|
11
|
+
super.onBind();
|
|
12
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
13
|
+
this._animator = animator;
|
|
14
|
+
const duration = this.duration, easing = this.easing, target = this.target, {symbolStartOuterType: symbolStartOuterType = "scale", titleType: titleType = "typewriter", titlePanelType: titlePanelType = "scale"} = this.params, symbolTime = duration / 10;
|
|
15
|
+
let symbolStartOuterFrom, symbolStartOuterTo;
|
|
16
|
+
if (target._symbolStart.setAttributes({
|
|
17
|
+
scaleX: 0,
|
|
18
|
+
scaleY: 0
|
|
19
|
+
}), animator.animate(target._symbolStart, {
|
|
20
|
+
type: "to",
|
|
21
|
+
to: {
|
|
22
|
+
scaleX: 1,
|
|
23
|
+
scaleY: 1
|
|
24
|
+
},
|
|
25
|
+
duration: 5 * symbolTime,
|
|
26
|
+
easing: easing
|
|
27
|
+
}), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
|
|
28
|
+
scaleX: 0,
|
|
29
|
+
scaleY: 0
|
|
30
|
+
}, symbolStartOuterTo = {
|
|
31
|
+
scaleX: 1,
|
|
32
|
+
scaleY: 1
|
|
33
|
+
}) : (symbolStartOuterFrom = {
|
|
34
|
+
clipRange: 0
|
|
35
|
+
}, symbolStartOuterTo = {
|
|
36
|
+
clipRange: 1
|
|
37
|
+
}), target._symbolStartOuter.setAttributes(symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
|
|
38
|
+
type: "to",
|
|
39
|
+
to: symbolStartOuterTo,
|
|
40
|
+
duration: 5 * symbolTime,
|
|
41
|
+
easing: easing
|
|
42
|
+
}), target._symbolEnd.setAttributes({
|
|
43
|
+
scaleX: 0,
|
|
44
|
+
scaleY: 0
|
|
45
|
+
}), animator.animate(target._symbolEnd, {
|
|
46
|
+
type: "to",
|
|
47
|
+
to: {
|
|
48
|
+
scaleX: 1,
|
|
49
|
+
scaleY: 1
|
|
50
|
+
},
|
|
51
|
+
duration: 2 * symbolTime,
|
|
52
|
+
delay: 8 * symbolTime,
|
|
53
|
+
easing: easing
|
|
54
|
+
}), target._line.setAttributes({
|
|
55
|
+
clipRange: 0
|
|
56
|
+
}), animator.animate(target._line, {
|
|
57
|
+
type: "to",
|
|
58
|
+
to: {
|
|
59
|
+
clipRange: 1
|
|
60
|
+
},
|
|
61
|
+
duration: 9 * symbolTime,
|
|
62
|
+
easing: easing
|
|
63
|
+
}), "typewriter" === titleType) {
|
|
64
|
+
const titleTopText = target._titleTop.attribute.text;
|
|
65
|
+
target._titleTop.setAttributes({
|
|
66
|
+
text: ""
|
|
67
|
+
}), animator.animate(target._titleTop, {
|
|
68
|
+
type: "custom",
|
|
69
|
+
delay: 5 * symbolTime,
|
|
70
|
+
duration: 4 * symbolTime,
|
|
71
|
+
easing: "linear",
|
|
72
|
+
to: {
|
|
73
|
+
text: titleTopText
|
|
74
|
+
},
|
|
75
|
+
custom: input_text_1.InputText
|
|
76
|
+
});
|
|
77
|
+
const titleBottomText = target._titleBottom.attribute.text;
|
|
78
|
+
target._titleBottom.setAttributes({
|
|
79
|
+
text: ""
|
|
80
|
+
}), animator.animate(target._titleBottom, {
|
|
81
|
+
type: "custom",
|
|
82
|
+
delay: 5 * symbolTime,
|
|
83
|
+
duration: 4 * symbolTime,
|
|
84
|
+
easing: "linear",
|
|
85
|
+
to: {
|
|
86
|
+
text: titleBottomText
|
|
87
|
+
},
|
|
88
|
+
custom: input_text_1.InputText
|
|
89
|
+
});
|
|
90
|
+
} else target._titleTop.setAttributes({
|
|
91
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
92
|
+
}), animator.animate(target._titleTop, {
|
|
93
|
+
type: "to",
|
|
94
|
+
to: {
|
|
95
|
+
dy: 0
|
|
96
|
+
},
|
|
97
|
+
delay: 5 * symbolTime,
|
|
98
|
+
duration: 4 * symbolTime,
|
|
99
|
+
easing: "linear"
|
|
100
|
+
}), target._titleBottom.setAttributes({
|
|
101
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
102
|
+
}), animator.animate(target._titleBottom, {
|
|
103
|
+
type: "to",
|
|
104
|
+
to: {
|
|
105
|
+
dy: 0
|
|
106
|
+
},
|
|
107
|
+
delay: 5 * symbolTime,
|
|
108
|
+
duration: 4 * symbolTime,
|
|
109
|
+
easing: "linear"
|
|
110
|
+
});
|
|
111
|
+
"scale" === titlePanelType ? [ target._titleTopPanel, target._titleBottomPanel ].forEach((panel => {
|
|
112
|
+
var _a;
|
|
113
|
+
const scaleX = null !== (_a = panel.attribute.scaleX) && void 0 !== _a ? _a : 1;
|
|
114
|
+
panel.setAttributes({
|
|
115
|
+
scaleX: 0
|
|
116
|
+
}), animator.animate(panel, {
|
|
117
|
+
type: "to",
|
|
118
|
+
to: {
|
|
119
|
+
scaleX: scaleX
|
|
120
|
+
},
|
|
121
|
+
duration: duration,
|
|
122
|
+
easing: easing
|
|
123
|
+
});
|
|
124
|
+
})) : "stroke" === titlePanelType && [ target._titleTopPanel, target._titleBottomPanel ].forEach((panel => {
|
|
125
|
+
const b = panel.AABBBounds, totalLen = 2 * (b.width() + b.height());
|
|
126
|
+
panel.setAttributes({
|
|
127
|
+
lineDash: [ 0, 10 * totalLen ]
|
|
128
|
+
}), animator.animate(panel, {
|
|
129
|
+
type: "to",
|
|
130
|
+
to: {
|
|
131
|
+
lineDash: [ totalLen, 10 * totalLen ]
|
|
132
|
+
},
|
|
133
|
+
duration: duration,
|
|
134
|
+
easing: easing
|
|
135
|
+
});
|
|
136
|
+
})), this.completeBind(animator);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
exports.LabelItemAppear = LabelItemAppear;
|
|
141
|
+
|
|
142
|
+
class LabelItemDisappear extends custom_animate_1.AComponentAnimate {
|
|
143
|
+
onBind() {
|
|
144
|
+
super.onBind();
|
|
145
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
146
|
+
this._animator = animator;
|
|
147
|
+
const duration = this.duration, easing = this.easing, target = this.target, {mode: mode} = this.params;
|
|
148
|
+
"scale" === mode ? animator.animate(target._symbolStart, {
|
|
149
|
+
type: "to",
|
|
150
|
+
to: {
|
|
151
|
+
scaleX: 0,
|
|
152
|
+
scaleY: 0
|
|
153
|
+
},
|
|
154
|
+
duration: duration,
|
|
155
|
+
easing: easing
|
|
156
|
+
}) : (animator.animate(target._line, {
|
|
157
|
+
type: "to",
|
|
158
|
+
to: {
|
|
159
|
+
clipRange: 0
|
|
160
|
+
},
|
|
161
|
+
duration: duration,
|
|
162
|
+
easing: easing
|
|
163
|
+
}), animator.animate(target._symbolStart, {
|
|
164
|
+
type: "to",
|
|
165
|
+
to: {
|
|
166
|
+
scaleX: 0,
|
|
167
|
+
scaleY: 0
|
|
168
|
+
},
|
|
169
|
+
duration: duration / 2,
|
|
170
|
+
delay: duration / 2,
|
|
171
|
+
easing: easing
|
|
172
|
+
}), animator.animate(target._symbolEnd, {
|
|
173
|
+
type: "to",
|
|
174
|
+
to: {
|
|
175
|
+
scaleX: 0,
|
|
176
|
+
scaleY: 0
|
|
177
|
+
},
|
|
178
|
+
duration: duration,
|
|
179
|
+
easing: easing
|
|
180
|
+
}), animator.animate(target._titleTop, {
|
|
181
|
+
type: "to",
|
|
182
|
+
to: {
|
|
183
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
184
|
+
},
|
|
185
|
+
duration: duration / 2,
|
|
186
|
+
easing: easing
|
|
187
|
+
}), animator.animate(target._titleBottom, {
|
|
188
|
+
type: "to",
|
|
189
|
+
to: {
|
|
190
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
191
|
+
},
|
|
192
|
+
duration: duration / 2,
|
|
193
|
+
easing: easing
|
|
194
|
+
}), animator.animate(target._symbolStartOuter, {
|
|
195
|
+
type: "to",
|
|
196
|
+
to: {
|
|
197
|
+
clipRange: 0
|
|
198
|
+
},
|
|
199
|
+
duration: duration / 2,
|
|
200
|
+
delay: duration / 2,
|
|
201
|
+
easing: easing
|
|
202
|
+
}), animator.animate(target._titleTopPanel, {
|
|
203
|
+
type: "to",
|
|
204
|
+
to: {
|
|
205
|
+
scaleX: 0
|
|
206
|
+
},
|
|
207
|
+
duration: duration,
|
|
208
|
+
easing: easing
|
|
209
|
+
}), animator.animate(target._titleBottomPanel, {
|
|
210
|
+
type: "to",
|
|
211
|
+
to: {
|
|
212
|
+
scaleX: 0
|
|
213
|
+
},
|
|
214
|
+
duration: duration,
|
|
215
|
+
easing: easing
|
|
216
|
+
})), this.completeBind(animator);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
exports.LabelItemDisappear = LabelItemDisappear;
|
|
221
|
+
//# sourceMappingURL=label-item-animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/label-item-animate.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,4CAAuD;AACvD,6CAAyC;AAKzC,MAAa,eAAgB,SAAQ,kCAAsB;IACzD,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GA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AC;CACF;AAjFD,gDAiFC","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 {};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.multiToOneMorph = exports.splitGraphic = exports.cloneGraphic = exports.MultiToOneMorphingPath = exports.oneToMultiMorph = exports.morphPath = exports.MorphingPath = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), morphing_1 = require("../config/morphing"), transform_1 = require("../utils/transform"), interpolateOtherAttrs = (attrs, out, ratio) => {
|
|
8
|
+
attrs.forEach((entry => {
|
|
9
|
+
if (Number.isFinite(entry.to)) out[entry.key] = entry.from + (entry.to - entry.from) * ratio; else if ("fill" === entry.key || "stroke" === entry.key) {
|
|
10
|
+
const color = (0, vrender_core_1.interpolateColor)(entry.from, entry.to, ratio, !1);
|
|
11
|
+
color && (out[entry.key] = color);
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
}, interpolateMorphingData = (morphingData, path, ratio) => {
|
|
15
|
+
const tmpArr = [], newCp = [];
|
|
16
|
+
path.clear();
|
|
17
|
+
for (let i = 0; i < morphingData.length; i++) {
|
|
18
|
+
const item = morphingData[i], from = item.from, to = item.to, angle = item.rotation * ratio, fromCp = item.fromCp, toCp = item.toCp, sa = Math.sin(angle), ca = Math.cos(angle);
|
|
19
|
+
newCp[0] = fromCp[0] + (toCp[0] - fromCp[0]) * ratio, newCp[1] = fromCp[1] + (toCp[1] - fromCp[1]) * ratio;
|
|
20
|
+
for (let m = 0; m < from.length; m += 2) {
|
|
21
|
+
const x0 = from[m], y0 = from[m + 1], x = x0 * (1 - ratio) + to[m] * ratio, y = y0 * (1 - ratio) + to[m + 1] * ratio;
|
|
22
|
+
tmpArr[m] = x * ca - y * sa + newCp[0], tmpArr[m + 1] = x * sa + y * ca + newCp[1];
|
|
23
|
+
}
|
|
24
|
+
let x0 = tmpArr[0], y0 = tmpArr[1];
|
|
25
|
+
path.moveTo(x0, y0);
|
|
26
|
+
for (let m = 2; m < from.length; m += 6) {
|
|
27
|
+
const x1 = tmpArr[m], y1 = tmpArr[m + 1], x2 = tmpArr[m + 2], y2 = tmpArr[m + 3], x3 = tmpArr[m + 4], y3 = tmpArr[m + 5];
|
|
28
|
+
x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3 ? path.lineTo(x3, y3) : path.bezierCurveTo(x1, y1, x2, y2, x3, y3),
|
|
29
|
+
x0 = x3, y0 = y3;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, parseMorphingData = (fromPath, toPath, config) => {
|
|
33
|
+
const fromBezier = fromPath ? (0, vrender_core_1.pathToBezierCurves)(fromPath) : [], toBezier = (0,
|
|
34
|
+
vrender_core_1.pathToBezierCurves)(toPath);
|
|
35
|
+
config && fromBezier && (config.fromTransform && (0, vrender_core_1.applyTransformOnBezierCurves)(fromBezier, config.fromTransform.clone().getInverse()),
|
|
36
|
+
(0, vrender_core_1.applyTransformOnBezierCurves)(fromBezier, config.toTransfrom));
|
|
37
|
+
const [fromBezierCurves, toBezierCurves] = (0, vrender_core_1.alignBezierCurves)(fromBezier, toBezier);
|
|
38
|
+
return fromPath ? (0, vrender_core_1.findBestMorphingRotation)(fromBezierCurves, toBezierCurves, 10, Math.PI) : toBezierCurves.map(((to, index) => ({
|
|
39
|
+
from: fromBezierCurves[index],
|
|
40
|
+
to: to,
|
|
41
|
+
fromCp: [ 0, 0 ],
|
|
42
|
+
toCp: [ 0, 0 ],
|
|
43
|
+
rotation: 0
|
|
44
|
+
})));
|
|
45
|
+
}, validateOtherAttrs = [ "fill", "fillOpacity", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "stroke", "strokeOpacity", "lineDashOffset" ], parseOtherAnimateAttrs = (fromAttrs, toAttrs) => {
|
|
46
|
+
if (!fromAttrs || !toAttrs) return null;
|
|
47
|
+
const res = [];
|
|
48
|
+
let hasAttr = !1;
|
|
49
|
+
return Object.keys(fromAttrs).forEach((fromKey => {
|
|
50
|
+
if (!validateOtherAttrs.includes(fromKey)) return;
|
|
51
|
+
const toValue = toAttrs[fromKey];
|
|
52
|
+
if (!(0, vutils_1.isNil)(toValue) && !(0, vutils_1.isNil)(fromAttrs[fromKey]) && toValue !== fromAttrs[fromKey]) {
|
|
53
|
+
if ("fill" === fromKey || "stroke" === fromKey) {
|
|
54
|
+
const parseColor = color => "string" == typeof color ? vrender_core_1.ColorStore.Get(color, vrender_core_1.ColorType.Color255) : color;
|
|
55
|
+
res.push({
|
|
56
|
+
from: (0, vutils_1.isArray)(fromAttrs[fromKey]) ? fromAttrs[fromKey].map(parseColor) : parseColor(fromAttrs[fromKey]),
|
|
57
|
+
to: (0, vutils_1.isArray)(toValue) ? toValue.map(parseColor) : parseColor(toValue),
|
|
58
|
+
key: fromKey
|
|
59
|
+
});
|
|
60
|
+
} else res.push({
|
|
61
|
+
from: fromAttrs[fromKey],
|
|
62
|
+
to: toValue,
|
|
63
|
+
key: fromKey
|
|
64
|
+
});
|
|
65
|
+
hasAttr = !0;
|
|
66
|
+
}
|
|
67
|
+
})), hasAttr ? res : null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
class MorphingPath extends custom_animate_1.ACustomAnimate {
|
|
71
|
+
constructor(config, duration, easing) {
|
|
72
|
+
super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs,
|
|
73
|
+
this.saveOnEnd = config.saveOnEnd;
|
|
74
|
+
}
|
|
75
|
+
getEndProps() {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
onBind() {
|
|
79
|
+
this.target.createPathProxy(), this.onUpdate(!1, 0, this.target.attribute);
|
|
80
|
+
}
|
|
81
|
+
onEnd() {}
|
|
82
|
+
onUpdate(end, ratio, out) {
|
|
83
|
+
const target = this.target, pathProxy = "function" == typeof target.pathProxy ? target.pathProxy(target.attribute) : target.pathProxy;
|
|
84
|
+
interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio),
|
|
85
|
+
this.target.setAttributes(out), end && !this.saveOnEnd && (this.target.pathProxy = null);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
exports.MorphingPath = MorphingPath;
|
|
90
|
+
|
|
91
|
+
const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
|
|
92
|
+
var _a, _b, _c;
|
|
93
|
+
if (fromGraphic && (!fromGraphic.valid || !fromGraphic.toCustomPath)) return __DEV__ && console.error(fromGraphic, " is not validate"),
|
|
94
|
+
null;
|
|
95
|
+
if (!toGraphic.valid || !toGraphic.toCustomPath) return __DEV__ && console.error(toGraphic, " is not validate"),
|
|
96
|
+
null;
|
|
97
|
+
let fromTransform = null == fromGraphic ? void 0 : fromGraphic.globalTransMatrix;
|
|
98
|
+
fromGraphicTransform && fromTransform && (fromTransform = fromGraphicTransform.clone().multiply(fromTransform.a, fromTransform.b, fromTransform.c, fromTransform.d, fromTransform.e, fromTransform.f));
|
|
99
|
+
const morphingData = parseMorphingData(null === (_a = null == fromGraphic ? void 0 : fromGraphic.toCustomPath) || void 0 === _a ? void 0 : _a.call(fromGraphic), toGraphic.toCustomPath(), {
|
|
100
|
+
fromTransform: fromTransform,
|
|
101
|
+
toTransfrom: toGraphic.globalTransMatrix
|
|
102
|
+
}), attrs = parseOtherAnimateAttrs(null == fromGraphic ? void 0 : fromGraphic.attribute, toGraphic.attribute), animate = toGraphic.animate(animationConfig);
|
|
103
|
+
(null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay);
|
|
104
|
+
const morphingPath = new MorphingPath({
|
|
105
|
+
morphingData: morphingData,
|
|
106
|
+
otherAttrs: attrs
|
|
107
|
+
}, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing);
|
|
108
|
+
return animate.play(morphingPath), animate;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
exports.morphPath = morphPath;
|
|
112
|
+
|
|
113
|
+
const oneToMultiMorph = (fromGraphic, toGraphics, animationConfig) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const validateToGraphics = toGraphics.filter((graphic => graphic && graphic.toCustomPath && graphic.valid));
|
|
116
|
+
validateToGraphics.length || __DEV__ && console.error(validateToGraphics, " is not validate"),
|
|
117
|
+
fromGraphic.valid && fromGraphic.toCustomPath || __DEV__ && console.error(fromGraphic, " is not validate");
|
|
118
|
+
const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? exports.cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : exports.splitGraphic)(fromGraphic, validateToGraphics.length, !1), oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd;
|
|
119
|
+
let count = validateToGraphics.length;
|
|
120
|
+
const onEachEnd = () => {
|
|
121
|
+
count--, 0 === count && oldOnEnd && oldOnEnd();
|
|
122
|
+
};
|
|
123
|
+
validateToGraphics.forEach(((toChild, index) => {
|
|
124
|
+
var _a;
|
|
125
|
+
const fromChild = childGraphics[index], delay = (null !== (_a = null == animationConfig ? void 0 : animationConfig.delay) && void 0 !== _a ? _a : 0) + ((null == animationConfig ? void 0 : animationConfig.individualDelay) ? animationConfig.individualDelay(index, validateToGraphics.length, fromChild, toChild) : 0);
|
|
126
|
+
(0, exports.morphPath)(fromChild, toChild, Object.assign({}, animationConfig, {
|
|
127
|
+
onEnd: onEachEnd,
|
|
128
|
+
delay: delay
|
|
129
|
+
}), fromGraphic.globalTransMatrix);
|
|
130
|
+
}));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
exports.oneToMultiMorph = oneToMultiMorph;
|
|
134
|
+
|
|
135
|
+
class MultiToOneMorphingPath extends custom_animate_1.ACustomAnimate {
|
|
136
|
+
constructor(config, duration, easing) {
|
|
137
|
+
super({}, {}, duration, easing), this.morphingData = config.morphingData, this.otherAttrs = config.otherAttrs;
|
|
138
|
+
}
|
|
139
|
+
getEndProps() {
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
onBind() {
|
|
143
|
+
this.addPathProxy();
|
|
144
|
+
}
|
|
145
|
+
addPathProxy() {
|
|
146
|
+
this.target.shadowRoot.forEachChildren((child => {
|
|
147
|
+
child.createPathProxy();
|
|
148
|
+
})), this.onUpdate(!1, 0, this.target.attribute);
|
|
149
|
+
}
|
|
150
|
+
clearPathProxy() {
|
|
151
|
+
this.target.shadowRoot.forEachChildren((child => {
|
|
152
|
+
child.pathProxy = null;
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
onEnd() {}
|
|
156
|
+
onUpdate(end, ratio, out) {
|
|
157
|
+
this.target.shadowRoot.forEachChildren(((child, index) => {
|
|
158
|
+
var _a;
|
|
159
|
+
interpolateMorphingData(this.morphingData[index], "function" == typeof child.pathProxy ? child.pathProxy(child.attribute) : child.pathProxy, ratio),
|
|
160
|
+
(null === (_a = this.otherAttrs) || void 0 === _a ? void 0 : _a[index]) && this.otherAttrs[index].length && interpolateOtherAttrs(this.otherAttrs[index], child.attribute, ratio);
|
|
161
|
+
})), end && (this.clearPathProxy(), this.morphingData = null);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
exports.MultiToOneMorphingPath = MultiToOneMorphingPath;
|
|
166
|
+
|
|
167
|
+
const parseShadowChildAttrs = graphicAttrs => {
|
|
168
|
+
const attrs = {};
|
|
169
|
+
return Object.keys(graphicAttrs).forEach((key => {
|
|
170
|
+
(0, transform_1.isTransformKey)(key) || (attrs[key] = graphicAttrs[key]);
|
|
171
|
+
})), attrs;
|
|
172
|
+
}, appendShadowChildrenToGraphic = (graphic, children, count) => {
|
|
173
|
+
const childAttrs = parseShadowChildAttrs(graphic.attribute), shadowRoot = graphic.attachShadow();
|
|
174
|
+
if (children.length) shadowRoot.setTheme({
|
|
175
|
+
[children[0].type]: childAttrs
|
|
176
|
+
}), children.forEach((element => {
|
|
177
|
+
element.setAttributes({
|
|
178
|
+
pickable: !1
|
|
179
|
+
}), shadowRoot.appendChild(element);
|
|
180
|
+
})); else {
|
|
181
|
+
const box = graphic.AABBBounds, width = box.width(), height = box.height();
|
|
182
|
+
shadowRoot.setTheme({
|
|
183
|
+
rect: childAttrs
|
|
184
|
+
}), new Array(count).fill(0).forEach((el => {
|
|
185
|
+
const child = vrender_core_1.application.graphicService.creator.rect({
|
|
186
|
+
x: 0,
|
|
187
|
+
y: 0,
|
|
188
|
+
width: width,
|
|
189
|
+
height: height,
|
|
190
|
+
pickable: !1
|
|
191
|
+
});
|
|
192
|
+
shadowRoot.appendChild(child), children.push(child);
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
}, cloneGraphic = (graphic, count, needAppend) => {
|
|
196
|
+
const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute), path = graphic.toCustomPath();
|
|
197
|
+
for (let i = 0; i < count; i++) {
|
|
198
|
+
const element = {
|
|
199
|
+
path: (new vrender_core_1.CustomPath2D).fromCustomPath2D(path)
|
|
200
|
+
};
|
|
201
|
+
children.push(vrender_core_1.application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
202
|
+
}
|
|
203
|
+
return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
exports.cloneGraphic = cloneGraphic;
|
|
207
|
+
|
|
208
|
+
const splitGraphic = (graphic, count, needAppend) => {
|
|
209
|
+
const children = [], childAttrs = needAppend ? null : parseShadowChildAttrs(graphic.attribute);
|
|
210
|
+
if ("rect" === graphic.type) {
|
|
211
|
+
(0, vrender_core_1.splitRect)(graphic, count).forEach((element => {
|
|
212
|
+
children.push(vrender_core_1.application.graphicService.creator.rect(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
213
|
+
}));
|
|
214
|
+
} else if ("arc" === graphic.type) {
|
|
215
|
+
(0, vrender_core_1.splitArc)(graphic, count).forEach((element => {
|
|
216
|
+
children.push(vrender_core_1.application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
217
|
+
}));
|
|
218
|
+
} else if ("circle" === graphic.type) {
|
|
219
|
+
(0, vrender_core_1.splitCircle)(graphic, count).forEach((element => {
|
|
220
|
+
children.push(vrender_core_1.application.graphicService.creator.arc(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
221
|
+
}));
|
|
222
|
+
} else if ("line" === graphic.type) {
|
|
223
|
+
const childrenAttrs = (0, vrender_core_1.splitLine)(graphic, count), defaultSymbol = {
|
|
224
|
+
size: 10,
|
|
225
|
+
symbolType: "circle"
|
|
226
|
+
};
|
|
227
|
+
childrenAttrs.forEach((element => {
|
|
228
|
+
children.push(vrender_core_1.application.graphicService.creator.symbol(needAppend ? Object.assign({}, element, defaultSymbol) : Object.assign({}, childAttrs, element, defaultSymbol)));
|
|
229
|
+
}));
|
|
230
|
+
} else if ("polygon" === graphic.type) {
|
|
231
|
+
(0, vrender_core_1.splitPolygon)(graphic, count).forEach((element => {
|
|
232
|
+
children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
233
|
+
}));
|
|
234
|
+
} else if ("area" === graphic.type) {
|
|
235
|
+
(0, vrender_core_1.splitArea)(graphic, count).forEach((element => {
|
|
236
|
+
children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
237
|
+
}));
|
|
238
|
+
} else if ("path" === graphic.type) {
|
|
239
|
+
(0, vrender_core_1.splitPath)(graphic, count).forEach((element => {
|
|
240
|
+
"path" in element ? children.push(vrender_core_1.application.graphicService.creator.path(needAppend ? element : Object.assign({}, childAttrs, element))) : children.push(vrender_core_1.application.graphicService.creator.polygon(needAppend ? element : Object.assign({}, childAttrs, element)));
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
return needAppend && appendShadowChildrenToGraphic(graphic, children, count), children;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
exports.splitGraphic = splitGraphic;
|
|
247
|
+
|
|
248
|
+
const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
|
|
249
|
+
var _a, _b, _c;
|
|
250
|
+
const validateFromGraphics = fromGraphics.filter((graphic => graphic.toCustomPath && graphic.valid));
|
|
251
|
+
validateFromGraphics.length || __DEV__ && console.error(fromGraphics, " is not validate"),
|
|
252
|
+
toGraphic.valid && toGraphic.toCustomPath || __DEV__ && console.error(toGraphic, " is not validate");
|
|
253
|
+
const childGraphics = ("clone" === (null == animationConfig ? void 0 : animationConfig.splitPath) ? exports.cloneGraphic : null !== (_a = null == animationConfig ? void 0 : animationConfig.splitPath) && void 0 !== _a ? _a : exports.splitGraphic)(toGraphic, validateFromGraphics.length, !0), toAttrs = toGraphic.attribute;
|
|
254
|
+
toGraphic.setAttribute("visible", !1);
|
|
255
|
+
const morphingData = validateFromGraphics.map(((graphic, index) => parseMorphingData(graphic.toCustomPath(), childGraphics[index].toCustomPath(), {
|
|
256
|
+
fromTransform: graphic.globalTransMatrix,
|
|
257
|
+
toTransfrom: childGraphics[index].globalTransMatrix
|
|
258
|
+
}))), otherAttrs = validateFromGraphics.map(((graphic, index) => parseOtherAnimateAttrs(graphic.attribute, toAttrs)));
|
|
259
|
+
if (null == animationConfig ? void 0 : animationConfig.individualDelay) {
|
|
260
|
+
const oldOnEnd = animationConfig.onEnd;
|
|
261
|
+
let count = validateFromGraphics.length;
|
|
262
|
+
const onEachEnd = () => {
|
|
263
|
+
count--, 0 === count && (toGraphic.setAttributes({
|
|
264
|
+
visible: !0,
|
|
265
|
+
ratio: null
|
|
266
|
+
}, !1, {
|
|
267
|
+
type: vrender_core_1.AttributeUpdateType.ANIMATE_END
|
|
268
|
+
}), toGraphic.detachShadow(), oldOnEnd && oldOnEnd());
|
|
269
|
+
};
|
|
270
|
+
childGraphics.forEach(((to, index) => {
|
|
271
|
+
var _a, _b, _c;
|
|
272
|
+
const delay = (null !== (_a = animationConfig.delay) && void 0 !== _a ? _a : 0) + animationConfig.individualDelay(index, validateFromGraphics.length, fromGraphics[index], to), animate = to.animate(Object.assign({}, animationConfig, {
|
|
273
|
+
onEnd: onEachEnd
|
|
274
|
+
}));
|
|
275
|
+
animate.wait(delay), animate.play(new MorphingPath({
|
|
276
|
+
morphingData: morphingData[index],
|
|
277
|
+
saveOnEnd: !0,
|
|
278
|
+
otherAttrs: otherAttrs[index]
|
|
279
|
+
}, null !== (_b = animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing));
|
|
280
|
+
}));
|
|
281
|
+
} else {
|
|
282
|
+
const oldOnEnd = null == animationConfig ? void 0 : animationConfig.onEnd, config = animationConfig ? Object.assign({}, animationConfig) : {};
|
|
283
|
+
config.onEnd = () => {
|
|
284
|
+
toGraphic.setAttribute("visible", !0, !1, {
|
|
285
|
+
type: vrender_core_1.AttributeUpdateType.ANIMATE_END
|
|
286
|
+
}), toGraphic.detachShadow(), oldOnEnd && oldOnEnd();
|
|
287
|
+
};
|
|
288
|
+
const animate = toGraphic.animate(config);
|
|
289
|
+
(null == animationConfig ? void 0 : animationConfig.delay) && animate.wait(animationConfig.delay),
|
|
290
|
+
animate.play(new MultiToOneMorphingPath({
|
|
291
|
+
morphingData: morphingData,
|
|
292
|
+
otherAttrs: otherAttrs
|
|
293
|
+
}, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : morphing_1.DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : morphing_1.DefaultMorphingAnimateConfig.easing));
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
exports.multiToOneMorph = multiToOneMorph;
|
|
298
|
+
//# sourceMappingURL=morphing.js.map
|