Getting S shape with Beizer curve on canvas in HTML
by TheIndependentAquarius from LinuxQuestions.org on (#5A87M)
Code:<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="300" height="400" 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();
ctx.moveTo(20, 20);
ctx.bezierCurveTo(30, 100, 200, 100, 200, 200);
ctx.stroke();
</script>
</body>
</html>This code results in a S shaped Beizer curve as shown in the attached
picture.
See this link: https://www.w3schools.com/code/tryit...e=GKLMRIJ4EWO7
My problem is that I want to change the start and end control points
as per my wish but at the same time I want that S shape to be there.
I have observed whenever I change the control points, the overall
shape of the curve becomes strange.
What is the way out?
Attached Thumbnails


<html>
<body>
<canvas id="myCanvas" width="300" height="400" 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();
ctx.moveTo(20, 20);
ctx.bezierCurveTo(30, 100, 200, 100, 200, 200);
ctx.stroke();
</script>
</body>
</html>This code results in a S shaped Beizer curve as shown in the attached
picture.
See this link: https://www.w3schools.com/code/tryit...e=GKLMRIJ4EWO7
My problem is that I want to change the start and end control points
as per my wish but at the same time I want that S shape to be there.
I have observed whenever I change the control points, the overall
shape of the curve becomes strange.
What is the way out?
Attached Thumbnails