Define your own functions
5.1: Function Basics - p5.js Tutorial
Code for Video
Make your own functions for:
- modularity = Organize your code!
Make variable containers: name/value pairs
Make ball functions for: move, bounce, display
Pick function names that make sense and describe what they do.
Pick function names that are NOT already used in p5js (for example, do NOT make a function called "ellipse". One already exists!)
In next video:
- reusability = don't copy/paste code; write functions
Code for Video
Make your own functions for:
- modularity = Organize your code!
Make variable containers: name/value pairs
Make ball functions for: move, bounce, display
Pick function names that make sense and describe what they do.
Pick function names that are NOT already used in p5js (for example, do NOT make a function called "ellipse". One already exists!)
In next video:
- reusability = don't copy/paste code; write functions