@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/clip.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EasingType } from '
|
|
1
|
+
import type { EasingType } from '@visactor/vrender-core';
|
|
2
2
|
import { CommonIn, CommonOut } from './common';
|
|
3
3
|
export interface IScaleAnimationOptions {
|
|
4
4
|
direction?: 'x' | 'y' | 'xy';
|
|
@@ -6,6 +6,7 @@ export interface IScaleAnimationOptions {
|
|
|
6
6
|
export declare class ClipIn extends CommonIn {
|
|
7
7
|
valid: boolean;
|
|
8
8
|
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
9
|
+
onFirstRun(): void;
|
|
9
10
|
}
|
|
10
11
|
export declare class ClipOut extends CommonOut {
|
|
11
12
|
valid: boolean;
|
package/es/custom/clip.js
CHANGED
|
@@ -2,7 +2,15 @@ import { CommonIn, CommonOut } from "./common";
|
|
|
2
2
|
|
|
3
3
|
export class ClipIn extends CommonIn {
|
|
4
4
|
constructor(from, to, duration, easing, params) {
|
|
5
|
-
super(from, to, duration, easing, params), this.keys = [ "clipRange" ]
|
|
5
|
+
super(from, to, duration, easing, params), this.keys = [ "clipRange" ], this.from = {
|
|
6
|
+
clipRange: 0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
onFirstRun() {
|
|
10
|
+
var _a;
|
|
11
|
+
super.onFirstRun();
|
|
12
|
+
const {clipDimension: clipDimension} = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || {};
|
|
13
|
+
clipDimension && (this.target.attribute.clipRangeByDimension = clipDimension);
|
|
6
14
|
}
|
|
7
15
|
}
|
|
8
16
|
|
package/es/custom/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/clip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAGlC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/custom/clip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAGlC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAC/B,CAAC;IACD,UAAU;;QACR,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,EAAE,aAAa,EAAE,GAAG,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,KAAI,EAAE,CAAC;QAErD,IAAI,aAAa,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC,oBAAoB,GAAG,aAAa,CAAC;SACrE;IACH,CAAC;CACF;AAED,MAAM,OAAO,OAAQ,SAAQ,SAAS;IAGpC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;CACF","file":"clip.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport { CommonIn, CommonOut } from './common';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport class ClipIn extends CommonIn {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n this.keys = ['clipRange'];\n this.from = { clipRange: 0 };\n }\n onFirstRun(): void {\n super.onFirstRun();\n const { clipDimension } = this.params?.options || {};\n // 需要设置clipRangeByDimension\n if (clipDimension) {\n (this.target.attribute as any).clipRangeByDimension = clipDimension;\n }\n }\n}\n\nexport class ClipOut extends CommonOut {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n this.keys = ['clipRange'];\n }\n}\n"]}
|
package/es/custom/common.d.ts
CHANGED
|
@@ -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 interface IScaleAnimationOptions {
|
|
5
4
|
direction?: 'x' | 'y' | 'xy';
|
|
@@ -9,7 +8,6 @@ export declare class CommonIn extends ACustomAnimate<Record<string, number>> {
|
|
|
9
8
|
keys: string[];
|
|
10
9
|
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
11
10
|
onBind(): void;
|
|
12
|
-
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
13
11
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
14
12
|
}
|
|
15
13
|
export declare class CommonOut extends ACustomAnimate<Record<string, number>> {
|
package/es/custom/common.js
CHANGED
|
@@ -5,22 +5,23 @@ export class CommonIn extends ACustomAnimate {
|
|
|
5
5
|
super(from, to, duration, easing, params);
|
|
6
6
|
}
|
|
7
7
|
onBind() {
|
|
8
|
-
var _a;
|
|
9
|
-
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
super.onBind();
|
|
10
|
+
const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {}, to = {}, from = null !== (_b = this.from) && void 0 !== _b ? _b : {};
|
|
10
11
|
this.keys.forEach((key => {
|
|
11
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
12
13
|
to[key] = null !== (_a = null == attrs ? void 0 : attrs[key]) && void 0 !== _a ? _a : 1,
|
|
13
|
-
from[key] = null !== (
|
|
14
|
-
}))
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
super.onEnd(cb);
|
|
14
|
+
from[key] = null !== (_c = null !== (_b = from[key]) && void 0 !== _b ? _b : fromAttrs[key]) && void 0 !== _c ? _c : 0;
|
|
15
|
+
}));
|
|
16
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
17
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.props = to, this.propKeys = this.keys,
|
|
18
|
+
this.from = from, this.to = to, !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
|
|
19
19
|
}
|
|
20
20
|
onUpdate(end, ratio, out) {
|
|
21
|
+
const attribute = this.target.attribute;
|
|
21
22
|
this.propKeys.forEach((key => {
|
|
22
|
-
|
|
23
|
-
})), this.target.
|
|
23
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
24
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -29,20 +30,23 @@ export class CommonOut extends ACustomAnimate {
|
|
|
29
30
|
super(from, to, duration, easing, params);
|
|
30
31
|
}
|
|
31
32
|
onBind() {
|
|
32
|
-
|
|
33
|
+
super.onBind();
|
|
34
|
+
const attrs = this.target.attribute, to = {}, from = {};
|
|
33
35
|
this.keys.forEach((key => {
|
|
34
36
|
var _a;
|
|
35
|
-
to[key] = 0, from[key] = null !== (_a =
|
|
36
|
-
})), this.props = to, this.propKeys = this.keys, this.
|
|
37
|
-
this.
|
|
37
|
+
to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
|
|
38
|
+
})), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to,
|
|
39
|
+
Object.assign(this.target.attribute, from), this.target.addUpdatePositionTag(),
|
|
40
|
+
this.target.addUpdateBoundTag();
|
|
38
41
|
}
|
|
39
42
|
onEnd(cb) {
|
|
40
43
|
super.onEnd(cb);
|
|
41
44
|
}
|
|
42
45
|
onUpdate(end, ratio, out) {
|
|
46
|
+
const attribute = this.target.attribute;
|
|
43
47
|
this.propKeys.forEach((key => {
|
|
44
|
-
|
|
45
|
-
})), this.target.
|
|
48
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
49
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
//# sourceMappingURL=common.js.map
|
package/es/custom/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/custom/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,MAAM,OAAO,QAAS,SAAQ,cAA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AC;QAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAElC,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":"common.js","sourcesContent":["import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport class CommonIn extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n keys: string[];\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const attrs = this.target.getFinalAttribute();\n const fromAttrs: Record<string, any> = this.target.attribute ?? {};\n\n const to: Record<string, number> = {};\n const from: Record<string, number> = this.from ?? {};\n this.keys.forEach(key => {\n to[key] = attrs?.[key] ?? 1;\n from[key] = from[key] ?? fromAttrs[key] ?? 0;\n });\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n\n this.props = to;\n this.propKeys = this.keys;\n this.from = from;\n this.to = to;\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\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 CommonOut extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n keys: string[];\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const attrs: Record<string, any> = this.target.attribute;\n\n const to: Record<string, number> = {};\n const from: Record<string, number> = {};\n this.keys.forEach(key => {\n to[key] = 0;\n from[key] = attrs[key] ?? 1;\n });\n\n this.props = to;\n this.propKeys = this.keys;\n this.from = from;\n this.to = to;\n\n Object.assign(this.target.attribute, from);\n this.target.addUpdatePositionTag();\n this.target.addUpdateBoundTag();\n // this.target.setAttributes(from as any);\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,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { EasingType } from '
|
|
3
|
-
import type { IAnimateStepType } from '../intreface/type';
|
|
1
|
+
import type { ComponentAnimator } from '../component';
|
|
2
|
+
import type { EasingType, IAnimateStepType, ICustomAnimate } from '@visactor/vrender-core';
|
|
4
3
|
import { Step } from '../step';
|
|
5
4
|
export declare abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {
|
|
6
5
|
type: IAnimateStepType;
|
|
@@ -13,3 +12,8 @@ export declare abstract class ACustomAnimate<T> extends Step implements ICustomA
|
|
|
13
12
|
update(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
14
13
|
protected setProps(props: T): void;
|
|
15
14
|
}
|
|
15
|
+
export declare abstract class AComponentAnimate<T> extends ACustomAnimate<T> {
|
|
16
|
+
protected _animator: ComponentAnimator;
|
|
17
|
+
completeBind(animator: ComponentAnimator): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
}
|
|
@@ -8,10 +8,19 @@ export class ACustomAnimate extends Step {
|
|
|
8
8
|
update(end, ratio, out) {
|
|
9
9
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
10
10
|
const easedRatio = this.easing(ratio);
|
|
11
|
-
this.onUpdate(end, easedRatio, out);
|
|
11
|
+
this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
12
12
|
}
|
|
13
13
|
setProps(props) {
|
|
14
14
|
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
export class AComponentAnimate extends ACustomAnimate {
|
|
19
|
+
completeBind(animator) {
|
|
20
|
+
this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration());
|
|
21
|
+
}
|
|
22
|
+
stop() {
|
|
23
|
+
this._animator && this._animator.stop();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
//# sourceMappingURL=custom-animate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/custom-animate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/custom/custom-animate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,OAAgB,cAAkB,SAAQ,IAAI;IAUlD,YAAY,UAAa,EAAE,QAAW,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QACxF,KAAK,CAAC,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAVrD,SAAI,GAAqB,eAAe,CAAC;QAWvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAE1D,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,OAAO;SACR;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAES,QAAQ,CAAC,KAAQ;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAgB,iBAAqB,SAAQ,cAAiB;IAGlE,YAAY,CAAC,QAA2B;QACtC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI;QACF,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF","file":"custom-animate.js","sourcesContent":["import type { ComponentAnimator } from '../component';\nimport type { EasingType, IAnimateStepType, ICustomAnimate } from '@visactor/vrender-core';\nimport { Step } from '../step';\n\nexport abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {\n type: IAnimateStepType = 'customAnimate';\n declare customFrom: T;\n declare params?: any;\n declare props?: T;\n declare from?: T;\n declare to?: T;\n\n // 为了兼容旧的api,from和to是可选的,且尽量不需要From,因为为了避免突变,From都应该从当前位置开始\n // 所以From并不会真正设置到fromProps中,而是作为customFrom参数\n constructor(customFrom: T, customTo: T, duration: number, easing: EasingType, params?: any) {\n super('customAnimate', customTo, duration, easing);\n this.customFrom = customFrom;\n this.params = params;\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n\n protected setProps(props: T) {\n this.props = props;\n this.propKeys = Object.keys(props);\n this.animate.reSyncProps();\n }\n}\n\nexport abstract class AComponentAnimate<T> extends ACustomAnimate<T> {\n protected _animator: ComponentAnimator;\n\n completeBind(animator: ComponentAnimator): void {\n this.setStartTime(0);\n this._animator && this._animator.start();\n this.setDuration(animator.getDuration());\n }\n\n stop(): void {\n this._animator && this._animator.stop();\n }\n}\n"]}
|
package/es/custom/fade.d.ts
CHANGED
package/es/custom/fade.js
CHANGED
|
@@ -2,13 +2,18 @@ import { CommonIn, CommonOut } from "./common";
|
|
|
2
2
|
|
|
3
3
|
export class FadeIn extends CommonIn {
|
|
4
4
|
constructor(from, to, duration, easing, params) {
|
|
5
|
-
super(from, to, duration, easing, params), this.keys = [ "opacity" ]
|
|
5
|
+
super(from, to, duration, easing, params), this.keys = [ "opacity", "fillOpacity", "strokeOpacity" ],
|
|
6
|
+
this.from = {
|
|
7
|
+
opacity: 0,
|
|
8
|
+
fillOpacity: 0,
|
|
9
|
+
strokeOpacity: 0
|
|
10
|
+
};
|
|
6
11
|
}
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
export class FadeOut extends CommonOut {
|
|
10
15
|
constructor(from, to, duration, easing, params) {
|
|
11
|
-
super(from, to, duration, easing, params), this.keys = [ "opacity" ];
|
|
16
|
+
super(from, to, duration, easing, params), this.keys = [ "opacity", "fillOpacity", "strokeOpacity" ];
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
//# sourceMappingURL=fade.js.map
|
package/es/custom/fade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/fade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAGlC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/custom/fade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAGlC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAC/D,CAAC;CACF;AAED,MAAM,OAAO,OAAQ,SAAQ,SAAS;IAGpC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAA+B;QACrG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;CACF","file":"fade.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport { CommonIn, CommonOut } from './common';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport class FadeIn extends CommonIn {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n this.keys = ['opacity', 'fillOpacity', 'strokeOpacity'];\n this.from = { opacity: 0, fillOpacity: 0, strokeOpacity: 0 };\n }\n}\n\nexport class FadeOut extends CommonOut {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n this.keys = ['opacity', 'fillOpacity', 'strokeOpacity'];\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EasingType } from '@visactor/vrender-core';
|
|
2
|
+
import { ACustomAnimate } from './custom-animate';
|
|
3
|
+
export declare class FromTo extends ACustomAnimate<Record<string, number>> {
|
|
4
|
+
valid: boolean;
|
|
5
|
+
keys: string[];
|
|
6
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
7
|
+
onBind(): void;
|
|
8
|
+
onFirstRun(): void;
|
|
9
|
+
update(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
+
|
|
3
|
+
export class FromTo extends ACustomAnimate {
|
|
4
|
+
constructor(from, to, duration, easing, params) {
|
|
5
|
+
super(from, to, duration, easing, params), this.from = null != from ? from : {};
|
|
6
|
+
}
|
|
7
|
+
onBind() {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
super.onBind(), Object.keys(this.from).forEach((key => {
|
|
10
|
+
null == this.props[key] && (this.props[key] = this.target.getGraphicAttribute(key));
|
|
11
|
+
}));
|
|
12
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
13
|
+
"appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) && finalAttribute && this.target.setAttributes(finalAttribute),
|
|
14
|
+
!1 !== (null === (_b = this.params.controlOptions) || void 0 === _b ? void 0 : _b.immediatelyApply) && this.target.setAttributes(this.from);
|
|
15
|
+
}
|
|
16
|
+
onFirstRun() {
|
|
17
|
+
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
18
|
+
const startProps = this.animate.getStartProps();
|
|
19
|
+
this.propKeys && this.propKeys.forEach((key => {
|
|
20
|
+
var _a;
|
|
21
|
+
this.from[key] = null !== (_a = this.from[key]) && void 0 !== _a ? _a : startProps[key];
|
|
22
|
+
})), this.target.setAttributes(this.from);
|
|
23
|
+
}
|
|
24
|
+
update(end, ratio, out) {
|
|
25
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
26
|
+
const easedRatio = this.easing(ratio);
|
|
27
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach(((func, index) => {
|
|
28
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
29
|
+
const key = this.propKeys[index];
|
|
30
|
+
func(key, this.from[key], this.props[key], easedRatio, this, this.target);
|
|
31
|
+
})), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fromTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/fromTo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,MAAO,SAAQ,cAAsC;IAKhE,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QAClF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IACzB,CAAC;IAED,MAAM;;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QAGf,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACnC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;aACxD;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAEvD,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,cAAc,MAAK,QAAQ,EAAE;YACpD,IAAI,cAAc,EAAE;gBA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AC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;oBACjD,OAAO;iBACR;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF","file":"fromTo.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class FromTo extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n keys: string[];\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n this.from = from ?? {};\n }\n\n onBind(): void {\n super.onBind();\n\n // 如果存在from,不存在to,那么需要设置给props\n Object.keys(this.from).forEach(key => {\n if (this.props[key] == null) {\n this.props[key] = this.target.getGraphicAttribute(key);\n }\n });\n\n const finalAttribute = this.target.getFinalAttribute();\n // 如果入场动画,那么需要设置属性\n if (this.target.context?.animationState === 'appear') {\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n }\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(this.from);\n }\n }\n\n onFirstRun(): void {\n // 获取上一步的属性值作为起始值\n this.from = { ...this.getLastProps(), ...this.from };\n const startProps = this.animate.getStartProps();\n this.propKeys &&\n this.propKeys.forEach(key => {\n this.from[key] = this.from[key] ?? startProps[key];\n });\n // TODO:比较hack\n // 如果是入场动画,那么还需要设置属性\n // if (this.target.context?.animationState === 'appear') {\n // // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n // const finalAttribute = this.target.getFinalAttribute();\n // this.target.setAttributes(finalAttribute);\n // }\n this.target.setAttributes(this.from);\n }\n\n /**\n * 更新执行的时候调用\n * 如果跳帧了就不一定会执行\n */\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n // TODO 需要修复,只有在开始的时候才调用\n this.onStart();\n if (!this.props || !this.propKeys) {\n return;\n }\n // 应用缓动函数\n const easedRatio = this.easing(ratio);\n this.animate.interpolateUpdateFunction\n ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target)\n : this.interpolateUpdateFunctions.forEach((func, index) => {\n // 如果这个属性被屏蔽了,直接跳过\n if (!this.animate.validAttr(this.propKeys[index])) {\n return;\n }\n const key = this.propKeys[index];\n const fromValue = this.from[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n this.syncAttributeUpdate();\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EasingType } from '@visactor/vrender-core';
|
|
2
|
+
import { CommonIn, CommonOut } from './common';
|
|
3
|
+
export declare class GroupFadeIn extends CommonIn {
|
|
4
|
+
valid: boolean;
|
|
5
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
6
|
+
}
|
|
7
|
+
export declare class GroupFadeOut extends CommonOut {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonIn, CommonOut } from "./common";
|
|
2
|
+
|
|
3
|
+
export class GroupFadeIn extends CommonIn {
|
|
4
|
+
constructor(from, to, duration, easing, params) {
|
|
5
|
+
super(from, to, duration, easing, params), this.keys = [ "baseOpacity" ], this.from = {
|
|
6
|
+
baseOpacity: 0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class GroupFadeOut extends CommonOut {
|
|
12
|
+
constructor(from, to, duration, easing, params) {
|
|
13
|
+
super(from, to, duration, easing, params), this.keys = [ "baseOpacity" ];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/groupFade.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,OAAO,WAAY,SAAQ,QAAQ;IAGvC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QAClF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,SAAS;IAGzC,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QAClF,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;CACF","file":"groupFade.js","sourcesContent":["import type { EasingType, IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\nimport { CommonIn, CommonOut } from './common';\n\nexport class GroupFadeIn extends CommonIn {\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 this.keys = ['baseOpacity'];\n this.from = { baseOpacity: 0 };\n }\n}\n\nexport class GroupFadeOut extends CommonOut {\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 this.keys = ['baseOpacity'];\n }\n}\n"]}
|
package/es/custom/growAngle.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type IGraphic, type IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import { type IGraphic, type IGroup, type EasingType } from '@visactor/vrender-core';
|
|
3
2
|
import { ACustomAnimate } from './custom-animate';
|
|
4
3
|
interface IAnimationParameters {
|
|
5
4
|
width: number;
|
|
@@ -23,15 +22,21 @@ export interface IGrowAngleAnimationOptions {
|
|
|
23
22
|
}
|
|
24
23
|
export declare const growAngleIn: TypeAnimation<IGraphic>;
|
|
25
24
|
export declare const growAngleOut: TypeAnimation<IGraphic>;
|
|
26
|
-
export declare class
|
|
25
|
+
export declare class GrowAngleBase extends ACustomAnimate<Record<string, number>> {
|
|
27
26
|
valid: boolean;
|
|
27
|
+
_updateFunction: (ratio: number) => void;
|
|
28
28
|
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
29
|
+
determineUpdateFunction(): void;
|
|
30
|
+
deleteSelfAttr(key: string): void;
|
|
31
|
+
updateStartAngle(ratio: number): void;
|
|
32
|
+
updateEndAngle(ratio: number): void;
|
|
33
|
+
updateAngle(ratio: number): void;
|
|
29
34
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
30
35
|
}
|
|
31
|
-
export declare class GrowAngleIn extends
|
|
36
|
+
export declare class GrowAngleIn extends GrowAngleBase {
|
|
32
37
|
onBind(): void;
|
|
33
38
|
}
|
|
34
|
-
export declare class GrowAngleOut extends
|
|
39
|
+
export declare class GrowAngleOut extends GrowAngleBase {
|
|
35
40
|
onBind(): void;
|
|
36
41
|
}
|
|
37
42
|
export {};
|
package/es/custom/growAngle.js
CHANGED
|
@@ -53,7 +53,7 @@ export const growAngleIn = (graphic, options, animationParameters) => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const growAngleOutIndividual = (graphic, options, animationParameters) => {
|
|
56
|
-
const attrs = graphic.
|
|
56
|
+
const attrs = graphic.attribute;
|
|
57
57
|
return options && "anticlockwise" === options.orient ? {
|
|
58
58
|
from: {
|
|
59
59
|
startAngle: attrs.startAngle
|
|
@@ -70,7 +70,7 @@ const growAngleOutIndividual = (graphic, options, animationParameters) => {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
}, growAngleOutOverall = (graphic, options, animationParameters) => {
|
|
73
|
-
const attrs = graphic.
|
|
73
|
+
const attrs = graphic.attribute;
|
|
74
74
|
if (options && "anticlockwise" === options.orient) {
|
|
75
75
|
const overallValue = isNumber(options.overall) ? options.overall : 2 * Math.PI;
|
|
76
76
|
return {
|
|
@@ -102,31 +102,55 @@ export const growAngleOut = (graphic, options, animationParameters) => {
|
|
|
102
102
|
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleOutOverall(graphic, options) : growAngleOutIndividual(graphic, options);
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export class
|
|
105
|
+
export class GrowAngleBase extends ACustomAnimate {
|
|
106
106
|
constructor(from, to, duration, easing, params) {
|
|
107
107
|
super(from, to, duration, easing, params);
|
|
108
108
|
}
|
|
109
|
+
determineUpdateFunction() {
|
|
110
|
+
this.propKeys ? this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this.valid = !1 : this.valid = !1;
|
|
111
|
+
}
|
|
112
|
+
deleteSelfAttr(key) {
|
|
113
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
114
|
+
const index = this.propKeys.indexOf(key);
|
|
115
|
+
-1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this._updateFunction = null;
|
|
116
|
+
}
|
|
117
|
+
updateStartAngle(ratio) {
|
|
118
|
+
this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
|
|
119
|
+
}
|
|
120
|
+
updateEndAngle(ratio) {
|
|
121
|
+
this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
|
|
122
|
+
}
|
|
123
|
+
updateAngle(ratio) {
|
|
124
|
+
this.updateStartAngle(ratio), this.updateEndAngle(ratio);
|
|
125
|
+
}
|
|
109
126
|
onUpdate(end, ratio, out) {
|
|
110
|
-
this.
|
|
111
|
-
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
112
|
-
})), this.target.setAttributes(out);
|
|
127
|
+
this._updateFunction && (this._updateFunction(ratio), this.target.addUpdateShapeAndBoundsTag());
|
|
113
128
|
}
|
|
114
129
|
}
|
|
115
130
|
|
|
116
|
-
export class GrowAngleIn extends
|
|
131
|
+
export class GrowAngleIn extends GrowAngleBase {
|
|
117
132
|
onBind() {
|
|
118
|
-
var _a;
|
|
119
|
-
|
|
133
|
+
var _a, _b;
|
|
134
|
+
super.onBind();
|
|
135
|
+
const {from: from, to: to} = growAngleIn(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;
|
|
120
136
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
121
|
-
this.
|
|
137
|
+
this.from = fromAttrs, this.to = to;
|
|
138
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
139
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs),
|
|
140
|
+
this.determineUpdateFunction();
|
|
122
141
|
}
|
|
123
142
|
}
|
|
124
143
|
|
|
125
|
-
export class GrowAngleOut extends
|
|
144
|
+
export class GrowAngleOut extends GrowAngleBase {
|
|
126
145
|
onBind() {
|
|
127
|
-
|
|
128
|
-
const {from: from, to: to} =
|
|
146
|
+
super.onBind();
|
|
147
|
+
const {from: from, to: to} = (graphic = this.target, options = this.params.options,
|
|
148
|
+
this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleOutOverall(graphic, options) : growAngleOutIndividual(graphic, options));
|
|
149
|
+
var graphic, options, _a;
|
|
150
|
+
const fromAttrs = from;
|
|
129
151
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
130
|
-
this.
|
|
152
|
+
this.from = null != fromAttrs ? fromAttrs : this.target.attribute, this.to = to,
|
|
153
|
+
this.determineUpdateFunction();
|
|
131
154
|
}
|
|
132
|
-
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=growAngle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/growAngle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAsB5C,MAAM,qBAAqB,GAAG,CAC5B,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE;YACrC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,EAA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CAAC,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,mCAAI,IAAI,CAAC;QACxD,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;QAC/D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;CACF","file":"growAngle.js","sourcesContent":["import { type IGraphic, type IGroup } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\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\nconst growAngleInIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs?.endAngle },\n to: { startAngle: attrs?.startAngle }\n };\n }\n return {\n from: { endAngle: attrs?.startAngle },\n to: { endAngle: attrs?.endAngle }\n };\n};\n\nconst growAngleInOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n};\n\nexport const growAngleIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleInOverall(graphic, options, animationParameters)\n : growAngleInIndividual(graphic, options, animationParameters);\n};\n\nconst growAngleOutIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs.startAngle },\n to: { startAngle: attrs?.endAngle }\n };\n }\n return {\n from: { endAngle: attrs.endAngle },\n to: { endAngle: attrs?.startAngle }\n };\n};\n\nconst growAngleOutOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n};\n\nexport const growAngleOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleOutOverall(graphic, options, animationParameters)\n : growAngleOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GworPointsBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n 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\n/**\n * 增长渐入\n */\nexport class GrowAngleIn extends GworPointsBase {\n onBind(): void {\n const { from, to } = growAngleIn(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\nexport class GrowAngleOut extends GworPointsBase {\n onBind(): void {\n const { from, to } = growAngleOut(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"]}
|
|
1
|
+
{"version":3,"sources":["../src/custom/growAngle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAsB5C,MAAM,qBAAqB,GAAG,CAC5B,OAAiB,EACjB,OAAmC,EACnC,mBAAyC,EACzC,EAAE;IACF,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC1C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,eAAe,EAAE;QACjD,OAAO;YAC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C,IAAI,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAK,IAAI,CAAC,MAAM,CAAC,SAAiB,CAAC;QACxD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;CACF","file":"growAngle.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\nconst growAngleInIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs?.endAngle },\n to: { startAngle: attrs?.startAngle }\n };\n }\n return {\n from: { endAngle: attrs?.startAngle },\n to: { endAngle: attrs?.endAngle }\n };\n};\n\nconst growAngleInOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.getFinalAttribute();\n\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: overallValue,\n endAngle: overallValue\n },\n to: {\n startAngle: attrs?.startAngle,\n endAngle: attrs?.endAngle\n }\n };\n};\n\nexport const growAngleIn: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleInOverall(graphic, options, animationParameters)\n : growAngleInIndividual(graphic, options, animationParameters);\n};\n\nconst growAngleOutIndividual = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.attribute as any;\n\n if (options && options.orient === 'anticlockwise') {\n return {\n from: { startAngle: attrs.startAngle },\n to: { startAngle: attrs?.endAngle }\n };\n }\n return {\n from: { endAngle: attrs.endAngle },\n to: { endAngle: attrs?.startAngle }\n };\n};\n\nconst growAngleOutOverall = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const attrs = graphic.attribute as any;\n if (options && options.orient === 'anticlockwise') {\n const overallValue = isNumber(options.overall) ? options.overall : Math.PI * 2;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n }\n const overallValue = isNumber(options?.overall) ? options.overall : 0;\n return {\n from: {\n startAngle: attrs.startAngle,\n endAngle: attrs.endAngle\n },\n to: {\n startAngle: overallValue,\n endAngle: overallValue\n }\n };\n};\n\nexport const growAngleOut: TypeAnimation<IGraphic> = (\n graphic: IGraphic,\n options: IGrowAngleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n return (options?.overall ?? false) !== false\n ? growAngleOutOverall(graphic, options, animationParameters)\n : growAngleOutIndividual(graphic, options, animationParameters);\n};\n\nexport class GrowAngleBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n declare _updateFunction: (ratio: number) => void;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n determineUpdateFunction(): void {\n if (!this.propKeys) {\n this.valid = false;\n } else if (this.propKeys && this.propKeys.length > 1) {\n this._updateFunction = this.updateAngle;\n } else if (this.propKeys[0] === 'startAngle') {\n this._updateFunction = this.updateStartAngle;\n } else if (this.propKeys[0] === 'endAngle') {\n this._updateFunction = this.updateEndAngle;\n } else {\n this.valid = false;\n }\n }\n\n /**\n * 删除自身属性,会直接从props等内容里删除掉\n */\n deleteSelfAttr(key: string): void {\n delete this.props[key];\n // fromProps在动画开始时才会计算,这时可能不在\n this.fromProps && delete this.fromProps[key];\n const index = this.propKeys.indexOf(key);\n if (index !== -1) {\n this.propKeys.splice(index, 1);\n }\n\n if (this.propKeys && this.propKeys.length > 1) {\n this._updateFunction = this.updateAngle;\n } else if (this.propKeys[0] === 'startAngle') {\n this._updateFunction = this.updateStartAngle;\n } else if (this.propKeys[0] === 'endAngle') {\n this._updateFunction = this.updateEndAngle;\n } else {\n this._updateFunction = null;\n }\n }\n\n updateStartAngle(ratio: number): void {\n (this.target.attribute as any).startAngle =\n this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;\n }\n\n updateEndAngle(ratio: number): void {\n (this.target.attribute as any).endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;\n }\n\n updateAngle(ratio: number): void {\n this.updateStartAngle(ratio);\n this.updateEndAngle(ratio);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this._updateFunction) {\n this._updateFunction(ratio);\n this.target.addUpdateShapeAndBoundsTag();\n }\n }\n}\n\n/**\n * 增长渐入\n */\nexport class GrowAngleIn extends GrowAngleBase {\n onBind(): void {\n super.onBind();\n const { from, to } = growAngleIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n\n this.target.setAttributes(fromAttrs);\n this.determineUpdateFunction();\n }\n}\n\nexport class GrowAngleOut extends GrowAngleBase {\n onBind(): void {\n super.onBind();\n const { from, to } = growAngleOut(this.target, this.params.options, this.params);\n const fromAttrs = from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.from = fromAttrs ?? (this.target.attribute as any);\n this.to = to;\n\n // this.target.setAttributes(fromAttrs);\n this.determineUpdateFunction();\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { IAnimate, IStep } from '
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
1
|
+
import type { IAnimate, IStep, EasingType } from '@visactor/vrender-core';
|
|
3
2
|
import { ACustomAnimate } from './custom-animate';
|
|
4
3
|
export declare class GrowCenterIn extends ACustomAnimate<Record<string, number>> {
|
|
5
4
|
valid: boolean;
|
package/es/custom/growCenter.js
CHANGED
|
@@ -67,7 +67,7 @@ const growCenterIn = (graphic, options, animationParameters) => {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}, growCenterOut = (graphic, options, animationParameters) => {
|
|
70
|
-
const attrs = graphic.
|
|
70
|
+
const attrs = graphic.attribute;
|
|
71
71
|
switch (null == options ? void 0 : options.direction) {
|
|
72
72
|
case "x":
|
|
73
73
|
{
|
|
@@ -119,18 +119,22 @@ export class GrowCenterIn extends ACustomAnimate {
|
|
|
119
119
|
super(from, to, duration, easing, params);
|
|
120
120
|
}
|
|
121
121
|
onBind() {
|
|
122
|
-
var _a;
|
|
123
|
-
|
|
122
|
+
var _a, _b;
|
|
123
|
+
super.onBind();
|
|
124
|
+
const {from: from, to: to} = growCenterIn(this.target, this.params.options, this.params), fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
124
125
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
125
|
-
this.
|
|
126
|
+
this.from = fromAttrs, this.to = to;
|
|
127
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
128
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
126
129
|
}
|
|
127
130
|
onEnd(cb) {
|
|
128
131
|
super.onEnd(cb);
|
|
129
132
|
}
|
|
130
133
|
onUpdate(end, ratio, out) {
|
|
134
|
+
const attribute = this.target.attribute;
|
|
131
135
|
this.propKeys.forEach((key => {
|
|
132
|
-
|
|
133
|
-
})), this.target.
|
|
136
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
137
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -139,17 +143,19 @@ export class GrowCenterOut extends ACustomAnimate {
|
|
|
139
143
|
super(from, to, duration, easing, params);
|
|
140
144
|
}
|
|
141
145
|
onBind() {
|
|
142
|
-
|
|
146
|
+
super.onBind();
|
|
147
|
+
const {from: from, to: to} = growCenterOut(this.target, this.params.options, this.params);
|
|
143
148
|
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
144
|
-
this.
|
|
149
|
+
this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
145
150
|
}
|
|
146
151
|
onEnd(cb) {
|
|
147
152
|
super.onEnd(cb);
|
|
148
153
|
}
|
|
149
154
|
onUpdate(end, ratio, out) {
|
|
155
|
+
const attribute = this.target.attribute;
|
|
150
156
|
this.propKeys.forEach((key => {
|
|
151
|
-
|
|
152
|
-
})), this.target.
|
|
157
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
158
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
//# sourceMappingURL=growCenter.js.map
|