UNPKG

vue-danmaku

Version:

基于 Vue 的弹幕交互组件 | A danmaku component for Vue

56 lines (55 loc) 1.89 kB
/** * requestAnimationFrame动画管理器 * 用于弹幕的性能模式动画处理 */ /** * 启动弹幕动画 * @param el 弹幕DOM元素 * @param width 弹幕宽度 * @param containerWidth 容器宽度 * @param speed 弹幕速度(像素/秒) * @param isPaused 是否处于暂停状态 * @param onAnimationEnd 动画结束回调 */ export declare function startAnimation(el: HTMLDivElement, width: number, containerWidth: number, speed: number, isPaused: () => boolean, onAnimationEnd: (el: HTMLDivElement) => void): void; /** * 恢复弹幕动画 * @param el 弹幕DOM元素 * @param width 弹幕宽度 * @param containerWidth 容器宽度 * @param speed 弹幕速度 * @param isPaused 是否处于暂停状态 * @param onAnimationEnd 动画结束回调 */ export declare function resumeAnimation(el: HTMLDivElement, width: number, containerWidth: number, speed: number, isPaused: () => boolean, onAnimationEnd: (el: HTMLDivElement) => void): void; /** * 暂停所有动画 */ export declare function pauseAllAnimations(): void; /** * 取消元素的动画 * @param el 弹幕DOM元素 */ export declare function cancelAnimation(el: HTMLElement): void; /** * 取消所有动画,并清除位置信息 */ export declare function cancelAllAnimations(): void; /** * 开始主循环(适用于需要持续运行的动画系统) * @param callback 主循环回调函数 */ export declare function startMainLoop(callback: (timestamp: number) => void): void; /** * 取消主循环 */ export declare function cancelMainLoop(): void; /** * 获取元素的当前位置 * @param el 弹幕DOM元素 */ export declare function getElementPosition(el: HTMLElement): number | undefined; /** * 获取所有有位置记录的弹幕元素 */ export declare function getAllAnimatedElements(): HTMLElement[];