+ 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!👍

16th Jun 2018, 12:20 PM
Rahul Hemdev
Rahul Hemdev - avatar
6 odpowiedzi
+ 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
17th Jun 2018, 6:09 AM
Hanz
Hanz - avatar
+ 7
Thank you very much Maxi Boxi ^_^, estifanos tekiea, and special thanks to LKH. Thank you guys!☺👌
17th Jun 2018, 11:05 AM
Rahul Hemdev
Rahul Hemdev - avatar
+ 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
17th Jun 2018, 6:18 AM
estifanos
estifanos - avatar
+ 5
https://code.sololearn.com/WVBfWRAu48iA/?ref=app
16th Jun 2018, 4:09 PM
estifanos
estifanos - avatar
+ 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>
16th Jun 2018, 3:38 PM
Maxi Boxi ^_^
Maxi Boxi ^_^ - avatar
+ 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.
17th Jun 2018, 4:40 AM
Rahul Hemdev
Rahul Hemdev - avatar