Javascript examples for Canvas Reference:quadraticCurveTo
The quadraticCurveTo() method adds control points that represent a quadratic Bezier curve.
context.quadraticCurveTo(a, b, x, y);
Parameter | Description |
---|---|
a | The x-coordinate of the Bezier control point |
b | The y-coordinate of the Bezier control point |
x | The x-coordinate of the ending point |
y | The y-coordinate of the ending point |
Draw a quadratic Bezier curve:
JavaScript:
<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="300" height="250" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath();/* w w w .j a v a 2s . c om*/ ctx.moveTo(20, 20); ctx.quadraticCurveTo(24, 100, 200, 20); ctx.stroke(); </script> </body> </html>