P5JS – LA 1 – 1.1

Today we got our first assignment to make a robot with P5JS, we went a little overboard and added a bunch of stuff that wasn’t needed, but we had loads of fun doing it and we both really like how it turned out.

The code we used is the following:

function setup() {
  createCanvas(400, 400);
  background('#add8e6');
  
//body//  
rect(120, 160, 150, 100);
//head//
ellipse(190, 105, 110, 110);
//leg 1//
rect(140, 260, 40, 120);
//leg 2//
rect(210, 260, 40, 120);
//arm 1//
rect(85, 180, 35, 100);
//arm 2//
rect(270, 180, 35, 100);
//eye 1//
rect(170, 100, 10, 10);
//eye 2//
rect(200, 100, 10, 10);
//button 1//
ellipse(140, 180, 10, 10);
//button 2//
ellipse(160, 180, 10, 10);
//button 3//
ellipse(150, 195, 10, 10);
//cap//
triangle(120, 90, 195, 20, 270, 90);
//grass//
rect(-10, 380, 410, 20);
  
c = color('green');
fill(c);
noStroke();
rect(0, 380, 400, 20);
  
c = color(255, 204, 0);
fill(c);
noStroke();
ellipse(25, 25, 100, 100);
  
c = color('blue');
fill(c);
noStroke();
ellipse(140, 180, 10, 10);
  
c = color('red');
fill(c);
noStroke();
ellipse(160, 180, 10, 10);
  
c = color('black');
fill(c);
noStroke();
ellipse(150, 195, 10, 10);
  
c = color('black');
fill(c);
noStroke();
rect(250, 170, 10, 40);
  
c = color('black');
fill(c);
noStroke();
rect(230, 170, 10, 40);

c = color('black');
fill(c);
noStroke();
rect(240, 185, 10, 10);
}


By using this code we got the following image:

We didn’t have any questions and I consider this an easy exercise, friday we’ll work together again on 1.2.