O'Reilly logo

Learn JavaScript with p5.js: Coding for Visual Learners by Engin Arslan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Engin Arslan 2018
Engin ArslanLearn JavaScript with p5.jshttps://doi.org/10.1007/978-1-4842-3426-6_6

6. More p5.js Variables

Engin Arslan
(1)
Toronto, Ontario, Canada
 
In the previous chapter, we learned about the p5.js frameCount variable that provides us with a number that represents the number of times the draw function is called. There are a bunch of other highly useful variables that we could be using in p5.js. We will learn a few more in this chapter.

mouseIsPressed

mouseIsPressed is the first p5.js variable that we will see that allows us to add some interactivity to our programs. mouseIsPressed is a p5.js variable that assumes the value true when the mouse is clicked on the canvas area and false for every other time. Let’s alter one of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required