nahyunk1-Project-02-Variable-Face

sketch-124.js

  var eyeSize = 10;
  var faceWidth = 350;
  var faceHeight = 370;
  var red = 255;
  var green = 255;
  var blue = 255;

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

  function draw() {
      background(red, green, blue);
      noStroke();
      smooth();
      //watermelon skin
      fill("green");
      arc(320, 240, faceWidth,  faceHeight, 0, PI, CHORD);
      //watermelon fruit inside
      fill("red");
      arc(320, 240, faceWidth-20, faceHeight-30, 0, PI, CHORD);
      //watermelon smiley mouth
      fill("orange");
      arc(320, 270, eyeSize, eyeSize, 0, PI, CHORD);
      //eyesizes&color
      var eyeLX = 640 / 2 - 20;
      var eyeRX = 640 / 2 + 20;
      fill("black");
      ellipse(eyeLX, 320-50, eyeSize, eyeSize);
      ellipse(eyeRX, 320-50, eyeSize, eyeSize);
  }

  function mousePressed() {
      faceWidth = random(100, 400);
      faceHeight = random(100, 350);
      eyeLX = random(250, 300);
      eyeRX = random(340, 370);
      eyeSize = random (10, 25);
      red = random (0, 255);
      green = random (0, 255);
      blue = random(0, 255);
  }

I really hoped to be able to change the color of the background while trying to make my slice of watermelon character. I made the character with arcs and ellipses.

Leave a Reply