How to use Canvas Bezier Curve in HTML5
In this article I am going to explain about Canvas Bezier Curve in Html5.
Canvas Bezier Curve in Html5
The Bezier Curve is an canvas tool. That is mainly use for defined context point, Two control point and ending point of an element. For its use bezierCurveTo() Method within Style tag in Html document. Bezier Curve provide Two Control point by which we can design more complex curve.
Syntax
<script>
context.bezierCurveTo(controlX1, controlY1, controlX2, controlY2, endX, endY);
</script>
|
Example
<html>
<head>
<style>
body
{
margin: 0px;
padding: 0px;
}
</style>
<script>
window.onload = function () {
var cvs = document.getElementById("cnvs");
var cntx = cvs.getContext("2d");
cntx.beginPath();
cntx.moveTo(188, 130);
cntx.bezierCurveTo(140, 10, 388, 10, 388, 170);
cntx.lineWidth = 10;
cntx.strokeStyle = "brown";
cntx.stroke();
};
</script>
</head>
<body>
<canvas id="cnvs" width="500" height="150"></canvas>
</body>
</html>
|
Output

Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here