We can draw Bezier curve with either quadraticCurveTo, or bezierCurveTo.
quadraticCurveTo draws a quadratic Bezier curve, while bezierCurveTo draws a cubic Bezier curve.
Both kinds of Bezier curve use control points to manipulate a straight line into a curve.
A quadratic Bezier curve has one control point and you have only one curve along the line.
A cubic Bezier curve has two controls points and you have two curves along a single line.
<!DOCTYPE html> <html> <head> <title>Pushing canvas further</title> <meta charset="utf-8"> /* w w w .j a va2 s .co 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() { let canvas = $("#myCanvas"); let 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>