The map() Function
Code! Programming with p5.js Lesson #2.5
This video covers the map() function in p5.js – how to take a value from a given range and map it to a new range.
Topics
- 0:00 - Hello! Let's talk about the map function.
- 0:32 - Let's start with an example.
- 3:03 - Trying to change the range of mouseX without map().
- 4:17 - That sort of worked, but what about other scenarios?
- 5:12 - Let's see if I can explain how to use map().
- 7:44 - How about we try it out!
- 8:27 - Let's have some fun with map()!
- 9:39 - How could you take this farther?
Community Contributions
- Moving objects by Godeta (Source Code)
- Moving objects - digital segment numbers by Serup (Source Code)
- pixel to cm converter 0.01 version by Laszlo Nesztorov (Source Code)
- Doodler with Color Options by Kartikey Singh (Source Code)
- Growing circle and changing colours by Abukar Abukar (Source Code)
- Suck in this green hallway by Heinrich XIAO (Source Code)
- Moving ball animation by Or Shemesh (Source Code)
- Growing Circle by MarcuOrSomething (Source Code)
You can also add your own version! (See how)