afukuda_Project03

afukuda-project-03

/* 
   Name | Ai Fukuda 
   Course Section | C 
   Email | afukuda@andrew.cmu.edu
   Project | 02-VariableFaces
*/ 

var deg = mouseX;
var rad = radians(deg);
var size = 5;
 

function setup() {
    createCanvas(640, 480);
    rectMode(CENTER);
}

function draw() {
    background(214,233,248);
    if (mouseX > (width / 2)) {                                // change background color 
        background (219,233,198);
    }

    noStroke();                                                // orange square 
    fill(253, 205, 167);
    rect(40+mouseX, max((480 - mouseX)-60, 240), 40, 40);
    if (mouseX > 300) {                                
        fill(182,178,215);
    }

    fill(249, 200, 203);                                      // pink square 
    rect(60+mouseX, min((480 - mouseX)-60, 200), 60, 60);

    fill(254, 232, 147);    
    rotate(rad);                                              // yellow square
    rect(100+mouseX, min(mouseX-220), (mouseX*0.25)+60, (mouseX*0.25)+60);

    
}


    

 

 

Leave a Reply