> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.QdvNjGgPV0g/rev.1444
 * 
 * authors: 
 *   Felipe Escobar

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



// This sketch builds on a prior work, "UXAD", created by Felipe Escobar
// http://studio.sketchpad.cc/sp/pad/view/ro.9PyWEf2bDggHd/rev.14

/* @pjs preload="/static/uploaded_resources/p.3986/microwave.jpg,/static/uploaded_resources/p.3986/start.jpg, /static/uploaded_resources/p.3986/recom.png, /static/uploaded_resources/p.3986/phone.png, /static/uploaded_resources/p.3986/skip.png, /static/uploaded_resources/p.3986/ok.png, /static/uploaded_resources/p.3986/slider1.png, /static/uploaded_resources/p.3986/foodtype.png"; */
PImage mstart = loadImage("/static/uploaded_resources/p.3986/start.jpg");
PImage recomm = loadImage("/static/uploaded_resources/p.3986/recom.png");
PImage phone = loadImage("/static/uploaded_resources/p.3986/phone.png");
PImage img = loadImage("/static/uploaded_resources/p.3986/microwave.jpg");
PImage skipb = loadImage("/static/uploaded_resources/p.3986/skip.png");
PImage okb = loadImage("/static/uploaded_resources/p.3986/ok.png");
PImage slider = loadImage("/static/uploaded_resources/p.3986/slider1.png"); 
PImage foodtype = loadImage("/static/uploaded_resources/p.3986/foodtype.png");  


float posBox = -750;
float posTri = posBox+800;
float reverse=1.0;
boolean start = true;
boolean recom = false;
boolean ok = false;
boolean slide = false;
boolean foodselect = false;

void setup() {
    size(1024, 768 );
    fill(255, 255, 255);
        img = loadImage("/static/uploaded_resources/p.3986/microwave.jpg");
        mstart = loadImage("/static/uploaded_resources/p.3986/start.jpg");
        recomm = loadImage("/static/uploaded_resources/p.3986/recom.png");
        phone = loadImage("/static/uploaded_resources/p.3986/phone.png");
        skipb = loadImage("/static/uploaded_resources/p.3986/skip.png");
        okb = loadImage("/static/uploaded_resources/p.3986/ok.png");
        foodtype = loadImage("/static/uploaded_resources/p.3986/foodtype.png");       
}

// Loops
void draw() {
    if(start == true){

        image (mstart,0,0);
    }
    if(mousePressed){
        start=false;
    image (img, 0, 0);
    image (slider, posBox, 84);
    //rect(posBox,0,960,1024);
    stroke(255, 255, 255);
    fill(200);
    triangle (posTri+(10*reverse), height/2-20, posTri+(40*reverse), height/2, posTri+(10*reverse), height/2+20);
    if(mousePressed==true && mouseX >= posTri  && mouseX<= posTri+60){
            posBox += mouseX;
            posTri += mouseX;
            slide = true;
            if (posTri >= width-580){
                    posTri = width-580;
                    reverse = -1.0;
                }
                if (posBox >= -400 && slide == true){
                      recom = true;
                      posBox = -400;
                      slide = false;
                }
            }
            if (recom == true){
                image (recomm, 20, 180);
                image (phone, 100, 330);
                image (skipb, 320, 550);
            }
            
                if (mousePressed == true && slide == false){
                    if(mouseX >=320 && mouseX<= 411){
                        if(mouseY>=550 && mouseY<= 593){
                            recom = false;
                            ok = true;
                                                    }
                    }
                }
             if (ok == true){
                recomm = false;
                image (okb, 150, 330);
            }
            
            if (mousePressed == true &&  ok == true){
                if (mouseX >= 150 && mouseX <= 266){
                        if(mouseY >= 330 && mouseY >= 448){
                    
                    ok = false;
                    foodselect = true;
                    }
                    }
                }
                if (foodselect == true){
                    image (foodtype, 0, 86);
                }

}
}