纯CSS写一个环绕动画效果

 

<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/style.css" rel="stylesheet">
        <style>
            *{
                margin: 0;
                padding: 0;
                list-style: none;
                outline: none;
            }
            html,body{
                width: 100%;
                height: 100%;
            }
            body{
                background: radial-gradient(ellipse at center, #34679a 0%, #214163 50%, #0d1926 100%);
            }
            body>div{
                /* 上下并排,水平居中 
                display: inline-block;
                text-align: center; */
                width: 200px;
                height: 200px;
                border: 1px solid #fff;
                border-radius: 50%;
                position: absolute;
                top: 15%;
                left: 50%;
                margin-left: -50px;
                transform: rotateX(80deg) rotateY(20deg);
                transform-style: preserve-3d;

            }
            body > div:nth-of-type(2){
                transform: rotateX(-80deg) rotateY(20deg);
            }
            body > div:nth-of-type(3){
                transform: rotateX(-70deg) rotateY(60deg);
            }
            body > div:nth-of-type(4){
                transform: rotateX(70deg) rotateY(60deg);
            }
            body > div:first-of-type::after{
                content: "";
                /* display: inline-block; */
                width: 40px;
                height: 40px;
                background: #fff;
                position: absolute;
                top: 50%;
                left: 50%;
                margin-top: -20px;
                margin-left: -20px;
                transform: rotateX(80deg);
                border-radius: 50%;
                animation: nuclues 2s linear infinite;
            }
            @keyframes nuclues{
                0%{
                    box-shadow: 0 0 0 transparent;
                }
                50%{
                    box-shadow: 0 0 0 transparent;
                }
                100%{
                    box-shadow: 0 0 0 transparent;
                }
            }
            body > div > div{
                width: 200px;
                height: 200px;
                /* border-radius: 50%; */
                transform-style: preserve-3d;
                animation: trail 1s infinite linear;
            }
            @keyframes trail{
                from{
                    transform: rotateZ(0deg);
                }
                to{
                   transform: rotateZ(360deg); 
                }
            }
            body > div > div::after{
                content: "";
                width: 5px;
                height: 5px;
                position: absolute;
                background: #fff;
                border-radius: 50%;
                position: absolute;
                top: -5px;
                left: 50%;
                margin-left: -5px;
                box-shadow:  0 0 12px #fff;
                animation: particle 1s infinite linear;
            }
            @keyframes particle{
                from{
                    transform: rotateX(0deg) rotateY(0deg);
                }
                to{
                    transform: rotateX(90deg) rotateY(-360deg);
                }
            }
            body>div:nth-of-type(2)>div,
            body>div:nth-of-type(2)>div::after{
                animation-delay: -0.5s;
            }
            body>div:nth-of-type(3)>div,
            body>div:nth-of-type(3)>div::after{
                animation-delay: -1s;
            }
            body>div:nth-of-type(4)>div,
            body>div:nth-of-type(4)>div::after{
                animation-delay: -1.5s;
            }
        </style>
    </head>
    <body>
        <div>
            <div></div>
        </div>
        <div>
            <div></div>
        </div>
        <div>
            <div></div>
        </div>
        <div>
            <div></div>
        </div>
    </body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

H_Cisco

感谢大佬打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值