JSFiddle - React, Tailwind, and code Playground

by jeffreybiles

HTML

<html>
<body>
    <canvas id="myCanvas" width="400" height="300"></canvas>
</body>

CSS

#myCanvas {background-color: #999;}

JavaScript

//1.2 Operations

var x = 150 + 50;
var y = 100;
var radius = 20;
var color = 'black';

main = function(){    
    drawCircle(x, y, radius*2, color);
    drawCircle(x + 50, y/2, radius, color);
}
    
    
    
















    
    
//it's safe to ignore everything past this point for now
    
drawCircle = function(x, y, radius, color) {
    var canvas = document.getElementById("myCanvas");
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = color;
    ctx.beginPath();
    ctx.arc(x, y, radius, 0, Math.PI * 2, false);
    ctx.fill();
}
    
main()