-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
159 lines (159 loc) · 5.31 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lattice Boltzmann Fluid Simulation</title>
<style>
body { margin: 0; overflow: hidden; background-color: #000; }
#settings {
position: absolute;
top: 10px;
left: 10px;
background: rgba(255,255,255,0.8);
padding: 10px;
border-radius: 5px;
font-family: Arial, sans-serif;
font-size: 14px;
color: #333;
z-index: 10;
width: 250px; /* Set a fixed width */
max-height: 80vh; /* Limit maximum height */
overflow-y: auto;
}
#settings h2 {
margin-top: 0;
}
#settings label {
display: block;
margin-bottom: 10px;
}
#settings input[type=range],
#settings select {
width: 100%;
}
#settings button {
width: 100%;
margin-top: 5px;
}
#toggleSettings {
background: rgba(255,255,255,0.8);
border: none;
border-radius: 5px;
padding: 5px 10px;
cursor: pointer;
font-family: Arial, sans-serif;
font-size: 14px;
color: #333;
width: 100%;
margin-bottom: 10px;
}
#helpModal {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80vw;
max-width: 600px;
background: rgba(255,255,255,0.95);
padding: 20px;
border-radius: 10px;
z-index: 20;
overflow-y: auto;
max-height: 80vh;
box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#helpModal h3 {
margin-top: 0;
}
#helpOverlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
z-index: 15;
}
#closeHelp {
position: absolute;
top: 10px;
right: 10px;
background: #ccc;
border: none;
border-radius: 5px;
padding: 5px 10px;
cursor: pointer;
}
#canvas {
display: block;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="settings">
<button id="toggleSettings">Hide Settings</button>
<h2>Simulation Settings</h2>
<label>
Viscosity:
<input type="range" id="viscosity" min="0.6" max="1.8" step="0.1" value="1.0">
</label>
<label>
Force Strength:
<input type="range" id="forceStrength" min="0.1" max="1.0" step="0.1" value="0.5">
</label>
<label>
Brush Size:
<input type="range" id="brushSize" min="1" max="10" step="1" value="3">
</label>
<label>
Obstacle Brush Size:
<input type="range" id="obstacleBrushSize" min=".1" max="10" step="1" value="1">
</label>
<label>
Cell Size:
<input type="range" id="cellSize" min="2" max="10" step="1" value="4">
</label>
<label>
Vector Field Spacing:
<input type="range" id="vectorSpacing" min="5" max="50" step="1" value="15">
</label>
<label>Visualizations:</label>
<label><input type="checkbox" id="visualization-velocity" checked> Velocity</label>
<label><input type="checkbox" id="visualization-density"> Density</label>
<label><input type="checkbox" id="visualization-pressure"> Pressure</label>
<label><input type="checkbox" id="visualization-vorticity"> Vorticity</label>
<label><input type="checkbox" id="visualization-vectorField"> Vector Field</label>
<button id="reset">Reset Simulation</button>
<button id="clearObstacles">Clear Obstacles</button>
<button id="pauseResume">Pause Simulation</button>
<button id="helpButton">Help</button>
</div>
<div id="helpOverlay"></div>
<div id="helpModal">
<button id="closeHelp">Close</button>
<h3>Help</h3>
<p>This is a Lattice Boltzmann fluid simulation.</p>
<p><strong>Controls:</strong></p>
<ul>
<li><strong>Left Click:</strong> Apply force to the fluid.</li>
<li><strong>Right Click:</strong> Draw obstacles.</li>
<li>Use the sliders to adjust simulation parameters.</li>
</ul>
<p><strong>Visualization Options:</strong></p>
<ul>
<li>Select different properties to visualize, such as velocity, density, pressure, and vorticity.</li>
<li>Adjust the vector field spacing using the slider.</li>
</ul>
<p><strong>Notes:</strong></p>
<ul>
<li>Adjust the cell size for better performance or higher resolution.</li>
<li>Increasing viscosity will make the fluid flow more slowly.</li>
<li>Decreasing/Increasing the window size of the browser will effect performance; use a smaller window if its too laggy.</li>
</ul>
</div>
<script src="index.js"></script>
</body>
</html>