Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/* Oliver Tretrop
Introduction to Media Computaion
Assignment #1
*/

//Program that allows the user to cycle between night and day at a graveyard.

//Setup for the program
void setup() {
  size(400, 400);
  frameRate(30);
  smooth();
  noStroke();
  rectMode(CORNERS);
  ellipseMode(CENTER);
  strokeWeight(2);
}

void draw(){
 
//Background that is able to change from a bright blue to dark blue by moving mouse up and down
  background (0, 170-mouseY/3,255-mouseY/2);
  noStroke();
  fill(#A2A2A2); 
  ellipse((-mouseX+width)+(0.2*(mouseX-width/2)), (-mouseY+height)+(0.2*(mouseY-height/2)), 50, 50);

//Green grass on the bottom
  stroke(1);
  fill(#32B91E);
  rect (-2,400,400,250);
  
//LEFT MOST GRAVESTONE***

//Left most gravestone box
  fill(#676666);
  strokeWeight(1);
  stroke(1);
  rect(20,250,100,100);
  strokeWeight(0);
  fill(0, 200-mouseY/3,#32B91E-mouseY/2);
  noStroke();
  quad(20,250,100,250,20+mouseX,250+mouseY,-50+mouseX,250+mouseY);
  
//RIP writing on left most gravestone
  fill(10);
  rect(22,120,33,160);
  ellipse(35,130,20,20);
  strokeWeight(5);
  stroke(0);
  line(35,140,43,157);
  line(55,140,55,157);
  line(55,130,55,130);
  line(70,123,70,157);
  ellipse(80,132,20,20);
  fill(#676666);
  ellipse(35,130,15,15);
  fill(#676666);
  ellipse(80,132,20,20);
//***

//MIDDLE GRAVESTONE***

//Middle gravestone box
  strokeWeight(1);
  stroke(1);
  fill(#676666);
  rect(150,250,225,150);
  
//Middle gravestones shadow that follows mouse
  noStroke();
  fill(0, 200-mouseY/3,#32B91E-mouseY/2);
//shadow that follows the mouses coordinates
  quad(150,250,225,250,100+mouseX,250+mouseY,50+mouseX,250+mouseY);
 
//RIGHT MOST GRAVESTONE***

//right most gravestone
  stroke(1);
  fill(#676666);
  rect(275,250,375,100);
  
//changes colour of shadow as you move the mouse up and down
  fill(0, 200-mouseY/3,#32B91E-mouseY/2);
  noStroke();

//shadow for the right most gravestone
  quad(275,250,375,250,200+mouseX,250+mouseY,100+mouseX,250+mouseY);
  
//RIP writing for gravestone on the right
  fill(10);
  stroke(10);
  ellipse(300,130,20,20);
  rect(290,120,300,160);
  fill(#676666);
  ellipse(300,130,10,10);
  strokeWeight(5);
  fill(0);
  line(300,137,308,158);
  line(325,137,325,158);
  line(325,130,325,130);
  line(343,125,343,158);
  strokeWeight(0);
  ellipse(355,133,25,25);
  fill(#676666);
  ellipse(355,133,15,15);
  
//***
  
//CLOUDS MOVEMENT AND CREATION***

//Cloud 1
  fill(240);
  noStroke();
  ellipse(mouseX/5+50,50,70,20);
  ellipse(mouseX/5+40,40,80,30);
  ellipse(mouseX/5+60,60,90,40);
  ellipse(mouseX/5+100,40,90,40);
  
//Cloud 2
  fill(240);
  noStroke();
  ellipse(mouseX/7+250,60,90,40);
  ellipse(mouseX/7+270,70,90,40);
  ellipse(mouseX/7+290,50,90,40);
  
//***
}

//when mouse clicked, the message apears on screen
void mousePressed() {
  println("welcome to the graveyard...");
}