-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot-parade.html
183 lines (162 loc) · 5.41 KB
/
bot-parade.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Bot Parade</title>
<style>
/*************************************************************
* 1) Custom SGA Font (optional)
*************************************************************/
@font-face {
src: url('fonts/Sga-Regular.woff2') format('woff2'),
url('fonts/Sga-Regular.woff') format('woff'),
url('fonts/Sga-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-family: 'Sga Regular';
}
/*************************************************************
* 2) Base Body Styling (Green on Black + Fullscreen)
*************************************************************/
body {
margin: 0;
background: #000;
color: #00ff00; /* retro green */
font-family: 'Sga Regular', Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden; /* hide scrollbars, starfield covers entire BG */
}
/*************************************************************
* 3) The Starfield Canvas (fullscreen in background)
*************************************************************/
#starfield {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
/*************************************************************
* 4) Audio Panel + Hover Behavior
*************************************************************/
.audio-panel {
position: relative;
z-index: 1; /* in front of starfield */
background-color: rgba(0, 0, 0, 0.8);
width: 80%;
max-width: 600px;
padding: 20px;
text-align: center;
box-shadow: 0 0 20px #00ff00;
border: 2px solid #00ff00;
transition: font-family 0.3s ease; /* smooth font swap */
cursor: pointer; /* indicate clickable on mobile/desktop */
}
/*
On desktop hover, switch to Courier.
We’ll revert automatically when the mouse leaves.
*/
.audio-panel:hover {
font-family: "Courier New", monospace;
font-size: 0.75em;
}
/* Headings, paragraphs, etc. are automatically affected by .audio-panel's font-family */
audio {
width: 100%;
max-width: 300px;
margin-top: 20px;
}
</style>
</head>
<body>
<!-- Fullscreen flying starfield canvas -->
<canvas id="starfield"></canvas>
<!-- Main panel with song title + audio controls -->
<div class="audio-panel" id="audioPanel">
<h1>Bot Parade</h1>
<h2>By Flyxion</h1>
<audio controls>
<source src="bot-parade.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<script>
/*************************************************************
* A) STARFIELD ANIMATION
*************************************************************/
const starCanvas = document.getElementById('starfield');
const starCtx = starCanvas.getContext('2d');
function resizeCanvas() {
starCanvas.width = window.innerWidth;
starCanvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas(); // initial setup
let stars = [];
const numStars = 600;
const starSpeed = 0.05;
// Generate random star positions
for (let i = 0; i < numStars; i++) {
stars.push({
x: Math.random() * starCanvas.width,
y: Math.random() * starCanvas.height,
z: Math.random() * starCanvas.width
});
}
function updateStars() {
for (let star of stars) {
star.z -= starSpeed;
if (star.z <= 0) {
star.x = Math.random() * starCanvas.width;
star.y = Math.random() * starCanvas.height;
star.z = starCanvas.width;
}
}
}
function drawStars() {
starCtx.clearRect(0, 0, starCanvas.width, starCanvas.height);
for (let star of stars) {
const perspective = starCanvas.width / star.z;
const x = (star.x - starCanvas.width / 2) * perspective + starCanvas.width / 2;
const y = (star.y - starCanvas.height / 2) * perspective + starCanvas.height / 2;
const size = perspective * 1.5;
starCtx.beginPath();
starCtx.arc(x, y, size, 0, Math.PI * 2);
starCtx.fillStyle = "#ffffff";
starCtx.fill();
}
}
function animateStarfield() {
updateStars();
drawStars();
requestAnimationFrame(animateStarfield);
}
animateStarfield();
/*************************************************************
* B) FONT TOGGLE ON MOBILE (tap)
*************************************************************/
const audioPanel = document.getElementById('audioPanel');
let fontToggled = false;
/*
We’ll use a click listener to handle touch/click:
- On mobile: tapping toggles the font.
- On desktop: you still get the CSS hover effect automatically.
*/
audioPanel.addEventListener('click', () => {
// If we’re in default SGA font, switch to Courier.
// Otherwise, revert to SGA + fallback.
if (!fontToggled) {
audioPanel.style.fontFamily = '"Courier New", monospace';
fontToggled = true;
} else {
audioPanel.style.fontFamily = '"Sga Regular", Arial, sans-serif';
fontToggled = false;
}
});
</script>
</body>
</html>