-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
143 lines (126 loc) · 6.39 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Transmission Simulator</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec2 aVertexPosition;
uniform vec2 uScalingFactor;
uniform vec2 uTranslationVector;
void main() {
vec2 translatedPosition = vec2(
aVertexPosition.x + uTranslationVector.x,
aVertexPosition.y + uTranslationVector.y
);
gl_Position = vec4(translatedPosition * uScalingFactor, 0.0, 1.0);
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform vec4 uGlobalColor;
void main() {
gl_FragColor = uGlobalColor;
}
</script>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="scheduler.js"></script>
<script src="chart.js"></script>
<script src="renderer.js"></script>
<script src="simulation.js"></script>
<div id="mainDiv">
<h1>Transmission Simulator</h1>
<div id="upperBox">
<canvas id="drawArea" moz-opaque></canvas>
<div id="inputPanel">
<button class="button" id="startButton" onclick="StartSim()" style="width: 100%; margin-bottom: 10px;">Start Simulation</button>
<!--<button class="button" id="startPause" onclick="PauseSim()" style="width:50%; float:left;" disabled=true>Pause</button>-->
<button class="button" id="stopButton" onclick="StopSim()" style="width: 100%; margin-bottom: 10px;" disabled=true>End Simulation</button>
<div class="attributeGroup">
<div class="groupHeading">Population Attributes</div>
<div class="inputItem">Speed:
<select id='speedSelector'>
<option value="0.3">Slowest</option>
<option value="0.5" selected="selected">Slow</option>
<option value="1">Medium</option>
<option value="2">Fast</option>
</select>
</div>
<div class="inputItem">Population:
<select id='populationSelector'>
<option value="100">100</option>
<option value="300">300</option>
<option value="500" selected="selected">500</option>
<option value="750">750</option>
<option value="1000">1000</option>
<option value="2000">2000</option>
</select>
</div>
</div>
<div class="attributeGroup">
<div class="groupHeading">Contagion Attributes</div>
<div class="inputItem">Recovery Time:
<input type="range" class="slider" id="recoveryTimeSelector" min="1" max="10" value="6" step="1" onchange="SetRecoveryTime()"
oninput="recoveryTimeLabelObj.innerHTML = recoveryTimeSelectorObj.value;">
<label id="recoveryTimeLabel" for="recoveryTimeSelector">6</label>
</div>
<div class="inputItem">Critical Case Rate:
<input type="range" class="slider" id="criticalCaseRateSelector" min="0" max="1" value="0.15" step="0.05" onchange="SetCriticalCaseRate()"
oninput="criticalCaseRateLabelObj.innerHTML = criticalCaseRateSelectorObj.value;">
<label id="criticalCaseRateLabel" for="criticalCaseRateSelector">0.15</label>
</div>
<div class="inputItem">Death Rate (no icu):
<input type="range" class="slider" id="criticalDeathRateSelector" min="0" max="1" value="0.90" step="0.05" onchange="SetCriticalDeathRate()"
oninput="criticalDeathRateLabelObj.innerHTML = criticalDeathRateSelectorObj.value;">
<label id="criticalDeathRateLabel" for="criticalDeathRateSelector">0.90</label>
</div>
</div>
<div class="attributeGroup">
<div class="groupHeading">Hospital Attributes</div>
<div class="inputItem">ICU Capacity:
<input type="range" class="slider" id="icuCapacitySelector" min="0" max="20" value="2" step="1" onchange="SetIcuCapacity()"
oninput="icuCapacityLabelObj.innerHTML = icuCapacitySelectorObj.value;">
<label id="icuCapacityLabel" for="icuCapacitySelector">2</label>
</div>
<div class="inputItem">Death Rate (with icu):
<input type="range" class="slider" id="icuDeathRateSelector" min="0" max="1" value="0.05" step="0.05" onchange="SetIcuDeathRate()"
oninput="icuDeathRateLabelObj.innerHTML = icuDeathRateSelectorObj.value;">
<label id="icuDeathRateLabel" for="icuDeathRateSelector">0.05</label>
</div>
</div>
<div class="attributeGroup">
<div class="groupHeading">Reduce Interaction</div>
<div class="inputItem">Population Percent:
<input type="range" class="slider" id="popPercentSelector" min="0" max="100" value="0" step="5" onchange="SetPopPercent()"
oninput="popPercentLabelObj.innerHTML = popPercentSelectorObj.value;">
<label id="popPercentLabel" for="popPercentSelector">0</label>
</div>
<div class="inputItem">Speed Reduction:
<input type="range" class="slider" id="speedReductionSelector" min="30" max="100" value="50" step="10" onchange="SetSpeedReduction()"
oninput="speedReductionLabelObj.innerHTML = speedReductionSelectorObj.value;">
<label id="speedReductionLabel" for="speedReductionSelector">50</label>
</div>
</div>
</div>
</div>
<div id="statBox">
<div id="textPanel">
<div class="attributeGroup">
<div class="statItem">Healthy: <span class="statValue" id="healthyCount" style="color:rgb(90,160,255);">0</span></div>
<div class="statItem" style="margin-top: 8px; margin-bottom: 3px;">Infected: <span class="statValue" id="infectedCount" style="color:rgb(180,100,60);">0</span></div>
<div style="padding: 10px; background-color: #E0E0F5;">
<div class="statItem">Critical: <span class="statValue" id="criticalCount" style="color:rgb(255,0,0);">0</span></div>
<div class="statItem" style="margin-top: 8px">In ICU: <span class="statValue" id="icuCount" style="color:rgb(255,0,200);">0</span></div>
</div>
<div class="statItem" style="margin-top: 8px">Recovered: <span class="statValue" id="recoveredCount" style="color:rgb(150,200,130);">0</span></div>
<div class="statItem" style="margin-top: 8px">Deaths: <span class="statValue" id="deathCount" style="color:rgb(0,0,0);">0</span></div>
</div>
</div><div id="graphArea"></div>
</div>
</div>
</body>
</html>