|
发表于 2018-7-6 01:11:09
|
显示全部楼层
- <script>
- var c = c1.getContext('2d');
-
- function a(){
- c.beginPath();
- c.arc(333,333,150,0,Math.PI*2);
- c.stroke();
-
- c.beginPath();
- c.arc(350,250,40,0,Math.PI*2);
- c.fillStyle = "blue";
- c.fill();
- c.stroke();
-
- c.beginPath();
- c.arc(370,235,10,0,Math.PI*2);
- c.fillStyle = "#fff";
- c.fill();
- c.stroke();
-
-
- c.moveTo(333,333);
- c.lineTo(483,333);
- c.stroke();
- }
- var cool = Math.PI/180;
- function b(){
- c.beginPath();
- c.moveTo(333,333);
- c.closePath();
- c.arc(333,333,150,45*cool,315*cool);
- c.closePath();
- c.stroke();
-
- c.beginPath();
- c.arc(350,250,40,0,Math.PI*2);
- c.fillStyle = "blue";
- c.fill();
- c.stroke();
-
- c.beginPath();
- c.arc(370,235,10,0,Math.PI*2);
- c.fillStyle = "red";
- c.fill();
- c.stroke();
- }
- var n = 1;
- var t = setInterval(function(){
- c.clearRect(0,0,666,666);
- if(n == 1){
- b();
- n = 2;
- }else{
- a();
- n = 1;
- }
-
-
-
- },1000);
-
-
- </script>
复制代码 |
|