Skip to content

Instantly share code, notes, and snippets.

@lolocoo
Created June 6, 2016 07:49
Show Gist options
  • Select an option

  • Save lolocoo/bf6cb07866adb0e5fb3b12810d594c52 to your computer and use it in GitHub Desktop.

Select an option

Save lolocoo/bf6cb07866adb0e5fb3b12810d594c52 to your computer and use it in GitHub Desktop.
var time = 60000/360, init = 0, per = 2*Math.PI/360;
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.arc(100,75,50,0,0*Math.PI);
ctx.stroke();
function redrawCircle(){
init += per;
ctx.clearRect(0,0,c.width,c.height);
ctx.beginPath();
ctx.arc(100,75,50,0,init);
ctx.stroke();
}
setInterval(function(){
redrawCircle();
}, time);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment