-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
230 lines (209 loc) · 5.52 KB
/
index.html
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html>
<head>
<title>WebGL2 Conway's Game of Life</title>
<meta charset="UTF-8">
<style>
html, body {
margin: 0;
}
body {
background-color: #000;
overflow: hidden;
font-family: Consolas, Menlo, monospace;
}
body.hide-ui {
cursor: none;
}
#no-webgl2 {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
animation-name: error-fade;
animation-duration: 6s;
}
@keyframes error-fade {
0% {
opacity: 0;
}
75% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#c {
position: absolute;
}
#fps, #gen, #active, #toggle-help, #texture-desc {
position: absolute;
bottom: 10px;
color: #af0;
font-size: 12px;
background-color: rgba(0, 0, 0, 0.75)
}
.hide-ui #fps, .hide-ui #gen, .hide-ui #active, .hide-ui #toggle-help, .hide-ui #texture-desc {
display: none;
}
#texture-desc {
left: 50px;
}
#fps {
right: 10px;
}
#gen {
right: 50px;
}
#active {
right: 100px;
}
#toggle-help {
left: 10px;
cursor: pointer;
}
#help-container {
display: flex;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
align-items: center;
justify-content: center;
background-color: rgba(0,0,0,0.4);
cursor: default;
}
#help-container.hidden {
display: none;
}
#help {
background-color: rgba(0,0,0,0.6);
border: 1px solid rgb(255, 255, 255, 0.94);
padding: 16px;
color: rgb(255, 255, 255, 0.94);
font-size: 10pt;
}
#help h1 {
margin-top: 0;
font-weight: 100;
}
#help a {
color: #fff !important;
}
#help table {
margin-top: 16px;
}
</style>
</head>
<body>
<div id="no-webgl2">
<!-- iOS with experimental implements nothing of WebGL2 except the interface that falsely reports support :-( -->
<!-- instead assume that the canvas will cover the "no WebGL2" message, and fade it in to give loading time -->
<h1>:( sorry...WebGL2 is required</h1>
<h4>try using Firefox or Chrome on a desktop or laptop</h4>
</div>
<canvas id="c"></canvas>
<div id="toggle-help" onclick="toggleHelp()">[?]</div>
<div id="texture-desc"></div>
<div id="fps"></div>
<div id="gen"></div>
<div id="active"></div>
<div id="help-container" class="hidden" onclick="toggleHelp()">
<div id="help">
<h1> WebGL2 Conway's Game of Life</h1>
<a href="https://www.linkedin.com/in/joe-lynch-aa931b58" target="_blank">Joe Lynch</a><br>
<a href="https://github.com/joeblynch/webgl2-game-of-life" target="_blank">GitHub</a>
<table>
<tbody>
<tr>
<td>[double click] or [f]</td>
<td>toggle fullscreen (recommended)</td>
</tr>
<tr>
<td>[space]</td>
<td>pause / resume</td>
</tr>
<tr>
<td>[down]</td>
<td>decrease speed</td>
</tr>
<tr>
<td>[up]</td>
<td>increase speed</td>
</tr>
<tr>
<td>[left]</td>
<td>decrease dead cell brightness</td>
</tr>
<tr>
<td>[right]</td>
<td>increase dead cell brightness</td>
</tr>
<tr>
<td>[shift]+[left]</td>
<td>decrease dead cell saturation</td>
</tr>
<tr>
<td>[shift]+[right]</td>
<td>increase dead cell saturation</td>
</tr>
<tr>
<td>[ctrl]+[left]</td>
<td>decrease alive cell brightness</td>
</tr>
<tr>
<td>[ctrl]+[right]</td>
<td>increase alive cell brightness</td>
</tr>
<tr>
<td>[ctrl]+[shift]+[left]</td>
<td>decrease alive cell saturation</td>
</tr>
<tr>
<td>[shift]+[shift]+[right]</td>
<td>increase alive cell saturation</td>
</tr>
<tr>
<td>[shift]+[-]</td>
<td>decrease cell size (reset universe)</td>
</tr>
<tr>
<td>[shift]+[+]</td>
<td>increase cell size (reset universe)</td>
</tr>
<tr>
<td>[h] or [?]</td>
<td>toggle help</td>
</tr>
<tr>
<td>[r]</td>
<td>restart universe (same entropy)</td>
</tr>
<tr>
<td>[shift]+[r]</td>
<td>reset universe (new entropy)</td>
</tr>
<tr>
<td>[t]</td>
<td>toggle rendered texture</td>
</tr>
<tr>
<td>[u]</td>
<td>toggle UI</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="lib/picogl.min.js"></script>
<script src="main.js"></script>
</body>
</html>