Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/// Spencer Johnston. Intro to Media Computation.
/// September 21st 2015. 

//For desired effect, hold the mouse button and move the mouse
//from left to right.

void setup() {
  
  size(400, 400);
  background(220);
  
}

void draw(){
  
 //Drawing the Origami callsign from Heavy Rain 
  
  background(mouseX/2);
  drawOrigami(); //Drawing out and shading the indevidual triangles that make up the Origiami 
  agePaper();  //Adding a yellow tint to imply the deterioration of the paper
  fill(200);
  rect(0,240,500,240); //Ground
  
  drawBlood(mouseX); //Adding the iconic blood splatter on the Origami, as well as changing the ground colour
 
  
}

void drawOrigami(){
 
  stroke(0);
  fill(255);
  triangle(180, 200, 180, 160, 200, 180);
  fill(200);
  triangle(180, 160, 200, 180, 220, 160);
  fill(150);
  triangle(180, 200, 200, 180, 220, 200);
  fill(255);
  triangle(180, 200, 200, 220, 220, 200);
  fill(200);
  triangle(220, 240, 200, 220, 220, 200);
  fill(200);
  triangle(180, 200, 200, 220, 180, 240);
  fill(200);
  triangle(180, 200, 160, 220, 180, 240);
  fill(255);
  triangle(140, 240, 160, 220, 180, 240);
  
}

void agePaper(){
 
 //It is not lost on me that this is the least efficient way
 //to gradually change the colour of these triangles, but
 //I am struggling to find another way.
  stroke(0);
  fill(210, 200, 150, mouseX/2);
  triangle(180, 200, 180, 160, 200, 180);
  triangle(180, 160, 200, 180, 220, 160);
  triangle(180, 200, 200, 180, 220, 200);
  triangle(180, 200, 200, 220, 220, 200);
  triangle(220, 240, 200, 220, 220, 200);
  triangle(180, 200, 200, 220, 180, 240);
  triangle(180, 200, 160, 220, 180, 240);
  triangle(140, 240, 160, 220, 180, 240);
}

void drawBlood(int x){
  
  if(mousePressed == true){
    noStroke();
    fill(130,20,20, x);
    triangle(220, 240, 200, 220, 220, 220);
    rect(0,240,500,240);
  }
  
}