refactor: ♻️ 优化和精简加载动画

This commit is contained in:
hxr 2024-03-03 23:05:11 +08:00
parent 17c29ee971
commit 1f1194cb8c
1 changed files with 16 additions and 46 deletions

View File

@ -36,61 +36,31 @@
.loader { .loader {
position: relative; position: relative;
width: 50px; width: 40px;
aspect-ratio: 1.154; aspect-ratio: 0.577;
background: conic-gradient( overflow: hidden;
from 120deg at 50% 64%, clip-path: polygon(0 0, 100% 100%, 0 100%, 100% 0);
#0000, animation: l19 2s infinite linear;
#25b09b 1deg 120deg,
#0000 121deg
);
animation: l27-0 1.5s infinite cubic-bezier(0.3, 1, 0, 1);
} }
.loader::before, .loader::before {
.loader::after {
position: absolute; position: absolute;
inset: 0; inset: -150%;
content: ""; content: "";
background: inherit; background: repeating-conic-gradient(
transform-origin: 50% 66%; from 30deg,
animation: l27-1 1.5s infinite; #ffabab 0 60deg,
#abe4ff 0 120deg,
#ff7373 0 180deg
);
animation: inherit;
animation-direction: reverse;
} }
.loader::after { @keyframes l19 {
--s: -1;
}
@keyframes l27-0 {
0%,
30% {
transform: rotate(0);
}
70% {
transform: rotate(120deg);
}
70.01%,
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
@keyframes l27-1 {
0% {
transform: rotate(calc(var(--s, 1) * 120deg)) translate(0);
}
30%,
70% {
transform: rotate(calc(var(--s, 1) * 120deg))
translate(calc(var(--s, 1) * -5px), 10px);
}
100% {
transform: rotate(calc(var(--s, 1) * 120deg)) translate(0);
}
}
</style> </style>
</html> </html>