-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
43 lines (43 loc) · 1.23 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
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/addons/p5.dom.min.js"></script>
</head>
<body>
<div class="buttons">
<button onclick="noLoop();isLoop= false;setStatus()">pause</button>
<button onclick="loop();isLoop= true;setStatus()">resume</button>
<button
onclick="noLoop();isLoop= true;redraw();isLoop= false;setStatus()"
>
step+
</button>
<button onclick="noLoop();isLoop= false;clearCells();redraw();setStatus()">
clear
</button>
<button onclick="initialGen();redraw();loop();isLoop= true;setStatus()">
random
</button>
<span id="status"> </span>
</div>
<script src="sketch.js"></script>
</body>
<style>
.buttons {
margin-left: 20px;
position: absolute;
}
</style>
<script>
document.body.style.margin = 0;
function setStatus() {
document.getElementById("status").innerHTML = isLoop
? "Running"
: "Paused";
document.getElementById("status").style.backgroundColor = isLoop
? "rgb(72, 250, 2)"
: "red";
}
setStatus();
</script>
</html>