Answers for "how to draw horizontal line in canvas"

0

how to draw horizontal line in canvas

const canvas = document.querySelector('.main-canvas');
const ctx = canvas.getContext('2d');

let lineWidth = 33;
let totalWidth = canvas.width;
let middle = canvas.width / 2;

ctx.beginPath();
ctx.moveTo(0, middle);
ctx.lineTo(totalWidth, middle);
ctx.stroke();
Posted by: Guest on November-25-2020

Code answers related to "how to draw horizontal line in canvas"

Code answers related to "Javascript"

Browse Popular Code Answers by Language