-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
54 lines (43 loc) · 1 KB
/
app.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
44
45
46
47
48
49
50
51
52
53
54
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
background(0);
translate(200, 200);
rotate(-90);
let hours = hour();
let minutes = minute();
let seconds = second();
strokeWeight(8);
stroke(255,100,150);
noFill();
let secondAngle = map(seconds, 0, 60, 0, 360);
arc(0, 0, 260, 260, 0, secondAngle);
stroke(100,255,150);
let minuteAngle = map(minutes, 0, 60, 0, 360);
arc(0, 0, 280, 280, 0, minuteAngle);
stroke(100,150,255);
let hourAngle = map(hours % 12, 0, 12, 0, 360);
arc(0, 0, 300, 300, 0, hourAngle);
push();
rotate(secondAngle);
stroke(255, 100, 150);
line(0, 0, 100, 0);
pop();
push();
rotate(minuteAngle);
stroke(150, 255, 100);
line(0, 0, 75, 0);
pop();
push();
rotate(hourAngle);
stroke(150, 100, 255);
line(0, 0, 50, 0);
pop();
stroke(255);
point(0, 0);
// fill(255);
// noStroke();
// text(hr + ':' + mn + ':' + sc, 10, 200);
}