css3作炫酷的加载特效

布局部分:

<body>
    <section>
        <div class="loading">
            <div class="blocks" style="--i:1;"></div>
            <div class="blocks" style="--i:2;"></div>
            <div class="blocks" style="--i:3;"></div>
            <div class="blocks" style="--i:4;"></div>
            <div class="blocks" style="--i:5;"></div>
            <div class="blocks" style="--i:6;"></div>
            <div class="blocks" style="--i:7;"></div>
            <div class="blocks" style="--i:8;"></div>
            <div class="blocks" style="--i:9;"></div>
            <div class="blocks" style="--i:10;"></div>
            <div class="blocks" style="--i:11;"></div>
            <div class="blocks" style="--i:12;"></div>
            <div class="blocks" style="--i:13;"></div>
            <div class="blocks" style="--i:14;"></div>
            <div class="blocks" style="--i:15;"></div>
            <div class="blocks" style="--i:16;"></div>
            <div class="blocks" style="--i:17;"></div>
            <div class="blocks" style="--i:18;"></div>
            <div class="blocks" style="--i:19;"></div>
            <div class="blocks" style="--i:20;"></div>
            <h3>loading</h3>
        </div>
    </section>
</body>

样式部分:

<style>
    *{
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: consolas;
    }
    section{
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: #001d10;
        animation: animateBackgroundC0olor 10s linear infinite;
    }
    @keyframes animateBackgroundC0olor {
        0%{
            filter: hue-rotate(0deg);
        }
        100%{
            filter: hue-rotate(360deg);
        }
    }
    .loading{
        position: relative;
        width: 250px;
        height: 250px;
    }
    .loading .blocks{
        position: absolute;
        width: 8px;
        height: 25px;
        background:#050c09 ;
        left: 50%;
        border-radius: 8px;
        transform: rotate(calc(18deg * var(--i)));
        transform-origin: 0 125px;
        animation: animate 1.9s ease-in-out infinite;
        animation-delay: calc(0.05s * var(--i));
    }
    @keyframes animate{
        0%,50%{
            background: #050c09;
            box-shadow: none;
        }
        50.1%,100%{
            background: #0f0;
            box-shadow: 0 0 5px #0f0,
                        0  0 15px  #0f0,
                        0  0 30px  #0f0,
                        0  0 60px  #0f0,
                        0  0 90px  #0f0;
        }
    }
    h3{
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
        font-size: 2em;
        letter-spacing: 2px;
        animation: animateText 2s ease-in-out infinite;
        animation-delay:-1s ;
    }
    @keyframes animateText{
        0%,50%{
            
            text-shadow: none;
        }
        50.1%,100%{
            background: #0f0;
            text-shadow: 0 0 5px #0f0,
                        0  0 15px  #0f0;
                      
        }
    }
</style>

查看效果:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值