代码部分:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>过度球</title>
<style>
*{margin: 0;padding: 0;}
#foo{
width: 100%;
height: 500px;
background-color: black;
filter: blur(15px) contrast(30);
}
.box{
width: 100px;
height: 100px;
border-radius: 50%;
background-color: white;
float: left;
margin-top: 200px;
margin-left: 20%;
}
.box:nth-child(2){
animation: run 2s ease-in-out alternate infinite;
}
@keyframes run{
from{
box-shadow: 500px 0 0 white;
}
to{
box-shadow: -500px 0 0 white;
}
}
</style>
</head>
<body>
<div id="foo">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>
效果图: