Monke

Hier hebben we de afgelope 3 lessen aan gewerkt. het eindproduct is een aapje geworden we wij zelf ontworpen hebben. het ontwerpen zelf was niet moeilijk maar de extra dingen wel 


particles = [];
var angle = 0;
function setup() {
  createCanvas(400, 400);
  angleMode(DEGREES);
}
function draw() {
  grootte=250;
  background(53, 189, 89);

 
   if (mouseIsPressed == true) {
    if (mouseButton == LEFT) {
      fill(random(255),random(255),random(255));


    }
    else {
      fill(53, 189, 89);
    }
  }

  rect(0, 0, windowWidth, windowHeight);
   translate(width/2,height/2)
 if (mouseIsPressed == true) {
    if (mouseButton == LEFT) {
     
        rotate(angle); 
    }
 }


   
   stroke(110, 77, 5)
  strokeWeight(4)
    fill(255, 193, 94)
  ellipse(0, 0- 15 , 300,150) //oor
  
  fill(143, 99, 4) //basis emoji
ellipse(0,0,grootte,grootte)
 
  noStroke()
  
    fill(255, 193, 94) // linker licht bruine oog ding 
  ellipse(0-40 ,0-40,110,110)
  
     fill(255, 193, 94) // rechter licht bruine oog ding 
  ellipse(0+40 ,0-40,110,110)
  
    fill(255, 193, 94) // mond licht bruine
  ellipse(0, 0+40,195,170)
  
  fill(250)
  ellipse(0-45 ,0-50 ,45,55) // rechter witte oog  
  
  fill(250)
  ellipse(0+45 ,0-50 ,45,55)// rechter witte oog
  
  fill(0)
  ellipse(0-40 , 0-45, 25,25) // linker eyelid
  
  fill(0)
  ellipse(0+50 , 0-45, 25,25) // rechter eyelid
  
  fill(0)
  ellipse(0+20 , 0, 15,15)//neusgat 1
  
    fill(0)
  ellipse(0-20 , 0, 15,15) //neusgat 2
  
      textSize(15);
text('Left top is mouth open, Right bottom is mouth closed!', -190, -170);
  text('Left click for something funny 😃', -190,-185)
  

  
    for (let i = 0; i < 5; i++) {
    let p = new Particle();
    particles.push(p);
  }
  for (let i = particles.length - 1; i >= 0; i--) {
    particles[i].update();
    particles[i].show();
    if (particles[i].finished()) {
      // remove this particle
      particles.splice(i, 1);
      
if ((mouseX < 200) && (mouseY < 200)) {
  fill(0)
    arc(0,0+25,grootte-75,grootte-75,0,180) //mond

  fill(207, 2, 2) 
  ellipse(0, 0+88, grootte- 130 ,grootte-200)//tong
  
  
      fill(255)
  arc(0,0+25,grootte-100,grootte-220,0,180)//tanden
  }

  
            fill(0)
      ellipse(0,60,160,20)
      
  fill(107, 90, 43)
  rotate(45)
  ellipse(-5,140,20,120)
        fill(255, 94, 0)
  ellipse(-5,195,15,15)


      
      rotate(315)

            fill(53, 189, 89)
      
      angle++;
    }
  }
}

class Particle {
  constructor() {
    this.x = 0-145;
    this.y = 0+125;
    this.vx = random(-1, 1);
    this.vy = random(-5, -1);
    this.alpha = 255;
  }

  finished() {
    return this.alpha < 0;
  }

  update() {
    this.x += this.vx;
    this.y += this.vy;
    this.alpha -= 5;
  }

  show() {
    noStroke();
    fill(220, this.alpha);
    ellipse(this.x, this.y, 16);
  }
}