<!DOCTYPE HTML>
<html>
<body>
<canvas id="myCanvas" width="800" height="500" style="border:3px solid #FFFF00;"></canvas>
<!--Setting of size of Canvas-->
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.strokeStyle = 'red';
<!--Setting of color of arc-->
var x = canvas.width / 2;<!--center of x axis-->
var y = canvas.height / 2;<!--center of y axis-->
context.beginPath();
context.moveTo(x-100, y-100);
context.quadraticCurveTo(x-100, y+100, x+200, y-200);
context.lineWidth = 10;
context.strokeStyle = 'green';
context.stroke();
context.lineWidth = 2;
context.moveTo(x-100, y-100);
context.lineTo(x-100,y+100);
context.moveTo(x-100, y+100);
context.lineTo(x+200,y-200);
context.moveTo(x+200, y-200);
context.lineTo(x-100,y-100);
context.stroke();<!--for the drawing of line stroke is required-->
context.font = "20px Arial";
context.fillText("(x-100,y-100)",x-160,y-110);
context.fillText("(x-100,y+100)",x-160,y+120);
context.fillText("(x+200,y-200)",x+150,y-210);
context.font = "30px Arial";
context.fillText("moveTo(x-100,y-100)",x-310,y+170);
context.fillText("quadraticCurveTo(x-100, y+100, x+200, y-200)",x-310,y+210);
</script>
</body>
</html>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.