-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclock.js
43 lines (34 loc) · 795 Bytes
/
clock.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(5);
font = loadFont('ttf/subway-ticker.regular.ttf');
textFont(font);
canvasSetup();
}
function canvasSetup() {
w = min(windowWidth * 0.3 ,windowHeight * 0.4);
textSize(w);
noCursor();
}
function draw() {
let time = String(hour()).padStart(2,'0') + ":" + String(minute()).padStart(2,'0')
background(20);
stroke('#881111');
fill('#881111');
textAlign(CENTER, CENTER);
strokeWeight(1);
text(time, windowWidth/2.0, windowHeight/2.0);
}
function mousePressed() {
startTime=new Date();
loop();
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
canvasSetup();
}
function keyPressed({ key }) {
if (key == 'f' || key == 'F') {
fullscreen(!fullscreen());
}
}