-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch2.js
119 lines (96 loc) · 2.75 KB
/
sketch2.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var time = 0;
function setup(){
setTimeout(function(){
window.location.reload(1);
}, 60000);
var dt = new Date();
var hour = dt.getHours();
var minutes = dt.getMinutes();
var minutesX_ = (minutes % 10);
var minutes_X = round((minutes/10)-0.5);
time = (hour % 12);
if (hour === 12){
time = 12;
}
if (hour === 0){
time = 12;
}
createCanvas(windowWidth-15, windowHeight-15);
var counterHour = 0;
var points = [];
for(var i = 1; i < 360; i += (360/time)){
var xOffset = random(300, 10);
var yOffset = random(250, 10);
var x = sin(radians(i))*xOffset + width/2;
var y = cos(radians(i))*yOffset + height/3;
var p = {"x":x,"y":y,"name":counterHour};
points.push(p);
var x1 = sin(radians(i))*220 + width/2;
var y1 = cos(radians(i))*220 + height/3;
vertex(x, y);
counterHour++;
}
background(240, 240, 240);
strokeWeight(2);
noFill();
beginShape();
for(var j = 0; j < points.length; j++){
var onepoint = points[j];
var px = onepoint.x;
var py = onepoint.y;
stroke(150,150,150);
vertex(px,py);
if (time === 1){
strokeWeight(3);
point(px, py);
}
}
endShape(CLOSE);
var firstPoint = points[0];
var pastPoint = points[points.length-2];
stroke(0,0,0);
for(var k=0; k < minutesX_; k++){
var currX_ = random(3,280);
var currY_ = random(40,150);
if(time == 1){
strokeWeight(7);
var currX_1 = random(10,60);
point((width/2 + currX_), (height/2 + currY_));
strokeWeight(2);
line((width/2 + currX_), (height/2 + currY_), firstPoint.x, firstPoint.y);
} else if (time == 2) {
var currX_2 = random(10,60);
strokeWeight(7);
point((pastPoint.x + currX_), (pastPoint.y + currY_));
strokeWeight(2);
line((pastPoint.x + currX_), (pastPoint.y + currY_), firstPoint.x, firstPoint.y);
} else if (time > 2){
strokeWeight(7);
point(firstPoint.x + currX_, firstPoint.y + currY_);
strokeWeight(2);
line(firstPoint.x + currX_, firstPoint.y + currY_, firstPoint.x, firstPoint.y);
}
}
for(var l=0; l < minutes_X; l++){
var curr_X = random(3,280);
var curr_Y = random(40,150);
if(time == 1){
strokeWeight(3);
point((width/2 - curr_X), (height/2 + curr_Y));
strokeWeight(1);
line((width/2 - curr_X), (height/2 + curr_Y), firstPoint.x, firstPoint.y);
} else if (time == 2) {
strokeWeight(3);
point((pastPoint.x - curr_X), (pastPoint.y + curr_Y));
strokeWeight(1);
line((pastPoint.x - curr_X), (pastPoint.y + curr_Y), firstPoint.x, firstPoint.y);
} else if(time > 2){
strokeWeight(3);
point(firstPoint.x - curr_X, firstPoint.y + curr_Y);
strokeWeight(1);
line(firstPoint.x - curr_X, firstPoint.y + curr_Y, firstPoint.x, firstPoint.y);
}
}
}
function draw(){
}