Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import plugin from 'tailwindcss/plugin.js';
|
|
|
|
const enterAnimationPlugin = plugin(({ addUtilities }) => {
|
|
const maxChild = 5;
|
|
const utilities: Record<string, any> = {};
|
|
for (let i = 1; i <= maxChild; i++) {
|
|
const baseDelay = 0.1;
|
|
const delay = `${baseDelay * i}s`;
|
|
|
|
utilities[`.enter-x:nth-child(${i})`] = {
|
|
animation: `enter-x-animation 0.3s ease-in-out ${delay} forwards`,
|
|
opacity: '0',
|
|
transform: `translateX(50px)`,
|
|
};
|
|
|
|
utilities[`.enter-y:nth-child(${i})`] = {
|
|
animation: `enter-y-animation 0.3s ease-in-out ${delay} forwards`,
|
|
opacity: '0',
|
|
transform: `translateY(50px)`,
|
|
};
|
|
|
|
utilities[`.-enter-x:nth-child(${i})`] = {
|
|
animation: `enter-x-animation 0.3s ease-in-out ${delay} forwards`,
|
|
opacity: '0',
|
|
transform: `translateX(-50px)`,
|
|
};
|
|
|
|
utilities[`.-enter-y:nth-child(${i})`] = {
|
|
animation: `enter-y-animation 0.3s ease-in-out ${delay} forwards`,
|
|
opacity: '0',
|
|
transform: `translateY(-50px)`,
|
|
};
|
|
}
|
|
|
|
// 添加动画关键帧
|
|
addUtilities(utilities);
|
|
addUtilities({
|
|
'@keyframes enter-x-animation': {
|
|
to: {
|
|
opacity: '1',
|
|
transform: 'translateX(0)',
|
|
},
|
|
},
|
|
'@keyframes enter-y-animation': {
|
|
to: {
|
|
opacity: '1',
|
|
transform: 'translateY(0)',
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
export { enterAnimationPlugin };
|