Skip to content

Instantly share code, notes, and snippets.

@movii
Last active May 26, 2018 07:15
Show Gist options
  • Save movii/ec360767f40da3ab1a4ea85ff3fea06b to your computer and use it in GitHub Desktop.
Save movii/ec360767f40da3ab1a4ea85ff3fea06b to your computer and use it in GitHub Desktop.
const loop = () => {
ctx.clearRect(0, 0, $canvas.width, $canvas.height);
let x = 125 + Math.cos(angle) * 100
let y = 125 + Math.sin(angle) * 100
ctx.fillStyle = "hotpink";
ctx.beginPath();
ctx.arc(x, y, 10, 0, getRads(360));
ctx.closePath();
ctx.fill();
angle = angle >= 360
? 0
: angle + velocity
requestAnimationFrame(loop)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment