Creating cubic Bezier curves
<!DOCTYPE html> <html> <head> <title>Pushing canvas further</title> <meta charset="utf-8"> /* www.j a v a 2s . c o 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"); context.lineWidth = 5; context.beginPath(); context.moveTo(50, 50); context.bezierCurveTo(150, 50, 350, 450, 450, 250); context.stroke(); }); </script> </head> <body> <canvas id="myCanvas" width="500" height="500"> <!-- Insert fallback content here --> </canvas> </body> </html>
The bezierCurveTo function takes six arguments: