HTML Canvas .beginPath method
Hello guys, sorry to disturb you; I'm learning about HTML canvas and their is something which is confusing me. When drawing some elements, like using the .filleRect() method, we need to use the beginPath() method while when using the .Rect() method, we don't need to actually do that. Why and what is the purpose of the beginPath please
10 Replies
because it actually is mend to use as a part of a path. It's not a shape on itself
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/rect
what do we mean by current path please... I'm confused about the word "path" I saw that but I didn't understand ðŸ˜
current path is everything that comes between begin- and end-path.
you can draw lines, arcs, rects, etc in a single path to create a combined shape.
yeah I see, how can we think of the word "path" like our current drawing session ?
its like a shape you draw without lifting your pen
like imagine u took a pen, u put it on paper, and u start drawing
up until u lift the pen the route that you took, and moved your pen around is the "path"
yeah I see
allthoug there is also the .moveTo method in a path, so it's not exactly that. but almost
oh ya that's true
yeah but I now have a clearer view of what is meant by "path"... thanks guys really appreciate