How do you create a button that makes circles on a canvas?

image
image
image

so where do you get the value of centerX and centerY? last touch on the canvas? then save them in global variables when touched.

Perhaps you mean for the Circles Button to switch the Touch Event between dots and circles?

This draws squares of random sizes wherever you touch a Canvas.

You can do something similar using DrawCircle
Like:

You got the correct idea, you just did not use a Canvas.Touch... object EventHandler. :cry:

blocks

  • beaten to it by ABG and SteveJG :upside_down_face:

Yes that is what I want

So if you want to switch the Touch event between drawing dots and circkes using a Button, you need a place to remember what you will want to draw on the next Touch event, a dot or a circle.

A riddle for you:
What do you get when you draw a circle with radius = 1?

Answer: A dot.

So keep a global variable with the radius you want for the circle you draw on a Touch event, originally 1.
When you Click the button to switch to circles, change the radius variable to 15 (or whatever radius you like for circles.)
You can use another Button to switch the radius variable back to 1.

Be sure to use that Draw Circle block using the new radius variable.

2 Likes