-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
154 lines (141 loc) · 7.33 KB
/
index.html
File metadata and controls
154 lines (141 loc) · 7.33 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/style.css">
<link rel="stylesheet" href="styles/materials.css">
<title>Particle physics sandbox</title>
</head>
<body>
<div id="sideMenu">
<div>
<div id="fullscreen" class="button"><p>Go fullscreen</p></div>
<div id="clearPlayground" class="button">Clear playground</div>
</div>
<div id="frameCounter"></div>
</div>
<div id="playground">
<div id="floor"></div>
<div id="left-wall"></div>
<div id="right-wall">
<div id="scale"><p>2 meters</p></div>
</div>
<div id="ceiling"></div>
</div>
<!-- Edit and tools menu -->
<div class="menu">
<!-- Global variables modification menu -->
<div class="subMenuContainer">
<div id="gravityButton" class="button"><p>Toggle gravity</p></div>
<label for="gravityFactor">Gravity factor : </label>
<input type="range" id="gravityFactor" value="1" min="0" max="10" step="0.1" oninput="this.nextElementSibling.value = this.value;">
<output>1</output>
<label for="airDensity">Air density : </label>
<input type="number" id="airDensity" value="1.225" min="0" onchange="
if (parseInt(this.value) > parseInt(this.max)) this.value = parseInt(this.max);
if (parseInt(this.value) < parseInt(this.min)) this.value = parseInt(this.min);
">
<div id="variablesApplyButton" class="button apply">Apply</div>
</div>
<!-- Tool selection menu -->
<div class="subMenuContainer">
<div class="button" id="particleCreatorButton">Particle creator</div>
<div class="button" id="zoneCreatorButton">Zones</div>
<div class="button" id="objectCreatorButton">Objects</div>
<div class="button" id="inspectorToolButton">Inspector</div>
<div class="button" id="pusherToolButton">Pusher</div>
</div>
<!-- Creation tools -->
<div class="subMenuContainer">
<!-- Particle tool -->
<div id="particleTool">
<!-- Variables and sliders-->
<div class="menuColumn">
<h2>Custom particle</h2>
<label for="size">Diameter (cm) : </label>
<input type="number" id="size" value="30" min="1" max="970" step="10" onchange="
if (parseInt(this.value) > parseInt(this.max)) this.value = parseInt(this.max);
if (parseInt(this.value) < parseInt(this.min)) this.value = parseInt(this.min);
document.getElementById('mass').value = Math.round(((4/3) * Math.PI * Math.pow((parseInt(this.value)/2), 3) * (parseFloat(document.getElementById('density').value)/ 1000000)) * 1000) / 1000;
">
<label for="density">Density (kg/m³) : </label>
<input type="number" id="density" min="0.1" max="22590" value="1000" onchange="
if (parseInt(this.value) > parseInt(this.max)) this.value = parseInt(this.max);
if (parseInt(this.value) < parseInt(this.min)) this.value = parseInt(this.min);
document.getElementById('mass').value = Math.round(((4/3) * Math.PI * Math.pow((parseInt(document.getElementById('size').value)/2), 3) * (parseFloat(this.value)/ 1000000))*1000)/1000;
" list="densities">
<datalist id="densities">
<option value="0.18" label="Helium">Helium</option>
<option value="1.225">Air</option>
<option value="575">Chestnut wood</option>
<option value="1000">Water</option>
<option value="7850">Steel</option>
<option value="22590">Osmium</option>
</datalist>
<label for="mass">Mass (kg) : </label>
<input type="number" id="mass" value="14.137" readonly>
<label for="elasticity">Elasticity : </label>
<input type="range" id="elasticity" value="0.5" min="0" max="1" step="0.01" oninput="this.nextElementSibling.value = this.value;">
<output>0.50</output>
<div>
<label for="insideColor">Color : </label>
<input type="color" id="insideColor" value="#FF0000">
</div>
<div>
<label for="hasGravity">Has gravity : </label>
<input type="checkbox" id="hasGravity" checked>
</div>
<div>
<label for="isMovable">Is movable : </label>
<input type="checkbox" id="isMovable" checked disabled>
</div>
</div>
<!-- Materials -->
<div class="menuColumn" id="materialsColumn">
<h2>Density presets</h2>
<!-- Filled with JS loop -->
</div>
<div id="particleToolApply" class="button apply">Apply</div>
</div>
<!-- Zone tool -->
<div id="zoneTool">
<div class="menuColumn" id="densityZonesColumn">
<h2>Density zones</h2>
</div>
<div class="menuColumn" id="effectZonesColumn">
<h2>Effect zones</h2>
<!-- Filled with JS loop -->
</div>
</div>
<!-- Object tool -->
<div id="objectTool">
<div class="menuColumn" id="objectsList">
</div>
</div>
<!-- Inspector tool -->
<div id="inspectorTool">
<div class="menuColumn" id="inspectorInfo">
</div>
</div>
<!-- Pusher tool -->
<div id="pusherTool">
<div class="menuColumn">
</div>
</div>
</div>
<!-- Modal tutorial window -->
<dialog>
<button id="closeButton">X</button>
<h2>Guide</h2>
<ul>
<li>Use the scroll wheel to spawn particles</li>
<li>Use the pusher tool to push particles around</li>
<li><a href="https://github.com/BasileDM/Physics-engine-simulation-game" target="_blank">Github repository</a></li>
</ul>
</dialog>
<div id="tutorial"></div>
</div>
<script src="scripts/app.js" type="module"></script>
</body>
</html>