xxxxxxxxxx
function setup() {
createCanvas(400, 400);
angleMode(DEGREES)
}
function draw() {
background(0);
translate(200, 200);
rotate(-90)
let hr = hour();
let mn = minute();
let sc = second();
//strokeWeight(8);
stroke (0);
noFill();
ellipse(200, 200, 300, 300);
strokeWeight(8);
stroke(127, 255, 0);
let end1 = map(sc, 0, 60, 0, 360);
arc(0, 0, 300, 300, 0, end1);
//this section shows us the seconds on the clock in green
stroke(150, 100, 255)
let end2 = map(mn, 0, 60, 0, 360);
//arc(0, 0, 280, 280, 0, end2);
//this section shows us the minutes on the clock in purple
stroke(255, 204, 0)
let end3 = map(hr %12, 0, 12, -90, 360);
//arc(0, 0, 260, 260, 0, end3);
//this section shows us the hours on the clock in yellow
push();
rotate(end1)
stroke(127, 255, 0)
line(0, 0, 100, 0)
pop();
//this section indicates the movement of the seconds
push();
rotate(end2)
stroke(150, 100, 255)
line(0, 0, 80, 0)
pop();
//this section indicates the movement of the minutes
push();
rotate(end3)
stroke(255, 204, 0)
line(0, 0, 50, 0)
pop();
//this sectio indicates the movement of the hours
//fill(255);
//noStroke();
//text(hr + ':' + mn + ':' + sc, 10, 200);
}