a-luppe_ex2

Project 1.1 - Project 1.2 - Project 1.3 || Project 2.1 | Project 2.2 | Project 2.3 || Project 3

Project 1 - Exercise 2



ex2_6.png
Continuous
//set size of workspace to 250 px by 250 px and background colour to black
size(250,250);
background(0);
//set no stroke function and smooth function for ellipses
noStroke();
smooth();
 
 
//nested loop
for (int y= -10; y<= 250; y+=15){
  for (int x= -10; x<= 250; x+=15){
    //set float (random) function for random, colour, colour2 and weight
    float r = random(0,150);
    float colour = random(0,2500);
    float colour2 = random(0,2500);
    float weight = random(1,10);
    //use random function to vary stroke weight and stroke colour
    strokeWeight(weight/2);
  stroke(colour*5,colour2/10,colour/3,r);
  //set no stroke function
   noStroke();
   //center ellipse
    fill(r,colour,colour2,r);
   ellipse(x,125,30, x+40);
 //top ellipse
 fill(colour,colour2,r,r);
   ellipse(x,50,30, x+40);
  //bottom ellipse
  fill(colour2,r,colour,r);
 ellipse(x,200,30, x+40);
 
  }
 
}
 
//save image as ex2_continuous.png
 save("ex2_continuous.png");
ex2_dynamic.png
Dynamic
// set up size of workspace to 250px to 250px and background colour to dark blue
 
size(250,250);
background(4,0,36);
 
// smooth edges of shapes and set no stroke
smooth();
noStroke();
 
//set variables for first nested loop layer, y=0 and x=0
for(int y=0;y<250;y+=2.5){
  for(int x=0;x<250;x+=2.5){
    fill(12,0,108);
    ellipse(x*10,y*10,x,y);
  }
}
 
//set variables for second nested loop layer, y=-1 and x=-1
fill(21,0,188);
for(int y=-1;y<250;y+=3.5){
  for(int x=-1;x<250;x+=3.5){
    ellipse(x*10,y*10,x,y);
  }
}
 
//set variables for third nested loop layer, y=-2 and x=-2
fill(28,0,255);
for(int y=-2;y<250;y+=6){
  for(int x=-2;x<250;x+=6){
    ellipse(x*10,y*10,x,y);
  }
}
 
//save image as ex2_dynamic.png
save("ex2_dynamic.png");
ex2_11.png
Smooth
//set size of workspace to 250 px by 250 px and set background colour to black
size(250,250);
background(0);
//set no stroke function and smooth function
smooth();
noStroke();
 
 
// define variable x=0 for lines
 
for (int x=0;x<250; x+=5){
  stroke(255,255,255,75);
  line(250,0,0,x);
  line(0,250,250,x);
 
}
 
 // define variable x=0 for quad and lines
 
for (int x=0;x<250; x+=5){
  fill(178,255,3,5);
  //set no stroke
  noStroke();
 quad(75, 125, 125, 90, 175, 125, 125, 160);
  //set stroke and no fill functions
  stroke(255,255,255,75);
  noFill();
  line(175,125,0,x);
  line(75,125,250,x);
 
}
//save image as ex2_11.png
save("ex2_11.png");
 
 
ex2_coarse.png
Rough
// set workspace to 250px by 250px and background colour to black
size(250,250);
background(0);
//turn on smooth function
smooth();
 
//set int variable i=0
for(int i=0; i<250; i++) {
  //create float r= random numbers ranging from 0 to 150
  float r = random(0,150);
      //create float colour= random numbers ranging from 0 to 2500
    float colour = random(0,2500);
       //create float colour2= random numbers ranging from 0 to 2500
    float colour2 = random(0,2500);
         //create float weight= random numbers ranging from 0 to 2500
    float weight = random(1,10);
    //set stroke weight
    strokeWeight(weight/2);
  stroke(colour*5,colour2/10,colour/3,r);
  line(i, i, 50+r, i);
 
}
 
//save image as "ex2_coarse.png
save("ex2_coarse.png");