@visactor/vrender-animate 0.22.4 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate-extension.d.ts +12 -5
- package/cjs/animate-extension.js +23 -12
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +2 -5
- package/cjs/animate.js +23 -18
- package/cjs/animate.js.map +1 -1
- package/cjs/component/component-animate-extension.d.ts +1 -0
- package/cjs/component/component-animate-extension.js +1 -0
- package/cjs/component/component-animate-extension.js.map +1 -0
- package/cjs/component/component-animator.d.ts +22 -0
- package/cjs/component/component-animator.js +67 -0
- package/cjs/component/component-animator.js.map +1 -0
- package/cjs/component/index.d.ts +1 -0
- package/cjs/component/index.js +21 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/config/morphing.d.ts +2 -0
- package/cjs/config/morphing.js +9 -0
- package/cjs/config/morphing.js.map +1 -0
- package/cjs/custom/clip-graphic.d.ts +1 -1
- package/cjs/custom/clip-graphic.js +2 -2
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +2 -1
- package/cjs/custom/clip.js +9 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +1 -3
- package/cjs/custom/common.js +21 -17
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.d.ts +7 -3
- package/cjs/custom/custom-animate.js +13 -2
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/fade.d.ts +1 -1
- package/cjs/custom/fade.js +7 -2
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/fromTo.d.ts +10 -0
- package/cjs/custom/fromTo.js +42 -0
- package/cjs/custom/fromTo.js.map +1 -0
- package/cjs/custom/groupFade.d.ts +10 -0
- package/cjs/custom/groupFade.js +25 -0
- package/cjs/custom/groupFade.js.map +1 -0
- package/cjs/custom/growAngle.d.ts +10 -5
- package/cjs/custom/growAngle.js +38 -17
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.d.ts +1 -2
- package/cjs/custom/growCenter.js +16 -10
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.d.ts +1 -3
- package/cjs/custom/growHeight.js +19 -13
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.d.ts +1 -2
- package/cjs/custom/growPoints.js +41 -36
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.d.ts +4 -5
- package/cjs/custom/growRadius.js +22 -18
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.d.ts +1 -3
- package/cjs/custom/growWidth.js +15 -9
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/input-text.d.ts +1 -2
- package/cjs/custom/input-text.js.map +1 -1
- package/cjs/custom/label-item-animate.d.ts +7 -0
- package/cjs/custom/label-item-animate.js +221 -0
- package/cjs/custom/label-item-animate.js.map +1 -0
- package/cjs/custom/morphing.d.ts +51 -0
- package/cjs/custom/morphing.js +298 -0
- package/cjs/custom/morphing.js.map +1 -0
- package/cjs/custom/motionPath.d.ts +21 -0
- package/cjs/custom/motionPath.js +31 -0
- package/cjs/custom/motionPath.js.map +1 -0
- package/cjs/custom/move.d.ts +96 -0
- package/cjs/custom/move.js +133 -0
- package/cjs/custom/move.js.map +1 -0
- package/cjs/custom/number.d.ts +1 -2
- package/cjs/custom/number.js.map +1 -1
- package/cjs/custom/poptip-animate.d.ts +7 -0
- package/cjs/custom/poptip-animate.js +109 -0
- package/cjs/custom/poptip-animate.js.map +1 -0
- package/cjs/custom/register.d.ts +27 -0
- package/cjs/custom/register.js +418 -3
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +35 -0
- package/cjs/custom/richtext/input-richtext.js +80 -0
- package/cjs/custom/richtext/input-richtext.js.map +1 -0
- package/cjs/custom/richtext/output-richtext.d.ts +37 -0
- package/cjs/custom/richtext/output-richtext.js +94 -0
- package/cjs/custom/richtext/output-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/cjs/custom/richtext/slide-out-richtext.js +146 -0
- package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
- package/cjs/custom/richtext/slide-richtext.js +144 -0
- package/cjs/custom/richtext/slide-richtext.js.map +1 -0
- package/cjs/custom/rotate.d.ts +33 -0
- package/cjs/custom/rotate.js +79 -0
- package/cjs/custom/rotate.js.map +1 -0
- package/cjs/custom/scale.d.ts +6 -2
- package/cjs/custom/scale.js +32 -17
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.d.ts +2 -1
- package/cjs/custom/sphere.js +14 -5
- package/cjs/custom/sphere.js.map +1 -1
- package/cjs/custom/state.d.ts +1 -1
- package/cjs/custom/state.js +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.d.ts +196 -0
- package/cjs/custom/story.js +497 -0
- package/cjs/custom/story.js.map +1 -0
- package/cjs/custom/streamLight.d.ts +27 -0
- package/cjs/custom/streamLight.js +161 -0
- package/cjs/custom/streamLight.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +2 -3
- package/cjs/custom/tag-points.js +20 -4
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.d.ts +2 -2
- package/cjs/custom/update.js +10 -2
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +7 -6
- package/cjs/executor/animate-executor.js +118 -62
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/executor/executor.d.ts +9 -3
- package/cjs/executor/executor.js.map +1 -1
- package/cjs/index.d.ts +8 -8
- package/cjs/index.js +50 -18
- package/cjs/index.js.map +1 -1
- package/cjs/interpolate/store.d.ts +6 -2
- package/cjs/interpolate/store.js +13 -2
- package/cjs/interpolate/store.js.map +1 -1
- package/cjs/register.js +1 -5
- package/cjs/register.js.map +1 -1
- package/cjs/state/animation-state.d.ts +20 -2
- package/cjs/state/animation-state.js +48 -4
- package/cjs/state/animation-state.js.map +1 -1
- package/cjs/state/animation-states-registry.js +18 -0
- package/cjs/state/animation-states-registry.js.map +1 -1
- package/cjs/state/graphic-extension.d.ts +7 -1
- package/cjs/state/graphic-extension.js +20 -0
- package/cjs/state/graphic-extension.js.map +1 -1
- package/cjs/step.d.ts +7 -4
- package/cjs/step.js +33 -15
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +12 -7
- package/cjs/ticker/default-ticker.js +38 -33
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +6 -1
- package/cjs/ticker/manual-ticker.js +26 -4
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +14 -7
- package/cjs/timeline.js +31 -18
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/transform.d.ts +2 -0
- package/cjs/utils/transform.js +10 -0
- package/cjs/utils/transform.js.map +1 -0
- package/dist/index.es.js +3765 -527
- package/es/animate-extension.d.ts +12 -5
- package/es/animate-extension.js +24 -11
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +2 -5
- package/es/animate.js +14 -11
- package/es/animate.js.map +1 -1
- package/es/component/component-animate-extension.d.ts +1 -0
- package/es/component/component-animate-extension.js +1 -0
- package/es/component/component-animate-extension.js.map +1 -0
- package/es/component/component-animator.d.ts +22 -0
- package/es/component/component-animator.js +59 -0
- package/es/component/component-animator.js.map +1 -0
- package/es/component/index.d.ts +1 -0
- package/es/component/index.js +2 -0
- package/es/component/index.js.map +1 -0
- package/es/config/morphing.d.ts +2 -0
- package/es/config/morphing.js +5 -0
- package/es/config/morphing.js.map +1 -0
- package/es/custom/clip-graphic.d.ts +1 -1
- package/es/custom/clip-graphic.js +2 -2
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +2 -1
- package/es/custom/clip.js +9 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +1 -3
- package/es/custom/common.js +21 -17
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.d.ts +7 -3
- package/es/custom/custom-animate.js +10 -1
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/fade.d.ts +1 -1
- package/es/custom/fade.js +7 -2
- package/es/custom/fade.js.map +1 -1
- package/es/custom/fromTo.d.ts +10 -0
- package/es/custom/fromTo.js +34 -0
- package/es/custom/fromTo.js.map +1 -0
- package/es/custom/groupFade.d.ts +10 -0
- package/es/custom/groupFade.js +15 -0
- package/es/custom/groupFade.js.map +1 -0
- package/es/custom/growAngle.d.ts +10 -5
- package/es/custom/growAngle.js +39 -15
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.d.ts +1 -2
- package/es/custom/growCenter.js +16 -10
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.d.ts +1 -3
- package/es/custom/growHeight.js +20 -14
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.d.ts +1 -2
- package/es/custom/growPoints.js +40 -36
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.d.ts +4 -5
- package/es/custom/growRadius.js +22 -16
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.d.ts +1 -3
- package/es/custom/growWidth.js +16 -10
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/input-text.d.ts +1 -2
- package/es/custom/input-text.js.map +1 -1
- package/es/custom/label-item-animate.d.ts +7 -0
- package/es/custom/label-item-animate.js +215 -0
- package/es/custom/label-item-animate.js.map +1 -0
- package/es/custom/morphing.d.ts +51 -0
- package/es/custom/morphing.js +289 -0
- package/es/custom/morphing.js.map +1 -0
- package/es/custom/motionPath.d.ts +21 -0
- package/es/custom/motionPath.js +23 -0
- package/es/custom/motionPath.js.map +1 -0
- package/es/custom/move.d.ts +96 -0
- package/es/custom/move.js +118 -0
- package/es/custom/move.js.map +1 -0
- package/es/custom/number.d.ts +1 -2
- package/es/custom/number.js.map +1 -1
- package/es/custom/poptip-animate.d.ts +7 -0
- package/es/custom/poptip-animate.js +103 -0
- package/es/custom/poptip-animate.js.map +1 -0
- package/es/custom/register.d.ts +27 -0
- package/es/custom/register.js +48 -1
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +35 -0
- package/es/custom/richtext/input-richtext.js +74 -0
- package/es/custom/richtext/input-richtext.js.map +1 -0
- package/es/custom/richtext/output-richtext.d.ts +37 -0
- package/es/custom/richtext/output-richtext.js +88 -0
- package/es/custom/richtext/output-richtext.js.map +1 -0
- package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/es/custom/richtext/slide-out-richtext.js +140 -0
- package/es/custom/richtext/slide-out-richtext.js.map +1 -0
- package/es/custom/richtext/slide-richtext.d.ts +36 -0
- package/es/custom/richtext/slide-richtext.js +138 -0
- package/es/custom/richtext/slide-richtext.js.map +1 -0
- package/es/custom/rotate.d.ts +33 -0
- package/es/custom/rotate.js +65 -0
- package/es/custom/rotate.js.map +1 -0
- package/es/custom/scale.d.ts +6 -2
- package/es/custom/scale.js +32 -17
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.d.ts +2 -1
- package/es/custom/sphere.js +14 -5
- package/es/custom/sphere.js.map +1 -1
- package/es/custom/state.d.ts +1 -1
- package/es/custom/state.js +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.d.ts +196 -0
- package/es/custom/story.js +468 -0
- package/es/custom/story.js.map +1 -0
- package/es/custom/streamLight.d.ts +27 -0
- package/es/custom/streamLight.js +157 -0
- package/es/custom/streamLight.js.map +1 -0
- package/es/custom/tag-points.d.ts +2 -3
- package/es/custom/tag-points.js +21 -5
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.d.ts +2 -2
- package/es/custom/update.js +10 -2
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +7 -6
- package/es/executor/animate-executor.js +116 -61
- package/es/executor/animate-executor.js.map +1 -1
- package/es/executor/executor.d.ts +9 -3
- package/es/executor/executor.js.map +1 -1
- package/es/index.d.ts +8 -8
- package/es/index.js +10 -12
- package/es/index.js.map +1 -1
- package/es/interpolate/store.d.ts +6 -2
- package/es/interpolate/store.js +13 -3
- package/es/interpolate/store.js.map +1 -1
- package/es/register.js +0 -8
- package/es/register.js.map +1 -1
- package/es/state/animation-state.d.ts +20 -2
- package/es/state/animation-state.js +48 -2
- package/es/state/animation-state.js.map +1 -1
- package/es/state/animation-states-registry.js +18 -0
- package/es/state/animation-states-registry.js.map +1 -1
- package/es/state/graphic-extension.d.ts +7 -1
- package/es/state/graphic-extension.js +20 -0
- package/es/state/graphic-extension.js.map +1 -1
- package/es/step.d.ts +7 -4
- package/es/step.js +34 -16
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +12 -7
- package/es/ticker/default-ticker.js +30 -27
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +6 -1
- package/es/ticker/manual-ticker.js +27 -3
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +14 -7
- package/es/timeline.js +33 -18
- package/es/timeline.js.map +1 -1
- package/es/utils/transform.d.ts +2 -0
- package/es/utils/transform.js +4 -0
- package/es/utils/transform.js.map +1 -0
- package/package.json +16 -16
- package/cjs/custom/group-fade.d.ts +0 -16
- package/cjs/custom/group-fade.js +0 -66
- package/cjs/custom/group-fade.js.map +0 -1
- package/cjs/custom/scale-in.d.ts +0 -13
- package/cjs/custom/scale-in.js +0 -57
- package/cjs/custom/scale-in.js.map +0 -1
- package/cjs/interpolate/executor.d.ts +0 -66
- package/cjs/interpolate/executor.js +0 -6
- package/cjs/interpolate/executor.js.map +0 -1
- package/cjs/intreface/animate.d.ts +0 -91
- package/cjs/intreface/animate.js +0 -10
- package/cjs/intreface/animate.js.map +0 -1
- package/cjs/intreface/easing.d.ts +0 -3
- package/cjs/intreface/easing.js +0 -6
- package/cjs/intreface/easing.js.map +0 -1
- package/cjs/intreface/state.d.ts +0 -35
- package/cjs/intreface/state.js +0 -6
- package/cjs/intreface/state.js.map +0 -1
- package/cjs/intreface/ticker.d.ts +0 -37
- package/cjs/intreface/ticker.js +0 -10
- package/cjs/intreface/ticker.js.map +0 -1
- package/cjs/intreface/timeline.d.ts +0 -17
- package/cjs/intreface/timeline.js +0 -6
- package/cjs/intreface/timeline.js.map +0 -1
- package/cjs/intreface/type.d.ts +0 -13
- package/cjs/intreface/type.js +0 -15
- package/cjs/intreface/type.js.map +0 -1
- package/cjs/state/animation-state-machine.d.ts +0 -22
- package/cjs/state/animation-state-machine.js +0 -53
- package/cjs/state/animation-state-machine.js.map +0 -1
- package/cjs/state/animation-state-queue.d.ts +0 -24
- package/cjs/state/animation-state-queue.js +0 -66
- package/cjs/state/animation-state-queue.js.map +0 -1
- package/cjs/state/animation-state-registry.d.ts +0 -14
- package/cjs/state/animation-state-registry.js +0 -53
- package/cjs/state/animation-state-registry.js.map +0 -1
- package/es/custom/group-fade.d.ts +0 -16
- package/es/custom/group-fade.js +0 -56
- package/es/custom/group-fade.js.map +0 -1
- package/es/custom/scale-in.d.ts +0 -13
- package/es/custom/scale-in.js +0 -49
- package/es/custom/scale-in.js.map +0 -1
- package/es/interpolate/executor.d.ts +0 -66
- package/es/interpolate/executor.js +0 -2
- package/es/interpolate/executor.js.map +0 -1
- package/es/intreface/animate.d.ts +0 -91
- package/es/intreface/animate.js +0 -6
- package/es/intreface/animate.js.map +0 -1
- package/es/intreface/easing.d.ts +0 -3
- package/es/intreface/easing.js +0 -2
- package/es/intreface/easing.js.map +0 -1
- package/es/intreface/state.d.ts +0 -35
- package/es/intreface/state.js +0 -2
- package/es/intreface/state.js.map +0 -1
- package/es/intreface/ticker.d.ts +0 -37
- package/es/intreface/ticker.js +0 -6
- package/es/intreface/ticker.js.map +0 -1
- package/es/intreface/timeline.d.ts +0 -17
- package/es/intreface/timeline.js +0 -2
- package/es/intreface/timeline.js.map +0 -1
- package/es/intreface/type.d.ts +0 -13
- package/es/intreface/type.js +0 -14
- package/es/intreface/type.js.map +0 -1
- package/es/state/animation-state-machine.d.ts +0 -22
- package/es/state/animation-state-machine.js +0 -47
- package/es/state/animation-state-machine.js.map +0 -1
- package/es/state/animation-state-queue.d.ts +0 -24
- package/es/state/animation-state-queue.js +0 -58
- package/es/state/animation-state-queue.js.map +0 -1
- package/es/state/animation-state-registry.d.ts +0 -14
- package/es/state/animation-state-registry.js +0 -45
- package/es/state/animation-state-registry.js.map +0 -1
|
@@ -0,0 +1,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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.RotateOut = exports.RotateIn = exports.RotateBase = exports.rotateOut = exports.rotateIn = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate"), rotateIn = (graphic, options) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const attributeAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
10
|
+
let angle = 0;
|
|
11
|
+
return angle = (0, vutils_1.isNumberClose)(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
|
|
12
|
+
vutils_1.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,
|
|
13
|
+
{
|
|
14
|
+
from: {
|
|
15
|
+
angle: angle
|
|
16
|
+
},
|
|
17
|
+
to: {
|
|
18
|
+
angle: attributeAngle
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.rotateIn = rotateIn;
|
|
24
|
+
|
|
25
|
+
const rotateOut = (graphic, options) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const finalAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
28
|
+
let angle = 0;
|
|
29
|
+
return angle = (0, vutils_1.isNumberClose)(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
|
|
30
|
+
vutils_1.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,
|
|
31
|
+
{
|
|
32
|
+
from: {
|
|
33
|
+
angle: finalAngle
|
|
34
|
+
},
|
|
35
|
+
to: {
|
|
36
|
+
angle: angle
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.rotateOut = rotateOut;
|
|
42
|
+
|
|
43
|
+
class RotateBase extends custom_animate_1.ACustomAnimate {
|
|
44
|
+
constructor(from, to, duration, easing, params) {
|
|
45
|
+
super(from, to, duration, easing, params);
|
|
46
|
+
}
|
|
47
|
+
onUpdate(end, ratio, out) {
|
|
48
|
+
const attribute = this.target.attribute;
|
|
49
|
+
this.propKeys.forEach((key => {
|
|
50
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
51
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.RotateBase = RotateBase;
|
|
56
|
+
|
|
57
|
+
class RotateIn extends RotateBase {
|
|
58
|
+
onBind() {
|
|
59
|
+
var _a;
|
|
60
|
+
super.onBind();
|
|
61
|
+
const {from: from, to: to} = (0, exports.rotateIn)(this.target, this.params.options);
|
|
62
|
+
this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;
|
|
63
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
64
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.RotateIn = RotateIn;
|
|
69
|
+
|
|
70
|
+
class RotateOut extends RotateBase {
|
|
71
|
+
onBind() {
|
|
72
|
+
super.onBind();
|
|
73
|
+
const {from: from, to: to} = (0, exports.rotateOut)(this.target, this.params.options);
|
|
74
|
+
this.props = to, this.propKeys = [ "angle" ], this.from = from, this.to = to;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C,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;SAC3C;QAED,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,gBAAgB,MAAK,KAAK,EAAE;YAC1D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArBD,4BAqBC;AAED,MAAa,SAAU,SAAQ,UAAU;IACvC,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAA,iBAAS,EAAC,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;AAVD,8BAUC","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 super.onBind();\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 this.target.setAttributes(finalAttribute);\n }\n\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\n }\n}\n\nexport class RotateOut extends RotateBase {\n onBind(): void {\n super.onBind();\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/cjs/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';
|
|
@@ -7,8 +6,13 @@ export interface IScaleAnimationOptions {
|
|
|
7
6
|
export declare class ScaleIn extends ACustomAnimate<Record<string, number>> {
|
|
8
7
|
valid: boolean;
|
|
9
8
|
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
9
|
+
_updateFunction: (ratio: number) => void;
|
|
10
10
|
onBind(): void;
|
|
11
11
|
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
12
|
+
updateX(ratio: number): void;
|
|
13
|
+
updateY(ratio: number): void;
|
|
14
|
+
updateXY(ratio: number): void;
|
|
15
|
+
deleteSelfAttr(key: string): void;
|
|
12
16
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
13
17
|
}
|
|
14
18
|
export declare class ScaleOut extends ACustomAnimate<Record<string, number>> {
|
package/cjs/custom/scale.js
CHANGED
|
@@ -11,16 +11,17 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
|
|
|
11
11
|
super(from, to, duration, easing, params);
|
|
12
12
|
}
|
|
13
13
|
onBind() {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
15
15
|
let from, to;
|
|
16
|
-
|
|
16
|
+
super.onBind();
|
|
17
|
+
const attrs = this.target.getFinalAttribute(), fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
|
|
17
18
|
switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
|
|
18
19
|
case "x":
|
|
19
20
|
from = {
|
|
20
21
|
scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
|
|
21
22
|
}, to = {
|
|
22
23
|
scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
|
|
23
|
-
};
|
|
24
|
+
}, this._updateFunction = this.updateX;
|
|
24
25
|
break;
|
|
25
26
|
|
|
26
27
|
case "y":
|
|
@@ -28,7 +29,7 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
|
|
|
28
29
|
scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
|
|
29
30
|
}, to = {
|
|
30
31
|
scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
|
|
31
|
-
};
|
|
32
|
+
}, this._updateFunction = this.updateY;
|
|
32
33
|
break;
|
|
33
34
|
|
|
34
35
|
default:
|
|
@@ -38,18 +39,32 @@ class ScaleIn extends custom_animate_1.ACustomAnimate {
|
|
|
38
39
|
}, to = {
|
|
39
40
|
scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
|
|
40
41
|
scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
|
|
41
|
-
};
|
|
42
|
+
}, this._updateFunction = this.updateXY;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
this.
|
|
44
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
45
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.props = to, this.from = from,
|
|
46
|
+
this.to = to, !1 !== (null === (_l = this.params.controlOptions) || void 0 === _l ? void 0 : _l.immediatelyApply) && this.target.setAttributes(from);
|
|
45
47
|
}
|
|
46
48
|
onEnd(cb) {
|
|
47
49
|
super.onEnd(cb);
|
|
48
50
|
}
|
|
51
|
+
updateX(ratio) {
|
|
52
|
+
this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
|
|
53
|
+
}
|
|
54
|
+
updateY(ratio) {
|
|
55
|
+
this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
|
|
56
|
+
}
|
|
57
|
+
updateXY(ratio) {
|
|
58
|
+
this.updateX(ratio), this.updateY(ratio);
|
|
59
|
+
}
|
|
60
|
+
deleteSelfAttr(key) {
|
|
61
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
62
|
+
const index = this.propKeys.indexOf(key);
|
|
63
|
+
-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;
|
|
64
|
+
}
|
|
49
65
|
onUpdate(end, ratio, out) {
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
})), this.target.setAttributes(out);
|
|
66
|
+
this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(),
|
|
67
|
+
this.target.addUpdateBoundTag());
|
|
53
68
|
}
|
|
54
69
|
}
|
|
55
70
|
|
|
@@ -62,7 +77,8 @@ class ScaleOut extends custom_animate_1.ACustomAnimate {
|
|
|
62
77
|
onBind() {
|
|
63
78
|
var _a, _b, _c, _d, _e;
|
|
64
79
|
let from, to;
|
|
65
|
-
|
|
80
|
+
super.onBind();
|
|
81
|
+
const attrs = this.target.attribute;
|
|
66
82
|
switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
|
|
67
83
|
case "x":
|
|
68
84
|
from = {
|
|
@@ -89,18 +105,17 @@ class ScaleOut extends custom_animate_1.ACustomAnimate {
|
|
|
89
105
|
scaleY: 0
|
|
90
106
|
};
|
|
91
107
|
}
|
|
92
|
-
this.props = to, this.
|
|
93
|
-
this.to = to;
|
|
108
|
+
this.props = to, this.from = from, this.to = to;
|
|
94
109
|
}
|
|
95
110
|
onEnd(cb) {
|
|
96
111
|
super.onEnd(cb);
|
|
97
112
|
}
|
|
98
113
|
onUpdate(end, ratio, out) {
|
|
114
|
+
const attribute = this.target.attribute;
|
|
99
115
|
this.propKeys.forEach((key => {
|
|
100
|
-
|
|
101
|
-
})), this.target.
|
|
116
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
117
|
+
})), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
|
|
102
118
|
}
|
|
103
119
|
}
|
|
104
120
|
|
|
105
|
-
exports.ScaleOut = ScaleOut;
|
|
106
|
-
//# sourceMappingURL=scale.js.map
|
|
121
|
+
exports.ScaleOut = ScaleOut;
|
package/cjs/custom/scale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/scale.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/custom/scale.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAMlD,MAAa,OAAQ,SAAQ,+BAAsC;IAGjE,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;IAC5C,CAAC;IAID,MAAM;;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,IAA4B,CAAC;QACjC,IAAI,EAA0B,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;QAE9C,QAAQ,MAAA,IAAI,CAAC,MAAM,0CAAE,SAAS,EAAE;YAC9B,KAAK,GAAG;gBACN,IAAI,GAAG,EAAE,MAAM,EAA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;QACnC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;CACF;AA/CD,4BA+CC","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 super.onBind();\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 this.target.setAttributes(finalAttribute);\n }\n\n this.props = to;\n this.from = from;\n this.to = to;\n if (this.params.controlOptions?.immediatelyApply !== false) {\n this.target.setAttributes(from);\n }\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 this.target.addUpdateBoundTag();\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 super.onBind();\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 this.target.addUpdateBoundTag();\n }\n}\n"]}
|
package/cjs/custom/sphere.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export declare class RotateBySphereAnimate extends ACustomAnimate<any> {
|
|
|
12
12
|
params: RotateSphereParams;
|
|
13
13
|
theta: number;
|
|
14
14
|
phi: number;
|
|
15
|
-
onStart(): void;
|
|
16
15
|
onBind(): void;
|
|
16
|
+
onFirstRun(): void;
|
|
17
|
+
onStart(): void;
|
|
17
18
|
onEnd(): void;
|
|
18
19
|
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
19
20
|
}
|
package/cjs/custom/sphere.js
CHANGED
|
@@ -7,18 +7,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), custom_animate_1 = require("./custom-animate");
|
|
8
8
|
|
|
9
9
|
class RotateBySphereAnimate extends custom_animate_1.ACustomAnimate {
|
|
10
|
+
onBind() {
|
|
11
|
+
super.onBind(), this.propKeys = [ "x", "y", "z", "alpha", "zIndex" ];
|
|
12
|
+
}
|
|
13
|
+
onFirstRun() {
|
|
14
|
+
super.onFirstRun();
|
|
15
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
16
|
+
finalAttribute && this.target.setAttributes(finalAttribute);
|
|
17
|
+
}
|
|
10
18
|
onStart() {
|
|
11
|
-
|
|
19
|
+
super.onStart();
|
|
20
|
+
const {center: center, r: r} = "function" == typeof this.params ? this.params() : this.params, startX = this.target.finalAttribute.x, startY = this.target.finalAttribute.y, startZ = this.target.finalAttribute.z, phi = Math.acos((startY - center.y) / r);
|
|
12
21
|
let theta = Math.acos((startX - center.x) / r / Math.sin(phi));
|
|
13
22
|
startZ - center.z < 0 && (theta = vutils_1.pi2 - theta), this.theta = theta, this.phi = phi;
|
|
14
23
|
}
|
|
15
|
-
onBind() {}
|
|
16
24
|
onEnd() {}
|
|
17
25
|
onUpdate(end, ratio, out) {
|
|
18
26
|
if (null == this.phi || null == this.theta) return;
|
|
19
|
-
const {center: center, r: r, cb: cb} = "function" == typeof this.params ? this.params() : this.params, deltaAngle = 2 * Math.PI * ratio, theta = this.theta + deltaAngle, phi = this.phi, x = r * Math.sin(phi) * Math.cos(theta) + center.x, y = r * Math.cos(phi) + center.y, z = r * Math.sin(phi) * Math.sin(theta) + center.z;
|
|
20
|
-
for (
|
|
21
|
-
|
|
27
|
+
const target = this.target, {center: center, r: r, cb: cb} = "function" == typeof this.params ? this.params() : this.params, deltaAngle = 2 * Math.PI * ratio, theta = this.theta + deltaAngle, phi = this.phi, x = r * Math.sin(phi) * Math.cos(theta) + center.x, y = r * Math.cos(phi) + center.y, z = r * Math.sin(phi) * Math.sin(theta) + center.z;
|
|
28
|
+
for (target.attribute.x = x, target.attribute.y = y, target.attribute.z = z, target.attribute.alpha = theta + vutils_1.pi / 2; target.attribute.alpha > vutils_1.pi2; ) target.attribute.alpha -= vutils_1.pi2;
|
|
29
|
+
target.attribute.alpha = vutils_1.pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z,
|
|
30
|
+
cb && cb(out);
|
|
22
31
|
}
|
|
23
32
|
}
|
|
24
33
|
|
package/cjs/custom/sphere.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/sphere.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,qDAAkD;AAUlD,MAAa,qBAAsB,SAAQ,+BAAmB;IAK5D,OAAO;QACL,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;QACtF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/custom/sphere.ts"],"names":[],"mappings":";;;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AAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;QAEvB,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,GAAG,WAAE,GAAG,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,YAAG,EAAE;YACnC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,YAAG,CAAC;SAC/B;QACD,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,YAAG,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QAEtD,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;QACtD,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;CACF;AAvED,sDAuEC","file":"sphere.js","sourcesContent":["import { pi, pi2 } from '@visactor/vutils';\nimport { ACustomAnimate } from './custom-animate';\n\ntype RotateSphereParams =\n | {\n center: { x: number; y: number; z: number };\n r: number;\n cb?: (out: any) => void;\n }\n | (() => any);\n\nexport class RotateBySphereAnimate extends ACustomAnimate<any> {\n declare params: RotateSphereParams;\n declare theta: number;\n declare phi: number;\n\n onBind(): void {\n super.onBind();\n\n // const to: Record<string, number> = {};\n // const from: Record<string, number> = this.from ?? {};\n\n // 用于入场的时候设置属性(因为有动画的时候VChart不会再设置属性了)\n\n // this.props = to;\n this.propKeys = ['x', 'y', 'z', 'alpha', 'zIndex'];\n // this.from = from;\n // this.to = to;\n }\n\n onFirstRun(): void {\n super.onFirstRun();\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n }\n\n onStart(): void {\n super.onStart();\n const { center, r } = typeof this.params === 'function' ? this.params() : this.params;\n const startX = this.target.finalAttribute.x;\n const startY = this.target.finalAttribute.y;\n const startZ = this.target.finalAttribute.z;\n const phi = Math.acos((startY - center.y) / r);\n let theta = Math.acos((startX - center.x) / r / Math.sin(phi));\n if (startZ - center.z < 0) {\n theta = pi2 - theta;\n }\n this.theta = theta;\n this.phi = phi;\n }\n\n onEnd() {\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.phi == null || this.theta == null) {\n return;\n }\n const target = this.target;\n const { center, r, cb } = typeof this.params === 'function' ? this.params() : this.params;\n const deltaAngle = Math.PI * 2 * ratio;\n const theta = this.theta + deltaAngle;\n const phi = this.phi;\n const x = r * Math.sin(phi) * Math.cos(theta) + center.x;\n const y = r * Math.cos(phi) + center.y;\n const z = r * Math.sin(phi) * Math.sin(theta) + center.z;\n target.attribute.x = x;\n target.attribute.y = y;\n target.attribute.z = z;\n // out.beta = phi;\n target.attribute.alpha = theta + pi / 2;\n while (target.attribute.alpha > pi2) {\n target.attribute.alpha -= pi2;\n }\n target.attribute.alpha = pi2 - target.attribute.alpha;\n\n target.attribute.zIndex = target.attribute.z * -10000;\n cb && cb(out);\n }\n}\n"]}
|
package/cjs/custom/state.d.ts
CHANGED
package/cjs/custom/state.js
CHANGED
|
@@ -17,7 +17,7 @@ class State extends custom_animate_1.ACustomAnimate {
|
|
|
17
17
|
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
18
18
|
const key = this.propKeys[index];
|
|
19
19
|
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
20
|
-
})), this.onUpdate(end, easedRatio, out);
|
|
20
|
+
})), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
package/cjs/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,qDAAkD;AAclD,MAAa,KAAM,SAAQ,+BAAsC;IAG/D,YAAY,IAAU,EAAE,EAAQ,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAgC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"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 this.syncAttributeUpdate();\n }\n}\n"]}
|
|
@@ -0,0 +1,196 @@
|
|
|
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 interface IStrokeAnimationOptions {
|
|
22
|
+
lineWidth?: number;
|
|
23
|
+
strokeColor?: string;
|
|
24
|
+
fromOpacity?: number;
|
|
25
|
+
dashLength?: number;
|
|
26
|
+
showFill?: boolean;
|
|
27
|
+
fillOpacity?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface IPulseAnimationOptions {
|
|
30
|
+
pulseCount?: number;
|
|
31
|
+
pulseOpacity?: number;
|
|
32
|
+
pulseScale?: number;
|
|
33
|
+
pulseColor?: string;
|
|
34
|
+
pulseColorIntensity?: number;
|
|
35
|
+
strokeOnly?: boolean;
|
|
36
|
+
fillOnly?: boolean;
|
|
37
|
+
useScale?: boolean;
|
|
38
|
+
useOpacity?: boolean;
|
|
39
|
+
useColor?: boolean;
|
|
40
|
+
useStroke?: boolean;
|
|
41
|
+
useFill?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare class SlideIn extends ACustomAnimate<Record<string, number>> {
|
|
44
|
+
valid: boolean;
|
|
45
|
+
propKeys: string[];
|
|
46
|
+
from: Record<string, number>;
|
|
47
|
+
to: Record<string, number>;
|
|
48
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions);
|
|
49
|
+
onBind(): void;
|
|
50
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
51
|
+
}
|
|
52
|
+
export declare class GrowIn extends ACustomAnimate<Record<string, number>> {
|
|
53
|
+
valid: boolean;
|
|
54
|
+
propKeys: string[];
|
|
55
|
+
from: Record<string, number>;
|
|
56
|
+
to: Record<string, number>;
|
|
57
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions);
|
|
58
|
+
onBind(): void;
|
|
59
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
60
|
+
}
|
|
61
|
+
export declare class SpinIn extends ACustomAnimate<Record<string, number>> {
|
|
62
|
+
valid: boolean;
|
|
63
|
+
propKeys: string[];
|
|
64
|
+
from: Record<string, number>;
|
|
65
|
+
to: Record<string, number>;
|
|
66
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions);
|
|
67
|
+
onBind(): void;
|
|
68
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
69
|
+
}
|
|
70
|
+
export declare class StrokeIn extends ACustomAnimate<Record<string, any>> {
|
|
71
|
+
valid: boolean;
|
|
72
|
+
propKeys: string[];
|
|
73
|
+
from: Record<string, any>;
|
|
74
|
+
to: Record<string, any>;
|
|
75
|
+
private perimeter;
|
|
76
|
+
private originalAttributes;
|
|
77
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IStrokeAnimationOptions);
|
|
78
|
+
onBind(): void;
|
|
79
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
80
|
+
onEnd(): void;
|
|
81
|
+
}
|
|
82
|
+
export declare class StrokeOut extends ACustomAnimate<Record<string, any>> {
|
|
83
|
+
valid: boolean;
|
|
84
|
+
propKeys: string[];
|
|
85
|
+
from: Record<string, any>;
|
|
86
|
+
to: Record<string, any>;
|
|
87
|
+
private perimeter;
|
|
88
|
+
private originalAttributes;
|
|
89
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IStrokeAnimationOptions);
|
|
90
|
+
onFirstRun(): void;
|
|
91
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
92
|
+
}
|
|
93
|
+
export interface IMoveScaleAnimationOptions {
|
|
94
|
+
slideDirection?: 'top' | 'bottom' | 'left' | 'right';
|
|
95
|
+
slideDistance?: number;
|
|
96
|
+
fromScale?: number;
|
|
97
|
+
scaleDirection?: 'x' | 'y' | 'xy';
|
|
98
|
+
slideRatio?: number;
|
|
99
|
+
fromOpacity?: number;
|
|
100
|
+
}
|
|
101
|
+
export declare class MoveScaleIn extends ACustomAnimate<any> {
|
|
102
|
+
valid: boolean;
|
|
103
|
+
private readonly slideInDuration;
|
|
104
|
+
private readonly growInDuration;
|
|
105
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
|
|
106
|
+
onBind(): void;
|
|
107
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
108
|
+
}
|
|
109
|
+
export interface IMoveRotateAnimationOptions {
|
|
110
|
+
slideDirection?: 'top' | 'bottom' | 'left' | 'right';
|
|
111
|
+
slideDistance?: number;
|
|
112
|
+
fromAngle?: number;
|
|
113
|
+
fromScale?: number;
|
|
114
|
+
slideRatio?: number;
|
|
115
|
+
fromOpacity?: number;
|
|
116
|
+
}
|
|
117
|
+
export declare class MoveRotateIn extends ACustomAnimate<any> {
|
|
118
|
+
valid: boolean;
|
|
119
|
+
private readonly slideInDuration;
|
|
120
|
+
private readonly spinInDuration;
|
|
121
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
|
|
122
|
+
onBind(): void;
|
|
123
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
124
|
+
}
|
|
125
|
+
export declare class SlideOut extends ACustomAnimate<Record<string, number>> {
|
|
126
|
+
valid: boolean;
|
|
127
|
+
propKeys: string[];
|
|
128
|
+
from: Record<string, number>;
|
|
129
|
+
to: Record<string, number>;
|
|
130
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISlideAnimationOptions & {
|
|
131
|
+
toOpacity?: number;
|
|
132
|
+
});
|
|
133
|
+
onFirstRun(): void;
|
|
134
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
135
|
+
}
|
|
136
|
+
export declare class GrowOut extends ACustomAnimate<Record<string, number>> {
|
|
137
|
+
valid: boolean;
|
|
138
|
+
propKeys: string[];
|
|
139
|
+
from: Record<string, number>;
|
|
140
|
+
to: Record<string, number>;
|
|
141
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IGrowAnimationOptions & {
|
|
142
|
+
toOpacity?: number;
|
|
143
|
+
});
|
|
144
|
+
onFirstRun(): void;
|
|
145
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
146
|
+
}
|
|
147
|
+
export declare class SpinOut extends ACustomAnimate<Record<string, number>> {
|
|
148
|
+
valid: boolean;
|
|
149
|
+
propKeys: string[];
|
|
150
|
+
from: Record<string, number>;
|
|
151
|
+
to: Record<string, number>;
|
|
152
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: ISpinAnimationOptions & {
|
|
153
|
+
toOpacity?: number;
|
|
154
|
+
});
|
|
155
|
+
onFirstRun(): void;
|
|
156
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
157
|
+
}
|
|
158
|
+
export declare class MoveScaleOut extends ACustomAnimate<any> {
|
|
159
|
+
valid: boolean;
|
|
160
|
+
private readonly growOutDuration;
|
|
161
|
+
private readonly slideOutDuration;
|
|
162
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveScaleAnimationOptions);
|
|
163
|
+
onFirstRun(): void;
|
|
164
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
165
|
+
}
|
|
166
|
+
export declare class MoveRotateOut extends ACustomAnimate<any> {
|
|
167
|
+
valid: boolean;
|
|
168
|
+
private readonly spinOutDuration;
|
|
169
|
+
private readonly slideOutDuration;
|
|
170
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IMoveRotateAnimationOptions);
|
|
171
|
+
onFirstRun(): void;
|
|
172
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
173
|
+
}
|
|
174
|
+
export declare class PulseAnimate extends ACustomAnimate<Record<string, any>> {
|
|
175
|
+
valid: boolean;
|
|
176
|
+
private originalAttributes;
|
|
177
|
+
private pulseCount;
|
|
178
|
+
private pulseOpacity;
|
|
179
|
+
private pulseScale;
|
|
180
|
+
private pulseColor;
|
|
181
|
+
private pulseColorIntensity;
|
|
182
|
+
private strokeOnly;
|
|
183
|
+
private fillOnly;
|
|
184
|
+
private useScale;
|
|
185
|
+
private useOpacity;
|
|
186
|
+
private useStroke;
|
|
187
|
+
private useFill;
|
|
188
|
+
private useColor;
|
|
189
|
+
private originalFill;
|
|
190
|
+
private originalStroke;
|
|
191
|
+
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IPulseAnimationOptions);
|
|
192
|
+
onBind(): void;
|
|
193
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
194
|
+
private applyColorPulse;
|
|
195
|
+
onEnd(): void;
|
|
196
|
+
}
|