xxxxxxxxxx
30
let fnt;
function preload() {
fnt = loadFont("font/PPAir-ExtraLightMono.ttf");
}
function setup() {
createCanvas(500, 300);
}
function draw() {
let h = hour();
let m = minute();
let s = second();
let hCol = map(h % 12, 0, 12, 0, 255);
let mCol = map(m, 0, 60, 0, 255);
let sCol = map(s, 0, 60, 0, 255);
background(hCol, mCol, sCol);
let clock = nf(h, 2) + ":" + nf(m, 2) + ":" + nf(s, 2);
textSize(60);
textFont(fnt);
textAlign(CENTER);
fill("#F2F2F2");
text(clock, width/2, height/2);
}