In this video, I introduce the concept of variables! The setup() and draw() functions are covered along with mouseX and mouseY in p5.js.

Timestamps:
0:00 Introduction
0:35 What is program flow? How does it work in p5.js?
2:22 Let’s simplify!
3:16 What is a variable?
4:47 What’s happening here?
5:26 What could we do? Let’s make a simple painting program!
6:05 Let’s move background into setup. What do you think is gonna happen?
6:34 Why does that happen?
7:31 Let’s talk about events! We can add a mousePressed function.
8:41 Let’s add mousePressed and put background in it!
9:07 You might have this question. Why isn’t it flickering?
10:10 What can you try? Can’t wait to see what you create!

🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/s…

Links discussed in this video:
🔗 mouseX (p5.js Reference): https://p5js.org/reference/#/p5/mouseX

Subscribe: https://www.youtube.com/c/TheCodingTrain/featured

#js #javascript #p5js

Variables in p5.js (mouseX, mouseY) - p5.js Tutorial
2.60 GEEK