@visactor/vrender-animate
Version:
This module provides a graph-based animation system for VRender.
71 lines (70 loc) • 2.79 kB
TypeScript
import type { EasingType, IAnimate, ICustomAnimate, IGraphic, IStep, ITimeline } from '@visactor/vrender-core';
import { AnimateStatus } from '@visactor/vrender-core/event/constant';
export declare class Animate implements IAnimate {
readonly id: string | number;
status: AnimateStatus;
target: IGraphic;
_onStart?: (() => void)[];
_onFrame?: ((step: IStep, ratio: number) => void)[];
_onEnd?: (() => void)[];
_onRemove?: (() => void)[];
private _timeline;
private _startTime;
private _duration;
private _totalDuration;
private _loopCount;
private _currentLoop;
private _bounce;
private _firstStep;
private _lastStep;
private _startProps;
private _endProps;
private _preventAttrs;
priority: number;
protected currentTime: number;
slience?: boolean;
lastRunStep?: IStep;
interpolateUpdateFunction: ((from: Record<string, any>, to: Record<string, any>, ratio: number, step: IStep, target: IGraphic) => void) | null;
constructor(id?: string | number, timeline?: ITimeline, slience?: boolean);
getStartProps(): Record<string, any>;
getEndProps(): Record<string, any>;
setTimeline(timeline: ITimeline): void;
getTimeline(): ITimeline;
get timeline(): ITimeline;
bind(target: IGraphic): this;
to(props: Record<string, any>, duration?: number, easing?: EasingType): this;
wait(delay: number): this;
protected updateStepAfterAppend(step: IStep): void;
parseStepProps(step: IStep): void;
reSyncProps(): void;
from(props: Record<string, any>, duration?: number, easing?: EasingType): this;
play(customAnimate: ICustomAnimate): this;
pause(): void;
resume(): void;
onStart(cb?: () => void): void;
onEnd(cb?: () => void): void;
onFrame(cb?: (step: IStep, ratio: number) => void): void;
onRemove(cb?: () => void): void;
preventAttr(key: string): void;
preventAttrs(keys: string[]): void;
validAttr(key: string): boolean;
runCb(cb: (a: IAnimate, step: IStep) => void): IAnimate;
startAt(t: number): this;
customInterpolate(key: string, ratio: number, from: any, to: any, target: IGraphic, ret: Record<string, any>): boolean;
getFromValue(): Record<string, any>;
getToValue(): Record<string, any>;
stop(type?: 'start' | 'end' | Record<string, any>): void;
release(): void;
getDuration(): number;
getStartTime(): number;
afterAll(list: IAnimate[]): this;
after(animate: IAnimate): this;
parallel(animate: IAnimate): this;
loop(n: number | boolean): this;
bounce(b: boolean): this;
advance(delta: number): void;
updateDuration(): void;
getTotalDuration(): number;
getLoop(): number;
protected forEachStep(cb: (step: IStep) => void): void;
}