Canvas I have to use beginpath () with html5 lines

I know that you can use beginpath(); with circles on canvas. However, from what I have been taught, you do not need to use it with lines. I sometimes do not use it with lines, and it works fine, the same thing with the addition of beginpath() , it works fine anyway. But should beginpath(); be used beginpath(); with lines? If so, what else? Is it a good or bad habit, tell me everything you know.

Thanks for the help!

+4
source share
1 answer

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.

+2
source

All Articles