HTML Canvas beginPath() quadratic Bezier curve

Description

HTML Canvas beginPath() quadratic Bezier curve

View in separate window

<!DOCTYPE html>

<html>
  <head>
    <title>Pushing canvas further</title>
    <meta charset="utf-8">
    /*from   w ww .  ja v a 2 s. c o m*/
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    
    <script type="text/javascript">
      $(document).ready(function() {  
        var canvas = $("#myCanvas");
        var context = canvas.get(0).getContext("2d");
        
        // A quadratic Bezier curve
        context.lineWidth = 5;
        context.beginPath();
        context.moveTo(50, 250);
        context.quadraticCurveTo(250, 100, 450, 250);
        context.stroke();
        
      });
    </script>
  </head>
  
  <body>
    <canvas id="myCanvas" width="500" height="500">
      <!-- Insert fallback content here -->
    </canvas>
  </body>
</html>



PreviousNext

Related