西瓜瓜瓜

导航

贝塞尔曲线

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8"/>
  <script type="application/javascript">
    function draw() {
      var canvas = document.getElementById('canvas');
      if (canvas.getContext) {
        var ctx = canvas.getContext('2d');



        
  ctx.lineWidth = 6;
  ctx.strokeStyle = "#333";
  ctx.beginPath();
  ctx.moveTo(100, 250);
  ctx.bezierCurveTo(169, 53, 350, 100, 400, 250);
  ctx.stroke();;
      }
    }
  </script>
  <style type="text/css">
     canvas { border: 1px solid black; }
   </style>
 </head>
 <body onload="draw();">
   <canvas id="canvas" width="500" height="500"></canvas>
 </body>
</html>

  

posted on 2018-11-27 15:22  西瓜瓜瓜  阅读(143)  评论(0编辑  收藏  举报