@visactor/vrender-animate 0.23.0-alpha.3 → 1.0.0-alpha.1
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 +1 -3
- package/cjs/animate-extension.js +0 -7
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +1 -5
- package/cjs/animate.js +12 -12
- package/cjs/animate.js.map +1 -1
- package/cjs/component/component-animator.d.ts +3 -2
- package/cjs/component/component-animator.js +18 -32
- package/cjs/component/component-animator.js.map +1 -1
- package/cjs/custom/clip-graphic.d.ts +1 -1
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +1 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +1 -2
- package/cjs/custom/common.js +12 -10
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.d.ts +2 -4
- package/cjs/custom/custom-animate.js +2 -2
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/fade.d.ts +1 -1
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/from-to.d.ts +9 -0
- package/cjs/custom/from-to.js +38 -0
- package/cjs/custom/from-to.js.map +1 -0
- package/cjs/custom/group-fade.d.ts +8 -14
- package/cjs/custom/group-fade.js +9 -50
- package/cjs/custom/group-fade.js.map +1 -1
- package/cjs/custom/growAngle.d.ts +2 -2
- package/cjs/custom/growAngle.js +17 -12
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.d.ts +1 -2
- package/cjs/custom/growCenter.js +8 -7
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.d.ts +1 -3
- package/cjs/custom/growHeight.js +7 -7
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.d.ts +1 -2
- package/cjs/custom/growPoints.js +19 -17
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.d.ts +4 -5
- package/cjs/custom/growRadius.js +12 -12
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.d.ts +1 -3
- package/cjs/custom/growWidth.js +7 -6
- 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.js +2 -2
- package/cjs/custom/label-item-animate.js.map +1 -1
- package/cjs/custom/move.d.ts +92 -0
- package/cjs/custom/move.js +131 -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.js +2 -1
- package/cjs/custom/poptip-animate.js.map +1 -1
- package/cjs/custom/register.js +21 -2
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +33 -0
- package/cjs/custom/richtext/input-richtext.js +70 -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 +76 -0
- package/cjs/custom/rotate.js.map +1 -0
- package/cjs/custom/scale.d.ts +2 -2
- package/cjs/custom/scale.js +25 -21
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.js +1 -2
- package/cjs/custom/state.d.ts +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.d.ts +128 -0
- package/cjs/custom/story.js +347 -0
- package/cjs/custom/story.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +2 -3
- package/cjs/custom/tag-points.js +18 -5
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.d.ts +2 -1
- package/cjs/custom/update.js +10 -2
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +6 -5
- package/cjs/executor/animate-executor.js +57 -29
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/executor/executor.d.ts +6 -3
- package/cjs/executor/executor.js.map +1 -1
- package/cjs/index.d.ts +3 -6
- package/cjs/index.js +16 -4
- package/cjs/index.js.map +1 -1
- package/cjs/interpolate/store.d.ts +2 -2
- package/cjs/interpolate/store.js +2 -0
- package/cjs/interpolate/store.js.map +1 -1
- package/cjs/state/animation-state.d.ts +2 -2
- package/cjs/state/animation-state.js +3 -3
- package/cjs/state/animation-state.js.map +1 -1
- package/cjs/state/graphic-extension.d.ts +1 -1
- package/cjs/state/graphic-extension.js.map +1 -1
- package/cjs/step.d.ts +2 -4
- package/cjs/step.js +1 -1
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +2 -3
- package/cjs/ticker/default-ticker.js +14 -12
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +1 -1
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +1 -2
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/easing-func.js +2 -1
- package/dist/index.es.js +1859 -554
- package/es/animate-extension.d.ts +1 -3
- package/es/animate-extension.js +0 -7
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +1 -5
- package/es/animate.js +1 -3
- package/es/animate.js.map +1 -1
- package/es/component/component-animator.d.ts +3 -2
- package/es/component/component-animator.js +18 -32
- package/es/component/component-animator.js.map +1 -1
- package/es/custom/clip-graphic.d.ts +1 -1
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +1 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +1 -2
- package/es/custom/common.js +12 -10
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.d.ts +2 -4
- package/es/custom/custom-animate.js +2 -2
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/fade.d.ts +1 -1
- package/es/custom/fade.js.map +1 -1
- package/es/custom/from-to.d.ts +9 -0
- package/es/custom/from-to.js +30 -0
- package/es/custom/from-to.js.map +1 -0
- package/es/custom/group-fade.d.ts +8 -14
- package/es/custom/group-fade.js +9 -50
- package/es/custom/group-fade.js.map +1 -1
- package/es/custom/growAngle.d.ts +2 -2
- package/es/custom/growAngle.js +20 -12
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.d.ts +1 -2
- package/es/custom/growCenter.js +8 -7
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.d.ts +1 -3
- package/es/custom/growHeight.js +8 -8
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.d.ts +1 -2
- package/es/custom/growPoints.js +19 -17
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.d.ts +4 -5
- package/es/custom/growRadius.js +12 -10
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.d.ts +1 -3
- package/es/custom/growWidth.js +8 -7
- 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.js +2 -2
- package/es/custom/label-item-animate.js.map +1 -1
- package/es/custom/move.d.ts +92 -0
- package/es/custom/move.js +116 -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.js +2 -1
- package/es/custom/poptip-animate.js.map +1 -1
- package/es/custom/register.js +41 -16
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +33 -0
- package/es/custom/richtext/input-richtext.js +64 -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 +62 -0
- package/es/custom/rotate.js.map +1 -0
- package/es/custom/scale.d.ts +2 -2
- package/es/custom/scale.js +25 -21
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.js +1 -2
- package/es/custom/state.d.ts +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.d.ts +128 -0
- package/es/custom/story.js +323 -0
- package/es/custom/story.js.map +1 -0
- package/es/custom/tag-points.d.ts +2 -3
- package/es/custom/tag-points.js +19 -6
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.d.ts +2 -1
- package/es/custom/update.js +10 -2
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +6 -5
- package/es/executor/animate-executor.js +55 -29
- package/es/executor/animate-executor.js.map +1 -1
- package/es/executor/executor.d.ts +6 -3
- package/es/executor/executor.js.map +1 -1
- package/es/index.d.ts +3 -6
- package/es/index.js +4 -10
- package/es/index.js.map +1 -1
- package/es/interpolate/store.d.ts +2 -2
- package/es/interpolate/store.js +2 -0
- package/es/interpolate/store.js.map +1 -1
- package/es/state/animation-state.d.ts +2 -2
- package/es/state/animation-state.js +4 -2
- package/es/state/animation-state.js.map +1 -1
- package/es/state/graphic-extension.d.ts +1 -1
- package/es/state/graphic-extension.js.map +1 -1
- package/es/step.d.ts +2 -4
- package/es/step.js +2 -2
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +2 -3
- package/es/ticker/default-ticker.js +5 -5
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +1 -1
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +1 -2
- package/es/timeline.js +1 -1
- package/es/timeline.js.map +1 -1
- package/es/utils/easing-func.js +2 -1
- package/package.json +5 -5
- package/cjs/custom/label-animate.d.ts +0 -4
- package/cjs/custom/label-animate.js +0 -48
- package/cjs/custom/label-animate.js.map +0 -1
- package/cjs/intreface/animate.d.ts +0 -92
- 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/ticker.d.ts +0 -37
- package/cjs/intreface/ticker.js +0 -11
- 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/es/custom/label-animate.d.ts +0 -4
- package/es/custom/label-animate.js +0 -42
- package/es/custom/label-animate.js.map +0 -1
- package/es/intreface/animate.d.ts +0 -92
- 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/ticker.d.ts +0 -37
- package/es/intreface/ticker.js +0 -7
- 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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EasingType, IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
import { ACustomAnimate } from './custom-animate';
|
|
3
|
+
export interface IRotateAnimationOptions {
|
|
4
|
+
orient?: 'clockwise' | 'anticlockwise';
|
|
5
|
+
angle?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const rotateIn: (graphic: IGraphic, options: IRotateAnimationOptions) => {
|
|
8
|
+
from: {
|
|
9
|
+
angle: number;
|
|
10
|
+
};
|
|
11
|
+
to: {
|
|
12
|
+
angle: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const rotateOut: (graphic: IGraphic, options: IRotateAnimationOptions) => {
|
|
16
|
+
from: {
|
|
17
|
+
angle: any;
|
|
18
|
+
};
|
|
19
|
+
to: {
|
|
20
|
+
angle: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare class RotateBase extends ACustomAnimate<Record<string, number>> {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: any);
|
|
26
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class RotateIn extends RotateBase {
|
|
29
|
+
onBind(): void;
|
|
30
|
+
}
|
|
31
|
+
export declare class RotateOut extends RotateBase {
|
|
32
|
+
onBind(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isNumberClose, isValidNumber } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { ACustomAnimate } from "./custom-animate";
|
|
4
|
+
|
|
5
|
+
export const rotateIn = (graphic, options) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const attributeAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
8
|
+
let angle = 0;
|
|
9
|
+
return angle = isNumberClose(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(attributeAngle / (2 * Math.PI)) * Math.PI * 2,
|
|
10
|
+
{
|
|
11
|
+
from: {
|
|
12
|
+
angle: angle
|
|
13
|
+
},
|
|
14
|
+
to: {
|
|
15
|
+
angle: attributeAngle
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const rotateOut = (graphic, options) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const finalAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
23
|
+
let angle = 0;
|
|
24
|
+
return angle = isNumberClose(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2,
|
|
25
|
+
{
|
|
26
|
+
from: {
|
|
27
|
+
angle: finalAngle
|
|
28
|
+
},
|
|
29
|
+
to: {
|
|
30
|
+
angle: angle
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export class RotateBase extends ACustomAnimate {
|
|
36
|
+
constructor(from, to, duration, easing, params) {
|
|
37
|
+
super(from, to, duration, easing, params);
|
|
38
|
+
}
|
|
39
|
+
onUpdate(end, ratio, out) {
|
|
40
|
+
const attribute = this.target.attribute;
|
|
41
|
+
this.propKeys.forEach((key => {
|
|
42
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
43
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class RotateIn extends RotateBase {
|
|
48
|
+
onBind() {
|
|
49
|
+
const {from: from, to: to} = rotateIn(this.target, this.params.options);
|
|
50
|
+
this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;
|
|
51
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
52
|
+
finalAttribute && Object.assign(this.target.attribute, finalAttribute), this.target.setAttributes(from);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class RotateOut extends RotateBase {
|
|
57
|
+
onBind() {
|
|
58
|
+
const {from: from, to: to} = rotateOut(this.target, this.params.options);
|
|
59
|
+
this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=rotate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/rotate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAiB,EAAE,OAAgC,EAAE,EAAE;;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAA,UAAU,CAAC,KAAK,mCAAI,CAAC,CAAC;IAE7C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,aAAa,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACpD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAClE;SAAM,IAAI,aAAa,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,EAAE;QACxC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACv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AAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAGb,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;SACtD;QAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,UAAU;IACvC,MAAM;QACJ,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC;QAE1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF","file":"rotate.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender-core';\nimport { isNumberClose, isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IRotateAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n angle?: number;\n}\n\nexport const rotateIn = (graphic: IGraphic, options: IRotateAnimationOptions) => {\n const finalAttrs = graphic.getFinalAttribute();\n const attributeAngle = finalAttrs.angle ?? 0;\n\n let angle = 0;\n if (isNumberClose(attributeAngle / (Math.PI * 2), 0)) {\n angle = Math.round(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(attributeAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle },\n to: { angle: attributeAngle }\n };\n};\n\nexport const rotateOut = (graphic: IGraphic, options: IRotateAnimationOptions) => {\n const finalAttrs = graphic.getFinalAttribute();\n const finalAngle = finalAttrs.angle ?? 0;\n let angle = 0;\n if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {\n angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle: finalAngle },\n to: { angle }\n };\n};\n\nexport class RotateBase extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: any) {\n super(from, to, duration, easing, params);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.addUpdatePositionTag();\n this.target.addUpdateShapeAndBoundsTag();\n }\n}\n\n/**\n * 增长渐入\n */\nexport class RotateIn extends RotateBase {\n onBind(): void {\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const { from, to } = rotateIn(this.target, this.params.options);\n\n this.props = to;\n this.propKeys = ['angle'];\n this.from = from;\n this.to = to;\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n\n this.target.setAttributes(from);\n }\n}\n\nexport class RotateOut extends RotateBase {\n onBind(): void {\n const { from, to } = rotateOut(this.target, this.params.options);\n this.props = to;\n this.propKeys = ['angle'];\n\n this.from = from;\n this.to = to;\n }\n}\n"]}
|
package/es/custom/scale.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';
|
|
@@ -13,6 +12,7 @@ export declare class ScaleIn extends ACustomAnimate<Record<string, number>> {
|
|
|
13
12
|
updateX(ratio: number): void;
|
|
14
13
|
updateY(ratio: number): void;
|
|
15
14
|
updateXY(ratio: number): void;
|
|
15
|
+
deleteSelfAttr(key: string): void;
|
|
16
16
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
17
17
|
}
|
|
18
18
|
export declare class ScaleOut extends ACustomAnimate<Record<string, number>> {
|
package/es/custom/scale.js
CHANGED
|
@@ -5,38 +5,38 @@ export class ScaleIn extends ACustomAnimate {
|
|
|
5
5
|
super(from, to, duration, easing, params);
|
|
6
6
|
}
|
|
7
7
|
onBind() {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
9
9
|
let from, to;
|
|
10
|
-
(null
|
|
11
|
-
|
|
12
|
-
switch (null === (_d = this.params) || void 0 === _d ? void 0 : _d.direction) {
|
|
10
|
+
const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
|
|
11
|
+
switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
|
|
13
12
|
case "x":
|
|
14
13
|
from = {
|
|
15
|
-
scaleX: null !== (
|
|
14
|
+
scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
|
|
16
15
|
}, to = {
|
|
17
|
-
scaleX: null !== (
|
|
18
|
-
}, this.
|
|
16
|
+
scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
|
|
17
|
+
}, this._updateFunction = this.updateX;
|
|
19
18
|
break;
|
|
20
19
|
|
|
21
20
|
case "y":
|
|
22
21
|
from = {
|
|
23
|
-
scaleY: null !== (
|
|
22
|
+
scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
|
|
24
23
|
}, to = {
|
|
25
|
-
scaleY: null !== (
|
|
26
|
-
}, this.
|
|
24
|
+
scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
|
|
25
|
+
}, this._updateFunction = this.updateY;
|
|
27
26
|
break;
|
|
28
27
|
|
|
29
28
|
default:
|
|
30
29
|
from = {
|
|
31
|
-
scaleX: null !== (
|
|
32
|
-
scaleY: null !== (
|
|
30
|
+
scaleX: null !== (_g = fromAttrs.scaleX) && void 0 !== _g ? _g : 0,
|
|
31
|
+
scaleY: null !== (_h = fromAttrs.scaleY) && void 0 !== _h ? _h : 0
|
|
33
32
|
}, to = {
|
|
34
|
-
scaleX: null !== (
|
|
35
|
-
scaleY: null !== (
|
|
36
|
-
}, this.
|
|
33
|
+
scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
|
|
34
|
+
scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
|
|
35
|
+
}, this._updateFunction = this.updateXY;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
this.target.
|
|
37
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
38
|
+
finalAttribute && Object.assign(this.target.attribute, finalAttribute), this.props = to,
|
|
39
|
+
this.from = from, this.to = to, this.target.setAttributes(from);
|
|
40
40
|
}
|
|
41
41
|
onEnd(cb) {
|
|
42
42
|
super.onEnd(cb);
|
|
@@ -50,8 +50,13 @@ export class ScaleIn extends ACustomAnimate {
|
|
|
50
50
|
updateXY(ratio) {
|
|
51
51
|
this.updateX(ratio), this.updateY(ratio);
|
|
52
52
|
}
|
|
53
|
+
deleteSelfAttr(key) {
|
|
54
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
55
|
+
const index = this.propKeys.indexOf(key);
|
|
56
|
+
-1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : "scaleX" === this.propKeys[0] ? this._updateFunction = this.updateX : "scaleY" === this.propKeys[0] ? this._updateFunction = this.updateY : this._updateFunction = null;
|
|
57
|
+
}
|
|
53
58
|
onUpdate(end, ratio, out) {
|
|
54
|
-
this._updateFunction(ratio), this.target.addUpdatePositionTag();
|
|
59
|
+
this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag());
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
|
|
@@ -62,7 +67,7 @@ export class ScaleOut extends ACustomAnimate {
|
|
|
62
67
|
onBind() {
|
|
63
68
|
var _a, _b, _c, _d, _e;
|
|
64
69
|
let from, to;
|
|
65
|
-
const attrs = this.target.
|
|
70
|
+
const attrs = this.target.attribute;
|
|
66
71
|
switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
|
|
67
72
|
case "x":
|
|
68
73
|
from = {
|
|
@@ -89,8 +94,7 @@ export class ScaleOut extends ACustomAnimate {
|
|
|
89
94
|
scaleY: 0
|
|
90
95
|
};
|
|
91
96
|
}
|
|
92
|
-
this.props = to, this.
|
|
93
|
-
this.to = to;
|
|
97
|
+
this.props = to, this.from = from, this.to = to;
|
|
94
98
|
}
|
|
95
99
|
onEnd(cb) {
|
|
96
100
|
super.onEnd(cb);
|
package/es/custom/scale.js.map
CHANGED
|
@@ -1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E,CAAC;IACf,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;IACrC,CAAC;CACF","file":"scale.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 ScaleIn extends ACustomAnimate<Record<string, number>> {\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 }\n\n declare _updateFunction: (ratio: number) => void;\n\n onBind(): void {\n let from: Record<string, number>;\n let to: Record<string, number>;\n const attrs = this.target.getFinalAttribute();\n const fromAttrs = this.target.attribute ?? {};\n\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: fromAttrs.scaleX ?? 0 };\n to = { scaleX: attrs?.scaleX ?? 1 };\n this._updateFunction = this.updateX;\n break;\n case 'y':\n from = { scaleY: fromAttrs.scaleY ?? 0 };\n to = { scaleY: attrs?.scaleY ?? 1 };\n this._updateFunction = this.updateY;\n break;\n case 'xy':\n default:\n from = { scaleX: fromAttrs.scaleX ?? 0, scaleY: fromAttrs.scaleY ?? 0 };\n to = {\n scaleX: attrs?.scaleX ?? 1,\n scaleY: attrs?.scaleY ?? 1\n };\n this._updateFunction = this.updateXY;\n }\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n Object.assign(this.target.attribute, finalAttribute);\n }\n\n this.props = to;\n this.from = from;\n this.to = to;\n // 调用次数不多,可以setAttributes\n this.target.setAttributes(from);\n }\n\n onEnd(cb?: (animate: IAnimate, step: IStep) => void): void {\n super.onEnd(cb);\n }\n\n updateX(ratio: number): void {\n this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;\n }\n\n updateY(ratio: number): void {\n this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;\n }\n\n updateXY(ratio: number): void {\n this.updateX(ratio);\n this.updateY(ratio);\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.updateXY;\n } else if (this.propKeys[0] === 'scaleX') {\n this._updateFunction = this.updateX;\n } else if (this.propKeys[0] === 'scaleY') {\n this._updateFunction = this.updateY;\n } else {\n this._updateFunction = null;\n }\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this._updateFunction) {\n this._updateFunction(ratio);\n this.target.addUpdatePositionTag();\n }\n }\n}\n\nexport class ScaleOut extends ACustomAnimate<Record<string, number>> {\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 }\n\n onBind(): void {\n let from: Record<string, number>;\n let to: Record<string, number>;\n // 获取当前的数据\n const attrs = this.target.attribute;\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: attrs?.scaleX ?? 1 };\n to = { scaleX: 0 };\n break;\n case 'y':\n from = { scaleY: attrs?.scaleY ?? 1 };\n to = { scaleY: 0 };\n break;\n case 'xy':\n default:\n from = { scaleX: attrs?.scaleX ?? 1, scaleY: attrs?.scaleY ?? 1 };\n to = {\n scaleX: 0,\n scaleY: 0\n };\n }\n this.props = to;\n this.from = from;\n this.to = to;\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 }\n}\n"]}
|
package/es/custom/sphere.js
CHANGED
|
@@ -16,5 +16,4 @@ export class RotateBySphereAnimate extends ACustomAnimate {
|
|
|
16
16
|
for (out.x = x, out.y = y, out.z = z, out.alpha = theta + pi / 2; out.alpha > pi2; ) out.alpha -= pi2;
|
|
17
17
|
out.alpha = pi2 - out.alpha, out.zIndex = -1e4 * out.z, cb && cb(out);
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=sphere.js.map
|
|
19
|
+
}
|
package/es/custom/state.d.ts
CHANGED
package/es/custom/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/custom/state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAclD,MAAM,OAAO,KAAM,SAAQ,cAAsC;IAG/D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAgC;QACtG,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC1D,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,OAAO,CAAC,yBAAyB;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACnG,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,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,SAAS,CAAC,GAAG,CAAC,CAAC;gBACtC,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;IACtC,CAAC;CACF","file":"state.js","sourcesContent":["import type { EasingType, IAnimate, IStep } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IUpdateAnimationOptions {\n diffAttrs: Record<string, any>;\n animationState: string;\n diffState: string;\n data: Record<string, any>[];\n}\n\n/**\n * 文本输入动画,实现类似打字机的字符逐个显示效果\n * 支持通过beforeText和afterText参数添加前缀和后缀\n * 支持通过showCursor参数显示光标,cursorChar自定义光标字符\n */\nexport class State extends ACustomAnimate<Record<string, number>> {\n declare valid: boolean;\n\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: IUpdateAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\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.fromProps, 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.fromProps[key];\n const toValue = this.props[key];\n func(key, fromValue, toValue, easedRatio, this, this.target);\n });\n this.onUpdate(end, easedRatio, out);\n }\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { FadeIn } from './fade';
|
|
2
|
+
import type { EasingType } from '@visactor/vrender-core';
|
|
3
|
+
import { ACustomAnimate } from './custom-animate';
|
|
4
|
+
export declare class StoryFadeIn extends FadeIn {
|
|
5
|
+
}
|
|
6
|
+
export interface ISlideAnimationOptions {
|
|
7
|
+
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
distance?: number;
|
|
9
|
+
fromOpacity?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IGrowAnimationOptions {
|
|
12
|
+
fromScale?: number;
|
|
13
|
+
direction?: 'x' | 'y' | 'xy';
|
|
14
|
+
fromOpacity?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ISpinAnimationOptions {
|
|
17
|
+
fromAngle?: number;
|
|
18
|
+
fromScale?: number;
|
|
19
|
+
fromOpacity?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class SlideIn extends ACustomAnimate<Record<string, number>> {
|
|
22
|
+
valid: boolean;
|
|
23
|
+
propKeys: string[];
|
|
24
|
+
from: Record<string, number>;
|
|
25
|
+
to: Record<string, number>;
|
|
26
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions);
|
|
27
|
+
onBind(): void;
|
|
28
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class GrowIn extends ACustomAnimate<Record<string, number>> {
|
|
31
|
+
valid: boolean;
|
|
32
|
+
propKeys: string[];
|
|
33
|
+
from: Record<string, number>;
|
|
34
|
+
to: Record<string, number>;
|
|
35
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions);
|
|
36
|
+
onBind(): void;
|
|
37
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
38
|
+
}
|
|
39
|
+
export declare class SpinIn extends ACustomAnimate<Record<string, number>> {
|
|
40
|
+
valid: boolean;
|
|
41
|
+
propKeys: string[];
|
|
42
|
+
from: Record<string, number>;
|
|
43
|
+
to: Record<string, number>;
|
|
44
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions);
|
|
45
|
+
onBind(): void;
|
|
46
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
47
|
+
}
|
|
48
|
+
export interface IMoveScaleAnimationOptions {
|
|
49
|
+
slideDirection?: 'top' | 'bottom' | 'left' | 'right';
|
|
50
|
+
slideDistance?: number;
|
|
51
|
+
fromScale?: number;
|
|
52
|
+
scaleDirection?: 'x' | 'y' | 'xy';
|
|
53
|
+
slideRatio?: number;
|
|
54
|
+
fromOpacity?: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class MoveScaleIn extends ACustomAnimate<any> {
|
|
57
|
+
valid: boolean;
|
|
58
|
+
private readonly slideInDuration;
|
|
59
|
+
private readonly growInDuration;
|
|
60
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
|
|
61
|
+
onBind(): void;
|
|
62
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
63
|
+
}
|
|
64
|
+
export interface IMoveRotateAnimationOptions {
|
|
65
|
+
slideDirection?: 'top' | 'bottom' | 'left' | 'right';
|
|
66
|
+
slideDistance?: number;
|
|
67
|
+
fromAngle?: number;
|
|
68
|
+
fromScale?: number;
|
|
69
|
+
slideRatio?: number;
|
|
70
|
+
fromOpacity?: number;
|
|
71
|
+
}
|
|
72
|
+
export declare class MoveRotateIn extends ACustomAnimate<any> {
|
|
73
|
+
valid: boolean;
|
|
74
|
+
private readonly slideInDuration;
|
|
75
|
+
private readonly spinInDuration;
|
|
76
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
|
|
77
|
+
onBind(): void;
|
|
78
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
79
|
+
}
|
|
80
|
+
export declare class SlideOut extends ACustomAnimate<Record<string, number>> {
|
|
81
|
+
valid: boolean;
|
|
82
|
+
propKeys: string[];
|
|
83
|
+
from: Record<string, number>;
|
|
84
|
+
to: Record<string, number>;
|
|
85
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions & {
|
|
86
|
+
toOpacity?: number;
|
|
87
|
+
});
|
|
88
|
+
onFirstRun(): void;
|
|
89
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
90
|
+
}
|
|
91
|
+
export declare class GrowOut extends ACustomAnimate<Record<string, number>> {
|
|
92
|
+
valid: boolean;
|
|
93
|
+
propKeys: string[];
|
|
94
|
+
from: Record<string, number>;
|
|
95
|
+
to: Record<string, number>;
|
|
96
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions & {
|
|
97
|
+
toOpacity?: number;
|
|
98
|
+
});
|
|
99
|
+
onFirstRun(): void;
|
|
100
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
101
|
+
}
|
|
102
|
+
export declare class SpinOut extends ACustomAnimate<Record<string, number>> {
|
|
103
|
+
valid: boolean;
|
|
104
|
+
propKeys: string[];
|
|
105
|
+
from: Record<string, number>;
|
|
106
|
+
to: Record<string, number>;
|
|
107
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions & {
|
|
108
|
+
toOpacity?: number;
|
|
109
|
+
});
|
|
110
|
+
onFirstRun(): void;
|
|
111
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
112
|
+
}
|
|
113
|
+
export declare class MoveScaleOut extends ACustomAnimate<any> {
|
|
114
|
+
valid: boolean;
|
|
115
|
+
private readonly growOutDuration;
|
|
116
|
+
private readonly slideOutDuration;
|
|
117
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
|
|
118
|
+
onFirstRun(): void;
|
|
119
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
120
|
+
}
|
|
121
|
+
export declare class MoveRotateOut extends ACustomAnimate<any> {
|
|
122
|
+
valid: boolean;
|
|
123
|
+
private readonly spinOutDuration;
|
|
124
|
+
private readonly slideOutDuration;
|
|
125
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
|
|
126
|
+
onFirstRun(): void;
|
|
127
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
128
|
+
}
|