HTML canvas stroke() Method
Example
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(25, 25);
// Stroke
ctx.lineTo(25, 100);
ctx.lineTo(100, 100);
ctx.strokeStyle = "red";
ctx.stroke();
Meaning
The stroke() method draws the path you have defined.
Standard Syntax
JavaScript syntax:
context.stroke();
Advertisement