This app uses a canvas component to allow the user to draw dots or lines on an image of a cat. The app features 4 buttons. 3 of the buttons have different colors and change the color of the dots or the lines. The last button wipes everything off of the canvas. The colors available are red, blue, and green. This app allows user's to express their creativity in many ways.
Reflections
1. Explain the meaning of the statements shown here, both in pseudocode and App Inventor. For example, suppose the variableX has the value 10 before the statement is executed. What value would it have after the statement is executed. Set X to X + 1. The statement means that the global value for x is set to the value of x plus 1. If x was equal to 10 before the statement was executed, x would become equal to 11 after the statement is executed, and will stay 11 until it is set to a different value.
2. One aspect of abstraction is that it helps to reduce details to focus on what's relevant. How does the use of a variable, such as dotsize, instead of a value, such as '5', help to reduce detail and focus on what is essential in this program? Using a variable instead of a value gives the user more freedom when using the app. It allows them to choose the size of the dots or lines, this allows them to express themselves, which is an important aspect in an app like this. The app's main purpose is for people to doodle on picture of cat, so it is important to allow people to have many different ways to do so.
Coding The app uses 7 event handlers, along with one line of code that initializes a global variable ("dotsize"). The first 3 event handlers can be triggered whenever one of the three colored buttons at the top of the screen are clicked. The buttons determine what color dots or lines will be drawn on the canvas. The fourth event handler is triggered when the canvas is tapped. It will place a dot on the exact x and y location that is tapped. The size of that dot is determined by the global variable ("dotsize"). The fifth event handler is triggered by dragging on the canvas. It will draw what seems like one free-form line, but instead makes a lot of tiny, combined lines. The lines are made from the previously touched x and y coordinate to the current x and y location. The fifth event handler is quite simple, when the Wipe_Button is clicked, the canvas gets cleared. The next block initializes the variable "dotsize" to 6. When the app is started it will set the global variable to the value 6. The sixth event handler controls the Plus_Button. When the button is clicked, the global variable is set to the value of "dotsize" plus 1. Also, the label is changed to whatever the current value of the "dotsize" is. The final event handler has the same function and the sixth event handler, but does one thing differently, rather than adding one to "dotsize" value, it subtracts 1 from the "dotsize" value.