css实现简单音乐符效果
利用css3中的transform、animation、keyframes实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.box{
width:60px;
height:40px;
position:relative;
margin:100px auto;
transform:rotate(180deg);
}
.box span{
position:absolute;
background:lightblue;
width:10px;
}
.box span:nth-child(1){
height:50px;
left:0px;
animation:run 0.8s linear 0s infinite alternate;
}
.box span:nth-child(2){
height:50px;
left:15px;
animation:run 0.9s linear 0s infinite alternate;
}
.box span:nth-child(3){
height:50px;
left:30px;
animation:run 1s linear 0s infinite alternate;
}
.box span:nth-child(4){
height:50px;
left:45px;
animation:run 0.7s linear 0s infinite alternate;
}
.box span:nth-child(5){
height:50px;
left:60px;
animation:run 0.8s linear 0s infinite alternate;
}
@keyframes run{
10%{
height:20%;
}
20%{
height:40%;
}
40%{
height:60%;
}
70%{
height:80%
}
100%{
height:100%
}
}
</style>
</head>
<body>
<div class="box">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
效果图: