• Gabriella Garcia

ICM Week 5: Array of light

This week I'm blogging first and fixing later; I really want to understand arrays and feel like I need to start this week's assign over because I strayed into unknown territory before locking the task at hand down. My biggest syntax issue at the moment is seeing the "bigger picture" from the outset of creating a sketch, so in this case trying to figure out how to define a class and the necessary variables/arrays before I know exactly how I'm going to use them trips me up from the outset. I feel like it's on the tip of my tongue though...

I started fairly simply, just to get the basics of classes, constructor arguments, and arrays. I took Shiffman's prompt in 6.3 to reconstruct the code with my own idea, so I made a class called StringTheory, and an array "let knots = [];" that could be used in a for loop. I'm having trouble here understanding why the for loop has to happen in both set up and draw functions. But resulting starting point is here (stroke is random when sketch is run):

code: https://editor.p5js.org/medusamachina/sketches/B1W7ta29m

oRelatively simple start, but pretty and inspiring. Here I wanted to expand on using the array to make the lines move, but first wanted to figure out if it was possible. I first went through different rotate transformations, and the scattering random lines suddenly reminded me of colors coming out of a projector, so I altered the class to make point of origin to (0,0), added rotation, and changed the number of increased and that's where I understood the beauty of having a class to quickly alter the look... but not sure how it differs from a function...

code: https://editor.p5js.org/medusamachina/sketches/B1XEpTh97

This is the point where I split from the path before fully feeling out the functionality of an array. I wanted to add some mouse interactivity here, but instead of using what I already had, I thought, hey, let's run with this late 80s/early 90s techno holograph vibe and try adding a third dimension. Since I was already working with rotate, I thought it would be cool to add a 3D object that appears when mousePressed, with some cool rotation? So I learned about WEBGL and it broke everything and I spent the rest of my evening (does 3am count as evening?) trying to force something to work that I'm not even sure p5 is capable of (repeated clicking of mouse shows what I was hoping it would do with 'function mousePressed'):

code: https://editor.p5js.org/medusamachina/sketches/r1bhEAh9X

Aaaand this is where I gave up:

code: https://editor.p5js.org/medusamachina/sketches/BJzYI03c7