-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobe.html
More file actions
235 lines (208 loc) · 9.26 KB
/
Copy pathglobe.html
File metadata and controls
235 lines (208 loc) · 9.26 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Natural Disaster Museum · The Globe</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Inter:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Special+Elite&family=Source+Sans+3:wght@300;400;600&display=swap" rel="stylesheet">
<!-- Styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Core Libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/3.0.2/topojson.min.js"></script>
<script src="https://unpkg.com/globe.gl"></script>
</head>
<body>
<header class="top-bar" id="top-bar">
<div class="brand">
<a href="curators.html"><span class="brand-earth">Earth</span> Natural Disaster Museum<span class="brand-dim"> · est. 2026</span></a>
</div>
<nav class="breadcrumb" id="top-breadcrumb">
<span class="crumb">The Globe: Earth</span>
</nav>
</header>
<div id="app">
<!-- SCENE 2: 3D Globe -->
<div id="scene-globe" class="scene active">
<!-- Static starfield background -->
<canvas id="starfieldCanvas"></canvas>
<!-- 3D Globe Container -->
<div id="globeContainer"></div>
<!-- Filter Panel (Left) -->
<aside class="filter-panel globe-filter-panel" id="filterPanel" aria-label="Globe filters">
<section class="filter-section" aria-labelledby="timePeriodTitle">
<h2 class="filter-title" id="timePeriodTitle">Time period</h2>
<div class="year-range-control">
<div class="range-slider-container">
<button type="button" id="timelinePlayButton" class="timeline-play-button" aria-label="Play timeline animation">
<svg class="play-icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M8 5v14l11-7z"/>
</svg>
<svg class="pause-icon" viewBox="0 0 24 24" fill="currentColor">
<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>
</svg>
</button>
<div class="range-slider-wrapper">
<div class="range-values" aria-hidden="true">
<span id="yearMinVal">1975</span>
<span id="yearMaxVal">2025</span>
</div>
<div class="range-slider" aria-label="Select event year range">
<div class="range-track">
<div class="range-fill" id="yearRangeFill"></div>
</div>
<input class="range-input range-input-min" type="range" id="yearStartSlider" min="1975" max="2025" value="1975" aria-label="Start year" />
<input class="range-input range-input-max" type="range" id="yearEndSlider" min="1975" max="2025" value="1975" aria-label="End year" />
</div>
</div>
</div>
</div>
</section>
<section class="filter-section" aria-labelledby="disasterTypesTitle">
<h2 class="filter-title" id="disasterTypesTitle">Disaster types</h2>
<div class="filter-chips" id="typeFilter"></div>
</section>
<div class="events-widget" aria-live="polite">
<div class="events-count" id="eventCount">0</div>
<div class="events-label">Events displayed</div>
<div class="data-status hidden" id="dataStatus"></div>
</div>
<button type="button" id="bubbleChartButton" class="bubble-chart-button">
<span class="bubble-chart-icon">●●●</span>
<span class="globe-icon">🌍</span>
<span class="bubble-chart-text">Open bubble chart</span>
</button>
</aside>
<!-- Bubble Chart Container -->
<div id="bubbleChartContainer" class="bubble-chart-container hidden">
<svg id="bubbleChartSvg"></svg>
<button type="button" id="closeBubbleChart" class="close-bubble-chart" aria-label="Close bubble chart">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 6L6 18M6 6l12 12"/>
</svg>
</button>
<div class="bubble-zoom-controls">
<button type="button" id="zoomIn" class="zoom-control-btn" aria-label="Zoom in">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/>
<path d="M21 21l-4.35-4.35M11 8v6M8 11h6"/>
</svg>
</button>
<button type="button" id="zoomOut" class="zoom-control-btn" aria-label="Zoom out">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/>
<path d="M21 21l-4.35-4.35M8 11h6"/>
</svg>
</button>
<button type="button" id="zoomReset" class="zoom-control-btn" aria-label="Reset zoom">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>
<path d="M3 3v5h5"/>
</svg>
</button>
</div>
</div>
<aside class="earth-story-card" aria-labelledby="earthStoryCardTitle">
<h2 id="earthStoryCardTitle">Earth Story</h2>
<p>How has the global profile of disasters shifted over time? Explore our Earth Story and uncover 50 years of striking trends.</p>
<button type="button" id="earthStoryExplore" class="earth-story-button">Explore</button>
</aside>
</div>
</div>
<!-- Earth Story overlay — stacked on top of globe -->
<div id="story-overlay" class="timeline-overlay" aria-hidden="true">
<iframe id="storyFrame" title="Earth Story" src="about:blank"></iframe>
</div>
<!-- Static starfield -->
<script>
(function () {
const canvas = document.getElementById('starfieldCanvas');
const ctx = canvas.getContext('2d');
function rng(seed) {
let s = seed;
return function () {
s = (s ^ (s << 13)) >>> 0;
s = (s ^ (s >>> 17)) >>> 0;
s = (s ^ (s << 5)) >>> 0;
return s / 0xffffffff;
};
}
function draw() {
const dpr = window.devicePixelRatio || 1;
const w = window.innerWidth;
const h = window.innerHeight;
canvas.width = w * dpr;
canvas.height = h * dpr;
canvas.style.width = w + 'px';
canvas.style.height = h + 'px';
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
ctx.fillStyle = '#0C1116';
ctx.fillRect(0, 0, w, h);
const rand = rng(42);
const count = Math.round(w * h / 1400); /* ~850 stars on 1080p */
for (let i = 0; i < count; i++) {
const x = rand() * w;
const y = rand() * h;
const size = rand() * 1.4 + 0.3;
const alpha = rand() * 0.7 + 0.15;
ctx.beginPath();
ctx.arc(x, y, size, 0, Math.PI * 2);
ctx.fillStyle = `rgba(255,255,255,${alpha.toFixed(2)})`;
ctx.fill();
}
/* faint radial vignette so the edges feel like deep space */
const grad = ctx.createRadialGradient(w/2, h/2, h * 0.2, w/2, h/2, h * 0.9);
grad.addColorStop(0, 'rgba(12,17,22,0)');
grad.addColorStop(1, 'rgba(12,17,22,0.55)');
ctx.fillStyle = grad;
ctx.fillRect(0, 0, w, h);
}
draw();
window.addEventListener('resize', draw);
})();
</script>
<!-- JavaScript Modules -->
<script src="js/data.js"></script>
<script src="js/scene1_ticket.js"></script>
<script src="js/scene2_globe.js"></script>
<!-- App Initialization -->
<script>
/* ── Earth Story overlay stack ───────────────────────────────── */
window.openStory = function () {
const overlay = document.getElementById('story-overlay');
const frame = document.getElementById('storyFrame');
frame.src = 'earth_story.html';
overlay.classList.add('visible');
overlay.setAttribute('aria-hidden', 'false');
history.pushState({ story: true }, '', '?story');
};
window.closeStory = function () {
const overlay = document.getElementById('story-overlay');
overlay.classList.remove('visible');
overlay.setAttribute('aria-hidden', 'true');
setTimeout(() => {
document.getElementById('storyFrame').src = 'about:blank';
}, 380);
if (history.state && history.state.story) history.back();
};
window.addEventListener('popstate', () => {
const story = document.getElementById('story-overlay');
if (!history.state?.story && story.classList.contains('visible')) {
story.classList.remove('visible');
story.setAttribute('aria-hidden', 'true');
setTimeout(() => {
document.getElementById('storyFrame').src = 'about:blank';
}, 380);
}
});
document.getElementById('earthStoryExplore')?.addEventListener('click', () => {
window.openStory();
});
document.addEventListener('DOMContentLoaded', async () => {
await initData();
Scene2.init();
});
</script>
</body>
</html>