Assignment 2 – Art using loops

Concept

The idea for this assignment originally was to make flashing lights in a dark background, however I couldn’t figure out how to make it work as intended. Because of that I decided to change the idea based on the sun and space, similar to this:

Planet found around sun twin in star cluster | Science News

Based on that I decided to make a big orange ball that would flash with small motionless circles to look like stars.

Code

Creating the code was the most difficult part of making the image. In my attempt to make the first concept, I stumbled into a video of making circles (https://www.youtube.com/watch?v=XATr_jdh-44) and to() functions.

for(i=0; i<20; i++){
   let x = random(width);
   let y= random(height);
   let r = random(1,5)
   fill(255,255,255) // had to fill it white because they took the color of the sun//
   ellipse(x,y,r,r) 
}

After this I used a code similar to the one seen in class of making the triangle loose color and make it bright again. At the end my code looked like this:

function setup() {
  createCanvas(400, 400);
}
let greenValue = 255;
function draw() {  
    background(0)
  for(i=0; i<20; i++){
   let x = random(width);
   let y= random(height);
   let r = random(1,5)
   fill(255,255,255)
   ellipse(x,y,r,r) 
    
  }  
  greenValue = greenValue - 5;
    if (greenValue === 105) {
    greenValue = 255;
    }
  fill(greenValue, greenValue - 111, greenValue - 200);
  ellipse(200,200, 300,300);
  
}

Completed Art-Work

 

Reflection/Future Work

Personally, I wish the code did not take as much time as it did, as well as reduce the amount of mistakes made, as my computer crashed a few times while writing the code.

Alongside that, I would have liked the color to dim down and slowly dim up repeatedly, but could not find a way to do it.

One thought on “Assignment 2 – Art using loops”

Leave a Reply