2.1: Variables in p5.js (mouseX, mouseY) - p5.js Tutorial

2.1: Variables in p5.js (mouseX, mouseY) - p5.js Tutorial

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=7A5tKW9HGoM



Duration: 10:41
83,515 views
1,607


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