xxxxxxxxxx
35
let c = 0;
let sec = 0;
let timer=0;
function setup() {
createCanvas(400, 400);
colorMode(HSB);
rectMode(CENTER);
}
function draw() {
background(220);
fill(c,100,100);
square(width/2,height/2,100);
fill(0);
if(sec != 1){
text(sec+' seconds',width/2-25,height/2+75);
}else{
text(sec+' second',width/2-25,height/2+75);
}
if(millis()-timer>=1000){
//every 1 second something happens
c += 10;
sec +=1;
timer=millis();
}
if(c>=360){
c=0;
}
}