Advertisement
Home Open Editor ❯

HTML canvas beginPath() Method

Example

ctx.beginPath();
ctx.lineWidth = "5";
ctx.strokeStyle = "red";
ctx.moveTo(25, 75);
ctx.lineTo(125, 75);
ctx.stroke();

ctx.beginPath();
ctx.strokeStyle = "green";
ctx.moveTo(25, 25);
ctx.lineTo(125, 75);
ctx.stroke();

Try this code ❯

Meaning

The beginPath() method begins a path, or resets the current path.


Standard Syntax

JavaScript syntax:

context.beginPath();


Advertisement

Home Open Editor ❯
Advertisement