xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
}
function draw() {
let h = hour();
let m = minute();
let s = second();
let hoff = map(h, 0, 23, 0, 255);
let moff = map(m, 0, 59, 0, 255);
let soff = map(s, 0, 59, 0, 255);
background(hoff, moff, soff);
let vreme = dn(h) + ":" + dn(m) + ":" + dn(s);
textSize(40);
fill(255);
//text(vreme, 40, 60);
}
function dn(broj) {
if (broj < 10) {
return "0" + broj;
} else {
return broj;
}
}