效果
代码
CSS代码:
body {
background-color: #000;
filter: blur(10px) contrast(5);
padding: 100px;
}
.box {
width: 100px; height: 100px;
border-radius: 50%;
position: absolute;
}
.box-1 {
background-color: deepskyblue;
animation: fly-r 5s infinite alternate;
}
.box-2 {
width: 60px; height: 60px;
margin-top: 20px;
background-color: white;
animation: fly-l 5s infinite alternate;
}
@keyframes fly-r {
from { transform: translateX(0); }
to { transform: translateX(120px); }
}
@keyframes fly-l {
from { transform: translateX(120px); }
to { transform: translateX(0); }
}
HTML代码:
<div class="box box-1"></div>
<div class="box box-2"></div>
其他酷酷的动效:https://codepen.io/Chokcoco/pen/gZVjJw