On the problem of element movement in canvas

clipboard.png

clipboard.png

A picture grows slowly when it slides up to a certain extent. Why does it bring out a line that has been entangled all night? I can"t find the reason.

Feb.26,2021

what kind of line? How much is the tilt?


use save () and restore () .
basic steps of canvas animation:

  1. Save canvas state
  2. draw animation frames
  3. restore the canvas state and redraw the next frame

I can't find out why you posted the code like this. I can only guess draw that you didn't empty the canvas before. You can try to add draw () to

.
ctx1.clearRect(0, 0, canWidth, canHeight)
Menu