xxxxxxxxxx
21
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(220, 20, 120);
stroke(0);
let secondsNow = second();
// seconds -> circle width: [0, 59] -> [20, width]
let secondDiam = map(secondsNow, 0, 59, 20, width);
// seconds -> amount of green: [0, 59] -> [128, 255]
let greenVal = map(secondsNow, 0, 59, 128, 255);
translate(width / 2, height / 2);
fill(35, greenVal, 155);
ellipse(0, 0, secondDiam);
}