JSFiddle - React, Tailwind, and code Playground

by rmurphey

JavaScript

var spot = {
    center_x : 100,
    center_y : 100,
    width : 200,
    height : 50,
    type : 'ellipse',
    action : 'text',
    asset : 'text-asset-123'
};

var c = document.createElement('canvas');

document.body.appendChild( c );

function makeSpot(spot) {
    var ctx = c.getContext('2d');
    
    ctx.save();
    ctx.beginPath();
    ctx.arc(spot.center_x, spot.center_y, spot.height / 2, Math.PI * 2, false);
    ctx.closePath();
    ctx.fillStyle = "rgba(255,0,0,0.5)";
    ctx.fill();
}

makeSpot(spot);