xxxxxxxxxx
59
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
background(0);
let hr = hour();
let mn = minute();
let sc = second();
textSize(50);
noStroke();
fill(255);
text(hr + ":" + mn + ":" + sc, 110, 395);
text("12", 170, 120);
text("6", 185, 320);
text("9", 80, 220);
text("3", 295, 220);
strokeWeight(8);
noFill();
translate(200, 200);
rotate(-90);
stroke(150, 255, 100);
let end1 = map(sc, 0, 60, 0, 360);
arc(0, 0, 300, 300, 0, end1);
stroke(0, 0, 255);
let end2 = map(mn, 0, 60, 0, 360);
arc(0, 0, 280, 280, 0, end2);
stroke(255, 100, 150);
let end3 = map(hr % 12, 0, 12, 0, 360);
arc(0, 0, 260, 260, 0, end3);
push();
strokeWeight(9);
rotate(end3);
stroke(255);
line(0, 0, 80, 0);
pop();
push();
strokeWeight(6);
rotate(end2);
stroke(255);
line(0, 0, 120, 0);
pop();
push();
strokeWeight(3);
rotate(end1);
stroke(255);
line(0, 0, 140, 0);
pop();
strokeWeight(10);
stroke(255, 0, 0);
point(0, 0);
}