In Chapter 6, we learned about a p5.js variable called mouseIsPressed, which assumes the value to be true while the mouse is being pressed and false for all other instances.
We also learned that this is not a great way of capturing user input as the execution speed of the draw function can make it hard to get this variable updated in a reliable way. In this chapter we’ll review other ways of handling user input inside p5.js, namely, the events, which solve this problem. Using events, we can capture the user input outside the draw function loop.
There are numerous event functions in p5.js that ...