> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://uclaspring12.sketchpad.cc/sp/pad/view/ro.$A1h9w7cr7D/rev.554
 * 
 * authors: 
 *   Valentina
 *   Casey Reas
 *   
 *   

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// Valentina Rabinovich
// Workshop 4
//There are four images (street, detail, monument, and person) from three countries (England, France, and Italy). They rotate if your mouse is on them. If all four images align from the same country, you get to start over!

//This sketch builds on a prior work, "Workshop 4 [Template]"
// http://uclaspring12.sketchpad.cc/sp/pad/view/ro.6BjBY1l1d1-gMt/rev.14


/* @pjs preload="/static/uploaded_resources/p.4536/F1.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/F2.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/F3.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/F4.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/E1.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/E2.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/E3.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/E4.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/I1.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/I2.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/I3.jpg"; */
/* @pjs preload="/static/uploaded_resources/p.4536/I4.jpg"; */

PImage E1, E2, E3, E4;
PImage F1, F2, F3, F4;
PImage I1, I2, I3, I4;

//My Slots
PImage slot1;
PImage slot2;
PImage slot3;
PImage slot4;
 
void setup() {
 background(0);
 size(600, 300);
 colorMode(HSB);
 frameRate(1);
  
  E1 = loadImage("/static/uploaded_resources/p.4536/E1.jpg");
  E2 = loadImage("/static/uploaded_resources/p.4536/E2.jpg");
  E3 = loadImage("/static/uploaded_resources/p.4536/E3.jpg");
  E4 = loadImage("/static/uploaded_resources/p.4536/E4.jpg");
  F1 = loadImage("/static/uploaded_resources/p.4536/F1.jpg");
  F2 = loadImage("/static/uploaded_resources/p.4536/F2.jpg");
  F3 = loadImage("/static/uploaded_resources/p.4536/F3.jpg");
  F4 = loadImage("/static/uploaded_resources/p.4536/F4.jpg");
  I1 = loadImage("/static/uploaded_resources/p.4536/I1.jpg");
  I2 = loadImage("/static/uploaded_resources/p.4536/I2.jpg");
  I3 = loadImage("/static/uploaded_resources/p.4536/I3.jpg");
  I4 = loadImage("/static/uploaded_resources/p.4536/I4.jpg");
}
 
void draw() {
//slot1  
if (mouseX < 150){
  tint(0, 50, 400);
  float r = random(1);
    if (r<0.33){  
    image(E1, 0, 0);
    slot1 = E1;
  } else if (r < 0.66){
    image(F1, 0, 0);
    slot1 = F1;
  } else {
     image(I1, 0, 0);
     slot1 = I1;
  }
}

//slot2
if ((150<mouseX) && (mouseX<300)){
  tint(30, 155, 290);
  float r = random(1);
    if (r<0.33){  
    image(E2, 150, 0);
    slot2 = E2;
  } else if (r < 0.66){
    image(F2, 150, 0);
    slot2 = F2;
  } else {
     image(I2, 150, 0);
     slot2 = I2;
  }
}

//slot3  
if ((300<mouseX) && (mouseX<450)){
  tint(130, 255, 400);
  float r = random(1);
   if (r<0.33){  
   image(E3, 300, 0);
   slot3 = E3;
 } else if (r < 0.66){
   image(F3, 300, 0);
   slot3 = F3;
 } else {
    image(I3, 300, 0);
    slot3 = I3;
  }
}

//slot4
if ((450<mouseX) && (mouseX<600)){
  tint(80, 125, 230);
  float r = random(1);
   if (r<0.33){  
   image(E4, 450, 0);
   slot4 = E4;
 } else if (r < 0.66){
   image(F4, 450, 0);
   slot4 = F4;
 } else {
    image(I4, 450, 0);
    slot4 = I4;
  }
}

//strings and things
String slot1Country;
String slot2Country;
String slot3Country;
String slot4Country;

if( slot1 == E1 ){
  slot1Country = "England";
  }else if( slot1 == F1 ) {
  slot1Country = "France";
  } else if( slot1 == I1) {
  slot1Country = "Italy";
  } else {
  slot1Country = "Unknown";
}

if( slot2 == E2 ){
  slot2Country = "England";
  }else if( slot2 == F2 ) {
  slot2Country = "France";
  } else if( slot2 == I2) {
  slot2Country = "Italy";
  } else {
  slot2Country = "Unknown";
}

if( slot3 == E3 ){
  slot3Country = "England";
  }else if( slot3 == F3 ) {
  slot3Country = "France";
  } else if( slot3 == I3) {
  slot3Country = "Italy";
  } else {
  slot3Country = "Unknown";
}

if( slot4 == E4 ){
  slot4Country = "England";
  }else if( slot4 == F4 ) {
  slot4Country = "France";
  } else if( slot4 == I4) {
  slot4Country = "Italy";
  } else {
  slot4Country = "Unknown";
}

if ((slot1Country == slot2Country) && (slot1Country == slot3Country) && (slot1Country == slot4Country))
background (0);

//println("slot 1 = " + slot1Country );
//println("slot 2 = " + slot2Country );
//println("slot 3 = " + slot3Country );
//println("slot 4 = " + slot4Country );

}