效果展示:

源码展示:

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>加载球</title>
    <style type="text/css">
        .box{
            width: 200px;
            height: 200px;
            margin: 100px auto;
        }
        .wave{
            width: 200px;
            height: 200px;
            background-color: orange;
            border-radius: 50%;
            position: relative;
        }
 
        .wave::before,.wave::after{
            content: "";
            width: 400px;
            height: 400px;
            position: absolute;
            top: -100%;
            left: -50%;
        }
        .wave::before{
            background-color: rgba(255,255,255,0.7);
            border-radius: 40%;
            animation:10s rotate_before linear infinite;
        }
 
        .wave::after{
            background-color: rgba(255,255,255,1);
            border-radius: 46%;
            animation:10s rotate_after linear infinite;
        }
        @keyframes rotate_before{
            from{
                transform: translate(0%,0%) rotate(0deg);
            }
            to{
                transform:translate(0%,-60%) rotate(360deg);
            }
        }
        @keyframes rotate_after{
            from{
                transform: translate(0%,0%) rotate(0deg);
            }
            to{
                transform:translate(0%,-60%) rotate(30deg);
            }
        }
    </style>
</head>
<body>
<div class="box">
    <div class="wave"></div>
</div>
</body>
</html>

与御风痕博客园,程序员博客园地的首选!
御风痕博客园 » CSS3动画实现加载球(水波纹)

发表评论