@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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IAnimate } from './animate';
|
|
2
|
-
export interface ITimeline {
|
|
3
|
-
id: number;
|
|
4
|
-
isGlobal?: boolean;
|
|
5
|
-
animateCount: number;
|
|
6
|
-
addAnimate: (animate: IAnimate) => void;
|
|
7
|
-
removeAnimate: (animate: IAnimate, release?: boolean) => void;
|
|
8
|
-
tick: (delta: number) => void;
|
|
9
|
-
clear: () => void;
|
|
10
|
-
pause: () => void;
|
|
11
|
-
resume: () => void;
|
|
12
|
-
getTotalDuration: () => number;
|
|
13
|
-
getPlaySpeed: () => number;
|
|
14
|
-
setPlaySpeed: (speed: number) => void;
|
|
15
|
-
getPlayState: () => 'playing' | 'paused' | 'stopped';
|
|
16
|
-
isRunning: () => boolean;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/intreface/timeline.ts"],"names":[],"mappings":"","file":"timeline.js","sourcesContent":["import type { IAnimate } from './animate';\n\nexport interface ITimeline {\n id: number;\n isGlobal?: boolean;\n // 包含的动画数量(animate数组的数量),包含所有动画\n animateCount: number;\n // 添加动画\n addAnimate: (animate: IAnimate) => void;\n // 移除动画\n removeAnimate: (animate: IAnimate, release?: boolean) => void;\n // 更新动画\n tick: (delta: number) => void;\n // 清除动画\n clear: () => void;\n // 暂停动画\n pause: () => void;\n // 恢复动画\n resume: () => void;\n // 获取动画总时长\n getTotalDuration: () => number;\n // 获取动画的播放速度\n getPlaySpeed: () => number;\n // 设置动画的播放速度\n setPlaySpeed: (speed: number) => void;\n // 获取动画的播放状态\n getPlayState: () => 'playing' | 'paused' | 'stopped';\n // 获取动画是否正在运行\n isRunning: () => boolean;\n}\n"]}
|
package/cjs/intreface/type.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare enum AnimateStepType {
|
|
2
|
-
wait = "wait",
|
|
3
|
-
from = "from",
|
|
4
|
-
to = "to",
|
|
5
|
-
customAnimate = "customAnimate"
|
|
6
|
-
}
|
|
7
|
-
export declare enum AnimateStatus {
|
|
8
|
-
INITIAL = 0,
|
|
9
|
-
RUNNING = 1,
|
|
10
|
-
PAUSED = 2,
|
|
11
|
-
END = 3
|
|
12
|
-
}
|
|
13
|
-
export type IAnimateStepType = keyof typeof AnimateStepType;
|
package/cjs/intreface/type.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var AnimateStepType, AnimateStatus;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: !0
|
|
7
|
-
}), exports.AnimateStatus = exports.AnimateStepType = void 0, function(AnimateStepType) {
|
|
8
|
-
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to",
|
|
9
|
-
AnimateStepType.customAnimate = "customAnimate";
|
|
10
|
-
}(AnimateStepType = exports.AnimateStepType || (exports.AnimateStepType = {})),
|
|
11
|
-
function(AnimateStatus) {
|
|
12
|
-
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING",
|
|
13
|
-
AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
14
|
-
}(AnimateStatus = exports.AnimateStatus || (exports.AnimateStatus = {}));
|
|
15
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/intreface/type.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,4BAAS,CAAA;IACT,kDAA+B,CAAA;AACjC,CAAC,EALW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAK1B;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,qDAAU,CAAA;IACV,+CAAO,CAAA;AACT,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB","file":"type.js","sourcesContent":["export enum AnimateStepType {\n wait = 'wait',\n from = 'from',\n to = 'to',\n customAnimate = 'customAnimate'\n}\n\nexport enum AnimateStatus {\n INITIAL = 0,\n RUNNING = 1,\n PAUSED = 2,\n END = 3\n}\n\nexport type IAnimateStepType = keyof typeof AnimateStepType;\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { IGraphic, IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { AnimationStateEventType, IAnimationStateConfig, IAnimationStateRule, IAnimationStateMachine } from '../intreface/state';
|
|
3
|
-
import type { AnimateExecutor } from '../executor/animate-executor';
|
|
4
|
-
type StateEventCallback = (state: string, target: IGraphic | IGroup) => void;
|
|
5
|
-
export declare class AnimationStateMachine implements IAnimationStateMachine {
|
|
6
|
-
private target;
|
|
7
|
-
private executor;
|
|
8
|
-
private registry;
|
|
9
|
-
private stateQueue;
|
|
10
|
-
private eventListeners;
|
|
11
|
-
constructor(target: IGraphic | IGroup, executor: AnimateExecutor);
|
|
12
|
-
applyState(state: string | string[]): void;
|
|
13
|
-
registerState(config: IAnimationStateConfig, rule?: IAnimationStateRule): void;
|
|
14
|
-
getActiveState(): string | null;
|
|
15
|
-
reset(): void;
|
|
16
|
-
on(event: AnimationStateEventType, callback: StateEventCallback): void;
|
|
17
|
-
off(event: AnimationStateEventType, callback: StateEventCallback): void;
|
|
18
|
-
private handleStateEvent;
|
|
19
|
-
hasState(state: string): boolean;
|
|
20
|
-
getRegisteredStates(): string[];
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.AnimationStateMachine = void 0;
|
|
6
|
-
|
|
7
|
-
const animation_state_registry_1 = require("./animation-state-registry"), animation_state_queue_1 = require("./animation-state-queue");
|
|
8
|
-
|
|
9
|
-
class AnimationStateMachine {
|
|
10
|
-
constructor(target, executor) {
|
|
11
|
-
this.target = target, this.executor = executor, this.eventListeners = new Map, this.registry = new animation_state_registry_1.AnimationStateRegistry,
|
|
12
|
-
this.stateQueue = new animation_state_queue_1.AnimationStateQueue(target, this.registry, executor, this.handleStateEvent.bind(this));
|
|
13
|
-
}
|
|
14
|
-
applyState(state) {
|
|
15
|
-
this.stateQueue.enqueue(state);
|
|
16
|
-
}
|
|
17
|
-
registerState(config, rule) {
|
|
18
|
-
this.registry.register(config, rule);
|
|
19
|
-
}
|
|
20
|
-
getActiveState() {
|
|
21
|
-
return this.stateQueue.getActiveState();
|
|
22
|
-
}
|
|
23
|
-
reset() {
|
|
24
|
-
this.stateQueue.cancel();
|
|
25
|
-
}
|
|
26
|
-
on(event, callback) {
|
|
27
|
-
var _a;
|
|
28
|
-
this.eventListeners.has(event) || this.eventListeners.set(event, new Set), null === (_a = this.eventListeners.get(event)) || void 0 === _a || _a.add(callback);
|
|
29
|
-
}
|
|
30
|
-
off(event, callback) {
|
|
31
|
-
const listeners = this.eventListeners.get(event);
|
|
32
|
-
listeners && listeners.delete(callback);
|
|
33
|
-
}
|
|
34
|
-
handleStateEvent(event, state) {
|
|
35
|
-
const listeners = this.eventListeners.get(event);
|
|
36
|
-
listeners && listeners.forEach((callback => {
|
|
37
|
-
try {
|
|
38
|
-
callback(state, this.target);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error(`Error in animation state event listener for ${event}:`, error);
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
hasState(state) {
|
|
45
|
-
return !!this.registry.getState(state);
|
|
46
|
-
}
|
|
47
|
-
getRegisteredStates() {
|
|
48
|
-
return this.registry.getAllStateNames();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.AnimationStateMachine = AnimationStateMachine;
|
|
53
|
-
//# sourceMappingURL=animation-state-machine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/animation-state-machine.ts"],"names":[],"mappings":";;;AAOA,yEAAoE;AACpE,mEAA8D;AAQ9D,MAAa,qBAAqB;IAKhC,YAAoB,MAAyB,EAAU,QAAyB;QAA5D,WAAM,GAAN,MAAM,CAAmB;QAAU,aAAQ,GAAR,QAAQ,CAAiB;QAFxE,mBAAc,GAA0D,IAAI,GAAG,EAAE,CAAC;QAGxF,IAAI,CAAC,QAAQ,GAAG,IAAI,iDAAsB,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,2CAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/G,CAAC;IAKD,UAAU,CAAC,KAAwB;QACjC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAKD,aAAa,CAAC,MAA6B,EAAE,IAA0B;QACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAKD,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;IAKD,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAKD,EAAE,CAAC,KAA8B,EAAE,QAA4B;;QAC7D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;SAC3C;QACD,MAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAKD,GAAG,CAAC,KAA8B,EAAE,QAA4B;QAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SAC5B;IACH,CAAC;IAKO,gBAAgB,CAAC,KAAmE,EAAE,KAAa;QACzG,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC3B,IAAI;oBACF,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;iBAC9B;gBAAC,OAAO,KAAK,EAAE;oBACd,OAAO,CAAC,KAAK,CAAC,+CAA+C,KAAK,GAAG,EAAE,KAAK,CAAC,CAAC;iBAC/E;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAKD,QAAQ,CAAC,KAAa;QACpB,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAKD,mBAAmB;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IAC1C,CAAC;CACF;AAvFD,sDAuFC","file":"animation-state-machine.js","sourcesContent":["import type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type {\n AnimationStateEventType,\n IAnimationStateConfig,\n IAnimationStateRule,\n IAnimationStateMachine\n} from '../intreface/state';\nimport { AnimationStateRegistry } from './animation-state-registry';\nimport { AnimationStateQueue } from './animation-state-queue';\nimport type { AnimateExecutor } from '../executor/animate-executor';\n\ntype StateEventCallback = (state: string, target: IGraphic | IGroup) => void;\n\n/**\n * State machine for managing animation states and transitions\n */\nexport class AnimationStateMachine implements IAnimationStateMachine {\n private registry: AnimationStateRegistry;\n private stateQueue: AnimationStateQueue;\n private eventListeners: Map<AnimationStateEventType, Set<StateEventCallback>> = new Map();\n\n constructor(private target: IGraphic | IGroup, private executor: AnimateExecutor) {\n this.registry = new AnimationStateRegistry();\n this.stateQueue = new AnimationStateQueue(target, this.registry, executor, this.handleStateEvent.bind(this));\n }\n\n /**\n * Apply a state or sequence of states\n */\n applyState(state: string | string[]): void {\n this.stateQueue.enqueue(state);\n }\n\n /**\n * Register new state animations and rules\n */\n registerState(config: IAnimationStateConfig, rule?: IAnimationStateRule): void {\n this.registry.register(config, rule);\n }\n\n /**\n * Get current active state\n */\n getActiveState(): string | null {\n return this.stateQueue.getActiveState();\n }\n\n /**\n * Cancel all animations and clear queue\n */\n reset(): void {\n this.stateQueue.cancel();\n }\n\n /**\n * Add event listener for state events\n */\n on(event: AnimationStateEventType, callback: StateEventCallback): void {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, new Set());\n }\n this.eventListeners.get(event)?.add(callback);\n }\n\n /**\n * Remove event listener\n */\n off(event: AnimationStateEventType, callback: StateEventCallback): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.delete(callback);\n }\n }\n\n /**\n * Handle state change events from the queue\n */\n private handleStateEvent(event: 'stateStart' | 'stateEnd' | 'stateInterrupt' | 'stateReject', state: string): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.forEach(callback => {\n try {\n callback(state, this.target);\n } catch (error) {\n console.error(`Error in animation state event listener for ${event}:`, error);\n }\n });\n }\n }\n\n /**\n * Check if a specific state is registered\n */\n hasState(state: string): boolean {\n return !!this.registry.getState(state);\n }\n\n /**\n * Get all registered state names\n */\n getRegisteredStates(): string[] {\n return this.registry.getAllStateNames();\n }\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { IGraphic, IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type { IAnimationStateQueue } from '../intreface/state';
|
|
3
|
-
import type { AnimationStateRegistry } from './animation-state-registry';
|
|
4
|
-
import type { AnimateExecutor } from '../executor/animate-executor';
|
|
5
|
-
export declare class AnimationStateQueue implements IAnimationStateQueue {
|
|
6
|
-
private target;
|
|
7
|
-
private registry;
|
|
8
|
-
private executor;
|
|
9
|
-
private onStateChange;
|
|
10
|
-
private queue;
|
|
11
|
-
private activeState;
|
|
12
|
-
private activeAnimation;
|
|
13
|
-
private processingQueue;
|
|
14
|
-
constructor(target: IGraphic | IGroup, registry: AnimationStateRegistry, executor: AnimateExecutor, onStateChange: (event: 'stateStart' | 'stateEnd' | 'stateInterrupt' | 'stateReject', state: string) => void);
|
|
15
|
-
enqueue(states: string | string[]): void;
|
|
16
|
-
processNextState(): void;
|
|
17
|
-
private applyState;
|
|
18
|
-
onAnimationComplete(): void;
|
|
19
|
-
private interruptCurrentState;
|
|
20
|
-
cancel(): void;
|
|
21
|
-
canApplyState(state: string): boolean;
|
|
22
|
-
getActiveState(): string | null;
|
|
23
|
-
getPendingStates(): string[];
|
|
24
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.AnimationStateQueue = void 0;
|
|
6
|
-
|
|
7
|
-
const vutils_1 = require("@visactor/vutils");
|
|
8
|
-
|
|
9
|
-
class AnimationStateQueue {
|
|
10
|
-
constructor(target, registry, executor, onStateChange) {
|
|
11
|
-
this.target = target, this.registry = registry, this.executor = executor, this.onStateChange = onStateChange,
|
|
12
|
-
this.queue = [], this.activeState = null, this.activeAnimation = null, this.processingQueue = !1;
|
|
13
|
-
}
|
|
14
|
-
enqueue(states) {
|
|
15
|
-
if ((0, vutils_1.isArray)(states)) for (const state of states) this.queue.push(state); else this.queue.push(states);
|
|
16
|
-
this.processingQueue || this.processNextState();
|
|
17
|
-
}
|
|
18
|
-
processNextState() {
|
|
19
|
-
if (0 === this.queue.length || this.processingQueue) return;
|
|
20
|
-
this.processingQueue = !0;
|
|
21
|
-
const nextState = this.queue[0];
|
|
22
|
-
this.canApplyState(nextState) ? (this.queue.shift(), this.activeState && this.registry.hasConflict(this.activeState, nextState) ? this.registry.canInterrupt(this.activeState, nextState) ? (this.interruptCurrentState(),
|
|
23
|
-
this.applyState(nextState)) : (this.onStateChange("stateReject", nextState), this.processingQueue = !1,
|
|
24
|
-
this.processNextState()) : this.applyState(nextState)) : (this.queue.shift(), this.onStateChange("stateReject", nextState),
|
|
25
|
-
this.processingQueue = !1, this.processNextState());
|
|
26
|
-
}
|
|
27
|
-
applyState(state) {
|
|
28
|
-
const stateConfig = this.registry.getState(state);
|
|
29
|
-
if (!stateConfig) return console.warn(`Animation state "${state}" not found`), this.processingQueue = !1,
|
|
30
|
-
void this.processNextState();
|
|
31
|
-
this.activeState = state, this.onStateChange("stateStart", state), this.activeAnimation = this.executor.executeItem(stateConfig.animation, this.target),
|
|
32
|
-
this.activeAnimation ? this.activeAnimation.onEnd((() => {
|
|
33
|
-
this.onAnimationComplete();
|
|
34
|
-
})) : this.onAnimationComplete();
|
|
35
|
-
}
|
|
36
|
-
onAnimationComplete() {
|
|
37
|
-
if (this.activeState) {
|
|
38
|
-
const completedState = this.activeState;
|
|
39
|
-
this.onStateChange("stateEnd", completedState);
|
|
40
|
-
const transitionDelay = this.registry.getTransitionDelay(completedState);
|
|
41
|
-
this.activeState = null, this.activeAnimation = null, this.processingQueue = !1,
|
|
42
|
-
transitionDelay > 0 ? setTimeout((() => {
|
|
43
|
-
this.processNextState();
|
|
44
|
-
}), transitionDelay) : this.processNextState();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
interruptCurrentState() {
|
|
48
|
-
this.activeState && this.activeAnimation && (this.onStateChange("stateInterrupt", this.activeState),
|
|
49
|
-
this.activeAnimation.stop("end"), this.activeAnimation = null, this.activeState = null);
|
|
50
|
-
}
|
|
51
|
-
cancel() {
|
|
52
|
-
this.interruptCurrentState(), this.queue = [], this.processingQueue = !1;
|
|
53
|
-
}
|
|
54
|
-
canApplyState(state) {
|
|
55
|
-
return !!this.registry.getState(state) && (!this.activeState || (!this.registry.hasConflict(this.activeState, state) || this.registry.canInterrupt(this.activeState, state)));
|
|
56
|
-
}
|
|
57
|
-
getActiveState() {
|
|
58
|
-
return this.activeState;
|
|
59
|
-
}
|
|
60
|
-
getPendingStates() {
|
|
61
|
-
return [ ...this.queue ];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
exports.AnimationStateQueue = AnimationStateQueue;
|
|
66
|
-
//# sourceMappingURL=animation-state-queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/animation-state-queue.ts"],"names":[],"mappings":";;;AAKA,6CAA2C;AAK3C,MAAa,mBAAmB;IAM9B,YACU,MAAyB,EACzB,QAAgC,EAChC,QAAyB,EACzB,aAA2G;QAH3G,WAAM,GAAN,MAAM,CAAmB;QACzB,aAAQ,GAAR,QAAQ,CAAwB;QAChC,aAAQ,GAAR,QAAQ,CAAiB;QACzB,kBAAa,GAAb,aAAa,CAA8F;QAT7G,UAAK,GAAa,EAAE,CAAC;QACrB,gBAAW,GAAkB,IAAI,CAAC;QAClC,oBAAe,GAAoB,IAAI,CAAC;QACxC,oBAAe,GAAY,KAAK,CAAC;IAOtC,CAAC;IAKJ,OAAO,CAAC,MAAyB;QAC/B,IAAI,IAAA,gBAAO,EAAC,MAAM,CAAC,EAAE;YAEnB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBAC1B,IAAI,CAAC,KAA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;IACzB,CAAC;CACF;AA/LD,kDA+LC","file":"animation-state-queue.js","sourcesContent":["import type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type { IAnimate } from '../intreface/animate';\nimport type { IAnimationStateQueue } from '../intreface/state';\nimport type { AnimationStateRegistry } from './animation-state-registry';\nimport type { AnimateExecutor } from '../executor/animate-executor';\nimport { isArray } from '@visactor/vutils';\n\n/**\n * Queue for managing sequential animation states\n */\nexport class AnimationStateQueue implements IAnimationStateQueue {\n private queue: string[] = [];\n private activeState: string | null = null;\n private activeAnimation: IAnimate | null = null;\n private processingQueue: boolean = false;\n\n constructor(\n private target: IGraphic | IGroup,\n private registry: AnimationStateRegistry,\n private executor: AnimateExecutor,\n private onStateChange: (event: 'stateStart' | 'stateEnd' | 'stateInterrupt' | 'stateReject', state: string) => void\n ) {}\n\n /**\n * Add state(s) to queue\n */\n enqueue(states: string | string[]): void {\n if (isArray(states)) {\n // For array of states, add them to the queue in sequence\n for (const state of states) {\n this.queue.push(state);\n }\n } else {\n this.queue.push(states);\n }\n\n // If not already processing, start processing the queue\n if (!this.processingQueue) {\n this.processNextState();\n }\n }\n\n /**\n * Process the next state in queue\n */\n processNextState(): void {\n if (this.queue.length === 0 || this.processingQueue) {\n return;\n }\n\n this.processingQueue = true;\n const nextState = this.queue[0];\n\n // Check if we can apply this state now\n if (this.canApplyState(nextState)) {\n // Remove the state from the queue\n this.queue.shift();\n\n // If there's an active state that conflicts, we need to handle it\n if (this.activeState && this.registry.hasConflict(this.activeState, nextState)) {\n // Check if new state can interrupt current state\n if (this.registry.canInterrupt(this.activeState, nextState)) {\n // Interrupt current animation\n this.interruptCurrentState();\n this.applyState(nextState);\n } else {\n // Cannot interrupt, reject the state\n this.onStateChange('stateReject', nextState);\n this.processingQueue = false;\n this.processNextState(); // Continue with the next state\n }\n } else {\n // No conflict, apply the state\n this.applyState(nextState);\n }\n } else {\n // Cannot apply this state right now, reject it\n this.queue.shift();\n this.onStateChange('stateReject', nextState);\n this.processingQueue = false;\n this.processNextState(); // Continue with the next state\n }\n }\n\n /**\n * Apply a state animation\n */\n private applyState(state: string): void {\n const stateConfig = this.registry.getState(state);\n if (!stateConfig) {\n console.warn(`Animation state \"${state}\" not found`);\n this.processingQueue = false;\n this.processNextState();\n return;\n }\n\n this.activeState = state;\n this.onStateChange('stateStart', state);\n\n // Create and execute the animation\n this.activeAnimation = this.executor.executeItem(stateConfig.animation, this.target);\n\n // Register completion callback\n if (this.activeAnimation) {\n this.activeAnimation.onEnd(() => {\n this.onAnimationComplete();\n });\n } else {\n // If no animation was created, consider it completed immediately\n this.onAnimationComplete();\n }\n }\n\n /**\n * Called when current animation completes\n */\n onAnimationComplete(): void {\n if (this.activeState) {\n const completedState = this.activeState;\n this.onStateChange('stateEnd', completedState);\n\n // Apply transition delay if configured\n const transitionDelay = this.registry.getTransitionDelay(completedState);\n\n this.activeState = null;\n this.activeAnimation = null;\n this.processingQueue = false;\n\n if (transitionDelay > 0) {\n // Wait before processing next state\n setTimeout(() => {\n this.processNextState();\n }, transitionDelay);\n } else {\n // Process next state immediately\n this.processNextState();\n }\n }\n }\n\n /**\n * Interrupt the current state animation\n */\n private interruptCurrentState(): void {\n if (this.activeState && this.activeAnimation) {\n this.onStateChange('stateInterrupt', this.activeState);\n this.activeAnimation.stop('end'); // Stop at end state to avoid visual jumps\n this.activeAnimation = null;\n this.activeState = null;\n }\n }\n\n /**\n * Cancel current state and clear queue\n */\n cancel(): void {\n // Interrupt current animation if any\n this.interruptCurrentState();\n\n // Clear the queue\n this.queue = [];\n this.processingQueue = false;\n }\n\n /**\n * Check if we can apply a specific state now\n */\n canApplyState(state: string): boolean {\n // Check if the state is registered\n const stateConfig = this.registry.getState(state);\n if (!stateConfig) {\n return false;\n }\n\n // If there's no active state, we can apply\n if (!this.activeState) {\n return true;\n }\n\n // Check if there's a conflict and if we can resolve it\n if (this.registry.hasConflict(this.activeState, state)) {\n return this.registry.canInterrupt(this.activeState, state);\n }\n\n // No conflict, we can apply\n return true;\n }\n\n /**\n * Get the currently active state\n */\n getActiveState(): string | null {\n return this.activeState;\n }\n\n /**\n * Get the pending states in the queue\n */\n getPendingStates(): string[] {\n return [...this.queue];\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IAnimationStateConfig, IAnimationStateRegistry, IAnimationStateRule } from '../intreface/state';
|
|
2
|
-
export declare class AnimationStateRegistry implements IAnimationStateRegistry {
|
|
3
|
-
private states;
|
|
4
|
-
private rules;
|
|
5
|
-
register(state: IAnimationStateConfig, rule?: IAnimationStateRule): void;
|
|
6
|
-
getState(name: string): IAnimationStateConfig | undefined;
|
|
7
|
-
getRule(name: string): IAnimationStateRule | undefined;
|
|
8
|
-
hasConflict(stateA: string, stateB: string): boolean;
|
|
9
|
-
canInterrupt(stateA: string, stateB: string): boolean;
|
|
10
|
-
isQueueable(state: string): boolean;
|
|
11
|
-
getTransitionDelay(state: string): number;
|
|
12
|
-
getAllStateNames(): string[];
|
|
13
|
-
clear(): void;
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.AnimationStateRegistry = void 0;
|
|
6
|
-
|
|
7
|
-
class AnimationStateRegistry {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.states = new Map, this.rules = new Map;
|
|
10
|
-
}
|
|
11
|
-
register(state, rule) {
|
|
12
|
-
var _a;
|
|
13
|
-
const {name: name} = state;
|
|
14
|
-
name ? (this.states.set(name, Object.assign(Object.assign({}, state), {
|
|
15
|
-
priority: null !== (_a = state.priority) && void 0 !== _a ? _a : 0
|
|
16
|
-
})), rule && this.rules.set(name, rule)) : console.warn("Animation state must have a name");
|
|
17
|
-
}
|
|
18
|
-
getState(name) {
|
|
19
|
-
return this.states.get(name);
|
|
20
|
-
}
|
|
21
|
-
getRule(name) {
|
|
22
|
-
return this.rules.get(name);
|
|
23
|
-
}
|
|
24
|
-
hasConflict(stateA, stateB) {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
if (stateA === stateB) return !1;
|
|
27
|
-
const ruleA = this.getRule(stateA), ruleB = this.getRule(stateB);
|
|
28
|
-
return !!(null === (_a = null == ruleA ? void 0 : ruleA.conflicts) || void 0 === _a ? void 0 : _a.includes(stateB)) || !!(null === (_b = null == ruleB ? void 0 : ruleB.conflicts) || void 0 === _b ? void 0 : _b.includes(stateA));
|
|
29
|
-
}
|
|
30
|
-
canInterrupt(stateA, stateB) {
|
|
31
|
-
var _a, _b, _c;
|
|
32
|
-
const ruleA = this.getRule(stateA), stateAConfig = this.getState(stateA), stateBConfig = this.getState(stateB);
|
|
33
|
-
return !!(stateAConfig && stateBConfig && (null !== (_a = stateBConfig.priority) && void 0 !== _a ? _a : 0) > (null !== (_b = stateAConfig.priority) && void 0 !== _b ? _b : 0)) || !!(null === (_c = null == ruleA ? void 0 : ruleA.interruptibleBy) || void 0 === _c ? void 0 : _c.includes(stateB));
|
|
34
|
-
}
|
|
35
|
-
isQueueable(state) {
|
|
36
|
-
const rule = this.getRule(state);
|
|
37
|
-
return !!(null == rule ? void 0 : rule.queueable);
|
|
38
|
-
}
|
|
39
|
-
getTransitionDelay(state) {
|
|
40
|
-
var _a;
|
|
41
|
-
const rule = this.getRule(state);
|
|
42
|
-
return null !== (_a = null == rule ? void 0 : rule.transitionDelay) && void 0 !== _a ? _a : 0;
|
|
43
|
-
}
|
|
44
|
-
getAllStateNames() {
|
|
45
|
-
return Array.from(this.states.keys());
|
|
46
|
-
}
|
|
47
|
-
clear() {
|
|
48
|
-
this.states.clear(), this.rules.clear();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.AnimationStateRegistry = AnimationStateRegistry;
|
|
53
|
-
//# sourceMappingURL=animation-state-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/state/animation-state-registry.ts"],"names":[],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;CACF;AA5GD,wDA4GC","file":"animation-state-registry.js","sourcesContent":["import type { IAnimationStateConfig, IAnimationStateRegistry, IAnimationStateRule } from '../intreface/state';\n\n/**\n * Registry for animation states and their rules\n */\nexport class AnimationStateRegistry implements IAnimationStateRegistry {\n private states: Map<string, IAnimationStateConfig> = new Map();\n private rules: Map<string, IAnimationStateRule> = new Map();\n\n /**\n * Register a state with its animation config and rules\n */\n register(state: IAnimationStateConfig, rule?: IAnimationStateRule): void {\n const { name } = state;\n\n if (!name) {\n console.warn('Animation state must have a name');\n return;\n }\n\n this.states.set(name, {\n ...state,\n priority: state.priority ?? 0\n });\n\n if (rule) {\n this.rules.set(name, rule);\n }\n }\n\n /**\n * Get state configuration by name\n */\n getState(name: string): IAnimationStateConfig | undefined {\n return this.states.get(name);\n }\n\n /**\n * Get state rule by name\n */\n getRule(name: string): IAnimationStateRule | undefined {\n return this.rules.get(name);\n }\n\n /**\n * Check if two states conflict with each other\n */\n hasConflict(stateA: string, stateB: string): boolean {\n if (stateA === stateB) {\n return false; // Same state doesn't conflict with itself\n }\n\n const ruleA = this.getRule(stateA);\n const ruleB = this.getRule(stateB);\n\n if (ruleA?.conflicts?.includes(stateB)) {\n return true;\n }\n\n if (ruleB?.conflicts?.includes(stateA)) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Check if stateB can interrupt stateA\n */\n canInterrupt(stateA: string, stateB: string): boolean {\n const ruleA = this.getRule(stateA);\n const stateAConfig = this.getState(stateA);\n const stateBConfig = this.getState(stateB);\n\n // Higher priority can always interrupt\n if (stateAConfig && stateBConfig && (stateBConfig.priority ?? 0) > (stateAConfig.priority ?? 0)) {\n return true;\n }\n\n // Check if explicitly interruptible\n return !!ruleA?.interruptibleBy?.includes(stateB);\n }\n\n /**\n * Check if a state is queueable\n */\n isQueueable(state: string): boolean {\n const rule = this.getRule(state);\n return !!rule?.queueable;\n }\n\n /**\n * Get transition delay for a state\n */\n getTransitionDelay(state: string): number {\n const rule = this.getRule(state);\n return rule?.transitionDelay ?? 0;\n }\n\n /**\n * Get all registered state names\n */\n getAllStateNames(): string[] {\n return Array.from(this.states.keys());\n }\n\n /**\n * Clear all registered states and rules\n */\n clear(): void {\n this.states.clear();\n this.rules.clear();\n }\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import { ACustomAnimate } from './custom-animate';
|
|
3
|
-
export declare class GroupFadeIn extends ACustomAnimate<any> {
|
|
4
|
-
target: IGroup;
|
|
5
|
-
getEndProps(): Record<string, any>;
|
|
6
|
-
onBind(): void;
|
|
7
|
-
onEnd(): void;
|
|
8
|
-
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
9
|
-
}
|
|
10
|
-
export declare class GroupFadeOut extends ACustomAnimate<any> {
|
|
11
|
-
target: IGroup;
|
|
12
|
-
getEndProps(): Record<string, any>;
|
|
13
|
-
onBind(): void;
|
|
14
|
-
onEnd(): void;
|
|
15
|
-
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
16
|
-
}
|
package/es/custom/group-fade.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
-
|
|
3
|
-
export class GroupFadeIn extends ACustomAnimate {
|
|
4
|
-
getEndProps() {
|
|
5
|
-
return {};
|
|
6
|
-
}
|
|
7
|
-
onBind() {
|
|
8
|
-
this.target.setTheme({
|
|
9
|
-
common: {
|
|
10
|
-
opacity: 0
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
onEnd() {
|
|
15
|
-
this.target.setTheme({
|
|
16
|
-
common: {
|
|
17
|
-
opacity: 1
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
onUpdate(end, ratio, out) {
|
|
22
|
-
this.target.setTheme({
|
|
23
|
-
common: {
|
|
24
|
-
opacity: ratio
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class GroupFadeOut extends ACustomAnimate {
|
|
31
|
-
getEndProps() {
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
onBind() {
|
|
35
|
-
this.target.setTheme({
|
|
36
|
-
common: {
|
|
37
|
-
opacity: 1
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
onEnd() {
|
|
42
|
-
this.target.setTheme({
|
|
43
|
-
common: {
|
|
44
|
-
opacity: 0
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
onUpdate(end, ratio, out) {
|
|
49
|
-
this.target.setTheme({
|
|
50
|
-
common: {
|
|
51
|
-
opacity: 1 - ratio
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=group-fade.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/group-fade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,WAAY,SAAQ,cAAmB;IAGlD,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,cAAmB;IAGnD,WAAW;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC,GAAG,KAAK;aACnB;SACF,CAAC,CAAC;IACL,CAAC;CACF","file":"group-fade.js","sourcesContent":["import type { IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate } from './custom-animate';\n\nexport class GroupFadeIn extends ACustomAnimate<any> {\n declare target: IGroup;\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.target.setTheme({\n common: {\n opacity: 0\n }\n });\n return;\n }\n\n onEnd(): void {\n this.target.setTheme({\n common: {\n opacity: 1\n }\n });\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.setTheme({\n common: {\n opacity: ratio\n }\n });\n }\n}\n\nexport class GroupFadeOut extends ACustomAnimate<any> {\n declare target: IGroup;\n\n getEndProps(): Record<string, any> {\n return {};\n }\n\n onBind(): void {\n this.target.setTheme({\n common: {\n opacity: 1\n }\n });\n return;\n }\n\n onEnd(): void {\n this.target.setTheme({\n common: {\n opacity: 0\n }\n });\n return;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.setTheme({\n common: {\n opacity: 1 - ratio\n }\n });\n }\n}\n"]}
|
package/es/custom/scale-in.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IAnimate, IStep } from '../intreface/animate';
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
3
|
-
import { ACustomAnimate } from './custom-animate';
|
|
4
|
-
export interface IScaleAnimationOptions {
|
|
5
|
-
direction?: 'x' | 'y' | 'xy';
|
|
6
|
-
}
|
|
7
|
-
export declare class ScaleIn extends ACustomAnimate<Record<string, number>> {
|
|
8
|
-
valid: boolean;
|
|
9
|
-
constructor(from: null, to: null, duration: number, easing: EasingType, params?: IScaleAnimationOptions);
|
|
10
|
-
onFirstRun(): void;
|
|
11
|
-
onEnd(cb?: (animate: IAnimate, step: IStep) => void): void;
|
|
12
|
-
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
13
|
-
}
|
package/es/custom/scale-in.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ACustomAnimate } from "./custom-animate";
|
|
2
|
-
|
|
3
|
-
export class ScaleIn extends ACustomAnimate {
|
|
4
|
-
constructor(from, to, duration, easing, params) {
|
|
5
|
-
super(from, to, duration, easing, params);
|
|
6
|
-
}
|
|
7
|
-
onFirstRun() {
|
|
8
|
-
var _a, _b, _c, _d, _e;
|
|
9
|
-
let from, to;
|
|
10
|
-
const attrs = this.target.getAttributes();
|
|
11
|
-
switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
|
|
12
|
-
case "x":
|
|
13
|
-
from = {
|
|
14
|
-
scaleX: 0
|
|
15
|
-
}, to = {
|
|
16
|
-
scaleX: null !== (_b = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _b ? _b : 1
|
|
17
|
-
};
|
|
18
|
-
break;
|
|
19
|
-
|
|
20
|
-
case "y":
|
|
21
|
-
from = {
|
|
22
|
-
scaleY: 0
|
|
23
|
-
}, to = {
|
|
24
|
-
scaleY: null !== (_c = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _c ? _c : 1
|
|
25
|
-
};
|
|
26
|
-
break;
|
|
27
|
-
|
|
28
|
-
default:
|
|
29
|
-
from = {
|
|
30
|
-
scaleX: 0,
|
|
31
|
-
scaleY: 0
|
|
32
|
-
}, to = {
|
|
33
|
-
scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1,
|
|
34
|
-
scaleY: null !== (_e = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _e ? _e : 1
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
this.props = to, this.propKeys = Object.keys(to), this.animate.reSyncProps(), this.from = from,
|
|
38
|
-
this.to = to;
|
|
39
|
-
}
|
|
40
|
-
onEnd(cb) {
|
|
41
|
-
super.onEnd(cb);
|
|
42
|
-
}
|
|
43
|
-
onUpdate(end, ratio, out) {
|
|
44
|
-
this.valid && (this.propKeys.forEach((key => {
|
|
45
|
-
out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
46
|
-
})), this.target.setAttributes(out));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=scale-in.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom/scale-in.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD,MAAM,OAAO,OAAQ,SAAQ,cAAsC;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;IAED,UAAU;;QACR,IAAI,IAA4B,CAAC;QACjC,IAAI,EAA0B,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC1C,QAAQ,MAAA,IAAI,CAAC,MAAM,0CAAE,SAAS,EAAE;YAC9B,KAAK,GAAG;gBACN,IAAI,GAAG,EAA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C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF","file":"scale-in.js","sourcesContent":["import type { IAnimate, IStep } from '../intreface/animate';\nimport type { EasingType } from '../intreface/easing';\nimport { ACustomAnimate } from './custom-animate';\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\n/**\n * 文本输入动画,实现类似打字机的字符逐个显示效果\n * 支持通过beforeText和afterText参数添加前缀和后缀\n * 支持通过showCursor参数显示光标,cursorChar自定义光标字符\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 onFirstRun(): void {\n let from: Record<string, number>;\n let to: Record<string, number>;\n // 获取当前的数据\n const attrs = this.target.getAttributes();\n switch (this.params?.direction) {\n case 'x':\n from = { scaleX: 0 };\n to = { scaleX: attrs?.scaleX ?? 1 };\n break;\n case 'y':\n from = { scaleY: 0 };\n to = { scaleY: attrs?.scaleY ?? 1 };\n break;\n case 'xy':\n default:\n from = { scaleX: 0, scaleY: 0 };\n to = {\n scaleX: attrs?.scaleX ?? 1,\n scaleY: attrs?.scaleY ?? 1\n };\n }\n this.props = to;\n this.propKeys = Object.keys(to);\n this.animate.reSyncProps();\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 if (!this.valid) {\n return;\n }\n\n this.propKeys.forEach(key => {\n out[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(out);\n }\n}\n"]}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
-
import type { EasingType } from '../intreface/easing';
|
|
3
|
-
import type { ACustomAnimate } from '../custom/custom-animate';
|
|
4
|
-
export type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;
|
|
5
|
-
export type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;
|
|
6
|
-
interface IAnimationParameters {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}
|
|
9
|
-
export type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;
|
|
10
|
-
export type IAnimationChannelAttrs = Record<string, {
|
|
11
|
-
from?: any | IAnimationChannelFunction;
|
|
12
|
-
to?: any | IAnimationChannelFunction;
|
|
13
|
-
}>;
|
|
14
|
-
export type IAnimationChannelAttributes = string[];
|
|
15
|
-
export type IAnimationChannelInterpolator = (ratio: number, from: any, to: any, nextAttributes: any, datum: any, element: IGraphic, parameters: IAnimationParameters) => boolean | void;
|
|
16
|
-
export interface IAnimationCustomConstructor {
|
|
17
|
-
new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;
|
|
18
|
-
}
|
|
19
|
-
export interface IAnimationEffect {
|
|
20
|
-
type?: string;
|
|
21
|
-
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
22
|
-
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
23
|
-
customParameters?: MarkFunctionValueType<any>;
|
|
24
|
-
easing?: EasingType;
|
|
25
|
-
options?: MarkFunctionValueType<any>;
|
|
26
|
-
}
|
|
27
|
-
export interface IAnimationTimeSlice {
|
|
28
|
-
effects: IAnimationEffect | IAnimationEffect[];
|
|
29
|
-
duration?: MarkFunctionValueType<number>;
|
|
30
|
-
delay?: MarkFunctionValueType<number>;
|
|
31
|
-
delayAfter?: MarkFunctionValueType<number>;
|
|
32
|
-
}
|
|
33
|
-
export interface IAnimationControlOptions {
|
|
34
|
-
stopWhenStateChange?: boolean;
|
|
35
|
-
immediatelyApply?: boolean;
|
|
36
|
-
ignoreLoopFinalAttributes?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface IAnimationTypeConfig {
|
|
39
|
-
type?: string;
|
|
40
|
-
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
41
|
-
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
42
|
-
customParameters?: MarkFunctionValueType<any>;
|
|
43
|
-
easing?: EasingType;
|
|
44
|
-
delay?: MarkFunctionValueType<number>;
|
|
45
|
-
delayAfter?: MarkFunctionValueType<number>;
|
|
46
|
-
duration?: MarkFunctionValueType<number>;
|
|
47
|
-
oneByOne?: MarkFunctionValueType<boolean | number>;
|
|
48
|
-
startTime?: MarkFunctionValueType<number>;
|
|
49
|
-
totalTime?: MarkFunctionValueType<number>;
|
|
50
|
-
loop?: boolean | number;
|
|
51
|
-
options?: MarkFunctionValueType<any>;
|
|
52
|
-
controlOptions?: IAnimationControlOptions;
|
|
53
|
-
}
|
|
54
|
-
export interface IAnimationTimeline {
|
|
55
|
-
id?: string;
|
|
56
|
-
timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];
|
|
57
|
-
startTime?: MarkFunctionValueType<number>;
|
|
58
|
-
totalTime?: MarkFunctionValueType<number>;
|
|
59
|
-
oneByOne?: MarkFunctionValueType<number | boolean>;
|
|
60
|
-
loop?: MarkFunctionValueType<number | boolean>;
|
|
61
|
-
partitioner?: MarkFunctionCallback<boolean>;
|
|
62
|
-
sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;
|
|
63
|
-
controlOptions?: IAnimationControlOptions;
|
|
64
|
-
}
|
|
65
|
-
export type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;
|
|
66
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interpolate/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置 */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
|