关于animate的rate和speed理解
?我的理解是time是总的时间,分成很多段,rate是每段的时间,每个rate就移动speed的位移,
let animate = setInterval(() => {
if ( this.picBox.style.left == goal || Math.abs(Math.abs(parseFloat(this.picBox.style.left)) - Math.abs(goal)) < Math.abs(speed) ) {
this.picBox.style.left = goal + "px"
clearInterval(animate)
} else {
this.picBox.style.left = parseFloat(this.picBox.style.left) - speed + "px"
}
}, rate)