CSS - 滤镜的妙用 - 制作炫彩圆环(外加动画)

效果图如下:

 

 

话不多说,上代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>炫彩流光圆环</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            width: 100vw;
            height: 100vh;
            background-color: #505050;
            display: grid;
            place-items:center;
        }
        .box{
            width: 400px;
            height: 400px;
            background: url(./pig.jpg);
            border-radius: 50%;
            display: grid;
            place-items:center;
            position: relative;
            color:#fff;
        }
        .box::before{
            content: "";
            width: 400px;
            height: 400px;
            background:linear-gradient(0deg,#3498db,#8e44ad,#2ecc71,#e74c3c);
            border-radius: 50%;
            position: absolute;
            filter:blur(10px);
            animation: rotate 10s linear infinite 0s;
        }
        .box>div{
            width: 300px;
            height: 300px;
            background-color: #505050;
            border-radius: 50%;
            z-index: 2;
            display: grid;
            place-items: center;
        }
        @keyframes rotate {
            to{
                transform: rotate(360deg);
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div></div>
    </div>
</body>
</html>

 

posted @ 2020-08-21 18:42  武卡卡  阅读(294)  评论(0编辑  收藏  举报