zoukankan      html  css  js  c++  java
  • 闲来无写的,就是中间有一条小细线,求大神指点。

      <!DOCTYPE html>
      <html>
       
      <head>
      <meta charset="UTF-8">
      <title></title>
      </head>
       
      <body>
      <canvas id="canvas" width="500" height="500"></canvas>
      <script type="text/javascript">
      var oC = document.getElementById("canvas");
      var ctx = oC.getContext("2d");
       
      ctx.translate(250,250);
      function autoplay() {
      // 左边
      ctx.beginPath();
      ctx.fillStyle = "black";
      ctx.arc(0, 0, 200, Math.PI * 0.5, Math.PI * 1.5, false);
      ctx.fill();
      ctx.closePath();
       
       
      // 右边
      ctx.beginPath();
      ctx.fillStyle = "white";
      ctx.strokeStyle = "black";
      ctx.arc(0, 0, 200, Math.PI * 1.5, Math.PI * 0.5, false);
      ctx.fill();
      ctx.stroke();
      ctx.closePath();
      // 小大的
      ctx.beginPath();
      ctx.fillStyle = "white";
      ctx.arc(0, -100, 100, Math.PI * 0.5, Math.PI * 1.5, false);
      ctx.fill();
      ctx.closePath();
       
      ctx.beginPath();
      ctx.fillStyle = "black";
      ctx.arc(0, 100, 100, Math.PI * 1.5, Math.PI * 0.5, false);
      ctx.fill();
      //小小的
      ctx.beginPath();
      ctx.fillStyle = "white";
      ctx.arc(0, 100, 35, 0, Math.PI * 2, false);
      ctx.fill();
      ctx.closePath();
       
      ctx.beginPath();
      ctx.fillStyle = "black";
      ctx.arc(0, -100, 35, 0, Math.PI * 2, false);
      ctx.fill();
      ctx.closePath();
      }
       
       
      var deg = 0;
      // setInterval(function(){
      // deg += Math.PI / 6;
      // // 清空
      // ctx.clearRect(-250,-250,500,500);
      // ctx.rotate(Math.PI / 100);
      // autoplay();
      // },20)
       
       
      // function move(){
      // deg = Math.PI / 6;
      // // 清空
      // ctx.clearRect(-250,-250,500,500);
      // ctx.rotate(Math.PI / 100);
      // autoplay();
      // setTimeout(move,100);
      // }
      // move();
      function move(){
      deg = Math.PI / 6;
      // 清空
      ctx.clearRect(-250,-250,500,500);
      ctx.rotate(Math.PI / 100);
      autoplay();
      // 当浏览器渲染刷新的时候调用
      window.requestAnimationFrame(move);
      }
      move();
      </script>
      </body>
       
      </html>
       
       
       
       
       
       
       
       
       
  • 相关阅读:
    assert的使用
    网络性能测试工具iperf的注意事项
    sskykeygen + sshcopyid避免ssh/scp每次输入密码
    遗留系统维护的思考
    IList(T)转换DataSet
    可扩展性(Extensibility): 构建灵活系统的思考
    页面加一个"数据正在载入,请等待... Loading, please wait..."的提示
    优化JavaScript
    创业与老子的顺其自然
    实用正则表达式匹配和替换
  • 原文地址:https://www.cnblogs.com/haotian-dada666/p/5799997.html
Copyright © 2011-2022 走看看