Link to sketch: LINK
For Week 5’s assignment, I wanted to practice using some new functions in p5 that I’ve seen in some classmates’ projects: modular functions, sliders, preloading images, etc). This ended up shaping my end result more than any creative idea itself. A lot of the coding work I did this round was unplanned and through experimentation. It was fun to work this way for a change, but I do think the end result would be stronger with more concept work and planning.
I grabbed a portion of this code from my previous retro tv assignment.
When trying to create a repeating design using for loops, I found it more challenging than expected. It was more so the math part that was difficult than finding the corresponding code for it. I racked my brain for anything I could remember from high school calculus BC… but my brain was empty. I officially have lost that knowledge. The distance code was a math calculation that I have forgotten and found in a p5 sample code online. I experimented with using distance to create an interactive design, but didn’t end up integrating it into my final work. Instead, I played with sliders.
I was drawn to how the design looked rotated. However, it was rotating across 0,0. I wanted to center the design so it would create a spiral around the middle. I did this by using push() and pop(). I also loaded up a background space image using preload() in setup().
The slider would change the scale of the spiral as it rotates. I thought it would be interesting to have it so that every time you clicked, a star would be left behind as part of the night sky. This would also make good use of my newClick() function.
Hooray for math calculations found online done by someone who is not me. If I didn’t find this code online, I likely would have settled with a circle or a quad.
It was a bit tricky to get the starStack array to work. I’ve done nested arrays before, but not in Javascript. I wasn’t sure exactly what properties and functions arrays had in Javascript. I kept a clickCounter to keep track of how long the array was. It took a bit of time to make sure the array was never called upon when empty and to make sure that the loop referencing the array’s components never referred to a null object. Once it worked out, it worked out well!
One of many end results: