Assessment for a variation of Canvas looping panorama

Regarding looping panorama example for canvas I could not understand the code completely especially the draw function.
I wrote a different code quite similar to the original one but with these differences:

  • I didn’t use clearX and clearY and used the canvasXSize and canvasYSize instead because I thought it’s not necessary to clear the area out of the canvas.
  • And changed the code for draw function.

Please compare the new code to the original one and tell if you find any problem or if the original code is better, what’s the reason.
Thank you very much.