Use an if-statement to close the eyes of your emoji while the mouse-button is pressed. To check the state of the mouse-button inside the draw function you can use the variable mouseIsPressed
from p5.js. It is a bool that is true
when the button is pressed and false
if not.
10: Exercise - Close the eyes
This post is licensed under CC BY 4.0 by the author.