Skip to content

Commit 5886c71

Browse files
m2
1 parent 2f01a0f commit 5886c71

2 files changed

Lines changed: 58 additions & 30 deletions

File tree

docs/index.html

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,38 @@
2020
<div id="app">
2121
<!-- SCENE 1: Museum Entrance + Ticket -->
2222
<div id="scene-ticket" class="scene active">
23-
<canvas id="timeTravel"></canvas>
24-
<div class="museum-title">
25-
<h1>WELCOME TO THE<br/>NATURAL DISASTER<br/>MUSEUM</h1>
26-
<span class="museum-subtitle">1975 — 2025</span>
23+
<!-- Top half: Time travel effect + Title -->
24+
<div class="time-travel-section">
25+
<canvas id="timeTravel"></canvas>
26+
<div class="museum-title">
27+
<h1>WELCOME TO THE<br/>NATURAL DISASTER<br/>MUSEUM</h1>
28+
<span class="museum-subtitle">1975 — 2025</span>
29+
</div>
2730
</div>
2831

29-
<div class="ticket-wrapper" id="ticketWrapper">
30-
<div class="ticket" id="museumTicket">
31-
<!-- TICKET FRONT -->
32-
<div class="ticket-front">
33-
<div class="ticket-header">
34-
<span class="ticket-label">ADMISSION · FREE</span>
35-
<span class="ticket-num">#00480</span>
36-
</div>
37-
<div class="ticket-map" id="ticketMiniMap">
38-
<!-- Tiny SVG world map rendered here by scene1_ticket.js -->
39-
</div>
40-
<div class="ticket-footer">
41-
<div class="ticket-info">
42-
<span>4 EXHIBITS</span>
43-
<span>50 YEARS OF DATA</span>
44-
<span>230 COUNTRIES</span>
32+
<!-- Bottom half: Simple ticket -->
33+
<div class="ticket-section">
34+
<div class="ticket-wrapper" id="ticketWrapper">
35+
<div class="ticket" id="museumTicket">
36+
<!-- TICKET FRONT -->
37+
<div class="ticket-front">
38+
<div class="ticket-header">
39+
<span class="ticket-label">ADMISSION · FREE</span>
40+
<span class="ticket-num">#00480</span>
41+
</div>
42+
<div class="ticket-map" id="ticketMiniMap">
43+
<!-- Tiny SVG world map rendered here by scene1_ticket.js -->
44+
</div>
45+
<div class="ticket-footer">
46+
<div class="ticket-info">
47+
<span>4 EXHIBITS</span>
48+
<span>50 YEARS OF DATA</span>
49+
<span>230 COUNTRIES</span>
50+
</div>
51+
<div class="ticket-cta">CLICK TO ENTER &rarr;</div>
4552
</div>
46-
<div class="ticket-cta">CLICK TO ENTER &rarr;</div>
53+
<div class="ticket-tear"></div>
4754
</div>
48-
<div class="ticket-tear"></div>
4955
</div>
5056
</div>
5157
</div>

docs/js/scene1_ticket.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,32 @@ const Scene1 = {
2929

3030
this.timeTravelCtx = this.timeTravelCanvas.getContext('2d');
3131

32-
// Set canvas size
32+
// Set canvas size - only top half of screen
3333
const resize = () => {
34-
this.timeTravelCanvas.width = window.innerWidth;
35-
this.timeTravelCanvas.height = window.innerHeight;
34+
const timeTravelSection = document.querySelector('.time-travel-section');
35+
if (timeTravelSection) {
36+
this.timeTravelCanvas.width = timeTravelSection.clientWidth;
37+
this.timeTravelCanvas.height = timeTravelSection.clientHeight;
38+
}
3639
};
3740
resize();
38-
window.addEventListener('resize', resize);
41+
42+
// Recreate particles on resize
43+
let resizeTimeout;
44+
window.addEventListener('resize', () => {
45+
clearTimeout(resizeTimeout);
46+
resizeTimeout = setTimeout(() => {
47+
resize();
48+
this.createParticles();
49+
}, 100);
50+
});
51+
52+
this.createParticles();
53+
this.animateTimeTravel();
54+
},
55+
56+
createParticles() {
57+
this.particles = [];
3958

4059
// Create particles
4160
const numParticles = 100;
@@ -75,17 +94,20 @@ const Scene1 = {
7594
isYearLabel: true
7695
});
7796
}
78-
79-
this.animateTimeTravel();
8097
},
8198

8299
animateTimeTravel() {
83100
const ctx = this.timeTravelCtx;
84101
const canvas = this.timeTravelCanvas;
85-
const centerX = canvas.width / 2;
86-
const centerY = canvas.height / 2;
87102

88103
const animate = () => {
104+
if (!this.timeTravelCanvas || !this.timeTravelCtx) {
105+
return; // Stop if canvas is removed
106+
}
107+
108+
const centerX = canvas.width / 2;
109+
const centerY = canvas.height / 2;
110+
89111
// Fade out effect for trails
90112
ctx.fillStyle = 'rgba(8, 10, 15, 0.15)';
91113
ctx.fillRect(0, 0, canvas.width, canvas.height);

0 commit comments

Comments
 (0)