Week 2 Generative Art Post Zere

    • My concept of this week’s generative art task is an apartment building in a big city. Using the “random” function, I made the windows show different colors each time the mouse is clicked, reflecting that each resident has different stories happening to them every day.
    • I came about this idea when experimenting with functions and watching YouTube tutorials for gen. art.  . YouTuber Patt Vira created a tutorial on random smiley faces generative art, and the changing colors reminded me of lights reflected in people’s windows at night. I chose Starry Night by Vincent Van Gogh as the background. I saw the original painting at MoMA in NYC, and I was reminded of New York when creating this piece of work, which is why I chose this painting as the background.
    • Piece of code that I am proud of: the changing of the window’s colors. There’s a dynamic change in art, as well as loops used, that prevented me from creating each rectangle manually.
    • Embedded sketch:

  • let bg;
    
    function preload() {
      bg = loadImage("starrynight.jpg");
    }
    
    function setup() {
      createCanvas(400, 400);
      noLoop();
    }
    
    function draw() {
      // Starry Night background
      image(bg, 0, 0, width, height);
    
      // Building
      fill(51, 0, 0);
      noStroke();
      rect(10, 20, 300, 390);
    
      // Door
      fill(255);
      rect(135, 300, 60, 90);
      //Doorknob
     stroke(0);
      strokeWeight(2);
      circle(190,345,10)
      // Windows
      stroke(0);
      strokeWeight(2);
    
      for (let y = 40; y < 260; y += 60) {
        for (let x = 40; x < 280; x += 60) {
          fill(random(200), random(200), random(200));
          rect(x, y, 40, 40);
        }
      }
    }
    
    function mousePressed() {
      redraw();
    }
    
    

     

  • Reflection and ideas for future work or improvements: I’m proud of this sketch because it creates a colorful grid of windows that changes every time you click, making it interactive and fun. In the future, I’d like to make the colors change gradually or add more shapes to make it even more dynamic.

Leave a Reply