Ilona Altman- project 2- variable faces

sketch


var thetime = 1
var othetime = 1
var clr= 1


function setup() {
    createCanvas(200, 20);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}



function setup() {
    createCanvas(480,640);
    noStroke();
}

function draw() {
    background(215,126,107);

    //variables

    var x = 1/5*width;
    var y = 1/8*height;

    //moon static 
    fill(130+clr,170+clr,170+clr);
    circle(2.5*x,y,100);

    //moon dynamic
    fill(215,126,107);
    circle(2*x+othetime,y,100);

    //face base
    fill(235,150,140);
    circle(2.5*x, 5*y, 300);
    
    //moon eyes static 1 green
    fill(100+clr,140+clr,100+clr);
    circle(1.75*x, 4.5*y, 50);

    //moon eyes dynamic 1
    fill(235,150,140);
    circle(1.5*x+thetime,4.5*y, 50);

    // moon eyes static 2 green
    fill(100+clr,140+clr,100+clr);
    circle(3.25*x, 4.5*y, 50);

    // moon eyes dynamic 2 
    fill(235,150,140);
    circle(3*x+thetime, 4.5*y, 50);

}

function mousePressed() {
    thetime=random(-20,60);
    clr= random(-50,150);
    othetime=random(-150,150)
}

I had trouble getting the image to load earlier for some reason! Here is my project

Leave a Reply