css3實現水球波紋效果

原理:父div設爲圓形,並隱藏超出範圍的內容,多個子div設爲大圓角正方形並設置背景顏色, 子div圓心設置到父div下方,並繞自己的圓心旋轉, 效果就是水球波紋。

<div class="wave">
       水球波紋效果
       <div class="wave1"></div>
       <div class="wave2"></div>
       <div class="wave3"></div>
</div>
.wave{
    position: relative;
    border: 1px solid silver;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    line-height: 50px;
    margin: 0 auto;
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    animation: water-wave linear infinite;
}
.wave1{
    position: absolute;
    top: 40%;
    left: -25%;
    background: #33cfff;
    opacity: .7;
    width: 200%;
    height: 200%;
    border-radius: 40%;
    animation: inherit;
    animation-duration: 5s;
}
.wave2{
    position: absolute;
    top: 40%;
    left: -35%;
    background: #0eaffe;
    opacity: .7;
    width: 200%;
    height: 200%;
    border-radius: 35%;
    animation: inherit;
    animation-duration: 7s;
}
.wave3{
    position: absolute;
    top: 40%;
    left: -45%;
    background: #0f7ea4;
    opacity: .3;
    width: 200%;
    height: 200%;
    border-radius: 40%;
    animation: inherit;
    animation-duration: 11s;
}
@keyframes  water-wave{
    0% {transform: rotate(0deg);}
    100% {transform: rotate(360deg);}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章