HTML canvas quadraticCurveTo() method
Definition and Usage
quadraticCurveTo()
method to add a point to the current path by using the specified control points that represent the quadratic Bezier curve.
Tip:A quadratic Bezier curve requires two points. The first point is the control point used in the quadratic Bezier calculation, and the second point is the endpoint of the curve. The starting point of the curve is the last point in the current path. If the path does not exist, then please use beginPath() and moveTo() method to define the starting point.

- Starting point: moveTo(
20
,20
) - Control point: quadraticCurveTo(
20
,100
,200,20) - End point: quadraticCurveTo(20,100,
200
,20
)
Tip:Please see bezierCurveTo() method. It has two control points instead of one.
Example
Draw a quadratic Bezier curve:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.moveTo(20,20); ctx.quadraticCurveTo(20,100,200,20); ctx.stroke();
Syntax
context.quadraticCurveTo(cpx,cpy,x,y);
Parameter Value
Parameter | Description |
---|---|
cpx | The x-coordinate of the Bezier control point. |
cpy | The y-coordinate of the Bezier control point. |
x | The x-coordinate of the endpoint. |
y | The y-coordinate of the endpoint. |
Browser Support
The numbers in the table indicate the first browser version that fully supports this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.