xxxxxxxxxx
function setup() {
createCanvas(500, 500)
angleMode(DEGREES)
colorMode(HSB)
}
function draw() {
background(20)
translate(width / 2, height / 2)
rotate(-90)
var hr = hour()
var mn = minute()
var sc = second()
var size = width/2
push()
let hrAngle = map(hr % 24, 0, 24, 0, 360*2)
let hrCol = map(hrAngle, 0,360*2,360*2,0)
stroke(hrCol, 90,20)
strokeWeight(10)
if (hr >= 12){
fill(244,170,hr)
} else {
fill(30,170,204)
}
arc(0, 0, size*1.5, size*1.5, 0, hrAngle)
pop()
push()
let mnAngle = map(mn, 0, 60, 0, 360)
let mnCol = map(mnAngle, 0,360,360,0)
stroke(mnCol,40,90)
strokeWeight(8)
fill(240,30,120)
arc(0, 0, size * 1.25, size*1.25, 0, mnAngle)
pop()
push()
let scAngle = map(sc, 0, 60, 0, 360)
let scCol = map(scAngle, 0, 360, 360, 0)
stroke(255)
strokeWeight(6)
fill(scCol, 70,80)
arc(0, 0, size, size, 0, scAngle)
pop()
}