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

5. Conditional Statements and Comparison Operators

Engin Arslan1 
Toronto, Ontario, Canada

In the previous chapter, we saw some of the variables that p5.js makes available for us. One important thing to note is that these variables can only be used from inside the p5.js functions setup and draw. If we were to try to use them outside these functions, we would get an error saying that they are not declared.

In this chapter we’ll look at another useful variable that p5.js makes available for us: frameCount. We will also learn about frames and frameRate function.

frameCount, frameRate, and frame

Remember how we defined a count function in ...

Get Learn JavaScript with p5.js: Coding for Visual Learners now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.