Week 2- Art loop

Concept:

For my art project, I wanted to try and incorporate some of the material we learnt from the previous assignment. So I tried to make an art project where a part of it is moving randomly and has random color, while the rest of it is still. I implemented this using for and while loops for the most of it.

When I started looking for inspirations, I tried to think of something that I like. So in the end I decided on doing a simple lighthouse because i like the beach:

Although I had a picture for inspiration I tried to make my drawing more vibrant and colorful to represent how the lighthouse lights up the whole beach:

Code highlight:

I used for loops to create the outlines for the red and white stripes in the lighthouse, where the arc decreases per a specific distance. And when it came to the lines in the background, i made the code so that it chooses a random color and strokeWeight from a specific range. I tried to make that using a while loop so that the background does not become overwhelming and continue forever, so i set it to run till a maximum frame.

if (currentFrames < maxFrames) {
    // draws lines while under maxFrames
    let i = 0;
    while (i < 5) {
      // random color with transparency
      stroke(random(150, 255), random(150, 255), random(150, 255), 150);
      strokeWeight(random(1, 3));

      let x1 = random(width);
      let y1 = random(height);
      let x2 = random(width);
      let y2 = random(height);

      line(x1, y1, x2, y2); // draw a random line

      i++; // increment loop counter
    }
    currentFrames++;
  } else {
    background(180, 220, 255); // reset the canvas
    currentFrames = 0; // restart the frame counter
  }

Reflection and future improvement:

At first I tried to make the waves move but I couldn’t figure out how to make it have that illusion of it going back and forth so instead I decided to keep it and make the whole painting more vibrant by making the outlines of all the shapes have random colors as well.




 

Leave a Reply