JSFiddle - React, Tailwind, and code Playground

by Egor Mokeev

HTML

<canvas width="300" height="300" id="elem"></canvas>

JavaScript

var canvas = document.getElementById("elem");
var ctx = canvas.getContext("2d");
var step = 2 * Math.PI / 20;
var h = 150; 
var k = 150;
var r = 50;

ctx.beginPath();

for(var theta = 0; theta < 2 * Math.PI; theta += step) {
    var x = h + r * Math.cos(theta);
    var y = k - r * Math.sin(theta);
    ctx.lineTo(x, y);
}

ctx.closePath();
ctx.stroke();