您的位置:首页 > Web前端 > CSS

web前端小案例-纯css制作水滴效果

2018-02-25 14:10 761 查看


html代码:<div class="drip"></div>css代码:
<style>
html, body {
margin: 0;
height: 100%;
width: 100%;
display: flex;
background-color: #43A2CE;
}

.drip {
width: 200px;
height: 250px;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: auto;
position: relative;
}
.drip:before {
position: absolute;
left: 92.5px;
top: 0;
content: '';
width: 15px;
height: 15px;
background-color: #FFF;
border-radius: 50%;
opacity: 0;
animation: drip 4s ease infinite;
}
.drip:after {
box-sizing: border-box;
position: absolute;
bottom: 0;
left: 0;
content: '';
width: 0px;
height: 0px;
border: solid 4px #FFF;
border-radius: 50%;
opacity: 0;
animation: splash 4s ease infinite;
}

@keyframes drip {
10% {
top: 0;
opacity: 1;
animation-timing-function: cubic-bezier(0.24, 0, 0.76, 0.14);
}
25% {
opacity: 1;
top: 200px;
animation-timing-function: ease-out;
width: 15px;
height: 15px;
left: 92.5px;
}
30% {
opacity: 1;
top: 160px;
width: 5px;
height: 5px;
animation-timing-function: ease-in;
left: 97.5px;
}
33% {
top: 200px;
opacity: 0;
animation-timing-function: ease-out;
left: 97.5px;
}
33.001% {
opacity: 0;
}
100% {
opacity: 0;
}
}
@keyframes splash {
0% {
opacity: 0;
}
25% {
bottom: 50px;
left: 100px;
opacity: 0;
width: 0px;
height: 0px;
}
25.001% {
opacity: 1;
}
33% {
bottom: 0;
left: 0;
opacity: 0;
width: 200px;
height: 100px;
}
33.001% {
bottom: 50px;
left: 100px;
opacity: 1;
width: 0px;
height: 0px;
}
43% {
bottom: 0;
left: 0;
opacity: 0;
width: 200px;
height: 100px;
}
43.001% {
opacity: 0;
}
}

</style>

最后小编推荐一下我的前端学习群:575308719,视频、源码、经验等大量干货分享,不管你是小白还是大牛,小编都欢迎,欢迎初学和进阶中的小伙伴。





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息