我有下面的代码。如何平滑过渡渐变停止?它只是突然从一个变为另一个。
我似乎使用渐变位置的大多数渐变动画示例,但我相信更改渐变停止也应该是可能的。
.test {
display: inline-block;
width: 300px;
height: 300px;
border-radius: 100%;
background: conic-gradient(red, red);
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
background-size: auto;
-webkit-mask:radial-gradient(circle, transparent 50%, white calc(50% + 1px));
animation:
rotate
4.5s
ease-out
0s
infinite
none
running;
}
@keyframes rotate {
0% {
background-image: conic-gradient(red, red);
}
30% {
background-image: conic-gradient(red 70%, transparent);
}
70% {
background-image: conic-gradient(red 30%, transparent, transparent, transparent);
}
100% {
background-image: conic-gradient(red, transparent);
}
}
<div class="test"></div>