UNPKG

@visactor/vrender-animate

Version:

This module provides a graph-based animation system for VRender.

53 lines (52 loc) 2.28 kB
import type { IAnimate, IGraphic } from '@visactor/vrender-core'; import type { IAnimationState } from './types'; import type { IAnimationConfig } from '../executor/executor'; import { AnimateExecutor } from '../executor/animate-executor'; export declare const AnimationStates: { APPEAR: string; DISAPPEAR: string; UPDATE: string; HIGHLIGHT: string; UNHIGHLIGHT: string; SELECT: string; UNSELECT: string; HOVER: string; UNHOVER: string; ACTIVE: string; INACTIVE: string; }; export declare class AnimationStateStore { graphic: IGraphic; constructor(graphic: IGraphic); states?: Map<string, IAnimationState>; registerState(state: IAnimationState): void; clearStates(): void; } interface IStateInfo { state: string; animationConfig: IAnimationConfig | IAnimationConfig[]; executor: AnimateExecutor; } export declare class AnimationStateManager { protected graphic: IGraphic; protected trackedAnimates: Map<string | number, IAnimate>; stateList: IStateInfo[] | null; constructor(graphic: IGraphic); trackAnimate(animate: IAnimate): void; untrackAnimate(animateId: string | number): void; forEachTrackedAnimate(cb: (animate: IAnimate) => void): void; getTrackedAnimates(): Map<string | number, IAnimate>; hasTrackedAnimate(): boolean; protected hasStateInfo(list: IStateInfo[], target: IStateInfo): boolean; protected takeOverUpdateAttrs(nextState: IStateInfo, currentStates: IStateInfo[], shouldStopState: IStateInfo[]): void; applyState(nextState: string[], animationConfig: (IAnimationState | IAnimationState[])[], callback?: (empty?: boolean) => void): void; applyAppearState(animationConfig: IAnimationConfig, callback?: () => void): void; applyDisappearState(animationConfig: IAnimationConfig, callback?: () => void): void; applyUpdateState(animationConfig: IAnimationConfig, callback?: () => void): void; applyHighlightState(animationConfig: IAnimationConfig, callback?: () => void): void; applyUnhighlightState(animationConfig: IAnimationConfig, callback?: () => void): void; stopState(state: string, type?: 'start' | 'end' | Record<string, any>): void; clearState(): void; reApplyState(state: string): void; } export {};