@zxh19890103/wik
Version:
The world-class JavaScript library for building large-scale digital warehouse both on 2D and 3D.
60 lines (59 loc) • 1.74 kB
TypeScript
import { GlobalConstManager } from '../../model';
import { AnimationState } from './AnimationState.enum';
import { WithAnimate } from './WithAnimate';
export type WikAnimationValue = number | Record<string, number> | Array<number>;
export type WikAnimationOptions = {
delay?: number;
duration?: number;
[extra: string]: any;
};
export declare abstract class WikAnimation<M extends WithAnimate = WithAnimate> {
m: M;
readonly id: number;
readonly delay: number;
readonly options: WikAnimationOptions;
readonly value: WikAnimationValue;
state: AnimationState;
addedAt: number;
startAt: any;
duration: any;
/**
* Time sequence, tick
*/
t: number;
/**
* count of tick this animation would take to finish it.
*/
N: number;
/**
* last elapse (unit: ms)
*/
lastElapse: number;
/**
* next animation after this finished.
*/
next: WikAnimation;
readonly globalConstMgr: GlobalConstManager;
constructor(m: M, value: WikAnimationValue, options?: WikAnimationOptions);
/**
* many things to do...
* prepare
*/
abstract start(t: number): void;
/**
* Returns boolean or void.
* 1. if it's boolean: true means it'll continue running, false means it would be stopped.
* 2. if it's void: just keep running util timeout.
*/
abstract run(elapse: number, deltaT: number, t: number): boolean | void;
/**
* computes the duration animation need to take.
*
* returns Infinity if you want control the animation by t & N
*/
abstract calcDur(): number;
/**
* set the property to final value on the object/layer
*/
abstract final(): void;
}