@visactor/vrender-animate 0.22.4
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/README.md +177 -0
- package/cjs/animate-extension.d.ts +15 -0
- package/cjs/animate-extension.js +46 -0
- package/cjs/animate-extension.js.map +1 -0
- package/cjs/animate.d.ts +71 -0
- package/cjs/animate.js +210 -0
- package/cjs/animate.js.map +1 -0
- package/cjs/custom/clip-graphic.d.ts +53 -0
- package/cjs/custom/clip-graphic.js +146 -0
- package/cjs/custom/clip-graphic.js.map +1 -0
- package/cjs/custom/clip.d.ts +13 -0
- package/cjs/custom/clip.js +24 -0
- package/cjs/custom/clip.js.map +1 -0
- package/cjs/custom/common.d.ts +22 -0
- package/cjs/custom/common.js +58 -0
- package/cjs/custom/common.js.map +1 -0
- package/cjs/custom/custom-animate.d.ts +15 -0
- package/cjs/custom/custom-animate.js +25 -0
- package/cjs/custom/custom-animate.js.map +1 -0
- package/cjs/custom/fade.d.ts +13 -0
- package/cjs/custom/fade.js +24 -0
- package/cjs/custom/fade.js.map +1 -0
- package/cjs/custom/group-fade.d.ts +16 -0
- package/cjs/custom/group-fade.js +66 -0
- package/cjs/custom/group-fade.js.map +1 -0
- package/cjs/custom/growAngle.d.ts +37 -0
- package/cjs/custom/growAngle.js +140 -0
- package/cjs/custom/growAngle.js.map +1 -0
- package/cjs/custom/growCenter.d.ts +17 -0
- package/cjs/custom/growCenter.js +161 -0
- package/cjs/custom/growCenter.js.map +1 -0
- package/cjs/custom/growHeight.d.ts +36 -0
- package/cjs/custom/growHeight.js +154 -0
- package/cjs/custom/growHeight.js.map +1 -0
- package/cjs/custom/growPoints.d.ts +52 -0
- package/cjs/custom/growPoints.js +227 -0
- package/cjs/custom/growPoints.js.map +1 -0
- package/cjs/custom/growRadius.d.ts +41 -0
- package/cjs/custom/growRadius.js +113 -0
- package/cjs/custom/growRadius.js.map +1 -0
- package/cjs/custom/growWidth.d.ts +36 -0
- package/cjs/custom/growWidth.js +154 -0
- package/cjs/custom/growWidth.js.map +1 -0
- package/cjs/custom/input-text.d.ts +29 -0
- package/cjs/custom/input-text.js +45 -0
- package/cjs/custom/input-text.js.map +1 -0
- package/cjs/custom/number.d.ts +25 -0
- package/cjs/custom/number.js +102 -0
- package/cjs/custom/number.js.map +1 -0
- package/cjs/custom/register.d.ts +1 -0
- package/cjs/custom/register.js +35 -0
- package/cjs/custom/register.js.map +1 -0
- package/cjs/custom/scale-in.d.ts +13 -0
- package/cjs/custom/scale-in.js +57 -0
- package/cjs/custom/scale-in.js.map +1 -0
- package/cjs/custom/scale.d.ts +20 -0
- package/cjs/custom/scale.js +106 -0
- package/cjs/custom/scale.js.map +1 -0
- package/cjs/custom/sphere.d.ts +20 -0
- package/cjs/custom/sphere.js +26 -0
- package/cjs/custom/sphere.js.map +1 -0
- package/cjs/custom/state.d.ts +13 -0
- package/cjs/custom/state.js +25 -0
- package/cjs/custom/state.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +26 -0
- package/cjs/custom/tag-points.js +81 -0
- package/cjs/custom/tag-points.js.map +1 -0
- package/cjs/custom/update.d.ts +14 -0
- package/cjs/custom/update.js +26 -0
- package/cjs/custom/update.js.map +1 -0
- package/cjs/executor/animate-executor.d.ts +36 -0
- package/cjs/executor/animate-executor.js +177 -0
- package/cjs/executor/animate-executor.js.map +1 -0
- package/cjs/executor/executor.d.ts +69 -0
- package/cjs/executor/executor.js +6 -0
- package/cjs/executor/executor.js.map +1 -0
- package/cjs/index.d.ts +25 -0
- package/cjs/index.js +214 -0
- package/cjs/index.js.map +1 -0
- package/cjs/interpolate/executor.d.ts +66 -0
- package/cjs/interpolate/executor.js +6 -0
- package/cjs/interpolate/executor.js.map +1 -0
- package/cjs/interpolate/number.d.ts +1 -0
- package/cjs/interpolate/number.js +10 -0
- package/cjs/interpolate/number.js.map +1 -0
- package/cjs/interpolate/store.d.ts +32 -0
- package/cjs/interpolate/store.js +96 -0
- package/cjs/interpolate/store.js.map +1 -0
- package/cjs/intreface/animate.d.ts +91 -0
- package/cjs/intreface/animate.js +10 -0
- package/cjs/intreface/animate.js.map +1 -0
- package/cjs/intreface/easing.d.ts +3 -0
- package/cjs/intreface/easing.js +6 -0
- package/cjs/intreface/easing.js.map +1 -0
- package/cjs/intreface/state.d.ts +35 -0
- package/cjs/intreface/state.js +6 -0
- package/cjs/intreface/state.js.map +1 -0
- package/cjs/intreface/ticker.d.ts +37 -0
- package/cjs/intreface/ticker.js +10 -0
- package/cjs/intreface/ticker.js.map +1 -0
- package/cjs/intreface/timeline.d.ts +17 -0
- package/cjs/intreface/timeline.js +6 -0
- package/cjs/intreface/timeline.js.map +1 -0
- package/cjs/intreface/type.d.ts +13 -0
- package/cjs/intreface/type.js +15 -0
- package/cjs/intreface/type.js.map +1 -0
- package/cjs/register.d.ts +1 -0
- package/cjs/register.js +19 -0
- package/cjs/register.js.map +1 -0
- package/cjs/state/animation-state-machine.d.ts +22 -0
- package/cjs/state/animation-state-machine.js +53 -0
- package/cjs/state/animation-state-machine.js.map +1 -0
- package/cjs/state/animation-state-queue.d.ts +24 -0
- package/cjs/state/animation-state-queue.js +66 -0
- package/cjs/state/animation-state-queue.js.map +1 -0
- package/cjs/state/animation-state-registry.d.ts +14 -0
- package/cjs/state/animation-state-registry.js +53 -0
- package/cjs/state/animation-state-registry.js.map +1 -0
- package/cjs/state/animation-state.d.ts +25 -0
- package/cjs/state/animation-state.js +80 -0
- package/cjs/state/animation-state.js.map +1 -0
- package/cjs/state/animation-states-registry.d.ts +17 -0
- package/cjs/state/animation-states-registry.js +95 -0
- package/cjs/state/animation-states-registry.js.map +1 -0
- package/cjs/state/graphic-extension.d.ts +12 -0
- package/cjs/state/graphic-extension.js +37 -0
- package/cjs/state/graphic-extension.js.map +1 -0
- package/cjs/state/index.d.ts +3 -0
- package/cjs/state/index.js +22 -0
- package/cjs/state/index.js.map +1 -0
- package/cjs/state/types.d.ts +11 -0
- package/cjs/state/types.js +6 -0
- package/cjs/state/types.js.map +1 -0
- package/cjs/step.d.ts +49 -0
- package/cjs/step.js +124 -0
- package/cjs/step.js.map +1 -0
- package/cjs/ticker/default-ticker.d.ts +39 -0
- package/cjs/ticker/default-ticker.js +133 -0
- package/cjs/ticker/default-ticker.js.map +1 -0
- package/cjs/ticker/manual-ticker.d.ts +6 -0
- package/cjs/ticker/manual-ticker.js +37 -0
- package/cjs/ticker/manual-ticker.js.map +1 -0
- package/cjs/timeline.d.ts +34 -0
- package/cjs/timeline.js +84 -0
- package/cjs/timeline.js.map +1 -0
- package/cjs/utils/easing-func.d.ts +1 -0
- package/cjs/utils/easing-func.js +16 -0
- package/cjs/utils/easing-func.js.map +1 -0
- package/cjs/utils/easing.d.ts +49 -0
- package/cjs/utils/easing.js +141 -0
- package/cjs/utils/easing.js.map +1 -0
- package/dist/index.es.js +3824 -0
- package/es/animate-extension.d.ts +15 -0
- package/es/animate-extension.js +42 -0
- package/es/animate-extension.js.map +1 -0
- package/es/animate.d.ts +71 -0
- package/es/animate.js +207 -0
- package/es/animate.js.map +1 -0
- package/es/custom/clip-graphic.d.ts +53 -0
- package/es/custom/clip-graphic.js +134 -0
- package/es/custom/clip-graphic.js.map +1 -0
- package/es/custom/clip.d.ts +13 -0
- package/es/custom/clip.js +14 -0
- package/es/custom/clip.js.map +1 -0
- package/es/custom/common.d.ts +22 -0
- package/es/custom/common.js +48 -0
- package/es/custom/common.js.map +1 -0
- package/es/custom/custom-animate.d.ts +15 -0
- package/es/custom/custom-animate.js +17 -0
- package/es/custom/custom-animate.js.map +1 -0
- package/es/custom/fade.d.ts +13 -0
- package/es/custom/fade.js +14 -0
- package/es/custom/fade.js.map +1 -0
- package/es/custom/group-fade.d.ts +16 -0
- package/es/custom/group-fade.js +56 -0
- package/es/custom/group-fade.js.map +1 -0
- package/es/custom/growAngle.d.ts +37 -0
- package/es/custom/growAngle.js +132 -0
- package/es/custom/growAngle.js.map +1 -0
- package/es/custom/growCenter.d.ts +17 -0
- package/es/custom/growCenter.js +155 -0
- package/es/custom/growCenter.js.map +1 -0
- package/es/custom/growHeight.d.ts +36 -0
- package/es/custom/growHeight.js +144 -0
- package/es/custom/growHeight.js.map +1 -0
- package/es/custom/growPoints.d.ts +52 -0
- package/es/custom/growPoints.js +219 -0
- package/es/custom/growPoints.js.map +1 -0
- package/es/custom/growRadius.d.ts +41 -0
- package/es/custom/growRadius.js +105 -0
- package/es/custom/growRadius.js.map +1 -0
- package/es/custom/growWidth.d.ts +36 -0
- package/es/custom/growWidth.js +144 -0
- package/es/custom/growWidth.js.map +1 -0
- package/es/custom/input-text.d.ts +29 -0
- package/es/custom/input-text.js +37 -0
- package/es/custom/input-text.js.map +1 -0
- package/es/custom/number.d.ts +25 -0
- package/es/custom/number.js +94 -0
- package/es/custom/number.js.map +1 -0
- package/es/custom/register.d.ts +1 -0
- package/es/custom/register.js +39 -0
- package/es/custom/register.js.map +1 -0
- package/es/custom/scale-in.d.ts +13 -0
- package/es/custom/scale-in.js +49 -0
- package/es/custom/scale-in.js.map +1 -0
- package/es/custom/scale.d.ts +20 -0
- package/es/custom/scale.js +96 -0
- package/es/custom/scale.js.map +1 -0
- package/es/custom/sphere.d.ts +20 -0
- package/es/custom/sphere.js +20 -0
- package/es/custom/sphere.js.map +1 -0
- package/es/custom/state.d.ts +13 -0
- package/es/custom/state.js +17 -0
- package/es/custom/state.js.map +1 -0
- package/es/custom/tag-points.d.ts +26 -0
- package/es/custom/tag-points.js +77 -0
- package/es/custom/tag-points.js.map +1 -0
- package/es/custom/update.d.ts +14 -0
- package/es/custom/update.js +18 -0
- package/es/custom/update.js.map +1 -0
- package/es/executor/animate-executor.d.ts +36 -0
- package/es/executor/animate-executor.js +169 -0
- package/es/executor/animate-executor.js.map +1 -0
- package/es/executor/executor.d.ts +69 -0
- package/es/executor/executor.js +2 -0
- package/es/executor/executor.js.map +1 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +50 -0
- package/es/index.js.map +1 -0
- package/es/interpolate/executor.d.ts +66 -0
- package/es/interpolate/executor.js +2 -0
- package/es/interpolate/executor.js.map +1 -0
- package/es/interpolate/number.d.ts +1 -0
- package/es/interpolate/number.js +4 -0
- package/es/interpolate/number.js.map +1 -0
- package/es/interpolate/store.d.ts +32 -0
- package/es/interpolate/store.js +88 -0
- package/es/interpolate/store.js.map +1 -0
- package/es/intreface/animate.d.ts +91 -0
- package/es/intreface/animate.js +6 -0
- package/es/intreface/animate.js.map +1 -0
- package/es/intreface/easing.d.ts +3 -0
- package/es/intreface/easing.js +2 -0
- package/es/intreface/easing.js.map +1 -0
- package/es/intreface/state.d.ts +35 -0
- package/es/intreface/state.js +2 -0
- package/es/intreface/state.js.map +1 -0
- package/es/intreface/ticker.d.ts +37 -0
- package/es/intreface/ticker.js +6 -0
- package/es/intreface/ticker.js.map +1 -0
- package/es/intreface/timeline.d.ts +17 -0
- package/es/intreface/timeline.js +2 -0
- package/es/intreface/timeline.js.map +1 -0
- package/es/intreface/type.d.ts +13 -0
- package/es/intreface/type.js +14 -0
- package/es/intreface/type.js.map +1 -0
- package/es/register.d.ts +1 -0
- package/es/register.js +20 -0
- package/es/register.js.map +1 -0
- package/es/state/animation-state-machine.d.ts +22 -0
- package/es/state/animation-state-machine.js +47 -0
- package/es/state/animation-state-machine.js.map +1 -0
- package/es/state/animation-state-queue.d.ts +24 -0
- package/es/state/animation-state-queue.js +58 -0
- package/es/state/animation-state-queue.js.map +1 -0
- package/es/state/animation-state-registry.d.ts +14 -0
- package/es/state/animation-state-registry.js +45 -0
- package/es/state/animation-state-registry.js.map +1 -0
- package/es/state/animation-state.d.ts +25 -0
- package/es/state/animation-state.js +72 -0
- package/es/state/animation-state.js.map +1 -0
- package/es/state/animation-states-registry.d.ts +17 -0
- package/es/state/animation-states-registry.js +87 -0
- package/es/state/animation-states-registry.js.map +1 -0
- package/es/state/graphic-extension.d.ts +12 -0
- package/es/state/graphic-extension.js +29 -0
- package/es/state/graphic-extension.js.map +1 -0
- package/es/state/index.d.ts +3 -0
- package/es/state/index.js +6 -0
- package/es/state/index.js.map +1 -0
- package/es/state/types.d.ts +11 -0
- package/es/state/types.js +2 -0
- package/es/state/types.js.map +1 -0
- package/es/step.d.ts +49 -0
- package/es/step.js +120 -0
- package/es/step.js.map +1 -0
- package/es/ticker/default-ticker.d.ts +39 -0
- package/es/ticker/default-ticker.js +129 -0
- package/es/ticker/default-ticker.js.map +1 -0
- package/es/ticker/manual-ticker.d.ts +6 -0
- package/es/ticker/manual-ticker.js +29 -0
- package/es/ticker/manual-ticker.js.map +1 -0
- package/es/timeline.d.ts +34 -0
- package/es/timeline.js +79 -0
- package/es/timeline.js.map +1 -0
- package/es/utils/easing-func.d.ts +1 -0
- package/es/utils/easing-func.js +8 -0
- package/es/utils/easing-func.js.map +1 -0
- package/es/utils/easing.d.ts +49 -0
- package/es/utils/easing.js +134 -0
- package/es/utils/easing.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EasingType } from '../intreface/easing';
|
|
2
|
+
import { CommonIn, CommonOut } from './common';
|
|
3
|
+
export interface IScaleAnimationOptions {
|
|
4
|
+
direction?: 'x' | 'y' | 'xy';
|
|
5
|
+
}
|
|
6
|
+
export declare class ClipIn extends CommonIn {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
9
|
+
}
|
|
10
|
+
export declare class ClipOut extends CommonOut {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommonIn, CommonOut } from "./common";
|
|
2
|
+
|
|
3
|
+
export class ClipIn extends CommonIn {
|
|
4
|
+
constructor(from, to, duration, easing, params) {
|
|
5
|
+
super(from, to, duration, easing, params), this.keys = [ "clipRange" ];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class ClipOut extends CommonOut {
|
|
10
|
+
constructor(from, to, duration, easing, params) {
|
|
11
|
+
super(from, to, duration, easing, params), this.keys = [ "clipRange" ];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=clip.js.map
|
|
@@ -0,0 +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;IAC5B,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 '../intreface/easing';\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 }\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"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IAnimate, IStep } from '../intreface/animate';
|
|
2
|
+
import type { EasingType } from '../intreface/easing';
|
|
3
|
+
import { ACustomAnimate } from './custom-animate';
|
|
4
|
+
export interface IScaleAnimationOptions {
|
|
5
|
+
direction?: 'x' | 'y' | 'xy';
|
|
6
|
+
}
|
|
7
|
+
export declare class CommonIn extends ACustomAnimate<Record<string, number>> {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
keys: string[];
|
|
10
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
11
|
+
onBind(): void;
|
|
12
|
+
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
13
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class CommonOut extends ACustomAnimate<Record<string, number>> {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
keys: string[];
|
|
18
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
19
|
+
onBind(): void;
|
|
20
|
+
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
21
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
+
|
|
3
|
+
export class CommonIn extends ACustomAnimate {
|
|
4
|
+
constructor(from, to, duration, easing, params) {
|
|
5
|
+
super(from, to, duration, easing, params);
|
|
6
|
+
}
|
|
7
|
+
onBind() {
|
|
8
|
+
var _a;
|
|
9
|
+
const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : {}, to = {}, from = {};
|
|
10
|
+
this.keys.forEach((key => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
to[key] = null !== (_a = null == attrs ? void 0 : attrs[key]) && void 0 !== _a ? _a : 1,
|
|
13
|
+
from[key] = null !== (_b = null == fromAttrs ? void 0 : fromAttrs[key]) && void 0 !== _b ? _b : 0;
|
|
14
|
+
})), this.props = to, this.propKeys = this.keys, this.animate.reSyncProps(), this.from = from,
|
|
15
|
+
this.to = to, this.target.setAttributes(from);
|
|
16
|
+
}
|
|
17
|
+
onEnd(cb) {
|
|
18
|
+
super.onEnd(cb);
|
|
19
|
+
}
|
|
20
|
+
onUpdate(end, ratio, out) {
|
|
21
|
+
this.propKeys.forEach((key => {
|
|
22
|
+
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
23
|
+
})), this.target.setAttributes(out);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class CommonOut extends ACustomAnimate {
|
|
28
|
+
constructor(from, to, duration, easing, params) {
|
|
29
|
+
super(from, to, duration, easing, params);
|
|
30
|
+
}
|
|
31
|
+
onBind() {
|
|
32
|
+
const attrs = this.target.getFinalAttribute(), to = {}, from = {};
|
|
33
|
+
this.keys.forEach((key => {
|
|
34
|
+
var _a;
|
|
35
|
+
to[key] = 0, from[key] = null !== (_a = null == attrs ? void 0 : attrs[key]) && void 0 !== _a ? _a : 1;
|
|
36
|
+
})), this.props = to, this.propKeys = this.keys, this.animate.reSyncProps(), this.from = from,
|
|
37
|
+
this.to = to, this.target.setAttributes(from);
|
|
38
|
+
}
|
|
39
|
+
onEnd(cb) {
|
|
40
|
+
super.onEnd(cb);
|
|
41
|
+
}
|
|
42
|
+
onUpdate(end, ratio, out) {
|
|
43
|
+
this.propKeys.forEach((key => {
|
|
44
|
+
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
45
|
+
})), this.target.setAttributes(out);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAA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CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,EAA6C;QACjD,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF","file":"common.js","sourcesContent":["import type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\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 const attrs = this.target.getFinalAttribute();\n const fromAttrs = this.target.context.lastAttrs ?? {};\n\n const to: Record<string, number> = {};\n const from: Record<string, number> = {};\n this.keys.forEach(key => {\n to[key] = attrs?.[key] ?? 1;\n from[key] = fromAttrs?.[key] ?? 0;\n });\n\n this.props = to;\n this.propKeys = this.keys;\n this.animate.reSyncProps();\n this.from = from;\n this.to = to;\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 this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n\nexport class 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 const attrs = this.target.getFinalAttribute();\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.animate.reSyncProps();\n this.from = from;\n this.to = to;\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 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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ICustomAnimate } from '../intreface/animate';
|
|
2
|
+
import type { EasingType } from '../intreface/easing';
|
|
3
|
+
import type { IAnimateStepType } from '../intreface/type';
|
|
4
|
+
import { Step } from '../step';
|
|
5
|
+
export declare abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {
|
|
6
|
+
type: IAnimateStepType;
|
|
7
|
+
customFrom: T;
|
|
8
|
+
params?: any;
|
|
9
|
+
props?: T;
|
|
10
|
+
from?: T;
|
|
11
|
+
to?: T;
|
|
12
|
+
constructor(customFrom: T, customTo: T, duration: number, easing: EasingType, params?: any);
|
|
13
|
+
update(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
14
|
+
protected setProps(props: T): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Step } from "../step";
|
|
2
|
+
|
|
3
|
+
export class ACustomAnimate extends Step {
|
|
4
|
+
constructor(customFrom, customTo, duration, easing, params) {
|
|
5
|
+
super("customAnimate", customTo, duration, easing), this.type = "customAnimate",
|
|
6
|
+
this.customFrom = customFrom, this.params = params;
|
|
7
|
+
}
|
|
8
|
+
update(end, ratio, out) {
|
|
9
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
10
|
+
const easedRatio = this.easing(ratio);
|
|
11
|
+
this.onUpdate(end, easedRatio, out);
|
|
12
|
+
}
|
|
13
|
+
setProps(props) {
|
|
14
|
+
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=custom-animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/custom-animate.ts"],"names":[],"mappings":"AAGA,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;IACtC,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","file":"custom-animate.js","sourcesContent":["import type { ICustomAnimate } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport type { IAnimateStepType } from '../intreface/type';\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 }\n\n protected setProps(props: T) {\n this.props = props;\n this.propKeys = Object.keys(props);\n this.animate.reSyncProps();\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EasingType } from '../intreface/easing';
|
|
2
|
+
import { CommonIn, CommonOut } from './common';
|
|
3
|
+
export interface IScaleAnimationOptions {
|
|
4
|
+
direction?: 'x' | 'y' | 'xy';
|
|
5
|
+
}
|
|
6
|
+
export declare class FadeIn extends CommonIn {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
9
|
+
}
|
|
10
|
+
export declare class FadeOut extends CommonOut {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommonIn, CommonOut } from "./common";
|
|
2
|
+
|
|
3
|
+
export class FadeIn extends CommonIn {
|
|
4
|
+
constructor(from, to, duration, easing, params) {
|
|
5
|
+
super(from, to, duration, easing, params), this.keys = [ "opacity" ];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class FadeOut extends CommonOut {
|
|
10
|
+
constructor(from, to, duration, easing, params) {
|
|
11
|
+
super(from, to, duration, easing, params), this.keys = [ "opacity" ];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=fade.js.map
|
|
@@ -0,0 +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;IAC1B,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,CAAC,CAAC;IAC1B,CAAC;CACF","file":"fade.js","sourcesContent":["import type { EasingType } from '../intreface/easing';\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'];\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'];\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IGroup } from '@visactor/vrender-core';
|
|
2
|
+
import { ACustomAnimate } from './custom-animate';
|
|
3
|
+
export declare class GroupFadeIn extends ACustomAnimate<any> {
|
|
4
|
+
target: IGroup;
|
|
5
|
+
getEndProps(): Record<string, any>;
|
|
6
|
+
onBind(): void;
|
|
7
|
+
onEnd(): void;
|
|
8
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
9
|
+
}
|
|
10
|
+
export declare class GroupFadeOut extends ACustomAnimate<any> {
|
|
11
|
+
target: IGroup;
|
|
12
|
+
getEndProps(): Record<string, any>;
|
|
13
|
+
onBind(): void;
|
|
14
|
+
onEnd(): void;
|
|
15
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
+
|
|
3
|
+
export class GroupFadeIn extends ACustomAnimate {
|
|
4
|
+
getEndProps() {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
onBind() {
|
|
8
|
+
this.target.setTheme({
|
|
9
|
+
common: {
|
|
10
|
+
opacity: 0
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
onEnd() {
|
|
15
|
+
this.target.setTheme({
|
|
16
|
+
common: {
|
|
17
|
+
opacity: 1
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
onUpdate(end, ratio, out) {
|
|
22
|
+
this.target.setTheme({
|
|
23
|
+
common: {
|
|
24
|
+
opacity: ratio
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class GroupFadeOut extends ACustomAnimate {
|
|
31
|
+
getEndProps() {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
onBind() {
|
|
35
|
+
this.target.setTheme({
|
|
36
|
+
common: {
|
|
37
|
+
opacity: 1
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
onEnd() {
|
|
42
|
+
this.target.setTheme({
|
|
43
|
+
common: {
|
|
44
|
+
opacity: 0
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
onUpdate(end, ratio, out) {
|
|
49
|
+
this.target.setTheme({
|
|
50
|
+
common: {
|
|
51
|
+
opacity: 1 - ratio
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=group-fade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/group-fade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,WAAY,SAAQ,cAAmB;IAGlD,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,cAAmB;IAGnD,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC,GAAG,KAAK;aACnB;SACF,CAAC,CAAC;IACL,CAAC;CACF","file":"group-fade.js","sourcesContent":["import type { IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class GroupFadeIn extends ACustomAnimate<any> {\n declare target: IGroup;\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.target.setTheme({\n common: {\n opacity: 0\n }\n });\n return;\n }\n\n onEnd(): void {\n this.target.setTheme({\n common: {\n opacity: 1\n }\n });\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.setTheme({\n common: {\n opacity: ratio\n }\n });\n }\n}\n\nexport class GroupFadeOut extends ACustomAnimate<any> {\n declare target: IGroup;\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.target.setTheme({\n common: {\n opacity: 1\n }\n });\n return;\n }\n\n onEnd(): void {\n this.target.setTheme({\n common: {\n opacity: 0\n }\n });\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.setTheme({\n common: {\n opacity: 1 - ratio\n }\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type IGraphic, type IGroup } from '@visactor/vrender-core';
|
|
2
|
+
import type { EasingType } from '../intreface/easing';
|
|
3
|
+
import { ACustomAnimate } from './custom-animate';
|
|
4
|
+
interface IAnimationParameters {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
group: IGroup;
|
|
8
|
+
elementIndex: number;
|
|
9
|
+
elementCount: number;
|
|
10
|
+
view: any;
|
|
11
|
+
}
|
|
12
|
+
type TypeAnimation<T extends IGraphic> = (graphic: T, options: any, animationParameters: IAnimationParameters) => {
|
|
13
|
+
from?: {
|
|
14
|
+
[channel: string]: any;
|
|
15
|
+
};
|
|
16
|
+
to?: {
|
|
17
|
+
[channel: string]: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface IGrowAngleAnimationOptions {
|
|
21
|
+
orient?: 'clockwise' | 'anticlockwise';
|
|
22
|
+
overall?: boolean | number;
|
|
23
|
+
}
|
|
24
|
+
export declare const growAngleIn: TypeAnimation<IGraphic>;
|
|
25
|
+
export declare const growAngleOut: TypeAnimation<IGraphic>;
|
|
26
|
+
export declare class GworPointsBase extends ACustomAnimate<Record<string, number>> {
|
|
27
|
+
valid: boolean;
|
|
28
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
29
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
30
|
+
}
|
|
31
|
+
export declare class GrowAngleIn extends GworPointsBase {
|
|
32
|
+
onBind(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare class GrowAngleOut extends GworPointsBase {
|
|
35
|
+
onBind(): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
+
|
|
3
|
+
import { isNumber } from "@visactor/vutils";
|
|
4
|
+
|
|
5
|
+
const growAngleInIndividual = (graphic, options, animationParameters) => {
|
|
6
|
+
const attrs = graphic.getFinalAttribute();
|
|
7
|
+
return options && "anticlockwise" === options.orient ? {
|
|
8
|
+
from: {
|
|
9
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
10
|
+
},
|
|
11
|
+
to: {
|
|
12
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle
|
|
13
|
+
}
|
|
14
|
+
} : {
|
|
15
|
+
from: {
|
|
16
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
17
|
+
},
|
|
18
|
+
to: {
|
|
19
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, growAngleInOverall = (graphic, options, animationParameters) => {
|
|
23
|
+
const attrs = graphic.getFinalAttribute();
|
|
24
|
+
if (options && "anticlockwise" === options.orient) {
|
|
25
|
+
const overallValue = isNumber(options.overall) ? options.overall : 2 * Math.PI;
|
|
26
|
+
return {
|
|
27
|
+
from: {
|
|
28
|
+
startAngle: overallValue,
|
|
29
|
+
endAngle: overallValue
|
|
30
|
+
},
|
|
31
|
+
to: {
|
|
32
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
33
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const overallValue = isNumber(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
38
|
+
return {
|
|
39
|
+
from: {
|
|
40
|
+
startAngle: overallValue,
|
|
41
|
+
endAngle: overallValue
|
|
42
|
+
},
|
|
43
|
+
to: {
|
|
44
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
45
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const growAngleIn = (graphic, options, animationParameters) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleInOverall(graphic, options) : growAngleInIndividual(graphic, options);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const growAngleOutIndividual = (graphic, options, animationParameters) => {
|
|
56
|
+
const attrs = graphic.getFinalAttribute();
|
|
57
|
+
return options && "anticlockwise" === options.orient ? {
|
|
58
|
+
from: {
|
|
59
|
+
startAngle: attrs.startAngle
|
|
60
|
+
},
|
|
61
|
+
to: {
|
|
62
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
63
|
+
}
|
|
64
|
+
} : {
|
|
65
|
+
from: {
|
|
66
|
+
endAngle: attrs.endAngle
|
|
67
|
+
},
|
|
68
|
+
to: {
|
|
69
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, growAngleOutOverall = (graphic, options, animationParameters) => {
|
|
73
|
+
const attrs = graphic.getFinalAttribute();
|
|
74
|
+
if (options && "anticlockwise" === options.orient) {
|
|
75
|
+
const overallValue = isNumber(options.overall) ? options.overall : 2 * Math.PI;
|
|
76
|
+
return {
|
|
77
|
+
from: {
|
|
78
|
+
startAngle: attrs.startAngle,
|
|
79
|
+
endAngle: attrs.endAngle
|
|
80
|
+
},
|
|
81
|
+
to: {
|
|
82
|
+
startAngle: overallValue,
|
|
83
|
+
endAngle: overallValue
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const overallValue = isNumber(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
88
|
+
return {
|
|
89
|
+
from: {
|
|
90
|
+
startAngle: attrs.startAngle,
|
|
91
|
+
endAngle: attrs.endAngle
|
|
92
|
+
},
|
|
93
|
+
to: {
|
|
94
|
+
startAngle: overallValue,
|
|
95
|
+
endAngle: overallValue
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const growAngleOut = (graphic, options, animationParameters) => {
|
|
101
|
+
var _a;
|
|
102
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleOutOverall(graphic, options) : growAngleOutIndividual(graphic, options);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export class GworPointsBase extends ACustomAnimate {
|
|
106
|
+
constructor(from, to, duration, easing, params) {
|
|
107
|
+
super(from, to, duration, easing, params);
|
|
108
|
+
}
|
|
109
|
+
onUpdate(end, ratio, out) {
|
|
110
|
+
this.propKeys.forEach((key => {
|
|
111
|
+
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
112
|
+
})), this.target.setAttributes(out);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export class GrowAngleIn extends GworPointsBase {
|
|
117
|
+
onBind() {
|
|
118
|
+
var _a;
|
|
119
|
+
const {from: from, to: to} = growAngleIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
|
|
120
|
+
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
121
|
+
this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export class GrowAngleOut extends GworPointsBase {
|
|
126
|
+
onBind() {
|
|
127
|
+
var _a;
|
|
128
|
+
const {from: from, to: to} = growAngleOut(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
|
|
129
|
+
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
130
|
+
this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/growAngle.ts"],"names":[],"mappings":"AAEA,OA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C,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;AAED,MAAM,OAAO,YAAa,SAAQ,cAAc;IAC9C,MAAM;;QACJ,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IAnimate, IStep } from '../intreface/animate';
|
|
2
|
+
import type { EasingType } from '../intreface/easing';
|
|
3
|
+
import { ACustomAnimate } from './custom-animate';
|
|
4
|
+
export declare class GrowCenterIn extends ACustomAnimate<Record<string, number>> {
|
|
5
|
+
valid: boolean;
|
|
6
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
7
|
+
onBind(): void;
|
|
8
|
+
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
9
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class GrowCenterOut extends ACustomAnimate<Record<string, number>> {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
14
|
+
onBind(): void;
|
|
15
|
+
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
16
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { isValid } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
4
|
+
|
|
5
|
+
const growCenterIn = (graphic, options, animationParameters) => {
|
|
6
|
+
const attrs = graphic.getFinalAttribute();
|
|
7
|
+
switch (null == options ? void 0 : options.direction) {
|
|
8
|
+
case "x":
|
|
9
|
+
{
|
|
10
|
+
const x = attrs.x, x1 = attrs.x1, width = attrs.width;
|
|
11
|
+
return {
|
|
12
|
+
from: isValid(width) ? {
|
|
13
|
+
x: x + width / 2,
|
|
14
|
+
x1: void 0,
|
|
15
|
+
width: 0
|
|
16
|
+
} : {
|
|
17
|
+
x: (x + x1) / 2,
|
|
18
|
+
x1: (x + x1) / 2,
|
|
19
|
+
width: void 0
|
|
20
|
+
},
|
|
21
|
+
to: {
|
|
22
|
+
x: x,
|
|
23
|
+
x1: x1,
|
|
24
|
+
width: width
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
case "y":
|
|
30
|
+
{
|
|
31
|
+
const y = attrs.y, y1 = attrs.y1, height = attrs.height;
|
|
32
|
+
return {
|
|
33
|
+
from: isValid(height) ? {
|
|
34
|
+
y: y + height / 2,
|
|
35
|
+
y1: void 0,
|
|
36
|
+
height: 0
|
|
37
|
+
} : {
|
|
38
|
+
y: (y + y1) / 2,
|
|
39
|
+
y1: (y + y1) / 2,
|
|
40
|
+
height: void 0
|
|
41
|
+
},
|
|
42
|
+
to: {
|
|
43
|
+
y: y,
|
|
44
|
+
y1: y1,
|
|
45
|
+
height: height
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
default:
|
|
51
|
+
{
|
|
52
|
+
const x = attrs.x, x1 = attrs.x1, width = attrs.width, y = attrs.y, y1 = attrs.y1, height = attrs.height, from = {};
|
|
53
|
+
return isValid(width) ? (from.x = x + width / 2, from.width = 0, from.x1 = void 0) : (from.x = (x + x1) / 2,
|
|
54
|
+
from.x1 = (x + x1) / 2, from.width = void 0), isValid(height) ? (from.y = y + height / 2,
|
|
55
|
+
from.height = 0, from.y1 = void 0) : (from.y = (y + y1) / 2, from.y1 = (y + y1) / 2,
|
|
56
|
+
from.height = void 0), {
|
|
57
|
+
from: from,
|
|
58
|
+
to: {
|
|
59
|
+
x: x,
|
|
60
|
+
y: y,
|
|
61
|
+
x1: x1,
|
|
62
|
+
y1: y1,
|
|
63
|
+
width: width,
|
|
64
|
+
height: height
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, growCenterOut = (graphic, options, animationParameters) => {
|
|
70
|
+
const attrs = graphic.getFinalAttribute();
|
|
71
|
+
switch (null == options ? void 0 : options.direction) {
|
|
72
|
+
case "x":
|
|
73
|
+
{
|
|
74
|
+
const x = attrs.x, x1 = attrs.x1, width = attrs.width;
|
|
75
|
+
return {
|
|
76
|
+
to: isValid(width) ? {
|
|
77
|
+
x: x + width / 2,
|
|
78
|
+
x1: void 0,
|
|
79
|
+
width: 0
|
|
80
|
+
} : {
|
|
81
|
+
x: (x + x1) / 2,
|
|
82
|
+
x1: (x + x1) / 2,
|
|
83
|
+
width: void 0
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
case "y":
|
|
89
|
+
{
|
|
90
|
+
const y = attrs.y, y1 = attrs.y1, height = attrs.height;
|
|
91
|
+
return {
|
|
92
|
+
to: isValid(height) ? {
|
|
93
|
+
y: y + height / 2,
|
|
94
|
+
y1: void 0,
|
|
95
|
+
height: 0
|
|
96
|
+
} : {
|
|
97
|
+
y: (y + y1) / 2,
|
|
98
|
+
y1: (y + y1) / 2,
|
|
99
|
+
height: void 0
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
default:
|
|
105
|
+
{
|
|
106
|
+
const x = attrs.x, y = attrs.y, x1 = attrs.x1, y1 = attrs.y1, width = attrs.width, height = attrs.height, to = {};
|
|
107
|
+
return isValid(width) ? (to.x = x + width / 2, to.width = 0, to.x1 = void 0) : (to.x = (x + x1) / 2,
|
|
108
|
+
to.x1 = (x + x1) / 2, to.width = void 0), isValid(height) ? (to.y = y + height / 2,
|
|
109
|
+
to.height = 0, to.y1 = void 0) : (to.y = (y + y1) / 2, to.y1 = (y + y1) / 2, to.height = void 0),
|
|
110
|
+
{
|
|
111
|
+
to: to
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export class GrowCenterIn extends ACustomAnimate {
|
|
118
|
+
constructor(from, to, duration, easing, params) {
|
|
119
|
+
super(from, to, duration, easing, params);
|
|
120
|
+
}
|
|
121
|
+
onBind() {
|
|
122
|
+
var _a;
|
|
123
|
+
const {from: from, to: to} = growCenterIn(this.target, this.params.options, this.params), fromAttrs = null !== (_a = this.target.context.lastAttrs) && void 0 !== _a ? _a : from;
|
|
124
|
+
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
125
|
+
this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
|
|
126
|
+
}
|
|
127
|
+
onEnd(cb) {
|
|
128
|
+
super.onEnd(cb);
|
|
129
|
+
}
|
|
130
|
+
onUpdate(end, ratio, out) {
|
|
131
|
+
this.propKeys.forEach((key => {
|
|
132
|
+
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
133
|
+
})), this.target.setAttributes(out);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class GrowCenterOut extends ACustomAnimate {
|
|
138
|
+
constructor(from, to, duration, easing, params) {
|
|
139
|
+
super(from, to, duration, easing, params);
|
|
140
|
+
}
|
|
141
|
+
onBind() {
|
|
142
|
+
const attrs = this.target.getFinalAttribute(), {from: from, to: to} = growCenterOut(this.target, this.params.options, this.params);
|
|
143
|
+
this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
|
|
144
|
+
this.animate.reSyncProps(), this.from = from || attrs, this.to = to;
|
|
145
|
+
}
|
|
146
|
+
onEnd(cb) {
|
|
147
|
+
super.onEnd(cb);
|
|
148
|
+
}
|
|
149
|
+
onUpdate(end, ratio, out) {
|
|
150
|
+
this.propKeys.forEach((key => {
|
|
151
|
+
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
152
|
+
})), this.target.setAttributes(out);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=growCenter.js.map
|