-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
193 lines (190 loc) · 5.4 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
<html>
<head>
<title>virus-spread</title>
<link rel="stylesheet" type="text/css" href="infection_simulation.css" />
</head>
<body>
<div id="top">
<h1>Virus Spread</h1>
<nav>
<ul>
<li>
<a style="color: white;" href="./index.html"
>infection simulation</a
>
</li>
<li>
<a style="color: white;" href="./population_simulation.html"
>population simulation</a
>
</li>
</ul>
</nav>
</div>
<div id="simulation">
<h3>Simulation:</h3>
<button id="inf_btn">step!</button>
<button id="start_btn">start!</button>
<button id="stop_btn">stop!</button>
<br />
<br />
<div id="canvascontainer"></div>
</div>
<div id="settings">
<h3>Settings:</h3>
<ul>
<ul class="tab_bar">
<button
class="tab_button tab-selected"
onclick="openSetting(event, 'population_settings')"
>
Population
</button>
<button
class="tab_button"
onclick="openSetting(event, 'infection_settings')"
>
Infection
</button>
</ul>
<div class="settings_group" id="population_settings" class="settings">
<label style="color: white;" for="pop_size_input"
>population size (#)</label
>
<input
type="number"
id="pop_size_input"
name="population size"
min="1"
max="100000"
/><br />
<label style="color: white;" for="sim_spd_input"
>simulation speed (#ms)</label
>
<input
type="number"
id="sim_spd_input"
name="simulation speed"
min="1"
max="1000"
/><br />
<label style="color: white;" for="in_inf_input"
>initial infection chance (%)</label
>
<input
type="number"
id="in_inf_input"
name="initial infection chance"
min="0"
max="100"
/><br />
</div>
<div
class="settings_group"
id="infection_settings"
class="settings"
style="display: none;"
>
<label style="color: white;" for="inf_input"
>infection chance (%)</label
>
<input
type="number"
id="inf_input"
name="infection chance"
min="0"
max="100"
/><br />
<label style="color: white;" for="death_input"
>death chance for infected (%)</label
>
<input
type="number"
id="death_input"
name="death chance"
min="0"
max="100"
/><br />
<input
style="color: white;"
type="checkbox"
id="dev_imm"
name="develop immunity"
/>
<label style="color: white;" for="dev_imm"
>people do recovery period</label
><br />
<ul id="immunity_settings">
<label style="color: white;" for="imm_input"
>number of survivials for recovery period (#)</label
>
<input
type="number"
id="imm_input"
name="immunity development number"
min="0"
max="1000"
/>
</ul>
<input
style="color: white;"
type="checkbox"
id="imm_infect"
name="immune infect"
/>
<label style="color: white;" for="imm_infect"
>Recoverting people infect others</label
><br />
<input
style="color: white;"
type="checkbox"
id="imm_recover"
name="immune recover"
/>
<label style="color: white;" for="imm_recover"
>Recovering people recover</label
>
<ul id="recovery_time_settings">
<label for="imm_recover_time">recovery time (#)</label>
<input
type="number"
id="imm_recover_time"
name="immunity recovery time"
min="0"
max="1000"
/>
</ul>
</div>
<br />
<button id="set_btn">enter settings and reset</button>
</ul>
</div>
<div id="graphs">
<h3>Graphs:</h3>
<button id="showhide_graph">show/hide graph</button>
<div id="chart-container" style="display: block; margin-bottom: 100px;">
<h2>Current Percentages of Population</h2>
<p>Click category to hide:</p>
<canvas id="infectedChart" width="50" height="50"></canvas>
<div
id="chart-container"
style="
display: block;
height: 300px;
width: 300px;
margin-bottom: 100px;
"
>
<h2>Total Active Number</h2>
<p>Also includes total number of dead people</p>
<canvas id="barChart" width="50" height="50px"></canvas>
</div>
</div>
</div>
<!-- Scripts -->
<script src="Chart.js"></script>
<script src="p5/p5.js"></script>
<script src="infection_simulation.js"></script>
<script src="infection_visuals.js"></script>
</body>
</html>