首页 > js图片切换动画

js图片切换动画

请问用js怎样把这两张图做成动画,走一段距离后,沿原路线返回

做了几次,没做出来


<style>
.an{
    width: 155px;
    height: 88px;
    animation: anim 0.6s infinite;
}
@keyframes anim{
    from{background-image:url("1.png") ;}
    to{background-image:url("2.png") ;}
}
</style>
<div class="an">
</div>
【热门文章】
【热门文章】