@visactor/vrender-animate 0.22.4 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate-extension.d.ts +12 -5
- package/cjs/animate-extension.js +23 -12
- package/cjs/animate-extension.js.map +1 -1
- package/cjs/animate.d.ts +2 -5
- package/cjs/animate.js +23 -18
- package/cjs/animate.js.map +1 -1
- package/cjs/component/component-animate-extension.d.ts +1 -0
- package/cjs/component/component-animate-extension.js +1 -0
- package/cjs/component/component-animate-extension.js.map +1 -0
- package/cjs/component/component-animator.d.ts +22 -0
- package/cjs/component/component-animator.js +67 -0
- package/cjs/component/component-animator.js.map +1 -0
- package/cjs/component/index.d.ts +1 -0
- package/cjs/component/index.js +21 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/config/morphing.d.ts +2 -0
- package/cjs/config/morphing.js +9 -0
- package/cjs/config/morphing.js.map +1 -0
- package/cjs/custom/clip-graphic.d.ts +1 -1
- package/cjs/custom/clip-graphic.js +2 -2
- package/cjs/custom/clip-graphic.js.map +1 -1
- package/cjs/custom/clip.d.ts +2 -1
- package/cjs/custom/clip.js +9 -1
- package/cjs/custom/clip.js.map +1 -1
- package/cjs/custom/common.d.ts +1 -3
- package/cjs/custom/common.js +21 -17
- package/cjs/custom/common.js.map +1 -1
- package/cjs/custom/custom-animate.d.ts +7 -3
- package/cjs/custom/custom-animate.js +13 -2
- package/cjs/custom/custom-animate.js.map +1 -1
- package/cjs/custom/fade.d.ts +1 -1
- package/cjs/custom/fade.js +7 -2
- package/cjs/custom/fade.js.map +1 -1
- package/cjs/custom/fromTo.d.ts +10 -0
- package/cjs/custom/fromTo.js +42 -0
- package/cjs/custom/fromTo.js.map +1 -0
- package/cjs/custom/groupFade.d.ts +10 -0
- package/cjs/custom/groupFade.js +25 -0
- package/cjs/custom/groupFade.js.map +1 -0
- package/cjs/custom/growAngle.d.ts +10 -5
- package/cjs/custom/growAngle.js +38 -17
- package/cjs/custom/growAngle.js.map +1 -1
- package/cjs/custom/growCenter.d.ts +1 -2
- package/cjs/custom/growCenter.js +16 -10
- package/cjs/custom/growCenter.js.map +1 -1
- package/cjs/custom/growHeight.d.ts +1 -3
- package/cjs/custom/growHeight.js +19 -13
- package/cjs/custom/growHeight.js.map +1 -1
- package/cjs/custom/growPoints.d.ts +1 -2
- package/cjs/custom/growPoints.js +41 -36
- package/cjs/custom/growPoints.js.map +1 -1
- package/cjs/custom/growRadius.d.ts +4 -5
- package/cjs/custom/growRadius.js +22 -18
- package/cjs/custom/growRadius.js.map +1 -1
- package/cjs/custom/growWidth.d.ts +1 -3
- package/cjs/custom/growWidth.js +15 -9
- package/cjs/custom/growWidth.js.map +1 -1
- package/cjs/custom/input-text.d.ts +1 -2
- package/cjs/custom/input-text.js.map +1 -1
- package/cjs/custom/label-item-animate.d.ts +7 -0
- package/cjs/custom/label-item-animate.js +221 -0
- package/cjs/custom/label-item-animate.js.map +1 -0
- package/cjs/custom/morphing.d.ts +51 -0
- package/cjs/custom/morphing.js +298 -0
- package/cjs/custom/morphing.js.map +1 -0
- package/cjs/custom/motionPath.d.ts +21 -0
- package/cjs/custom/motionPath.js +31 -0
- package/cjs/custom/motionPath.js.map +1 -0
- package/cjs/custom/move.d.ts +96 -0
- package/cjs/custom/move.js +133 -0
- package/cjs/custom/move.js.map +1 -0
- package/cjs/custom/number.d.ts +1 -2
- package/cjs/custom/number.js.map +1 -1
- package/cjs/custom/poptip-animate.d.ts +7 -0
- package/cjs/custom/poptip-animate.js +109 -0
- package/cjs/custom/poptip-animate.js.map +1 -0
- package/cjs/custom/register.d.ts +27 -0
- package/cjs/custom/register.js +418 -3
- package/cjs/custom/register.js.map +1 -1
- package/cjs/custom/richtext/input-richtext.d.ts +35 -0
- package/cjs/custom/richtext/input-richtext.js +80 -0
- package/cjs/custom/richtext/input-richtext.js.map +1 -0
- package/cjs/custom/richtext/output-richtext.d.ts +37 -0
- package/cjs/custom/richtext/output-richtext.js +94 -0
- package/cjs/custom/richtext/output-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/cjs/custom/richtext/slide-out-richtext.js +146 -0
- package/cjs/custom/richtext/slide-out-richtext.js.map +1 -0
- package/cjs/custom/richtext/slide-richtext.d.ts +36 -0
- package/cjs/custom/richtext/slide-richtext.js +144 -0
- package/cjs/custom/richtext/slide-richtext.js.map +1 -0
- package/cjs/custom/rotate.d.ts +33 -0
- package/cjs/custom/rotate.js +79 -0
- package/cjs/custom/rotate.js.map +1 -0
- package/cjs/custom/scale.d.ts +6 -2
- package/cjs/custom/scale.js +32 -17
- package/cjs/custom/scale.js.map +1 -1
- package/cjs/custom/sphere.d.ts +2 -1
- package/cjs/custom/sphere.js +14 -5
- package/cjs/custom/sphere.js.map +1 -1
- package/cjs/custom/state.d.ts +1 -1
- package/cjs/custom/state.js +1 -1
- package/cjs/custom/state.js.map +1 -1
- package/cjs/custom/story.d.ts +196 -0
- package/cjs/custom/story.js +497 -0
- package/cjs/custom/story.js.map +1 -0
- package/cjs/custom/streamLight.d.ts +27 -0
- package/cjs/custom/streamLight.js +161 -0
- package/cjs/custom/streamLight.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +2 -3
- package/cjs/custom/tag-points.js +20 -4
- package/cjs/custom/tag-points.js.map +1 -1
- package/cjs/custom/update.d.ts +2 -2
- package/cjs/custom/update.js +10 -2
- package/cjs/custom/update.js.map +1 -1
- package/cjs/executor/animate-executor.d.ts +7 -6
- package/cjs/executor/animate-executor.js +118 -62
- package/cjs/executor/animate-executor.js.map +1 -1
- package/cjs/executor/executor.d.ts +9 -3
- package/cjs/executor/executor.js.map +1 -1
- package/cjs/index.d.ts +8 -8
- package/cjs/index.js +50 -18
- package/cjs/index.js.map +1 -1
- package/cjs/interpolate/store.d.ts +6 -2
- package/cjs/interpolate/store.js +13 -2
- package/cjs/interpolate/store.js.map +1 -1
- package/cjs/register.js +1 -5
- package/cjs/register.js.map +1 -1
- package/cjs/state/animation-state.d.ts +20 -2
- package/cjs/state/animation-state.js +48 -4
- package/cjs/state/animation-state.js.map +1 -1
- package/cjs/state/animation-states-registry.js +18 -0
- package/cjs/state/animation-states-registry.js.map +1 -1
- package/cjs/state/graphic-extension.d.ts +7 -1
- package/cjs/state/graphic-extension.js +20 -0
- package/cjs/state/graphic-extension.js.map +1 -1
- package/cjs/step.d.ts +7 -4
- package/cjs/step.js +33 -15
- package/cjs/step.js.map +1 -1
- package/cjs/ticker/default-ticker.d.ts +12 -7
- package/cjs/ticker/default-ticker.js +38 -33
- package/cjs/ticker/default-ticker.js.map +1 -1
- package/cjs/ticker/manual-ticker.d.ts +6 -1
- package/cjs/ticker/manual-ticker.js +26 -4
- package/cjs/ticker/manual-ticker.js.map +1 -1
- package/cjs/timeline.d.ts +14 -7
- package/cjs/timeline.js +31 -18
- package/cjs/timeline.js.map +1 -1
- package/cjs/utils/transform.d.ts +2 -0
- package/cjs/utils/transform.js +10 -0
- package/cjs/utils/transform.js.map +1 -0
- package/dist/index.es.js +3765 -527
- package/es/animate-extension.d.ts +12 -5
- package/es/animate-extension.js +24 -11
- package/es/animate-extension.js.map +1 -1
- package/es/animate.d.ts +2 -5
- package/es/animate.js +14 -11
- package/es/animate.js.map +1 -1
- package/es/component/component-animate-extension.d.ts +1 -0
- package/es/component/component-animate-extension.js +1 -0
- package/es/component/component-animate-extension.js.map +1 -0
- package/es/component/component-animator.d.ts +22 -0
- package/es/component/component-animator.js +59 -0
- package/es/component/component-animator.js.map +1 -0
- package/es/component/index.d.ts +1 -0
- package/es/component/index.js +2 -0
- package/es/component/index.js.map +1 -0
- package/es/config/morphing.d.ts +2 -0
- package/es/config/morphing.js +5 -0
- package/es/config/morphing.js.map +1 -0
- package/es/custom/clip-graphic.d.ts +1 -1
- package/es/custom/clip-graphic.js +2 -2
- package/es/custom/clip-graphic.js.map +1 -1
- package/es/custom/clip.d.ts +2 -1
- package/es/custom/clip.js +9 -1
- package/es/custom/clip.js.map +1 -1
- package/es/custom/common.d.ts +1 -3
- package/es/custom/common.js +21 -17
- package/es/custom/common.js.map +1 -1
- package/es/custom/custom-animate.d.ts +7 -3
- package/es/custom/custom-animate.js +10 -1
- package/es/custom/custom-animate.js.map +1 -1
- package/es/custom/fade.d.ts +1 -1
- package/es/custom/fade.js +7 -2
- package/es/custom/fade.js.map +1 -1
- package/es/custom/fromTo.d.ts +10 -0
- package/es/custom/fromTo.js +34 -0
- package/es/custom/fromTo.js.map +1 -0
- package/es/custom/groupFade.d.ts +10 -0
- package/es/custom/groupFade.js +15 -0
- package/es/custom/groupFade.js.map +1 -0
- package/es/custom/growAngle.d.ts +10 -5
- package/es/custom/growAngle.js +39 -15
- package/es/custom/growAngle.js.map +1 -1
- package/es/custom/growCenter.d.ts +1 -2
- package/es/custom/growCenter.js +16 -10
- package/es/custom/growCenter.js.map +1 -1
- package/es/custom/growHeight.d.ts +1 -3
- package/es/custom/growHeight.js +20 -14
- package/es/custom/growHeight.js.map +1 -1
- package/es/custom/growPoints.d.ts +1 -2
- package/es/custom/growPoints.js +40 -36
- package/es/custom/growPoints.js.map +1 -1
- package/es/custom/growRadius.d.ts +4 -5
- package/es/custom/growRadius.js +22 -16
- package/es/custom/growRadius.js.map +1 -1
- package/es/custom/growWidth.d.ts +1 -3
- package/es/custom/growWidth.js +16 -10
- package/es/custom/growWidth.js.map +1 -1
- package/es/custom/input-text.d.ts +1 -2
- package/es/custom/input-text.js.map +1 -1
- package/es/custom/label-item-animate.d.ts +7 -0
- package/es/custom/label-item-animate.js +215 -0
- package/es/custom/label-item-animate.js.map +1 -0
- package/es/custom/morphing.d.ts +51 -0
- package/es/custom/morphing.js +289 -0
- package/es/custom/morphing.js.map +1 -0
- package/es/custom/motionPath.d.ts +21 -0
- package/es/custom/motionPath.js +23 -0
- package/es/custom/motionPath.js.map +1 -0
- package/es/custom/move.d.ts +96 -0
- package/es/custom/move.js +118 -0
- package/es/custom/move.js.map +1 -0
- package/es/custom/number.d.ts +1 -2
- package/es/custom/number.js.map +1 -1
- package/es/custom/poptip-animate.d.ts +7 -0
- package/es/custom/poptip-animate.js +103 -0
- package/es/custom/poptip-animate.js.map +1 -0
- package/es/custom/register.d.ts +27 -0
- package/es/custom/register.js +48 -1
- package/es/custom/register.js.map +1 -1
- package/es/custom/richtext/input-richtext.d.ts +35 -0
- package/es/custom/richtext/input-richtext.js +74 -0
- package/es/custom/richtext/input-richtext.js.map +1 -0
- package/es/custom/richtext/output-richtext.d.ts +37 -0
- package/es/custom/richtext/output-richtext.js +88 -0
- package/es/custom/richtext/output-richtext.js.map +1 -0
- package/es/custom/richtext/slide-out-richtext.d.ts +38 -0
- package/es/custom/richtext/slide-out-richtext.js +140 -0
- package/es/custom/richtext/slide-out-richtext.js.map +1 -0
- package/es/custom/richtext/slide-richtext.d.ts +36 -0
- package/es/custom/richtext/slide-richtext.js +138 -0
- package/es/custom/richtext/slide-richtext.js.map +1 -0
- package/es/custom/rotate.d.ts +33 -0
- package/es/custom/rotate.js +65 -0
- package/es/custom/rotate.js.map +1 -0
- package/es/custom/scale.d.ts +6 -2
- package/es/custom/scale.js +32 -17
- package/es/custom/scale.js.map +1 -1
- package/es/custom/sphere.d.ts +2 -1
- package/es/custom/sphere.js +14 -5
- package/es/custom/sphere.js.map +1 -1
- package/es/custom/state.d.ts +1 -1
- package/es/custom/state.js +1 -1
- package/es/custom/state.js.map +1 -1
- package/es/custom/story.d.ts +196 -0
- package/es/custom/story.js +468 -0
- package/es/custom/story.js.map +1 -0
- package/es/custom/streamLight.d.ts +27 -0
- package/es/custom/streamLight.js +157 -0
- package/es/custom/streamLight.js.map +1 -0
- package/es/custom/tag-points.d.ts +2 -3
- package/es/custom/tag-points.js +21 -5
- package/es/custom/tag-points.js.map +1 -1
- package/es/custom/update.d.ts +2 -2
- package/es/custom/update.js +10 -2
- package/es/custom/update.js.map +1 -1
- package/es/executor/animate-executor.d.ts +7 -6
- package/es/executor/animate-executor.js +116 -61
- package/es/executor/animate-executor.js.map +1 -1
- package/es/executor/executor.d.ts +9 -3
- package/es/executor/executor.js.map +1 -1
- package/es/index.d.ts +8 -8
- package/es/index.js +10 -12
- package/es/index.js.map +1 -1
- package/es/interpolate/store.d.ts +6 -2
- package/es/interpolate/store.js +13 -3
- package/es/interpolate/store.js.map +1 -1
- package/es/register.js +0 -8
- package/es/register.js.map +1 -1
- package/es/state/animation-state.d.ts +20 -2
- package/es/state/animation-state.js +48 -2
- package/es/state/animation-state.js.map +1 -1
- package/es/state/animation-states-registry.js +18 -0
- package/es/state/animation-states-registry.js.map +1 -1
- package/es/state/graphic-extension.d.ts +7 -1
- package/es/state/graphic-extension.js +20 -0
- package/es/state/graphic-extension.js.map +1 -1
- package/es/step.d.ts +7 -4
- package/es/step.js +34 -16
- package/es/step.js.map +1 -1
- package/es/ticker/default-ticker.d.ts +12 -7
- package/es/ticker/default-ticker.js +30 -27
- package/es/ticker/default-ticker.js.map +1 -1
- package/es/ticker/manual-ticker.d.ts +6 -1
- package/es/ticker/manual-ticker.js +27 -3
- package/es/ticker/manual-ticker.js.map +1 -1
- package/es/timeline.d.ts +14 -7
- package/es/timeline.js +33 -18
- package/es/timeline.js.map +1 -1
- package/es/utils/transform.d.ts +2 -0
- package/es/utils/transform.js +4 -0
- package/es/utils/transform.js.map +1 -0
- package/package.json +16 -16
- package/cjs/custom/group-fade.d.ts +0 -16
- package/cjs/custom/group-fade.js +0 -66
- package/cjs/custom/group-fade.js.map +0 -1
- package/cjs/custom/scale-in.d.ts +0 -13
- package/cjs/custom/scale-in.js +0 -57
- package/cjs/custom/scale-in.js.map +0 -1
- package/cjs/interpolate/executor.d.ts +0 -66
- package/cjs/interpolate/executor.js +0 -6
- package/cjs/interpolate/executor.js.map +0 -1
- package/cjs/intreface/animate.d.ts +0 -91
- package/cjs/intreface/animate.js +0 -10
- package/cjs/intreface/animate.js.map +0 -1
- package/cjs/intreface/easing.d.ts +0 -3
- package/cjs/intreface/easing.js +0 -6
- package/cjs/intreface/easing.js.map +0 -1
- package/cjs/intreface/state.d.ts +0 -35
- package/cjs/intreface/state.js +0 -6
- package/cjs/intreface/state.js.map +0 -1
- package/cjs/intreface/ticker.d.ts +0 -37
- package/cjs/intreface/ticker.js +0 -10
- package/cjs/intreface/ticker.js.map +0 -1
- package/cjs/intreface/timeline.d.ts +0 -17
- package/cjs/intreface/timeline.js +0 -6
- package/cjs/intreface/timeline.js.map +0 -1
- package/cjs/intreface/type.d.ts +0 -13
- package/cjs/intreface/type.js +0 -15
- package/cjs/intreface/type.js.map +0 -1
- package/cjs/state/animation-state-machine.d.ts +0 -22
- package/cjs/state/animation-state-machine.js +0 -53
- package/cjs/state/animation-state-machine.js.map +0 -1
- package/cjs/state/animation-state-queue.d.ts +0 -24
- package/cjs/state/animation-state-queue.js +0 -66
- package/cjs/state/animation-state-queue.js.map +0 -1
- package/cjs/state/animation-state-registry.d.ts +0 -14
- package/cjs/state/animation-state-registry.js +0 -53
- package/cjs/state/animation-state-registry.js.map +0 -1
- package/es/custom/group-fade.d.ts +0 -16
- package/es/custom/group-fade.js +0 -56
- package/es/custom/group-fade.js.map +0 -1
- package/es/custom/scale-in.d.ts +0 -13
- package/es/custom/scale-in.js +0 -49
- package/es/custom/scale-in.js.map +0 -1
- package/es/interpolate/executor.d.ts +0 -66
- package/es/interpolate/executor.js +0 -2
- package/es/interpolate/executor.js.map +0 -1
- package/es/intreface/animate.d.ts +0 -91
- package/es/intreface/animate.js +0 -6
- package/es/intreface/animate.js.map +0 -1
- package/es/intreface/easing.d.ts +0 -3
- package/es/intreface/easing.js +0 -2
- package/es/intreface/easing.js.map +0 -1
- package/es/intreface/state.d.ts +0 -35
- package/es/intreface/state.js +0 -2
- package/es/intreface/state.js.map +0 -1
- package/es/intreface/ticker.d.ts +0 -37
- package/es/intreface/ticker.js +0 -6
- package/es/intreface/ticker.js.map +0 -1
- package/es/intreface/timeline.d.ts +0 -17
- package/es/intreface/timeline.js +0 -2
- package/es/intreface/timeline.js.map +0 -1
- package/es/intreface/type.d.ts +0 -13
- package/es/intreface/type.js +0 -14
- package/es/intreface/type.js.map +0 -1
- package/es/state/animation-state-machine.d.ts +0 -22
- package/es/state/animation-state-machine.js +0 -47
- package/es/state/animation-state-machine.js.map +0 -1
- package/es/state/animation-state-queue.d.ts +0 -24
- package/es/state/animation-state-queue.js +0 -58
- package/es/state/animation-state-queue.js.map +0 -1
- package/es/state/animation-state-registry.d.ts +0 -14
- package/es/state/animation-state-registry.js +0 -45
- package/es/state/animation-state-registry.js.map +0 -1
package/cjs/timeline.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { type IAnimate, type ITimeline } from '@visactor/vrender-core';
|
|
2
|
+
import { EventEmitter } from '@visactor/vutils';
|
|
3
|
+
interface AnimateNode {
|
|
4
|
+
animate: IAnimate;
|
|
5
|
+
next: AnimateNode | null;
|
|
6
|
+
prev: AnimateNode | null;
|
|
7
|
+
}
|
|
8
|
+
export declare class DefaultTimeline extends EventEmitter implements ITimeline {
|
|
4
9
|
id: number;
|
|
5
|
-
protected
|
|
6
|
-
protected
|
|
10
|
+
protected head: AnimateNode | null;
|
|
11
|
+
protected tail: AnimateNode | null;
|
|
12
|
+
protected animateMap: Map<IAnimate, AnimateNode>;
|
|
13
|
+
protected _animateCount: number;
|
|
7
14
|
protected paused: boolean;
|
|
8
15
|
protected _playSpeed: number;
|
|
9
16
|
protected _totalDuration: number;
|
|
10
17
|
protected _startTime: number;
|
|
11
18
|
protected _currentTime: number;
|
|
12
|
-
protected _endAnimatePtr: number;
|
|
13
19
|
isGlobal?: boolean;
|
|
14
20
|
get animateCount(): number;
|
|
15
21
|
constructor();
|
|
@@ -20,7 +26,7 @@ export declare class DefaultTimeline implements ITimeline {
|
|
|
20
26
|
resume(): void;
|
|
21
27
|
tick(delta: number): void;
|
|
22
28
|
clear(): void;
|
|
23
|
-
removeAnimate(animate: IAnimate, release?: boolean
|
|
29
|
+
removeAnimate(animate: IAnimate, release?: boolean): void;
|
|
24
30
|
protected recalculateTotalDuration(): void;
|
|
25
31
|
getTotalDuration(): number;
|
|
26
32
|
getPlaySpeed(): number;
|
|
@@ -32,3 +38,4 @@ export declare class DefaultTimeline implements ITimeline {
|
|
|
32
38
|
setCurrentTime(time: number): void;
|
|
33
39
|
}
|
|
34
40
|
export declare const defaultTimeline: DefaultTimeline;
|
|
41
|
+
export {};
|
package/cjs/timeline.js
CHANGED
|
@@ -4,26 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.defaultTimeline = exports.DefaultTimeline = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core");
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
|
|
8
8
|
|
|
9
|
-
class DefaultTimeline {
|
|
9
|
+
class DefaultTimeline extends vutils_1.EventEmitter {
|
|
10
10
|
get animateCount() {
|
|
11
|
-
return this.
|
|
11
|
+
return this._animateCount;
|
|
12
12
|
}
|
|
13
13
|
constructor() {
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
14
|
+
super(), this.head = null, this.tail = null, this.animateMap = new Map, this._animateCount = 0,
|
|
15
|
+
this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0,
|
|
16
|
+
this.id = vrender_core_1.Generator.GenAutoIncrementId(), this.paused = !1;
|
|
17
17
|
}
|
|
18
18
|
isRunning() {
|
|
19
|
-
return !this.paused && this.
|
|
19
|
+
return !this.paused && this._animateCount > 0;
|
|
20
20
|
}
|
|
21
21
|
forEachAccessAnimate(cb) {
|
|
22
|
-
|
|
22
|
+
let current = this.head, index = 0;
|
|
23
|
+
for (;current; ) {
|
|
24
|
+
const next = current.next;
|
|
25
|
+
cb(current.animate, index), index++, current = next;
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
addAnimate(animate) {
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const newNode = {
|
|
30
|
+
animate: animate,
|
|
31
|
+
next: null,
|
|
32
|
+
prev: null
|
|
33
|
+
};
|
|
34
|
+
this.head ? this.tail && (this.tail.next = newNode, newNode.prev = this.tail, this.tail = newNode) : (this.head = newNode,
|
|
35
|
+
this.tail = newNode), this.animateMap.set(animate, newNode), this._animateCount++,
|
|
36
|
+
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
27
37
|
}
|
|
28
38
|
pause() {
|
|
29
39
|
this.paused = !0;
|
|
@@ -35,21 +45,24 @@ class DefaultTimeline {
|
|
|
35
45
|
if (this.paused) return;
|
|
36
46
|
const scaledDelta = delta * this._playSpeed;
|
|
37
47
|
this._currentTime += scaledDelta, this.forEachAccessAnimate(((animate, i) => {
|
|
38
|
-
animate.status === vrender_core_1.AnimateStatus.END ? this.removeAnimate(animate, !0
|
|
39
|
-
}));
|
|
48
|
+
animate.status === vrender_core_1.AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== vrender_core_1.AnimateStatus.RUNNING && animate.status !== vrender_core_1.AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
49
|
+
})), 0 === this._animateCount && this.emit("animationEnd");
|
|
40
50
|
}
|
|
41
51
|
clear() {
|
|
42
52
|
this.forEachAccessAnimate((animate => {
|
|
43
53
|
animate.release();
|
|
44
|
-
})), this.
|
|
54
|
+
})), this.head = null, this.tail = null, this.animateMap.clear(), this._animateCount = 0,
|
|
55
|
+
this._totalDuration = 0;
|
|
45
56
|
}
|
|
46
|
-
removeAnimate(animate, release = !0
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
removeAnimate(animate, release = !0) {
|
|
58
|
+
const node = this.animateMap.get(animate);
|
|
59
|
+
node && (release && (animate._onRemove && animate._onRemove.forEach((cb => cb())),
|
|
60
|
+
animate.release()), node.prev ? node.prev.next = node.next : this.head = node.next,
|
|
61
|
+
node.next ? node.next.prev = node.prev : this.tail = node.prev, this.animateMap.delete(animate),
|
|
62
|
+
this._animateCount--, animate.getStartTime() + animate.getDuration() >= this._totalDuration && this.recalculateTotalDuration());
|
|
50
63
|
}
|
|
51
64
|
recalculateTotalDuration() {
|
|
52
|
-
this._totalDuration = 0, this.
|
|
65
|
+
this._totalDuration = 0, this.forEachAccessAnimate((animate => {
|
|
53
66
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
54
67
|
}));
|
|
55
68
|
}
|
package/cjs/timeline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/timeline.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/timeline.ts"],"names":[],"mappings":";;;AAAA,yDAAiG;AACjG,6CAAgD;AAShD,MAAa,eAAgB,SAAQ,qBAAY;IAgB/C,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;QACE,KAAK,EAAE,CAAC;QAnBA,SAAI,GAAuB,IAAI,CAAC;QAChC,SAAI,GAAuB,IAAI,CAAC;QAChC,eAAU,GAA+B,IAAI,GAAG,EAAE,CAAC;QACnD,kBAAa,GAAW,CAAC,CAAC;QAI1B,eAAU,GAAW,CAAC,CAAC;QACvB,mBAAc,GAAW,CAAC,CAAC;QAC3B,eAAU,GAAW,CAAC,CAAC;QACvB,iBAAY,GAAW,CAAC,CAAC;QAUjC,IAAI,CAAC,EAAE,GAAG,wBAAS,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,oBAAoB,CAAC,EAA8C;QACjE,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QACxB,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,OAAO,OAAO,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AAC;IAED,YAAY,CAAC,IAAY;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,cAAc,CAAC,IAAY;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;CACF;AAvMD,0CAuMC;AAGY,QAAA,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AACrD,uBAAe,CAAC,QAAQ,GAAG,IAAI,CAAC","file":"timeline.js","sourcesContent":["import { Generator, type IAnimate, type ITimeline, AnimateStatus } from '@visactor/vrender-core';\nimport { EventEmitter } from '@visactor/vutils';\n\n// 定义链表节点\ninterface AnimateNode {\n animate: IAnimate;\n next: AnimateNode | null;\n prev: AnimateNode | null;\n}\n\nexport class DefaultTimeline extends EventEmitter implements ITimeline {\n declare id: number;\n protected head: AnimateNode | null = null;\n protected tail: AnimateNode | null = null;\n protected animateMap: Map<IAnimate, AnimateNode> = new Map();\n protected _animateCount: number = 0;\n protected declare paused: boolean;\n\n // 添加必要的属性\n protected _playSpeed: number = 1;\n protected _totalDuration: number = 0;\n protected _startTime: number = 0;\n protected _currentTime: number = 0;\n\n declare isGlobal?: boolean;\n\n get animateCount() {\n return this._animateCount;\n }\n\n constructor() {\n super();\n this.id = Generator.GenAutoIncrementId();\n this.paused = false;\n }\n\n isRunning() {\n return !this.paused && this._animateCount > 0;\n }\n\n forEachAccessAnimate(cb: (animate: IAnimate, index: number) => void) {\n let current = this.head;\n let index = 0;\n\n while (current) {\n // 保存下一个节点的引用,以防在回调中移除当前节点\n const next = current.next;\n cb(current.animate, index);\n index++;\n current = next;\n }\n }\n\n addAnimate(animate: IAnimate) {\n const newNode: AnimateNode = {\n animate,\n next: null,\n prev: null\n };\n\n // 添加到链表尾部\n if (!this.head) {\n this.head = newNode;\n this.tail = newNode;\n } else {\n if (this.tail) {\n this.tail.next = newNode;\n newNode.prev = this.tail;\n this.tail = newNode;\n }\n }\n\n // 在映射中保存节点引用\n this.animateMap.set(animate, newNode);\n this._animateCount++;\n\n // 更新总时长\n this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());\n }\n\n pause() {\n this.paused = true;\n }\n\n resume() {\n this.paused = false;\n }\n\n tick(delta: number) {\n if (this.paused) {\n return;\n }\n\n // 应用播放速度\n const scaledDelta = delta * this._playSpeed;\n\n // 更新当前时间\n this._currentTime += scaledDelta;\n\n this.forEachAccessAnimate((animate, i) => {\n if (animate.status === AnimateStatus.END) {\n this.removeAnimate(animate, true);\n } else if (animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL) {\n animate.advance(scaledDelta);\n }\n });\n\n if (this._animateCount === 0) {\n this.emit('animationEnd');\n }\n }\n\n clear() {\n this.forEachAccessAnimate(animate => {\n animate.release();\n });\n\n this.head = null;\n this.tail = null;\n this.animateMap.clear();\n this._animateCount = 0;\n this._totalDuration = 0;\n }\n\n removeAnimate(animate: IAnimate, release: boolean = true) {\n const node = this.animateMap.get(animate);\n\n if (!node) {\n return;\n }\n\n if (release) {\n animate._onRemove && animate._onRemove.forEach(cb => cb());\n animate.release();\n }\n\n // 从链表中移除节点\n if (node.prev) {\n node.prev.next = node.next;\n } else {\n // 节点是头节点\n this.head = node.next;\n }\n\n if (node.next) {\n node.next.prev = node.prev;\n } else {\n // 节点是尾节点\n this.tail = node.prev;\n }\n\n // 从映射中移除\n this.animateMap.delete(animate);\n this._animateCount--;\n\n // 如果移除的是最长时间的动画,应该重新计算总时长\n if (animate.getStartTime() + animate.getDuration() >= this._totalDuration) {\n this.recalculateTotalDuration();\n }\n\n return;\n }\n\n // 重新计算总时长\n protected recalculateTotalDuration() {\n this._totalDuration = 0;\n this.forEachAccessAnimate(animate => {\n this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());\n });\n }\n\n getTotalDuration() {\n return this._totalDuration;\n }\n\n getPlaySpeed() {\n return this._playSpeed;\n }\n\n setPlaySpeed(speed: number) {\n this._playSpeed = speed;\n }\n\n // 实现ITimeline接口所需的其他方法\n getPlayState(): 'playing' | 'paused' | 'stopped' {\n if (this.paused) {\n return 'paused';\n }\n if (this.animateCount === 0) {\n return 'stopped';\n }\n return 'playing';\n }\n\n setStartTime(time: number) {\n this._startTime = time;\n }\n\n getStartTime() {\n return this._startTime;\n }\n\n getCurrentTime() {\n return this._currentTime;\n }\n\n setCurrentTime(time: number) {\n this._currentTime = time;\n }\n}\n\n// 不会使用,存粹做临时存储用,请一定要放置到stage中才行\nexport const defaultTimeline = new DefaultTimeline();\ndefaultTimeline.isGlobal = true;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.isTransformKey = exports.transformKeys = void 0, exports.transformKeys = [ "x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "scrollX", "scrollY" ];
|
|
6
|
+
|
|
7
|
+
const isTransformKey = key => exports.transformKeys.includes(key);
|
|
8
|
+
|
|
9
|
+
exports.isTransformKey = isTransformKey;
|
|
10
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/transform.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;CACV,CAAC;AACK,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE;IAC5C,OAAO,qBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","file":"transform.js","sourcesContent":["export const transformKeys = [\n 'x',\n 'y',\n 'dx',\n 'dy',\n 'scaleX',\n 'scaleY',\n 'angle',\n 'anchor',\n 'postMatrix',\n 'scrollX',\n 'scrollY'\n];\nexport const isTransformKey = (key: string) => {\n return transformKeys.includes(key);\n};\n"]}
|