实现边框的渐变颜色并且旋转
整体思路:用两个圆覆盖,制作圆环,利用大圆渐变色的背景旋转动画来实现边框旋转
上代码
HTML
<div style="width:100px;height:100px" class="pan-thumb">
<div class="center">
</div>
</div>
CSS
<style lang="css">
.pan-thumb {
width:100px;
height:100px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: linear-gradient(rgba(255, 59, 48, 1), rgba(255, 194, 48, 1));
animation: rotate 2s infinite linear;
}
.pan-thumb:hover {
transform: rotate(-100deg);
}
.pan-thumb>.center{
width: 80px;
height: 80%;
border-radius: 50%;
background-color: antiquewhite;
}
/* 渐变色背景旋转动画 */
@keyframes rotate {
0% {
transform: rotateZ(0);
}
100% {
transform: rotateZ(360deg);
}
}
</style>
效果图动态图就不展示了,你可以自己试验一下哦,希望对你有帮助,欢迎留言一起交流.