【CSS】纯css3螺旋状loading加载特效

效果图
在这里插入图片描述

<div class="ai-loader"><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div><div class="dot"></div></div>

<style>

.ai-loader {
    position: relative;
}

.ai-loader .dot {
    -webkit-animation-name: movement;
    animation-name: movement;
    -webkit-animation-duration: 2s;
    animation-duration: 2s;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
    -webkit-animation-timing-function: ease-in-out;
    animation-timing-function: ease-in-out;
    height: 10px;
    position: absolute;
    top: -10px;
    -webkit-transform: translate3d(0, -25px, 0) scale(1);
    transform: translate3d(0, -25px, 0) scale(1);
    width: 10px;
}

.ai-loader .dot:nth-of-type(1) {
    -webkit-animation-delay: -0.1s;
    animation-delay: -0.1s;
    left: 150px;
}

.ai-loader .dot:nth-of-type(1)::before {
    -webkit-animation-delay: -0.1s;
    animation-delay: -0.1s;
}

.ai-loader .dot:nth-of-type(2) {
    -webkit-animation-delay: -1.2s;
    animation-delay: -1.2s;
    left: 150px;
}

.ai-loader .dot:nth-of-type(2)::before {
    -webkit-animation-delay: -1.2s;
    animation-delay: -1.2s;
}

.ai-loader .dot:nth-of-type(3) {
    -webkit-animation-delay: -0.3s;
    animation-delay: -0.3s;
    left: 125px;
}

.ai-loader .dot:nth-of-type(3)::before {
    -webkit-animation-delay: -0.3s;
    animation-delay: -0.3s;
}

.ai-loader .dot:nth-of-type(4) {
    -webkit-animation-delay: -1.4s;
    animation-delay: -1.4s;
    left: 125px;
}

.ai-loader .dot:nth-of-type(4)::before {
    -webkit-animation-delay: -1.4s;
    animation-delay: -1.4s;
}

.ai-loader .dot:nth-of-type(5) {
    -webkit-animation-delay: -0.5s;
    animation-delay: -0.5s;
    left: 100px;
}

.ai-loader .dot:nth-of-type(5)::before {
    -webkit-animation-delay: -0.5s;
    animation-delay: -0.5s;
}

.ai-loader .dot:nth-of-type(6) {
    -webkit-animation-delay: -1.6s;
    animation-delay: -1.6s;
    left: 100px;
}

.ai-loader .dot:nth-of-type(6)::before {
    -webkit-animation-delay: -1.6s;
    animation-delay: -1.6s;
}

.ai-loader .dot:nth-of-type(7) {
    -webkit-animation-delay: -0.7s;
    animation-delay: -0.7s;
    left: 75px;
}

.ai-loader .dot:nth-of-type(7)::before {
    -webkit-animation-delay: -0.7s;
    animation-delay: -0.7s;
}

.ai-loader .dot:nth-of-type(8) {
    -webkit-animation-delay: -1.8s;
    animation-delay: -1.8s;
    left: 75px;
}

.ai-loader .dot:nth-of-type(8)::before {
    -webkit-animation-delay: -1.8s;
    animation-delay: -1.8s;
}

.ai-loader .dot:nth-of-type(9) {
    -webkit-animation-delay: -0.9s;
    animation-delay: -0.9s;
    left: 50px;
}

.ai-loader .dot:nth-of-type(9)::before {
    -webkit-animation-delay: -0.9s;
    animation-delay: -0.9s;
}

.ai-loader .dot:nth-of-type(10) {
    -webkit-animation-delay: -2s;
    animation-delay: -2s;
    left: 50px;
}

.ai-loader .dot:nth-of-type(10)::before {
    -webkit-animation-delay: -2s;
    animation-delay: -2s;
}

.ai-loader .dot:nth-of-type(11) {
    -webkit-animation-delay: -1.1s;
    animation-delay: -1.1s;
    left: 25px;
}

.ai-loader .dot:nth-of-type(11)::before {
    -webkit-animation-delay: -1.1s;
    animation-delay: -1.1s;
}

.ai-loader .dot:nth-of-type(12) {
    -webkit-animation-delay: -2.2s;
    animation-delay: -2.2s;
    left: 25px;
}

.ai-loader .dot:nth-of-type(12)::before {
    -webkit-animation-delay: -2.2s;
    animation-delay: -2.2s;
}

.ai-loader .dot:nth-of-type(13) {
    -webkit-animation-delay: -1.3s;
    animation-delay: -1.3s;
    left: 0px;
}

.ai-loader .dot:nth-of-type(13)::before {
    -webkit-animation-delay: -1.3s;
    animation-delay: -1.3s;
}

.ai-loader .dot:nth-of-type(14) {
    -webkit-animation-delay: -2.4s;
    animation-delay: -2.4s;
    left: 0px;
}

.ai-loader .dot:nth-of-type(14)::before {
    -webkit-animation-delay: -2.4s;
    animation-delay: -2.4s;
}

.ai-loader .dot:nth-of-type(15) {
    -webkit-animation-delay: -1.5s;
    animation-delay: -1.5s;
    left: -25px;
}

.ai-loader .dot:nth-of-type(15)::before {
    -webkit-animation-delay: -1.5s;
    animation-delay: -1.5s;
}

.ai-loader .dot:nth-of-type(16) {
    -webkit-animation-delay: -2.6s;
    animation-delay: -2.6s;
    left: -25px;
}

.ai-loader .dot:nth-of-type(16)::before {
    -webkit-animation-delay: -2.6s;
    animation-delay: -2.6s;
}

.ai-loader .dot:nth-of-type(17) {
    -webkit-animation-delay: -1.7s;
    animation-delay: -1.7s;
    left: -50px;
}

.ai-loader .dot:nth-of-type(17)::before {
    -webkit-animation-delay: -1.7s;
    animation-delay: -1.7s;
}

.ai-loader .dot:nth-of-type(18) {
    -webkit-animation-delay: -2.8s;
    animation-delay: -2.8s;
    left: -50px;
}

.ai-loader .dot:nth-of-type(18)::before {
    -webkit-animation-delay: -2.8s;
    animation-delay: -2.8s;
}

.ai-loader .dot:nth-of-type(19) {
    -webkit-animation-delay: -1.9s;
    animation-delay: -1.9s;
    left: -75px;
}

.ai-loader .dot:nth-of-type(19)::before {
    -webkit-animation-delay: -1.9s;
    animation-delay: -1.9s;
}

.ai-loader .dot:nth-of-type(20) {
    -webkit-animation-delay: -3s;
    animation-delay: -3s;
    left: -75px;
}

.ai-loader .dot:nth-of-type(20)::before {
    -webkit-animation-delay: -3s;
    animation-delay: -3s;
}

.ai-loader .dot:nth-of-type(21) {
    -webkit-animation-delay: -2.1s;
    animation-delay: -2.1s;
    left: -100px;
}

.ai-loader .dot:nth-of-type(21)::before {
    -webkit-animation-delay: -2.1s;
    animation-delay: -2.1s;
}

.ai-loader .dot:nth-of-type(22) {
    -webkit-animation-delay: -3.2s;
    animation-delay: -3.2s;
    left: -100px;
}

.ai-loader .dot:nth-of-type(22)::before {
    -webkit-animation-delay: -3.2s;
    animation-delay: -3.2s;
}

.ai-loader .dot:nth-of-type(23) {
    -webkit-animation-delay: -2.3s;
    animation-delay: -2.3s;
    left: -125px;
}

.ai-loader .dot:nth-of-type(23)::before {
    -webkit-animation-delay: -2.3s;
    animation-delay: -2.3s;
}

.ai-loader .dot:nth-of-type(24) {
    -webkit-animation-delay: -3.4s;
    animation-delay: -3.4s;
    left: -125px;
}

.ai-loader .dot:nth-of-type(24)::before {
    -webkit-animation-delay: -3.4s;
    animation-delay: -3.4s;
}

.ai-loader .dot:nth-of-type(25) {
    -webkit-animation-delay: -2.5s;
    animation-delay: -2.5s;
    left: -150px;
}

.ai-loader .dot:nth-of-type(25)::before {
    -webkit-animation-delay: -2.5s;
    animation-delay: -2.5s;
}

.ai-loader .dot:nth-of-type(26) {
    -webkit-animation-delay: -3.6s;
    animation-delay: -3.6s;
    left: -150px;
}

.ai-loader .dot:nth-of-type(26)::before {
    -webkit-animation-delay: -3.6s;
    animation-delay: -3.6s;
}

.ai-loader .dot::before {
    -webkit-animation-name: size-opacity;
    animation-name: size-opacity;
    -webkit-animation-duration: 2s;
    animation-duration: 2s;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
    -webkit-animation-timing-function: ease;
    animation-timing-function: ease;
    background: var(--el-color-primary);
    border-radius: 50%;
    content: '';
    display: block;
    height: 100%;
    width: 100%;
}

.ai-loader .dot:nth-of-type(even)::before {
    background-color: var(--el-color-primary-light-5);
    box-shadow: inset 0 0 4px #ff1492;
}

@Keyframes movement {
    0% {
        -webkit-transform: translate3d(0, -25px, 0);
        transform: translate3d(0, -25px, 0);
        z-index: 0;
    }

    50% {
        -webkit-transform: translate3d(0, 25px, 0);
        transform: translate3d(0, 25px, 0);
        z-index: 10;
    }

    100% {
        -webkit-transform: translate3d(0, -25px, 0);
        transform: translate3d(0, -25px, 0);
        z-index: -5;
    }
}

@Keyframes size-opacity {
    0% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }

    25% {
        -webkit-transform: scale(1.5);
        transform: scale(1.5);
    }

    50% {
        opacity: 1;
    }

    75% {
        opacity: .35;
        -webkit-transform: scale(0.5);
        transform: scale(0.5);
    }

    100% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值