export type RequestAnimationFrameArgs = [domHighResTimeStamp: number, ...args: Args]; export interface AnimationFrameContext { requestAnimationFrame(fn: (...args: RequestAnimationFrameArgs) => void): RequestId; cancelAnimationFrame(requestId: RequestId): void; } export type AnimationFrameLoopType = 'raf' | 'sto'; interface AnimationFrame { callback: (time: number, deltaTime: number, ...requestAnimationFrameArgs: RequestAnimationFrameArgs) => void; once: boolean; delay: number; order: number; calls: number; } declare class AnimationFrameLoop { private frames; private loopType; private isAnimating; private context; private requestId; private loop; private static sharedInstance?; static get shared(): AnimationFrameLoop; static getFrameTime(): number; constructor(); start(): void; stop(): void; setContext(context: AnimationFrameContext | null): void; getContext(): T | null; setLoopType(type: AnimationFrameLoopType): void; getLoopType(): AnimationFrameLoopType; private requestAnimationFrame; private cancelAnimationFrame; private remove; /** * 添加到动画循环 * @param callback - 动画循环回调 * @param once - 是否只回调一次 * @param delay - 延迟多少个动画循环回调 * @param order - 优先级,数字越小越早被调用 * @returns 移除动画循环函数 */ add(callback: AnimationFrame["callback"], once?: boolean, delay?: number, order?: number): () => void; clear(): void; } export { AnimationFrameLoop, AnimationFrame };