Article 5A87M Getting S shape with Beizer curve on canvas in HTML

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 Thumbnailsattachment.php?attachmentid=34554&stc=1& latest?d=yIl2AUoC8zA latest?i=R6gEswnCKFo:8ED7U4UoB9o:F7zBnMy latest?i=R6gEswnCKFo:8ED7U4UoB9o:V_sGLiP latest?d=qj6IDK7rITs latest?i=R6gEswnCKFo:8ED7U4UoB9o:gIN9vFwR6gEswnCKFo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments