week 3: generative glitch art

This week, we were tasked with making object-oriented generative artwork.

My idea was to make random colored rectangles appear at random places on screen, with the subtract blend mode on, so that when they overlap other colors show and create a ‘glitch’ effect.
I picked the subtract blend mode because I liked the way it looked :]

It should be slightly similar to this, but imagine squares on a white background instead ..

5 Artists Who Are Masters of Glitch Music

So I started working on my code. I made a class in a separate tab, and started making variables.

I made 3 functions; one for the red rectangle, one for the green, and one for the blue. I also made separate variables for each one rect.

Now I had my class, and I had my setup ready. I made a new object from my class and called the functions in void draw. Now, 3 rectangles of different sizes appeared on screen! It looked like this:

But then (with the help of professor & discord) I scrapped those 3 functions and made just one, with a for loop indicating how many rects should appear on screen. I made it so that 20 rects appear at once, and whenever you click the screen with your mouse, 20 more will appear. Also, their size and color is always random.

In the video, I experimented with both subtract and add blend modes , with white and black backgrounds, respectively.

Here’s the video!

https://youtu.be/xblMmu3f42w

Code:

--------class----------
class Rects {

  float sizeWR = random(20, 200) ;
  float sizeHR = random(20, 200);


  void drawRect(color col) {
    fill(col);
    rect(random(width), random(height), sizeWR, sizeHR );
  }

}

--------main tab----------

Rects rec;

//Rects [] rec2= new Rects [5];

void setup (){
size(600,600);
rectMode(CENTER);

//background(0);
//blendMode(ADD);
// for the black bg ^
background(255);
blendMode(SUBTRACT);
//for the white bg
rec = new Rects();
 

}


 void draw(){
   for (int i=0; i<20; i++){
     rec.drawRect(color(random(255),random(255),random(255)));
   }
   
   noLoop();




 }
 
 void mousePressed(){
  loop(); 
 }
  

  


 

 

 

simple work of art

This week’s assignment was to make a simple work of art using loops.

I wanted to create a piece that looked like fish swimming in a pond, and the time of day changes (the color of the water shows this) when you click the ‘d’ key (d for daytime).

It doesn’t stay that way unless you keep the key pressed though.

PROCESS:

I started my code with the base sketch, and I set the size and frame rate in void setup.

In void draw, I started by setting the background color, stroke and creating a float variable col.

The col variable is a random number from 100-255. I use this later for the color of the fishes in the pond.

Next, I added the code for the ‘d’ key. When the d key is pressed, the background color changes to a lighter one, making it look like daytime.

Next, I made a for loop for the water ripples. I set an int I to zero, and it keeps increasing by one when i<100. I set the stroke of this to :
stroke(40,106,245,col)
which is a blue color, but the transparency changes to make it look like light it reflecting on the surface of the water.

Next were the fishes. I changed the fill here to:
fill(col,col-50,col-70,150)
so that the color is a random orangey-red color.

I made another for loop for the fishes, made more float variables to make random x and y values, then I made ellipses for the fish.

And that’s it! TA-DA!

CODE:

void setup(){
  size(640,480);
  frameRate(3);
}

void draw(){
  background (59,58,152);
  stroke(10);
     float col = random(100,255);
     // gives a random color 
 
    if (keyPressed && key == 'd') {
      background(152, 208, 255);  
      fill(col,col); 
    stroke(255,col);
    //else fill(col,col,0,150);
    
    // if you press the 'd' key (d= daytime) the colors change to make it look
    //like the sky during the day. 
  }
 
  for( int i = 0; i< 100; i= i+1 ) { 
 noFill();
 stroke(40,106,245,col);
 // added col here to make it look like the water is reflecting
    ellipse(width/2, height/2, i*10, i*10);
  }
  // this makes the ripple effect thing
  fill(col,col-50,col-70,150);
  //so that the color is a random orangey-red color 
  noStroke();
  for( int i = 0; i< 600; i= i+10 ) { 
   // rectMode(CENTER);
    float x = random(width);
    float y = random(height);
 
   ellipse(x,y, 25,10);
     //triangle(x,y,x,y,x,y); (triangles look more like fishes but it doesnt work properly so.. circles it is)
  
  }

}

 

week 1: self portrait

This week’s assignment was to make a self portrait on processing. For my self portrait, I went with an emoji-type of style. (It’s more of a smiley face than a portrait, honestly)

I started by making a circle for the face , with a skin color fill. Then, I made the eyes , irises and highlights with circle().

I used a rectangle with rounded edges and an arc for the hair. (I was confused with the arc and would’ve liked it to look differently, but it’s okay)

I used ellipse() for the ears and earrings, and I made a variable (space) for the ear spacing.

I made the smile with arc().

I used different fill colors using the color selector, and  I tried different strokes.

I wanted to add triangles or lines for eyelashes, but I couldn’t figure out how to place them so I scrapped that idea.

(This is the final product! 


not a super accurate representation of me, but it’ll work.

CODE:

(ill just paste it here)

size(480, 480);
background(214, 244, 255);
int space = 180;

fill(57, 37, 37);
rectMode(CENTER);
rect(width/2, height/2, 380, 390, 120, 120, 12, 18);
//arc(width/2, 60, 100, 75, 0, PI, PIE);
//hair (long part)
fill(240, 216, 184);
noStroke();
circle(width/2, height/2, 350);
//face
ellipse(width/2-space, height/2-20, 40,60);
ellipse(width/2+space, height/2-20, 40,60);
//ears
fill(57,37,37);
ellipse(width/2-space, height/2, 10,10);
ellipse(width/2+space, height/2, 10,10);
//earrings
stroke(100);
fill(255);
circle(width/2-60, height/2-50, 80);
circle(width/2+60, height/2-50, 80);
//eyes
stroke(180);
fill(116, 75, 48);
circle(width/2-60, height/2-40, 50);
circle(width/2+60, height/2-40, 50);
//eye color
fill(255);
circle(width/2-70, height/2-50, 10);
circle(width/2+50, height/2-50, 10);
//eye highlight
fill(232, 140, 168);
arc(240, 280, width/4+50, height/4+50, 0, PI, CHORD);
//smile
fill(57, 37, 37);
noStroke();
arc(width/2, 60, 280, 220, 0, PI, PIE);
//bangs
stroke(0);
fill(57, 37, 37);
//hair