HTML5画布小dome八卦图

 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="utf-8" />
 <title></title>
  
 <style type="text/css">
 #BAgua{
 width: 300px;
 height: 300px;
 margin: 0 auto;
 text-align: center;
 display: flex;
 justify-content: center;
 align-items: center;
 }
 #mycanvas {
 animation: 2s zhuan infinite linear;
 }
 @keyframes zhuan {
 0% {transform: rotate(0deg);}
 100% {transform: rotate(360deg);}
 }
 </style>
 </head>
 <body>
 <div id="BAgua">
 <canvas id="mycanvas" width="200" height="200"></canvas>
 </div>
 </body>
 </html>
 <script type="text/javascript">
 var bag=document.getElementById("mycanvas");
 var ctx =bag.getContext("2d");
  
 ctx.beginPath();//开始一条路径
 ctx.arc(100,100,100,0,Math.PI*2);//绘制原型
 ctx.stroke();
  
 ctx.beginPath();
 ctx.arc(100,100,100,Math.PI*0.5,Math.PI*1.5);
 ctx.fillStyle="black";
 ctx.fill();
  
 ctx.beginPath();
 ctx.arc(100,50,50,Math.PI*0.5,Math.PI*1.5);
 ctx.stroke();
 ctx.fillStyle="white";
 ctx.fill();
  
 ctx.beginPath();
 ctx.arc(100,150,50,Math.PI*0.5,Math.PI*1.5,true);
 ctx.stroke();
 ctx.fillStyle="black";
 ctx.fill();
  
 ctx.beginPath();
 ctx.arc(100,50,10,0,Math.PI*2);
 ctx.stroke();
 ctx.fillStyle="black";
 ctx.fill();
  
 ctx.beginPath();
 ctx.arc(100,150,10,0,Math.PI*2);
 ctx.stroke();
 ctx.fillStyle="white";
 ctx.fill();
  
  
 </script>
  

转载于:https://www.cnblogs.com/ylq818/p/10531299.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值