-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
309 lines (298 loc) · 14 KB
/
Copy pathindex.html
File metadata and controls
309 lines (298 loc) · 14 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
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NBA Shot Chart 3D</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=DM+Mono:wght@400;500&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<canvas id="canvas"></canvas>
<div id="transition-overlay"></div>
<!-- Left HUD: branding + playback -->
<div id="ctrl-left" class="hud-card anim-left">
<div id="brand">
<div id="brand-eyebrow">NBA · 2025–26 SEASON</div>
<div id="brand-title">Shot Chart 3D</div>
<div id="brand-player"></div>
</div>
<div class="card-div"></div>
<div id="playback">
<button id="btnPlay" aria-label="Play">▶ Play</button>
<button id="btnReplay" class="icon-btn" title="Replay" aria-label="Replay">↺</button>
</div>
<div id="progress-track">
<div id="progress-bar"></div>
<div id="progress-thumb"></div>
</div>
</div>
<!-- Right HUD: configuration -->
<div id="ctrl-right" class="hud-card anim-right">
<div class="cfg-sec clickable" id="player-trigger-sec">
<span class="cfg-lbl cfg-lbl-row">Player</span>
<div class="player-trigger empty" id="player-trigger">
<span class="player-trigger-name" id="player-trigger-name">Select player</span>
<span class="player-trigger-team" id="player-trigger-team" style="display:none"></span>
</div>
</div>
<div class="card-div"></div>
<div class="cfg-sec clickable" id="filter-trigger-sec">
<span class="cfg-lbl cfg-lbl-row">Filter</span>
<div class="filter-trigger">
<span class="filter-summary" id="filter-summary">All shots</span>
<span class="filter-count" id="filter-count">5</span>
</div>
</div>
<div class="card-div"></div>
<div class="cfg-pair">
<div class="cfg-sec">
<span class="cfg-lbl">Speed</span>
<div class="speed-pills" id="speed-pills" role="radiogroup" aria-label="Animation speed">
<button class="pill-btn" data-speed="0.5" role="radio" aria-checked="false">0.5×</button>
<button class="pill-btn active" data-speed="1" role="radio" aria-checked="true">1×</button>
<button class="pill-btn" data-speed="2" role="radio" aria-checked="false">2×</button>
<button class="pill-btn" data-speed="5" role="radio" aria-checked="false">5×</button>
<button class="pill-btn" data-speed="10" role="radio" aria-checked="false">10×</button>
</div>
<select class="cfg-select" id="speed-select" aria-label="Animation speed">
<option value="0.5">0.5×</option>
<option value="1" selected>1×</option>
<option value="2">2×</option>
<option value="5">5×</option>
<option value="10">10×</option>
</select>
</div>
<div class="card-div"></div>
<div class="cfg-sec">
<span class="cfg-lbl">Camera</span>
<div class="speed-pills" id="camera-pills" role="radiogroup" aria-label="Camera view">
<button class="pill-btn active" data-cam="broadcast" role="radio" aria-checked="true" title="Broadcast view">BCAST</button>
<button class="pill-btn" data-cam="sideline" role="radio" aria-checked="false" title="Sideline view">SIDE</button>
<button class="pill-btn" data-cam="top" role="radio" aria-checked="false" title="Top-down view">TOP</button>
<button class="pill-btn" data-cam="pan" role="radio" aria-checked="false" title="Auto-rotate / panning">PAN</button>
<button class="pill-btn" data-cam="free" role="radio" aria-checked="false" title="Free orbit">FREE</button>
</div>
<select class="cfg-select" id="camera-select" aria-label="Camera view">
<option value="broadcast" selected>Broadcast</option>
<option value="sideline">Sideline</option>
<option value="top">Top-down</option>
<option value="pan">Pan / Auto</option>
<option value="free">Free</option>
</select>
</div>
</div>
<div class="card-div"></div>
<label class="arena-wrap">
<span class="cfg-lbl">Arena</span>
<div class="toggle-sw">
<input type="checkbox" id="chkArena" aria-label="Toggle arena visibility" checked />
<span class="toggle-track"></span>
</div>
</label>
</div>
<!-- Filter panel: drops below right card -->
<div id="filter-panel">
<div class="filter-row-pair">
<div class="filter-row">
<span class="filter-row-lbl">Result</span>
<div class="pill-group" data-filter-group="result" role="group" aria-label="Shot result">
<button class="pill-btn active active-made" data-result="made" aria-pressed="true">Made</button>
<button class="pill-btn active active-miss" data-result="miss" aria-pressed="true">Missed</button>
</div>
</div>
<div class="filter-row">
<span class="filter-row-lbl">Type</span>
<div class="pill-group" data-filter-group="type" role="group" aria-label="Shot type">
<button class="pill-btn active" data-type="2PT" aria-pressed="true">2PT</button>
<button class="pill-btn active" data-type="3PT" aria-pressed="true">3PT</button>
</div>
</div>
<div class="filter-row">
<span class="filter-row-lbl">Zone</span>
<div class="pill-group" data-filter-group="zone" role="group" aria-label="Shot zone">
<button class="pill-btn active" data-zone="paint" aria-pressed="true">Paint</button>
<button class="pill-btn active" data-zone="mid" aria-pressed="true">Mid</button>
<button class="pill-btn active" data-zone="three" aria-pressed="true">3PT</button>
</div>
</div>
</div>
<div class="filter-row">
<span class="filter-row-lbl">Quarter</span>
<div class="pill-group" data-filter-group="period" role="group" aria-label="Quarter">
<button class="pill-btn active" data-period="1" aria-pressed="true">Q1</button>
<button class="pill-btn active" data-period="2" aria-pressed="true">Q2</button>
<button class="pill-btn active" data-period="3" aria-pressed="true">Q3</button>
<button class="pill-btn active" data-period="4" aria-pressed="true">Q4</button>
<button class="pill-btn active" data-period="5" aria-pressed="true">OT</button>
</div>
</div>
<div id="filter-warning">No shots match the current filters.</div>
<div id="filter-actions">
<button id="filter-reset" class="fp-action fp-action-ghost">Reset</button>
<button id="filter-apply" class="fp-action fp-action-primary" disabled>Apply</button>
</div>
</div>
<!-- Shot tooltip (shown when clicking a floor marker) -->
<div id="shot-tooltip" aria-live="polite"></div>
<!-- Stats footer -->
<div id="stats" class="hidden anim-up">
<div class="stat-side stat-made">
<div class="stat-val" id="statMadeN">0</div>
<div class="stat-lbl">Made</div>
</div>
<div class="stat-mid">
<div class="stat-pct">
<div class="stat-val" id="statPct">—</div>
<div class="stat-lbl">FG%</div>
</div>
<div class="stat-zones">
<div class="stat-zone-cell">
<div class="stat-zone-val" id="statPaintPct">—</div>
<div class="stat-lbl">Paint</div>
</div>
<div class="stat-zone-cell">
<div class="stat-zone-val" id="statMidPct">—</div>
<div class="stat-lbl">Mid</div>
</div>
<div class="stat-zone-cell">
<div class="stat-zone-val" id="statThreePct">—</div>
<div class="stat-lbl">3PT</div>
</div>
</div>
</div>
<div class="stat-side stat-miss">
<div class="stat-val" id="statMissN">0</div>
<div class="stat-lbl">Missed</div>
</div>
</div>
<button id="help-bubble" type="button" aria-label="Open help" aria-expanded="false" aria-controls="help-popover">?</button>
<div id="help-tip" role="status" aria-live="polite" aria-label="Getting started hint" hidden>
<button class="help-tip-x" type="button" aria-label="Dismiss hint">×</button>
<div class="help-tip-title">Need help?</div>
<div class="help-tip-body">Tap the `?` for a quick guide to players, filters, camera, and shot markers.</div>
</div>
<div id="help-popover" role="dialog" aria-modal="false" aria-labelledby="help-title" hidden>
<div class="help-head">
<div class="help-title" id="help-title">How to use</div>
<button class="help-close" type="button" aria-label="Close help">×</button>
</div>
<div class="help-step"><span class="help-step-num">1</span><span>Pick a player, then press <strong>Play</strong> or <strong>Replay</strong>.</span></div>
<div class="help-step"><span class="help-step-num">2</span><span>Use <strong>Filters</strong> and tap <strong>Apply</strong> to change the shot sequence.</span></div>
<div class="help-step"><span class="help-step-num">3</span><span>Switch camera presets or tap the progress bar to scrub through the filtered shots.</span></div>
<div class="help-legend">
<span class="help-chip made">Made = green dot</span>
<span class="help-chip miss">Miss = red X</span>
</div>
<div class="help-foot">Click a marker for distance, quarter, and shot type. Shortcuts: Space play/pause, R replay, Esc close.</div>
</div>
<!-- Player picker / welcome screen -->
<div id="picker">
<div id="picker-card">
<div id="picker-header">
<div id="picker-header-top">
<div id="picker-heading">
<div id="picker-eyebrow">NBA · 2025–26 Regular Season</div>
<div id="picker-title">Choose a player</div>
<div id="picker-subtitle">Browse shot charts for every player from the season.</div>
</div>
<a id="picker-repo-link" href="https://github.com/ivanvlam/shot-chart" target="_blank" rel="noopener noreferrer" aria-label="Open GitHub repository">
<svg viewBox="0 0 16 16" aria-hidden="true">
<path d="M8 0C3.58 0 0 3.67 0 8.2c0 3.62 2.29 6.69 5.47 7.78.4.08.55-.18.55-.4 0-.2-.01-.85-.01-1.54-2.01.38-2.53-.5-2.69-.96-.09-.24-.48-.96-.82-1.15-.28-.15-.68-.52-.01-.53.63-.01 1.08.59 1.23.84.72 1.24 1.87.89 2.33.68.07-.53.28-.89.51-1.09-1.78-.21-3.64-.91-3.64-4.05 0-.89.31-1.63.82-2.2-.08-.21-.36-1.04.08-2.17 0 0 .67-.22 2.2.84A7.4 7.4 0 0 1 8 3.98c.68 0 1.36.09 2 .27 1.53-1.06 2.2-.84 2.2-.84.44 1.13.16 1.96.08 2.17.51.57.82 1.3.82 2.2 0 3.15-1.87 3.84-3.65 4.05.29.25.54.75.54 1.52 0 1.09-.01 1.97-.01 2.24 0 .22.15.48.55.4A8.08 8.08 0 0 0 16 8.2C16 3.67 12.42 0 8 0Z"/>
</svg>
<span class="repo-link-text">GitHub</span>
</a>
</div>
</div>
<div id="picker-search-wrap">
<span id="picker-search-icon">⌕</span>
<input id="picker-search" type="text" autocomplete="off" spellcheck="false" placeholder="Search by name…" />
</div>
<div id="picker-filters">
<div class="pf-group">
<span class="pf-lbl">Team</span>
<select id="pf-team" class="pf-select"></select>
</div>
<div class="pf-group">
<span class="pf-lbl">Pos</span>
<select id="pf-pos" class="pf-select">
<option value="">All</option>
<option value="G">Guards</option>
<option value="F">Forwards</option>
<option value="C">Centers</option>
</select>
</div>
<div class="pf-group">
<span class="pf-lbl">Height</span>
<select id="pf-height" class="pf-select"></select>
</div>
<div class="pf-group pf-advanced">
<span class="pf-lbl">FGA</span>
<select id="pf-fga" class="pf-select">
<option value="0">All</option>
<option value="200">> 200</option>
<option value="500">> 500</option>
<option value="800">> 800</option>
<option value="1000">> 1000</option>
</select>
</div>
<div class="pf-group pf-advanced">
<span class="pf-lbl">FG%</span>
<select id="pf-fgpct" class="pf-select">
<option value="0">All</option>
<option value="0.40">> 40%</option>
<option value="0.45">> 45%</option>
<option value="0.50">> 50%</option>
</select>
</div>
<div class="pf-group pf-advanced">
<span class="pf-lbl">PTS</span>
<select id="pf-pts" class="pf-select">
<option value="0">All</option>
<option value="500">> 500</option>
<option value="1000">> 1000</option>
<option value="1500">> 1500</option>
</select>
</div>
<div class="pf-group pf-advanced">
<span class="pf-lbl">Sort</span>
<select id="pf-sort" class="pf-select">
<option value="pts">PTS ↓</option>
<option value="fga">FGA ↓</option>
<option value="fg_pct">FG% ↓</option>
<option value="name">Name A–Z</option>
<option value="height_in">Tallest</option>
</select>
</div>
</div>
<button id="picker-filters-toggle" type="button" aria-expanded="false" aria-controls="picker-filters">More filters ▾</button>
<div id="picker-count"></div>
<div id="picker-results">
<div id="picker-grid"></div>
<div id="picker-empty">No players match the current filters.</div>
</div>
</div>
</div>
<script>
window.onerror = function(msg, src, line, col, err) {
var d = document.getElementById('err-overlay');
if (!d) { d = document.createElement('div'); d.id = 'err-overlay'; Object.assign(d.style, {position:'fixed',top:'10px',left:'10px',right:'10px',background:'#c0392b',color:'#fff',padding:'12px 16px',borderRadius:'6px',fontFamily:'monospace',fontSize:'13px',zIndex:9999,whiteSpace:'pre-wrap'}); document.body.appendChild(d); }
d.textContent += (src ? src.split('/').pop() + ':' + line + '\n' : '') + msg + '\n';
};
window.addEventListener('unhandledrejection', function(e) {
window.onerror(String(e.reason), '', 0);
});
</script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.167.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.167.0/examples/jsm/"
}
}
</script>
<script type="module" src="src/main.js"></script>
</body>
</html>