1 | import { ComponentNode } from './html';
|
2 |
|
3 | export const getAnimationDuration = ($el: Element) => parseFloat(window.getComputedStyle($el).animationDuration);
|
4 |
|
5 | export const setAnimation = (animationClass: string, duration?: number) => ({ dom }: ComponentNode) => {
|
6 | dom.classList.add(animationClass);
|
7 | return new Promise((resolve) => {
|
8 | setTimeout(resolve, duration == null ? 0.95 * getAnimationDuration(dom) * 1e3 : duration);
|
9 | });
|
10 | };
|