JSFiddle - React, Tailwind, and code Playground
by muztv
HTML
<canvas id="canvas" width="1000" height="1000"></canvas>
JavaScript
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext("2d");
const render = (t) => {
const x = 200 + Math.sin(t / 500) * 100;
const y = 200 + Math.cos(t / 500) * 100;
ctx.clearRect(0, 0, 1000, 1000);
ctx.beginPath();
ctx.arc(x, y, 50, 0, Math.PI * 2, true);
ctx.fill();
requestAnimationFrame(render);
}
requestAnimationFrame(render);