unika-components
Version:
Unika Vue3 components library
44 lines (43 loc) • 1.52 kB
TypeScript
/**
* 应用文字动画 - 用于 WorkRender/H5 等场景
* 支持整段动画(fadeInUp、fadeInDown 等)和逐字动画
*/
export interface TextAnimationItem {
animate: string;
duration?: number;
delay?: number;
count?: number;
loop?: boolean;
timing?: string;
order?: string;
/** 'text' 文字动画 | 'normal' 通用动画,用于区分应用方式 */
type?: 'text' | 'normal';
}
export interface ElementLike {
id: string | number;
textContent?: string;
type?: string;
css?: unknown;
properties?: {
textAni?: TextAnimationItem[];
};
}
/**
* 恢复文字元素的原始内容(撤销逐字动画后调用)
* @param element 元素数据
* @param rootElement 根元素
*/
export declare function restoreTextAnimation(element: ElementLike, rootElement?: HTMLElement | Document): void;
/**
* 对指定页面的文字元素应用 textAni 动画
* @param elements 页面元素列表
* @param rootElement 可选的根元素,用于限定查找范围(如当前页的容器)
*/
export declare function applyTextAnimationsForPage(elements: ElementLike[], rootElement?: HTMLElement): void;
/**
* 对单个文字元素应用 textAni 动画
* @param element 元素数据
* @param textAni 动画配置数组
* @param rootElement 可选的根元素
*/
export declare function applyTextAnimation(element: ElementLike, textAni: TextAnimationItem[], rootElement?: HTMLElement | Document): void;