imedia,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<style>
#canvas /* стили для canvas*/
{
border: 1px solid black; /*рамка*/
}
</style>
</head>
<body>
<canvas id="canvas" width="600" height="300"> Браузер не поддерживает canvas</canvas>
<script>
window.onload = function() {
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var x = canvas.width /2;
var y = canvas.height / 2;
var radius = 50;
var counterClockwise = false;
var run = function() {
var time = (new Date().getTime()- startTime)/ duration;
var startAngle = 10*Math.PI/7;
var endAngle = 2*Math.PI/1.0;;
context.lineWidth = 8;
context.strokeStyle = 'rgba(204,0,65,1)';
if(time < 1) {requestAnimationFrame(run);
endAngle = startAngle +(endAngle - startAngle)* time;
}
context.clearRect(0, 0, 600, 300);
context.beginPath();
context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
context.stroke();
context.strokeStyle = 'rgba(251,79,134,1)';
context.beginPath();
context.arc(x, y, radius-15, startAngle, endAngle, counterClockwise);
context.stroke();
}
var duration = 4000,
startTime = new Date().getTime();
run();
}
</script>
</body>