JSFiddle - React, Tailwind, and code Playground

by atesgoral

HTML

<canvas width="2000" height="2000"></canvas>

JavaScript

var canvas = document.getElementsByTagName('canvas')[0];
var ctx = canvas.getContext('2d');

ctx.strokeStyle = 'cyan';

ctx.beginPath();
ctx.moveTo(canvas.width / 2, 0);
ctx.lineTo(canvas.width / 2, canvas.height);
ctx.stroke();

ctx.beginPath();
ctx.moveTo(0, canvas.height / 2);
ctx.lineTo(canvas.width, canvas.height / 2);
ctx.stroke();

console.log(canvas.toDataURL());