<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
background: #282C34;
}
.box {
width: 500px;
height: 250px;
border: 1px solid #235FA7;
margin: 50px auto;
position: relative;
}
.bar {
width: 120px;
height: 3px;
border-radius: 3em;
background: linear-gradient(to right, rgba(79, 209, 221, 0), rgba(79, 209, 221, 1));
position: absolute;
left: 0;
bottom: 0;
animation: slider 1s linear infinite;
}
@keyframes slider {
0% {
left: 0;
}
100% {
left: calc(100% - 120px);
}
}
</style>
</head>
<body>
<div class="box">
<div class="bar"></div>
</div>
</body>
</html>
参考: datav.jiaminghi.com/guide/borde… 用css实现简单光束左右移动的动画,当然效果偏差有点大,有时间再继续完善 (ง •_•)ง