<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div>
<canvas width="152" height="152" id="process"></canvas>
<h4>CSS3</h4>
</div>
</body>
<script type="text/javascript">
var c = document.getElementById("process");
var ctx = c.getContext('2d');
var centerX = c.width/2;
var centerY = c.height/2;
var rad = Math.PI*2/100;
var speed = 0.4;
animate();
function animate(){
window.requestAnimationFrame(function(){
if(speed < 80 ){
animate();
}
});
ctx.clearRect(0, 0, c.width, c.height);
speed += 0.4;
drawCircle(ctx,speed);
};
function drawCircle(ctx,percent){
ctx.save();
ctx.strokeStyle = "#D8CCBE";
ctx.lineWidth = 12;
ctx.beginPath();
ctx.arc(centerX, centerY, 68, 0, Math.PI*2, false);
ctx.stroke();
ctx.closePath();
ctx.restore();
ctx.save();
ctx.strokeStyle = "#E87E04";
ctx.lineWidth = 12;
ctx.beginPath();
ctx.arc(centerX, centerY, 68, -Math.PI/2, -Math.PI/2 +percent*rad, false);
ctx.stroke();
ctx.closePath();
ctx.restore();
ctx.save();
ctx.fillStyle = "#474d5d";
ctx.font = "bold 21px Arial";
ctx.fillText(percent.toFixed(0) + '%', centerX-20, centerY+10);
ctx.restore();
}
</script>
</html>