<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>loading</title>
</head>
<body>
<div class="loading"></div>
</body>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
min-width: 100vw;
background: #ccc;
}
@keyframes spin {
0% {
transform: rotate(0deg);
/* animation-timing-function: linear; */
}
100% {
transform: rotate(360deg);
/* animation-timing-function: linear; */
}
}
.loading {
width: 100px;
aspect-ratio: 1;
border-radius: 100%;
background-image: conic-gradient(#f66, 30%, #ffffff);
-webkit-mask-image: radial-gradient(
closest-side,
transparent 80%,
black 80%
);
animation: spin 1s linear infinite reverse;
}
</style>
</html>
css 渐变实现loading
于 2023-09-10 07:32:19 首次发布