Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

quadraticCurveTo method

Adds a point to the current subpath by using the specified control points that represent a quadratic Bézier curve.

HTML Canvas 2D Context, Section 9Internet Explorer 9



CanvasRenderingContext2D.quadraticCurveTo(cp1x, cp1y, x, y);


cp1x [in]

Type: number

The x-coordinate of the Bézier control point.

cp1y [in]

Type: number

The y-coordinate of the Bézier control point.

x [in]

Type: number

The x-coordinate of the point to add to the current path.

y [in]

Type: number

The y-coordinate of the point to add to the current path.

Return value

This method does not return a value.

Standards information


A quadratic Bézier curve requires two points. The first point is a control point that is used in the quadratic Bézier calculation and the second point is the ending point for the curve. The starting point for the curve is the last point in the existing current subpath. If a path does not exist, use the beginPath and moveTo methods to set a starting point.


The following code example uses quadraticCurveTo to draw an arc.

    <title>QuadraticCurveTo example</title>
  <script type="text/javascript">
      function beginDemo() {
          var canvas = document.getElementById("demo")
          var ctx = canvas.getContext('2d');
          // Draw a straight reference line.
          ctx.strokeStyle = "blue";
          ctx.moveTo(100, 100);
          ctx.lineTo(300, 100);
          // Draw a quadratic curve by using the same line coordinates.
          ctx.lineWidth = "3";
          ctx.strokeStyle = "black";
          ctx.moveTo(100, 100);
          ctx.quadraticCurveTo(200, 300, 300, 100);
    <body onload="beginDemo();">
        <canvas id="demo" width="400" height="400"></canvas>

See also




© 2017 Microsoft