IFD:All Hail The Pixels/Patterns: Difference between revisions

From Medien Wiki
Line 367: Line 367:
     //  popMatrix();
     //  popMatrix();
     }
     }
==Maria Estel==
*Pattern A
//three objects: one fixed, one moving and one depending to the two
void setup () {
  size (1000,600);
}
void draw () {
  background (255);
 
  fill (0);
  rect (100,200,300,300);
 
  stroke (0);
  line (100,200,200,100);
  line (400,200,500,100);
  line (400,500,500,400);
 
  line (200,100,500,100);
  line (500,100,500,400);
 
  float dimension = mouseX;
 
  noFill ();
  ellipse (750,300,dimension,dimension);
 
  float halfDimension = dimension * 0.5;
 
  //line (500,100,750 - halfDimension,300);
  //line (500,400,750 - halfDimension,300);
 
  fill (0);
  triangle (500,100,500,400,750-halfDimension,300);
}
Pattern B
//three objects: one fixed, one moving and one depending to the two
//changing on mouseklick
void setup () {
  size (1000,600);
}
void draw () {
 
  if (mousePressed) {
    background (0,0,0);
    stroke (255,0,255);
    fill (0,0,0);
  }
  else {
    background (255);
    stroke (0);
    fill (0);
  }
 
  rect (100,200,300,300);
 
  stroke (0);
  line (100,200,200,100);
  line (400,200,500,100);
  line (400,500,500,400);
 
  line (200,100,500,100);
  line (500,100,500,400);
 
  if (mousePressed) {
    stroke (255,0,255);
    noFill ();
  }
  else {
    stroke (0);
    noFill ();
  }
 
  float dimension = mouseX;
 
  ellipse (750,300,dimension,dimension);
 
  if (mousePressed) {
    stroke (255,0,255);
    fill (0,0,0);
  }
  else {
    stroke (0);
    fill (0);
  }
 
  float halfDimension = dimension * 0.5;
 
  triangle (500,100,500,400,750-halfDimension,300);
}
*Pattern C
//two objects visible and one moving
//one object gets revealed by expanding the other while klicking the mouse
void setup () {
  size (1000,600);
}
void draw () {
 
  float dimensions = mouseY;
 
  if (mousePressed) {
    background (0,0,0);
    rect (100,200,dimensions,dimensions); //can't get rid of the not moving rectangular
    stroke (255,0,255);
    fill (0,0,0);
  }
  else {
    background (255); //if i put the command in here it's not filled anymore
    stroke (0,0,0);
    fill (0,0,0);
  }
 
  rect (100,200,300,300);
 
  stroke (0);
  line (100,200,200,100);
  line (400,200,500,100);
  line (400,500,500,400);
 
  line (200,100,500,100);
  line (500,100,500,400);
 
  float dimension = mouseX;
 
  if (mousePressed) {
    ellipse (750,300,300,300);
    stroke (255,0,255);
    fill (255);
  }
  else {
    ellipse (750,300,dimension,dimension);
    stroke (0);
    fill (255);
  }
}


== Xianzhi Zhang ==
== Xianzhi Zhang ==