One, component settings 1, Brush color options
Select 3 button, then rename to Red, yellow, green three colors, and then set the corresponding properties.
Here's a question of how to put it in one line.
Put 3 buttons in this box and you can turn into one line.
2. Canvas settings
Choose this tool, change the properties, put the picture you like, set the initial brush color to red.
3, Function button settings.
Follow the 4 buttons on this chart.
4. Display information
Put 2 labels on it, set title.
Second, block programming 1, global variable settings
Select Block in the box, and then change the name to Dotsize, setting the initial value to 2.
2. Canvas Logic Programming
(1) Draw points
Add this tool, then there are x,y,touchedanysprite three properties, you can choose to extract, or assign to other variables. The method is to hover over the mouse.
Add the tool into the touched and assign the X,y,radius with the existing variable.
This logic is done.
(2) Draw line
The same way, the block is still found in the canvas to be added.
To explain here, dragged is the point of movement when grabbing a touch, but only the beginning, the point of the last moment, and the current moment of the store.
In this way, we can use line segments to fit the line, and the screen pixel point is very small, the curve looks very smooth on the macroscopic.
3. Settings for brush options.
When clicked, set the brush color and label.
Other colors are the same.
4. Function button Setting
(1) Adjust the radius of the drawing point, adjust the radius of the dot
When clicked, set the dot radius and label.
(2) Camera function button setting
First add the click Function, then select Block in the camera, one is to open the photo
The other is to do the processing after the camera is opened.
In which to add the action to be done, here is the background change.
5. Clear the button settings
Find the empty button from the canvas.
Third, the finished product is as follows
Appinventor Study Notes (iii)--Paint bucket application Learning