JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="canvas1" width="500" height="500"></canvas>http://jsfiddle.net/9bMPD/http://jsfiddle.net/9bMPD/

JavaScript

var can = document.getElementById('canvas1');
var ctx = can.getContext('2d');

ctx.lineWidth = 1;

// linear gradient from start to end of line

ctx.strokeStyle = "red";

ctx.beginPath();
ctx.moveTo(50,150);
ctx.lineTo(150,150);

ctx.stroke();