-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
176 lines (173 loc) · 5.87 KB
/
Copy pathindex.html
File metadata and controls
176 lines (173 loc) · 5.87 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gravity Simulator</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
font-family: Arial, sans-serif;
}
#controls {
position: absolute;
top: 10px;
left: 10px;
background: rgba(255, 255, 255, 0.9);
padding: 15px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
z-index: 1000;
pointer-events: auto;
/* The info panel is anchored to the bottom of the viewport and is capped
at 180px tall. Capping this one to the remaining space keeps the two
from overlapping in a short window — they used to collide below about
640px of viewport height. On a normal screen this is far larger than
the panel's natural ~500px, so nothing moves. */
max-height: calc(100vh - 210px);
overflow-y: auto;
}
#controls h3 {
margin: 0 0 10px 0;
font-size: 16px;
}
#controls label {
display: block;
margin: 8px 0;
font-size: 12px;
}
#controls input[type="range"] {
width: 150px;
}
#controls button {
margin-top: 10px;
padding: 6px 12px;
cursor: pointer;
border: none;
background: #4CAF50;
color: white;
border-radius: 4px;
font-size: 12px;
}
#controls button:hover {
background: #45a049;
}
#info {
position: absolute;
bottom: 10px;
left: 10px;
background: rgba(255, 255, 255, 0.9);
padding: 10px;
border-radius: 8px;
font-size: 12px;
z-index: 1000;
pointer-events: auto;
max-width: 250px;
/* Paired with the cap on #controls above: 180 + 10 + 10 + 10 = 210. */
max-height: 180px;
overflow-y: auto;
box-sizing: border-box;
}
.particle-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px;
margin: 2px 0;
background: rgba(200, 220, 255, 0.3);
border-radius: 4px;
font-size: 11px;
}
.particle-item button {
padding: 2px 6px;
font-size: 10px;
cursor: pointer;
border: none;
background: #ff6b6b;
color: white;
border-radius: 3px;
}
.particle-item button:hover {
background: #ff5252;
}
</style>
</head>
<body>
<div id="controls">
<h3>Controls</h3>
<label>
Mass: <span id="massValue">200</span>
<input type="range" id="massSlider" min="100" max="5000" value="200" step="50">
</label>
<label>
Vector Range: <span id="rangeValue">150</span>px
<input type="range" id="rangeSlider" min="100" max="500" value="150" step="50">
</label>
<div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #ddd;">
<strong style="font-size: 13px;">Render Settings</strong>
</div>
<label>
Object Size: <span id="objectSizeValue">1.0</span>x
<input type="range" id="objectSizeSlider" min="0.3" max="3.0" value="1.0" step="0.1">
</label>
<label>
Arrow Size: <span id="arrowSizeValue">1.0</span>x
<input type="range" id="arrowSizeSlider" min="0.3" max="3.0" value="1.0" step="0.1">
</label>
<div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #ddd;">
<strong style="font-size: 13px;">Camera</strong>
</div>
<div style="font-size: 11px; margin: 5px 0; color: #666;">
Zoom: <span id="zoomValue">100</span>%<br>
<span style="font-size: 10px;">Scroll wheel to zoom<br>Middle-click or Ctrl+drag to pan</span>
</div>
<button id="resetCameraBtn" style="width: 100%; margin-top: 5px;">Reset Camera</button>
<label>
<input type="checkbox" id="showVectors" checked> Show Vector Field
</label>
<label>
<input type="checkbox" id="showParticleVectors" checked> Show Particle Vectors
</label>
<label>
<input type="checkbox" id="showTrails" checked> Show Trails
</label>
<div style="margin-top: 8px; padding-top: 8px; border-top: 1px solid #ddd;">
<label style="font-size: 11px;">
Grid Mode:
<select id="gridModeSelect" style="margin-left: 5px; padding: 2px;">
<option value="adaptive">Adaptive (Dense near objects)</option>
<option value="uniform">Uniform (Regular grid)</option>
</select>
</label>
</div>
<button id="clearBtn">Clear All</button>
<button id="pauseBtn">Pause</button>
</div>
<div id="info">
<strong>Click</strong> to add objects<br>
<strong>Drag</strong> to add velocity<br>
Objects: <span id="objectCount">0</span>
<div id="particleList" style="margin-top: 8px; max-height: 105px; overflow-y: auto;">
<!-- Particle list will be populated here -->
</div>
</div>
<div id="legend" style="position: absolute; bottom: 10px; right: 10px; background: rgba(255, 255, 255, 0.9); padding: 10px; border-radius: 8px; font-size: 11px; z-index: 1000; pointer-events: auto;">
<strong>Vector Field:</strong><br>
<div style="margin-top: 5px;">
<span style="color: #ff0000; font-weight: bold;">●</span> Strong Force<br>
<span style="color: #ffff00; font-weight: bold;">●</span> Medium-High<br>
<span style="color: #00ff00; font-weight: bold;">●</span> Medium<br>
<span style="color: #00ffff; font-weight: bold;">●</span> Medium-Low<br>
<span style="color: #0000ff; font-weight: bold;">●</span> Weak Force
</div>
<div style="margin-top: 10px; padding-top: 8px; border-top: 1px solid #ccc;">
<strong>Particle Vectors:</strong><br>
<span style="color: #ff8800; font-weight: bold;">→</span> Gravitational Force<br>
<span style="color: #00ffff; font-weight: bold;">→</span> Velocity (Movement)
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>