JSFiddle - React, Tailwind, and code Playground
by Darby Rathbone
HTML
<canvas id='can'></canvas>
JavaScript
const canvas = document.getElementById('can'),
shift = 150,
context = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var sides= 25,
radius = 25,
theta = 2 * Math.PI / sides,
path = '',
offset = theta * 0.5;
for (var i = 0; i < sides; i += 1) {
var angle = offset + (i * theta),
xx = Math.cos(angle) * radius ;
yy = Math.sin(angle) * radius;
path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' ';
}