1. 剑客传媒首页
  2. 开发技巧

纯css代码实现雷达扫描loading网页效果

timg?image&quality=80&size=b9999_10000&sec=1598012053025&di=c9f8100be00377ff8c6cfcf63756d8f0&imgtype=0&src=http%3A%2F%2Fdemo.lanrenzhijia.com%2Fdemo%2F44%2F4485%2F1.jpg插图
代码(主要就是恰当设置linar-gradient渐变属性)
<style>
.zh-page {
    position: relative;
    width: 300px;
    height: 400px
}
.zh-loading-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    margin: -140px 0 0 -140px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    overflow: hidden
}
.zh-loading {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 85, 255, .05);
    -webkit-animation: loading 3s linear infinite;
    animation: loading 3s linear infinite
}
.zh-loading:after {
    content: "";
    display: block;
    width: 50%;
    height: 50%;
    background: linear-gradient(45deg, transparent 50%, rgba(0, 85, 255, .2) 100%)
}
@-webkit-keyframes loading {
    to {
        transform: rotate(360deg)
    }
}
@keyframes loading {
    to {
        transform: rotate(360deg)
    }
}
</style>
<div class="zh-page">
    <div class="zh-loading-wrap">
        <div class="zh-loading"></div>
    </div>
</div>

原创文章,作者:剑客自媒体,如若转载,请注明出处:https://jiankeweb.com/articles/2173.html 。文章不代表本站观点,如有侵权联系站长删除。