'$INCLUDE:'p5js.bas'
createCanvas 400, 400
title "P5js Clock"
strokeB 255
radius = min(width&, height) / 2
secondsRadius = radius * 0.71
minutesRadius = radius * 0.6
hoursRadius = radius * 0.5
clockDiameter = radius * 1.7
cy = height / 2
backgroundB 230
noStroke
fill 244, 122, 158
p5ellipse cx, cy, clockDiameter / 2 + 20, clockDiameter / 2 + 20
fill 237, 34, 93
p5ellipse cx, cy, clockDiameter / 2, clockDiameter / 2
s
= map
(seconds
, 0, 60, 0, _PI * 2) - (_PI / 2) m
= map
(minute
+ map
(seconds
, 0, 60, 0, 1), 0, 60, 0, _PI * 2) - (_PI / 2) h
= map
(hour
+ map
(minute
, 0, 60, 0, 1), 0, 24, 0, _PI * 4) - (_PI / 2)
strokeB 255
strokeWeight 1
p5line cx
, cy
, cx
+ COS(s
) * secondsRadius
, cy
+ SIN(s
) * secondsRadius
strokeWeight 2
p5line cx
, cy
, cx
+ COS(m
) * minutesRadius
, cy
+ SIN(m
) * minutesRadius
strokeWeight 4
p5line cx
, cy
, cx
+ COS(h
) * hoursRadius
, cy
+ SIN(h
) * hoursRadius
strokeWeight 2
noFill
beginShape p5POINTS
LET x
= cx
+ COS(angle
) * secondsRadius
LET y
= cy
+ SIN(angle
) * secondsRadius
vertex x, y
endShape p5CLOSE
textAlign CENTER
textFont "marquee moon.ttf"
textSize 40
stroke 0, 244, 249
_TITLE "P5js Clock - " + Clock
SetWindowOpacity 200
SetWindowOpacity 255
CONST WS_EX_LAYERED
= &H80000 Msg
= Msg
OR WS_EX_LAYERED
ELSEIF H%
= 0 THEN hourclock
= "12" ' midnight hour Clock$ = hourclock + minclock + secclock + ampm$