let move=(obj,target,time,callback)=>{
clearInterval(obj.timer);
obj.timer=setInterval(function(){
let begin=obj.offsetLeft;
let speed=(target-begin)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(begin===target){
clearInterval(obj.timer);
callback&&callback();
}
obj.style.left=begin+speed+'px';
},time)
}
animate缓慢动画
最新推荐文章于 2024-08-27 15:59:21 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)