Laura Rospigliosi (Lrospigl) Project 3

lrospigl_project3

var r;
var t;
var a = 100;
var headx;
var discox;
var p;

function setup() {
  createCanvas(640, 480)

}

function draw() {
  var x = mouseX + (width / 2);
  var y = mouseY;

  background(230, x, y);

  strokeWeight(0);
  fill(a, 200, 200);
  ellipse(r, t, 20, 20);
  ellipse(r * 2, t, 20, 20);
  ellipse(r / 2, -t, 20, 20);
  ellipse(r, t / 2, 20, 20);

  if (mouseIsPressed) {
    ellipse(r, t, 50, 50);
    r = random(20, 500);
    t = random(20, 460);
    a = random(1, 250);
  }

  //disco man
    //shirt
  fill(255);
  rect (headx - 15, 360, 130, 100, 20);
  
  //hair
  fill(40);
  arc(headx + 50, 250, 200, 200, PI-QUARTER_PI, TWO_PI+QUARTER_PI, CHORD);
  //neck
  fill(254, 213, 192);
  rect(headx + 35, 300, 30, 80, 20);
  //face
  fill(254, 213, 192)
  rect(headx, 250, 100, 100, 20);
  //glasses
  fill(0)
  arc(headx + 30, 290, 30, 30, TWO_PI, PI, CHORD);
  arc(headx + 70, 290, 30, 30, TWO_PI, PI, CHORD);
  rect (headx + 30, 290, 40, 5);


  fill(0, 102, 153, 51);
  text("click and drag mouse accross canvas", 5, 480);
  
  if (100 < mouseX & mouseX < (width - 100)) {
    headx = mouseX - 50;
  }
  strokeWeight (0.5)
  fill (255, mouseX)
  ellipse (p, 50, discox, discox)
  
  if (100 < mouseX & mouseX < (width/2)) {
    p = mouseX;
    discox = mouseX/3
  }
    if ((width/2) < mouseX & mouseX < (width - 100)) {
    p = mouseX;
    discox = (width - mouseX)/3
  }
}

Leave a Reply