xxxxxxxxxx
27
// Simple beginning template for variable face.
// Created by Golan Levin
let eyeSize = 20;
let faceWidth = 100;
let faceHeight = 150;
function setup() {
createCanvas(300, 300);
}
function draw() {
background(180);
ellipse(width / 2, height / 2, faceWidth, faceHeight);
let eyeLX = width / 2 - faceWidth * 0.25;
let eyeRX = width / 2 + faceWidth * 0.25;
ellipse(eyeLX, height / 2, eyeSize, eyeSize);
ellipse(eyeRX, height / 2, eyeSize, eyeSize);
}
function mousePressed() {
// when the user clicks, these variables are reassigned
// to random values within specified ranges. For example,
// 'faceWidth' gets a random value between 75 and 150.
faceWidth = random(75, 150);
faceHeight = random(100, 200);
eyeSize = random(10, 30);
}