JSFiddle - React, Tailwind, and code Playground
by Kai
JavaScript
var canvas = document.createElement('canvas'),
c = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
document.body.appendChild(canvas);
var posX = canvas.width/2,
posY = canvas.height/2,
angle = Math.PI,
radius = 10;
function loop () {
c.clearRect(0, 0, canvas.width, canvas.height);
c.beginPath();
c.fillStyle = 'black';
c.arc(posX, posY, radius, 0, Math.PI*2, true);
c.fill();
c.closePath();
posX = 100 * Math.cos(angle) + 200;
posY = 100 * Math.sin(angle) + 200;
angle += 0.1;
}
setInterval(loop, 1000/30);