<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>按钮动画</title>
<style type="text/css">
*{
margin:0;
padding:0;
box-sizing: border-box;
font-family: sans-serif;
}
body{
background: #fcfcfc;
}
#btn-grp{
max-width: 768px;
margin:auto;
}
h1,h2,h3,h4{
text-align: center;
margin-bottom: 25px;
color: #7f8c8d;
}
p{
color: #7f8c8d;
text-align: center;
}
.btn{
margin: 25px auto;
position: relative;
font-size: 25px;
color: #fff;
padding: 20px;
width: 200px;
overflow: hidden;
text-align: center;
cursor: pointer;
text-transform: uppercase;
}
.btn:nth-of-type(1){
background-color: #2ecc71;
}
.btn:nth-of-type(2){
background-color:#3498db;
}
.btn:nth-of-type(3){
background-color: #e74c3c;
}
.btn.left:after{
left: 0;
}
.btn.wave:after{
content: "";
background: #fff;
display: block;
position: absolute;
width: 200%;
height: 200%;
top:-5%;
border-radius: 50px;
margin-left: -30%;
opacity: 0;
transition: all 0.75s ease-in-out;
}
.btn.wave:active:after{
width: 0px;
opacity: 1;
transition: 0s;
}
.btn.half-stroke:after{
content: "";
background:#fff;
display: block;
position: absolute;
width: 100%;
height: 100%;
top:0;
opacity: 0;
transition: all 0.75s ease-in-out
}
.btn.half-stroke:active:after{
width: 0px;
opacity: 1;
transition: 0s;
}
.btn.bubble:after{
content: "";
background: #fff;
position: absolute;
width: 200px;
height: 200px;
left: 0;
top:0;
right: 0;
bottom:0;
opacity: 0;
margin:auto;
border-radius: 50%;
transform: scale(1);
transition: all 0.75s ease-in-out;
}
.btn.bubble:active:after{
transform: scale(0);
opacity: 1;
transition: 0s;
}
</style>
</head>
<body>
<p>水波动画</p>
<div class="btn wave left">Click</div>
<p>缓慢的笔刷动画</p>
<div class="btn half-stroke left">Click</div>
<p>气泡动画</p>
<div class="btn bubble left">Click</div>
</body>
</html>