This commit is contained in:
2024-09-29 21:04:06 +08:00
parent 3a8a4aada3
commit c53528079b
6 changed files with 82 additions and 11 deletions

View File

@@ -1,11 +1,21 @@
/*
* @Author: ddmt
* @Date: 2024-9-29 20:50:12
* @LastEditTime: 2024-9-29 20:50:12
* @LastEditors: ddmt
* @Description: ddmt-index file
* @FilePath: /Tool/animate.js
*/
/**
* 动画函数
* @param {HTMLElement} event
* @param {string} classname
*/
export function animate(event, classname) {
event.classList.add(classname);
export function animateStart(event, className, forceExecute) {
if (forceExecute) event.target.classList.remove(className); // 清洗动画
event.classList.add(className);
event.addEventListener('animationend', (event) => {
event.target.classList.remove(classname); // 清洗动画
event.target.classList.remove(className); // 清洗动画
});
}