Assignment 3

For this assignment I was inspired by Sol Lewitt’s work called Wall Drawings. I wanted to create an algorithm that connects multiple points together with lines similar to the artist’s work which asked people to draw points and join them together with straight lines.

I started off with figuring out how to put random points on the canvas but using classes and arrays. Then, I proceeded on to figure out how to connect them and get rid of the original points. And then I used some code that we saw in class and modified it a little according to my needs to make the points move. I also used the background opacity feature to create a mesmerizing artwork that become more and more hypnotic the more you click on it.

Sketch:

Problems and Potential Future work:

I want to create a further element of interactivity where the points (or lines) move away from the user’s mouse as it is hovered over the canvas. I tried doing it, but ran into confusion due to multiple things going on with the classes and arrays already.

 

let fiftyballs = []; //array for storing however many balls the user wants to create

let xPosition = []; //arrays for x and y position of each point the line begins from
let yPosition = [];
 
let x_Pos; //global variables to make it easy to store the x and y positions of the points
let y_Pos;

let R = 236;
let G = 238;
let B = 129;


let totalcount = 5; // variable for number of points to be created


class ballproducer {
  constructor() {
    
    this.xPos = random(10, width - 10);
    this.yPos = random(10, height - 10);
    
    x_Pos = this.xPos;
    y_Pos = this.yPos;
  
    this.xSpeed = random(-3,3);
    this.ySpeed = random(-3,3);
    
  }
  

  move() {
    // move the ball
    this.xPos += this.xSpeed;
    this.yPos += this.ySpeed;
    x_Pos = this.xPos;
    y_Pos = this.yPos;
  }
  


  checkForCollisions() {
    // check first for left and right wall
    if (this.xPos <= 15 || this.xPos >= width - 15) {
      this.xSpeed = -this.xSpeed;
    }

    // do the same for the ceiling and the floor
    if (this.yPos <= 15 || this.yPos >= height - 15) {
      this.ySpeed = -this.ySpeed;
    }
  }

  draw() {
    circle(this.xPos, this.yPos, 0);
  }
  

}


function setup() {
  createCanvas(600, 600);
  
  frameRate (60);
  
  for (let i = 0; i < totalcount; i++) {
   
    fiftyballs[i] = new ballproducer(); 
  
  }
  
  
}

function draw() {
  
   background(R, G , B  ,15);
    
  
  for (let i = 0; i < totalcount; i++) {
  
    
    xPosition[i] = x_Pos;
    yPosition[i] = y_Pos;
  
    fiftyballs[i].draw();
    fiftyballs[i].move();
    
    fiftyballs[i].checkForCollisions();
    
    line(xPosition[i], yPosition [i], xPosition[i-1], yPosition[i-1]); //draws the line from the previous to the next point
  
}
}

function mouseClicked(){ //each mouse click adds +1 lines to the graphic
  
  R =  random(140,237);
  G = random(160,238);
  B = random(129,237);
  
   
  fiftyballs[totalcount] = new ballproducer(); // adds a new value to the array which has the objects for the balls
  totalcount =  totalcount+1; //increases the number of points or lines by 1 on each click
}

 

Response to Video – Week 2

I think that the reading really challenged my idea of computer-generated art and how much meaning does it have. I didn’t associate much meaning to algorithmically generated art as I thought it’s just a bunch of code, but after seeing this lecture I find it to be way more meaningful. It is essentially a study of how randomness gives meaning to things in nature, as in nature we see things that follow certain rules, but with slight variation just like how Casey Reas mentions in his lecture.
I am also intrigued by the idea that the universe was all random and chaotic before a God or almighty power brought order to it, as Casey mentions in the beginning of the lecture. I want to relate it to the concept of entropy, which entails that the universe is constantly moving towards a state of randomness; it’s going toward chaos from a state of orderliness. If a certain part is cold and another hot, the laws of physics are making sure that it all becomes equal in temperature everywhere. My questions are:
Is the existence of life and current state of the universe the most likely state that the universe can be in? If entropy is a real thing, is the current state of the universe the most likely scenario, the most homogenous it can get? Or is it merely a stage in the process?

Assignment 2 – AakifR

Concept:
I wanted to use the Urdu word عشق or Ishq and create a fun pattern with it while also involving some level of animation in it. I created a function that would make the word and then I called it in the draw function to repeatedly draw the word on the canvas and create a repetitive pattern. I changed how the word looks each time it is called by using random(). If you want the animation to restart, you can click your mouse.

Highlight:
Not technically too exciting, but I’m kind of proud of creating the word عشق through programming. It was a slightly tedious process and I’m also interested in learning how to streamline that process.

Sketch:

Reflection:
I really wanted each عشق to rotate around a point, but it turned out that it was harder than I thought and it’s something I still need to figure out.

let angle = 0; 

function setup() {
  
  
  createCanvas(1200, 1200);
  background(250, 141, 141);
  
  // let's draw ishq
}
  
//   function executeishq(){
    
//    for (let xchange = 0; xchange < width; xchange = xchange +30){
//     for (let ychange = 0; ychange < height ; ychange = ychange +30){
    
//     noStroke();
//     fill(random(100,105),random(10,55),random(25,55));
//     rotate(random(1,90));
      
//   drawishq(xchange + random (1, 100),ychange + random(1,100), random(1,5));
//     }
// }

// }


function drawishq(xpos,ypos, size){ //the xpos, ypos change the position of ishq on screen
  
  //first letter
  
  
  square(16 + xpos,20 + ypos,size,2);
  square(22 + xpos,20 + ypos,size,2);
  square(28 + xpos,20 + ypos,size,2);
  square(34 + xpos,25 + ypos,size,2);
  square(16 + xpos,26 + ypos,size,2);
  square(16 + xpos,32 + ypos,size,2);
  square(16 + xpos,38 + ypos,size,2);
  square(22 + xpos,38 + ypos,size,2);
  square(28 + xpos,38 + ypos,size,2);
  square(34 + xpos,38 + ypos,size,2);
  square(40 + xpos,38 + ypos,size,2);
  square(10 + xpos,38 + ypos,size,2);
  square(4 + xpos,38 + ypos,size,2);
  
  
  //2nd letter
  
  square(-2 + xpos,38 + ypos,size,2);
  square(-2 + xpos,32 + ypos,size,2);
  square(-8 + xpos,38 + ypos,size,2);
  square(-14 + xpos,32 + ypos,size,2);
  square(-14 + xpos,38 + ypos,size,2);
  square(-20 + xpos,38 + ypos,size,2);
  square(-26 + xpos,38 + ypos,size,2);
  square(-26 + xpos,32 + ypos,size,2);
  square(-32 + xpos,38 + ypos,size,2);
  square(-38 + xpos,38 + ypos,size,2);
  
  //dots
  
  square(-14 + xpos,14 + ypos,size,2);
  square(-20 + xpos,20 + ypos,size,2);
  square(-8 + xpos,20 + ypos,size,2);
  
  //third letter
  
   square(-44 + xpos,38 + ypos,size,2);
   square(-50 + xpos,38 + ypos,size,2);
   square(-50 + xpos,32 + ypos,size,2);
   square(-50 + xpos,26 + ypos,size,2);
   square(-50 + xpos,20 + ypos,size,2);
   square(-56 + xpos,26 + ypos,size,2);
   square(-56 + xpos,20 + ypos,size,2);
   square(-50 + xpos,44 + ypos,size,2);
   square(-50 + xpos,50 + ypos,size,2);
   square(-50 + xpos,56 + ypos,size,2);
   square(-50 + xpos,62 + ypos,size,2);
   square(-56 + xpos,62 + ypos,size,2);
  square(-62 + xpos,62 + ypos,size,2);
  square(-68 + xpos,62 + ypos,size,2);
  square(-74 + xpos,62 + ypos,size,2);
  square(-80 + xpos,62 + ypos,size,2);
  square(-86 + xpos,62 + ypos,size,2);
  square(-92 + xpos,62 + ypos,size,2);
  square(-92 + xpos,56 + ypos,size,2);
  square(-92 + xpos,50 + ypos,size,2);
  square(-92 + xpos,44 + ypos,size,2);
  
  // dots
  square(-50 + xpos,8 + ypos,size,2);
  square(-62 + xpos,8 + ypos,size,2);
  
  
  
  
}

function draw() {
  
  rotate(angle); 
  
  
  drawishq(random(0,width),random(0,height),random(1,5));
 
  angle += radians(2);
  
  if(mouseIsPressed){
    background(250, 141, 141);
  }
  

  
  print(mouseX + "," + mouseY);

}

 

Assignment 1 – AakifR

For the first assignment, I wanted to create a character that represents me in some way. I used a simple pencil sketch to figure out which shapes go where and then started coding. The final sketch turned out to be different than what I originally planned for as the fluffy hair was quite difficult to achieve.

Highlight:

I think something that stood out to me was figuring out the semicircles by browsing the reference library. I think it gave my portrait more dimensionality instead of being all circles.

Future:

I think I would like to add some animations – like blinking eyes or moving mouth. Or some interactive elements where the user could change the portrait’s mood by clicking, or change the hat.

Code:

 

function setup() {
  createCanvas(600, 600);
  background(254, 226, 221);
  
   //body
  fill(10);
  rect(140, 460, 325, 250, 100);
  
  fill(255, 219, 172);
  
  ellipse(145, 293, 50, 50 ); //left ear
  ellipse(454, 290, 50, 50 ); // right ear
  
  arc(300, 240, 325, 450, 0, 3.14, [OPEN]);
  //ellipse(300, 300, 300, 400); // face
  
  fill(255);
  arc(230, 280, 60, 40, 0, 3.14, [OPEN]);
  fill(0);
  circle(220, 290, 15);
  //circle(230, 273, 60); // left eye
  
  fill(255);
  arc(354, 280, 60, 40, 0, 3.14, [OPEN]);
  fill(0);
  circle(342, 290, 15);
  //circle(354, 273, 60); // right eye
  //circle(294, 410, 60);
  
  
  
  fill(0, 0, 0)
  arc(295, 380, 60, 45, 0, 3.14, [OPEN]) //mouth
  
  arc(162, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(192, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(220, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(260, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(290, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(320, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(350, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(390, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(420, 238, 60, 45, 0, 3.14, [OPEN]);
  arc(436, 238, 60, 45, 0, 3.14, [OPEN]);
  
  
  //hat
  fill(111, 78, 55);
  rect(110, 230, 375, 10);
  arc(300, 230, 340, 300, 3.14, 0, [OPEN])
  
  //nose
  line(293, 308, 282, 347);
  line(282, 347, 301, 348);
  
 
  
}

function draw() {

  print(mouseX + "," + mouseY);
  
}