Project 3, odh

odhP3

//Owen D Haft
//Section D
//odh@andrew.cmu.edu
//Project 3

var R = 100; //"R" of RGB
var G = 100; //"G" of RGB
var W = 50; //Width of the ellipse
var H = 50; //height of the ellipse

function setup() {
    createCanvas(600, 480);
}
 
function draw() {
    background(50, 50, 100);
    noStroke();

    rectMode(CENTER);

    fill(100, 0, 0);
    rect(150, 240, 100, mouseX);

    fill(0, 100, 0);
    rect(450, 240, mouseY, 100);

    fill(R, G, 0);
    ellipse(mouseX, mouseY, W, H);

    H = mouseX;
    W = mouseY;


    //Changes the color of the ellipse depending on its location
    if (mouseX > 100) {
        G = 200;
    };
    if (mouseY > 100) {
        R = 200;
    };

}

I based all my changes on the location of the mouse, the change of size of the rectangles, the size of the ellipse, the color of the ellipse, and the location of the ellipse.

Leave a Reply