0 points

Draws a line in canvas


dashboard

Tue May 05 2020 16:17:01 GMT+0000 (UTC)

Posted by @madeusblack #javascript

                                
function drawLine( color, xInit, yInit, xEnd, yEnd, canvas)
{
    canvas.beginPath();
    canvas.strokeStyle=color;
    canvas.lineWidth=grosorLinea;
    canvas.moveTo(xInit, yInit);
    canvas.lineTo(xEnd, yEnd);
    canvas.stroke();
    canvas.closePath();
}
content_copy Copy

requires a contextualized canvas