This week we had to create a sketch from patterns and loops, I am still getting to grips with the concept of creative coding so these exercises are proving to be a challenge. I am learning slowly to understand what is going on as I create a sketch.
I decided to create a pattern that consisted of multiple layers of flashing colors on top of each other. It is inspired by my time spent in Huaqiangbei in Shenzhen in China. This area is the biggest electronics market in the world and as you wander around these markets you see hundreds of thousands if not millions of LEDs all flashing on and off!
https://editor.p5js.org/Joycey210/sketches/0ZXpXoo1j
I think my biggest issues with executing code is trying to figure out variables. I get confused about logic quite frequently and regularly have to refer back to videos and tutorials.
With more time using P5.js I am confident some more of the problems I have will become less frequent! I have to do more of the challenges.
Hi Noel, I see so many buttons and LEDs! Is it overwhelming to be surrounded by the real thing? Off centering and flashing the LEDs gives me a sense of what could be the chaos of Huaqiangbei.
I see there is a nested loop nested inside a nested loop that is nested in another nested loop. With just one nested loop we have a double the amount of iterations. Embedding additional nested loops exponentially increases the amount running in one go and can drastically slow the frame rate of the sketch ( console.log(frameRate()); to check the rate). Mentioning it here because sometimes a low frame rate can be an issue if you have other aspects of your sketch that rely on a faster rate for smooth animation. And sometimes doing this many calculations can crash the browser.
One thing you might look into is moving the second rect into the nested loop of the first rect. Since both loops create a grid with the same resolution, everything will line up the same way. Try also decoupling the nested loop of ellipses and see how that impacts the frame rate. Let me know how it goes!
Also, it’s great to hear that working through the regular exercises is helping your understanding.
LikeLike