[6-7] - calculate the coordinates of the center point of the Canvas
[9-14] - a function that draws a circle.
Because we will be drawing multiple circles and certain parts of code (beginning and ending the path, setting the color etc.) are the same for each circle, we can create a function that can be called by the main program.
The main program will pass the following parameters of the circle to the function:
- the y coordinate (we don't need the x coordinate because it is always in the center of the Canvas)
- radius of the circle
- fill color
[15-24] The main program:
[16] the main white circle
[17-20] black half-circle
[21] medium white circle
[22] medium black circle
[23] small black circle
[24] small white circle
And finally, a live Canvas and code you can execute and experiment with: