Yes, use beginPath ()
beginPath () tells canvas that you are about to start a new path, and toLine () is the path process. Without beginPath (), your next drawings will bleed for your previous drawings, because the canvas thinks that you are still continuing these previous drawings. The same goes for other road drawings such as arc, arcTo, quadraticCurveTo, etc.
markE source share