+ 7
How do I make circles in JavaScript; like how we make squares and rectangles.
I want circles as output, but I don't know how to create circles. I also want to know how to fill the circles with specific colour. Thanks!👍
6 Antworten
+ 3
You can find out how to draw a circle by going through the HTML course.
https://www.sololearn.com/learn/HTML/2200/?ref=app
https://www.sololearn.com/learn/HTML/2201/?ref=app
+ 7
Thank you very much Maxi Boxi ^_^, estifanos tekiea, and special thanks to LKH.
Thank you guys!☺👌
+ 6
fillstyle("red") to fill the shape by red color
beginpath() to begin the path of the circle
arc(x axis ,y axis ,radius , start ,stop)
draw the circle
fill() fill the shape by the color mentioned at the top
here is the circle only
https://code.sololearn.com/WQ2yfto6hFQw/?ref=app
+ 5
https://code.sololearn.com/WVBfWRAu48iA/?ref=app
+ 4
<body>
<canvas id="myCanvas" width="500" height="500"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.arc(200, 100, 80, 0, 2 * Math.PI);
context.fillStyle = 'blue';
context.fill();
context.lineWidth = 6;
context.strokeStyle = '#aaa';
context.stroke();
</script>
</body>
+ 4
Guys I didn't understand how to make circles. Can you explain please? I only want to make a small red circle. Please help.