Question: Write a Processing program that allows the user to toggle between pictures of a surprised face and an angry face. When your program starts, it

Write a Processing program that allows the user to toggle between pictures of a surprised face and an angry face. When your program starts, it should display a picture of a surprised face. Whenever the user clicks the mouse, it should display and angry face (if an angry face was already displayed, well then it should keep displaying an angry face). Whenever the user presses any key, it should display a surprised face (again, regardless of whether a surprised face was already being displayed). In this way, the user can toggle back and forth between the pictures of the two faces as many times as they like.
To achieve this, and practice using functions in a useful way, you should define a function called draw_face (), with the following 6 parameters:
r_face, g_face, b_face: 3 integers, representing RGB color values for the face's colour
r_brows, g_brows, b_brows: 3 integers, representing RGB color values for the face's eyebrows
Whenever you need to draw either of the faces, your code should call this function. Don't create a different function for each face, simply call this one with different values for the arguments. (hint: If you don't want the eyebrows to be visible, what color should they be in relation to the face colour?)
Your pictures of the two faces need not look exactly like the sample, but you should make a reasonable attempt at aesthetic appeal.
Hint: You may find the strokeWeight () function useful to draws lines of different thickness.
Figure 1: Picture of surprised face (left) and angry face (right)
 Write a Processing program that allows the user to toggle between

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!