xxxxxxxxxx
// Instantiate
let obj1;
let obj2;
function setup() {
createCanvas(500, 500);
// Generate random color when the app starts
let rndFaceCl = color(random(255),random(255),random(255));
// Generate random size for the head
let hSz = random(100, width / 2)
// Pass the value to the Face class and create the object
obj1 = new Face(rndFaceCl, hSz);
// Set color to black and size to 150 for the obj2
obj2 = new Face(color(0), 150);
}
function draw() {
background(240,230,232);
// Display obj1
obj1.display();
// Set the position of obj2
obj2.x = 75;
obj2.y = 75;
// Display 2nd instance (obj2)
obj2.display();
}