
2.1: Variables in p5.js (mouseX, mouseY) - p5.js Tutorial
In this video, I introduce the concept of variables! The setup() and draw() functions are covered along with mouseX and mouseY in p5.js. Code: https://thecodingtrain.com/tracks/code-programming-with-p5-js/code/2-variables/1-mouseX-mouseY
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/IeblvUQrf
π₯ Previous video: https://youtu.be/xJcrPJuem5Q?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π₯ Next video: https://youtu.be/dRhXIIFp-ys?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
References:
πΎ mouseX: https://p5js.org/reference/#/p5/mouseX
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!
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://discord.gg/hPuGy2g
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#mouseinteraction #basics #variables #p5js #javascript