What are processing and p5.js?
Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.
Getting familiar with the building blocks
The first step is to learn the basics of coding in processing and p5.js. I would recommend you to first learn to process and then move on to p5.js. There is a lot of documentation and tutorials out there but my favorite are the ones by Daniel Shiffman on his popular youtube channel called the Coding Train.
Once you have the basics covered it’s time to apply the concepts and have some fun! Here are a few examples I made using processings:
- Mouse Tracker — The width of the tracker is directly proportional to the speed of the mouse’s movement. It uses the basic formula of distance with the x and y calculated by subtracting the mouse’s previous coordinates from its new ones.
- Disco Lights — The squares display random colors of the small squares which are controlled via a nested loop.
- Catch me if you can — The ball will respawn to a new location as your mouse pointer is in the vicinity of the radius of the ball from its center in any direction.
- Gravity bounce — The square is falling due to gravity and a damping coefficient.
- Bubbles fizz — They are a simulation of the bubbles in a liquid. The smaller the bubbles the slower they move and also have a random zig-zag motion.
I also did some playing around with p5.js and here are a few interesting animations:
- Solar system — It’s a 2D representation of the solar system. For the purpose of making it appealing, I made the bigger planets travel slower than the smaller ones.
- Tango Waves — This is a simple representation of vibrating particles with different amplitudes and phases of each wave.
- Personal Genie — It is a simple text generator made using an array of predefined elements. It changes its copy with the click of the mouse.
- Chaos — This is a random balls simulator with reflective bounding walls. The initial direction and the size of the balls are random and the reflection adds to the chaos.
After doing a bit of practice I made a user-centric project for my college called outfit tracker, using p5.js! It was basically a filtering system that recommends an outfit based on your preferences. You can read about the project here.
Thanks for your time, I hope you enjoyed reading!