-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
297 lines (274 loc) · 14.1 KB
/
Copy pathapp.html
File metadata and controls
297 lines (274 loc) · 14.1 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Projectile Motion Simulator</title>
<link rel="stylesheet" href="src/css/app.css">
</head>
<body>
<!-- Top Header with attribution and help -->
<header class="shell">
<div class="hero">
<div class="hero-top">
<div>
<p class="kicker">The Thinking Experiment</p>
<h1>🚀 Projectile Motion Simulator</h1>
<p class="subtitle">Interactive Physics Simulation</p>
</div>
</div>
</div></header>
<div class="container">
<main>
<!-- LEFT PANEL: Controls -->
<aside class="controls-section">
<h2>⚙️ Controls</h2>
<!-- Step-by-Step Instructions -->
<div class="instructions">
<h3>📖 How to Use:</h3>
<ol>
<li>Choose a <strong>projectile type</strong> below</li>
<li>Adjust <strong>parameters</strong> with sliders</li>
<li>Click <strong>Launch</strong> to see the motion</li>
<li>Observe the <strong>two-column analysis</strong> on the right</li>
</ol>
</div>
<!-- Mode Selection -->
<div class="mode-selection">
<h3>Step 1: Choose Projectile Type</h3>
<div class="type-buttons">
<button class="type-btn active" data-type="vertical">
<span class="icon">⬆️</span>
<div class="text">
<div>Vertical</div>
<small style="opacity: 0.7;">Throw up or down</small>
</div>
</button>
<button class="type-btn" data-type="horizontal">
<span class="icon">➡️</span>
<div class="text">
<div>Horizontal</div>
<small style="opacity: 0.7;">Launch from height</small>
</div>
</button>
<button class="type-btn" data-type="angled">
<span class="icon">↗️</span>
<div class="text">
<div>Angled</div>
<small style="opacity: 0.7;">Launch at angle</small>
</div>
</button>
</div>
</div>
<!-- Parameters -->
<div class="parameters">
<h3>Step 2: Set Parameters</h3>
<div class="param-group">
<label>
<span>⚡ Initial Velocity</span>
<span class="value-display" id="v0Display">20 m/s</span>
</label>
<input type="range" id="initialVelocity" min="-50" max="50" value="20" step="0.5" title="Initial velocity (can be negative)">
</div>
<div class="param-group" id="angleGroup" style="display: none;">
<label>
<span>📐 Launch Angle</span>
<span class="value-display" id="angleDisplay">45°</span>
</label>
<input type="range" id="angle" min="0" max="90" value="45" step="1" title="Launch angle">
</div>
<div class="param-group" id="heightGroup">
<label>
<span>🏔️ Launch Height</span>
<span class="value-display" id="h0Display">0 m</span>
</label>
<input type="range" id="initialHeight" min="0" max="50" value="0" step="0.5" title="Initial height">
</div>
<div class="param-group">
<label>
<span>🌍 Gravity</span>
<span class="value-display" id="gDisplay">9.8 m/s²</span>
</label>
<input type="range" id="gravity" min="1" max="20" value="9.8" step="0.1" title="Gravity">
</div>
</div>
<!-- Control Buttons -->
<!-- Prediction Section -->
<div class="param-group" id="predictGroup">
<label><span>📝 Predict:</span></label>
<div class="predict-flex">
<input type="number" id="predictTime" placeholder="Time (s)" class="predict-input" title="Predict time of flight">
<input type="number" id="predictHeight" placeholder="Max Height (m)" class="predict-input height" title="Predict max height">
<input type="number" id="predictRange" placeholder="Range (m)" class="predict-input range" title="Predict range">
</div>
<small>Enter your prediction(s) before launching!</small>
</div>
<div class="control-buttons">
<button id="launchBtn" class="btn-primary">
<span>🚀</span> Launch
</button>
<button id="pauseBtn" class="btn-secondary" disabled>
<span>⏸️</span> Pause
</button>
<button id="resetBtn" class="btn-secondary">
<span>🔄</span> Reset
</button>
</div>
<div id="resultPanel"></div>
<div id="modalOverlay" class="modal-overlay hidden">
<div id="modalContent" class="modal-content">
<div class="modal-header">
<div id="modalTabs" class="modal-tabs"></div>
<button id="closeModalBtn" class="close-modal-btn">✖️</button>
</div>
<div id="modalBody"></div>
</div>
</div>
</aside>
<!-- CENTER PANEL: Visualization -->
<section class="visualization-section">
<h2>📊 Visualization</h2>
<div class="viz-controls">
<button class="viz-btn" id="slowMotion">🐌 Slow Motion</button>
<button class="viz-btn active" id="showVectors">📊 Vectors</button>
<button class="viz-btn active" id="showGrid">📐 Grid</button>
<button class="viz-btn active" id="showTrail">🎨 Trail</button>
</div>
<div id="canvasContainer"></div>
</section>
<!-- RIGHT PANEL: Analysis -->
<aside class="analysis-section">
<h2>📈 Two-Column Analysis</h2>
<div class="two-columns">
<!-- Horizontal Column -->
<div class="column horizontal-column">
<h3>➡️ Horizontal (X-axis)</h3>
<div class="equations">
<div class="equation-line">
<span class="label">Motion type:</span>
<span class="value">Uniform (constant v)</span>
</div>
<div class="equation-line">
<span class="label">Initial velocity:</span>
<span class="value" id="vx0">v₀ₓ = 0 m/s</span>
</div>
<div class="equation-line">
<span class="label">Acceleration:</span>
<span class="value" id="ax">aₓ = 0 m/s²</span>
</div>
<div class="equation-line">
<span class="label">Position:</span>
<span class="value" id="xPos">x = v₀ₓ·t</span>
</div>
<div class="equation-line highlight">
<span class="label">Current x:</span>
<span class="value live" id="currentX">0.0 m</span>
</div>
<div class="equation-line">
<span class="label">Current vₓ:</span>
<span class="value live" id="currentVx">0.0 m/s</span>
</div>
</div>
</div>
<!-- Vertical Column -->
<div class="column vertical-column">
<h3>⬆️ Vertical (Y-axis)</h3>
<div class="equations">
<div class="equation-line">
<span class="label">Motion type:</span>
<span class="value">Accelerated (gravity)</span>
</div>
<div class="equation-line">
<span class="label">Initial velocity:</span>
<span class="value" id="vy0">v₀ᵧ = 20 m/s</span>
</div>
<div class="equation-line">
<span class="label">Acceleration:</span>
<span class="value" id="ay">aᵧ = -9.8 m/s²</span>
</div>
<div class="equation-line">
<span class="label">Position:</span>
<span class="value" id="yPos">y = v₀ᵧ·t - ½g·t²</span>
</div>
<div class="equation-line highlight">
<span class="label">Current y:</span>
<span class="value live" id="currentY">0.0 m</span>
</div>
<div class="equation-line">
<span class="label">Current vᵧ:</span>
<span class="value live" id="currentVy">0.0 m/s</span>
</div>
</div>
</div>
</div>
<!-- Results -->
<div class="results">
<h3>📋 Calculated Results</h3>
<div class="result-grid">
<div class="result-item">
<span class="label">⏱️ Time of Flight:</span>
<span class="value" id="timeOfFlight">—</span>
</div>
<div class="result-item">
<span class="label">🏔️ Max Height:</span>
<span class="value" id="maxHeight">—</span>
</div>
<div class="result-item">
<span class="label">📏 Range:</span>
<span class="value" id="range">—</span>
</div>
<div class="result-item">
<span class="label">⏲️ Current Time:</span>
<span class="value" id="currentTime">0.00 s</span>
</div>
</div>
</div>
<!-- Help Section -->
<div class="help-section">
<h3>💡 Tips for Current Mode</h3>
<div class="help-content">
<ul id="tipsList">
<li>Vertical projectiles have no horizontal motion (vₓ = 0)</li>
<li>Time to go up equals time to come down</li>
<li>Maximum height occurs when vᵧ = 0</li>
<li>Try different velocities to see how height changes</li>
</ul>
</div>
</div>
</aside>
</main>
<footer>
<p>© 2026 Vladimir Lopez · The Thinking Experiment · Interactive Physics Simulations</p>
</footer>
</div>
<!-- App Footer with copyright -->
<footer class="app-footer">
<p>© 2025 Vladimir Lopez. Licensed under the MIT License.
<a href="https://github.com/vladimirlopez/Projectiles-Simulation-Copilot-version" target="_blank" rel="noopener">View on GitHub</a></p>
</footer>
<!-- Modal for Help/Game Rules -->
<div id="modalOverlay" class="modal-overlay hidden">
<div id="modalContent" class="modal-content">
<div class="modal-header">
<div id="modalTabs" class="modal-tabs"></div>
<button id="closeModalBtn" class="close-modal-btn">✖️</button>
</div>
<div id="modalBody"></div>
</div>
</div>
<!-- p5.js Library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.7.0/p5.min.js"></script>
<!-- Visualization (p5.js sketch, must load after p5.js) -->
<script src="src/js/visualization.js"></script>
<!-- Main Application (must be a module, loads last) -->
<script type="module" src="src/js/main.js"></script>
<!-- DEBUG TEST: Remove after debugging -->
<script>
document.addEventListener('DOMContentLoaded', function() {
console.log('DOM loaded');
console.log('Type buttons:', document.querySelectorAll('.type-btn'));
console.log('Launch button:', document.getElementById('launchBtn'));
});
</script>
</body>
</html>