xxxxxxxxxx
// The Map 2016-11-09
// An historical moment (reaction sketched using Processing P5)
// Kenneth Sherwood
// kwsherwood@gmail.com
// Creative Commons Share and Share Alike, by Attribution
PImage img; // calls up image library
int rep;
int max;
int incr; // increments the rate of fade in
void setup(){
size(1440,960);
background(255);
// loads image
// Images must be in the "data" directory to load correctly
img = loadImage("map.png");
rep = 1;
incr = 3;
max = 2000; // this is the number of cycles before blackout
}
void draw() {
fill(200);
textSize(22);
image(img, 0, 0,1440,1000);
if (mousePressed == true) {
if (mouseX < (width-100)/2 && mouseY < (height/2)) {
fill(15,30,185,incr); // blue
text("The voice of the people must be heard.",mouseX,mouseY);
rep = rep+1;
}
if (mouseX < (width-100)/2 && mouseY > height/2) {
fill(237,45,45,incr); //red
text("The gov't can't be trusted.",mouseX,mouseY);
rep = rep+1;
}
if (mouseX > (width-100)/2 && mouseY < height/2) {
fill(237,45,45,incr); //red
text("The system of democracy is an elegant machine.",mouseX,mouseY);
rep = rep+1;
}
if (mouseX > width/2 && mouseY > height/2) {
fill(15,30,185,incr); // blue
text("Gather the torches and pitchforks.",mouseX,mouseY);
rep = rep+1;
}
}
// --------------this will slowly overwrite the text and all turn to black
if (rep > max) {
fill(0,0,0,10); // rectangle blackout
rect(0,0,width,height);
}
if (rep > (max+10)) {
fill(150,150,150,150);
textSize(50);
text("November 9, 2016 ", (width-450)/2,(height+150)/2);
}
}