For this week’s Computational Media’s project, I worked with Lydia on using loops and custom buttons/switches. We both created a canvas using loops separately, then exchanged our code with each other and added our own button/slider to the other person’s code.
My first part of the assignment used loops to create a starry background. I also used the p5.js reference page for lerpColor here, to do a subtle blend of dark blue and a slight purple to give the background some dimension. I tried to keep my code simple and use pseudo code to explain my thought process into creating my sketch so when I gave it to Lydia, she would be able to understand what I was doing. Here is my first sketch.
The hardest part of this week’s assignment was taking someone else’s code and figuring out how to subtly change it. This week’s assignment took me a lot of time to figure out and a lot of frustration when I couldn’t figure out why my button wasn’t working. Lydia’s was more complicated than mine and there were a lot of different things going on (which made it really pretty to look at!) But it also made me understand the need for functions, which we learned about in this week’s videos. I tried my best to change her background color with the click of a button, but I do not think I did the sketch any justice. I see how adding functions, would have made the sketch easier to work with, especially when you are dealing with so many variables and trying to change them in certain circumstances (like pressing a button). The final product of Lydia’s sketch with my button addition can be seen here. Every time the button is clicked, a random background color comes up. It’s fun, but I think in the future, using functions will make everything easier when it comes to changing certain variables properly. I definitely struggled with implementing a button into the sketch that worked properly when the mouse clicked over it. It was hard getting the dimensions right and most of the time it was simply having too many “}”.
Leave a Reply