Project 03 – Dynamic Drawing

sketch

// Deklin Versace Section E
var eyeX = 700;
var eyeY = 250;
var diameter = 75;
var r = 100;
var g = 50;
var b = 50;
var handY = 500;
var handX = 375;

function setup() {
    createCanvas(900, 900);
    r = random(0, 255);
    g = random(0, 255);
    b = random(0, 255);
}

function draw() {
  background(r, g, b);
  noStroke();
  fill(r - 60, g - 60, b - 60);
  quad(width / 2 - 150, eyeY, width / 2 + 150, eyeY, 485, 900, 415, 900);
  fill(r - 60, g - 60 ,b - 60);
  ellipseMode(CENTER);
  ellipse(width / 2, eyeY, eyeX + abs(700 - eyeX), abs(450 - eyeX / 3));
  headH = abs(450 - eyeX / 3);
  headW = eyeX + abs(700 - eyeX);
  fill(240);
  ellipse(eyeX, eyeY, diameter, diameter);
  ellipse(width - eyeX, eyeY, diameter, diameter);
  if(mouseX > 650 || mouseX < 250 || (mouseX > 400 & mouseX < 500)){
    eyeX = eyeX;
  }   else{
      eyeX = mouseX;
  }

  fill(r - 100, g - 100, b - 100);
  bezier((width / 2) - (headW / 5), eyeY + 50, (width / 2) - (headW / 5), eyeY + (headH / 2) - 50, (width / 2) + (headW / 5), eyeY + (headH / 2) - 50, (width / 2) + (headW / 5), eyeY + 50);


  strokeWeight(60);
  stroke(r - 50, g - 50, b - 50);
  line(width / 2 - 100, 420, width / 2 - 250, 420 + ((handY - 420) / 2));
  line(width / 2 + 100, 420, width / 2 + 250, 420 + ((handY - 420) / 2));
  stroke(r - 40, g - 40, b - 40);
  line(width / 2 - 250, 420 + ((handY - 420) / 2), handX, handY);
  line(width / 2 + 250, 420 + ((handY - 420) / 2), 900 - handX, handY);
  if(mouseX > 100 & mouseX < 410)
  handX = mouseX;
  else{
  handX = handX;
  }
  if(mouseY < 700){
    handY = mouseY;
  } else{
  handY = 700;
}
}
function mousePressed() {
  r = random(0, 255);
  g = random(0, 255);
  b = random(0, 255);
}

Leave a Reply