ASSIGNMENT #3 - CONDITIONALS & LOOPS

For this two person assignment I worked with Shivani to create an animated sketch using repetition and a slider.

We worked on separate sketches then met and merged them by using Shivani’s sketch and the slider from mine.

Here is my initial sketch: https://editor.p5js.org/aileenstanziola/sketches/SJF4XSrKm

Screen Shot 2018-09-27 at 11.33.14 AM.png

The first issue I encountered was not being able to have the variation of color on my grid every other square and not every other row. With help from Mithru and Seho, I did an if/else function using the % component. Every square was separated by 50pixels meaning they were all divisible by 100 so I applied it like this:

if(x % 100) {

fill(b, 0, 255);

} else {

fill(0, 0, 0);

}

Then I started working on the slider. I struggled with the dragging aspect of it. Initially I had used the x variable too many times and that was the reason why it wasn’t working. I changed the x variable under the slider to SliderX instead and it worked (I was made aware of this by Mithru otherwise I wouldn’t have seen it!).

I then met with Shivani and we merged the two. And this is the final sketch: https://editor.p5js.org/aileenstanziola/sketches/SJnGqF5FX

Screen Shot 2018-09-27 at 12.51.12 PM.png

P.S. Some cool mistakes happened like this one when the background was drawn in setup and not draw.

Link: https://editor.p5js.org/aileenstanziola/sketches/HyUL2D9YX

Screen Shot 2018-09-27 at 10.44.01 AM.png