This site requires JavaScript, please enable it in your browser!
Greenfoot back
lvl30dragon
lvl30dragon wrote ...

2024/5/2

How do I draw a circle?

lvl30dragon lvl30dragon

2024/5/2

#
I'm trying to draw a circle that increases in size with the middle always being the center of the screen, and then decreases in size by "erasing" the outer circle and then drawing an inner circle. However afaik building a circle using the drawOval method doesn't draw the circle from the center but the bottom left or upper left. how do I do this?
danpost danpost

2024/5/2

#
lvl30dragon wrote...
I'm trying to draw a circle that increases in size with the middle always being the center of the screen, and then decreases in size by "erasing" the outer circle and then drawing an inner circle. However afaik building a circle using the drawOval method doesn't draw the circle from the center but the bottom left or upper left. how do I do this?
Just subtract half the size of the circle (the radius) from the x and y coordinates of the center. Use the results for the drawOval method call.
lvl30dragon lvl30dragon

2024/5/3

#
danpost wrote...
lvl30dragon wrote...
I'm trying to draw a circle that increases in size with the middle always being the center of the screen, and then decreases in size by "erasing" the outer circle and then drawing an inner circle. However afaik building a circle using the drawOval method doesn't draw the circle from the center but the bottom left or upper left. how do I do this?
Just subtract half the size of the circle (the radius) from the x and y coordinates of the center. Use the results for the drawOval method call.
That works. Thanks!
You need to login to post a reply.