forked from joinpursuit/FSW-Personal-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefraction-prototype.html
More file actions
376 lines (322 loc) · 10.7 KB
/
Copy pathrefraction-prototype.html
File metadata and controls
376 lines (322 loc) · 10.7 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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raindrip Refraction Prototype - June's Hack</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: white;
overflow: hidden;
height: 100vh;
}
/* June's Test Background - Need something with detail! */
.test-background {
position: absolute;
inset: 0;
background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
text-align: center;
}
.test-background::before {
content: 'RAINDRIP TEST';
position: absolute;
font-size: 120px;
font-weight: 900;
opacity: 0.1;
transform: rotate(-15deg);
}
.test-content {
position: relative;
z-index: 1;
padding: 40px;
background: rgba(255,255,255,0.1);
border-radius: 20px;
backdrop-filter: blur(10px);
}
.test-content h1 {
font-size: 48px;
margin-bottom: 20px;
}
.test-content p {
font-size: 20px;
line-height: 1.6;
}
/* The Refraction Container */
.rain-effect {
position: absolute;
inset: 0;
pointer-events: none;
}
/* June's Blur Layer - This makes everything look frosted */
.frost-layer {
position: absolute;
inset: 0;
backdrop-filter: blur(8px) brightness(1.1);
background: rgba(255,255,255,0.01);
z-index: 10;
}
/* Droplets Container */
.droplets-container {
position: absolute;
inset: 0;
z-index: 20;
}
/* Individual Droplet - June's "Just Make It Work" Approach */
.droplet {
position: absolute;
pointer-events: auto;
cursor: pointer;
}
/* The inner droplet that shows clear content */
.droplet-inner {
width: 100%;
height: 100%;
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
overflow: hidden;
box-shadow:
inset 0 -2px 4px rgba(0,0,0,0.2),
inset 0 2px 4px rgba(255,255,255,0.5),
0 2px 8px rgba(0,0,0,0.3);
backdrop-filter: blur(0px) brightness(1.15) contrast(1.1);
background: rgba(255,255,255,0.1);
position: relative;
}
/* Droplet highlight for that water shine */
.droplet-inner::before {
content: '';
position: absolute;
top: 10%;
left: 20%;
width: 50%;
height: 40%;
background: radial-gradient(ellipse at center,
rgba(255,255,255,0.8) 0%,
rgba(255,255,255,0) 70%);
border-radius: 50%;
filter: blur(2px);
}
/* Different droplet sizes */
.droplet.small {
width: 20px;
height: 25px;
}
.droplet.medium {
width: 35px;
height: 42px;
}
.droplet.large {
width: 50px;
height: 60px;
}
/* Animation for falling */
@keyframes fall {
0% {
transform: translateY(-100px);
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
transform: translateY(calc(100vh + 100px));
opacity: 0;
}
}
.droplet.falling {
animation: fall var(--duration, 4s) ease-in infinite;
animation-delay: var(--delay, 0s);
}
/* June's Control Panel */
.controls {
position: fixed;
top: 20px;
right: 20px;
background: rgba(0,0,0,0.8);
padding: 20px;
border-radius: 10px;
z-index: 100;
backdrop-filter: blur(10px);
}
.controls button {
display: block;
width: 100%;
padding: 10px;
margin: 5px 0;
background: #667eea;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
.controls button:hover {
background: #764ba2;
}
/* Jay's Debug Info */
.debug-info {
position: fixed;
bottom: 20px;
left: 20px;
background: rgba(0,0,0,0.8);
padding: 10px;
border-radius: 5px;
font-family: monospace;
font-size: 12px;
z-index: 100;
}
</style>
</head>
<body>
<!-- Test Background with Content -->
<div class="test-background">
<div class="test-content">
<h1>🌧️ Raindrip Effect</h1>
<p>Can you see the droplets?<br>
They should look like water on glass!<br>
Click anywhere to spawn drops.</p>
</div>
</div>
<!-- Rain Effect Container -->
<div class="rain-effect">
<!-- Frost layer over everything -->
<div class="frost-layer"></div>
<!-- Droplets go here -->
<div class="droplets-container" id="droplets"></div>
</div>
<!-- June's Control Panel -->
<div class="controls">
<h3>June's Controls 🎮</h3>
<button onclick="spawnDroplet()">Spawn Droplet</button>
<button onclick="startRain()">Start Rain</button>
<button onclick="stopRain()">Stop Rain</button>
<button onclick="clearAll()">Clear All</button>
</div>
<!-- Jay's Debug Info -->
<div class="debug-info" id="debug">
Droplets: <span id="droplet-count">0</span><br>
FPS: <span id="fps">60</span><br>
Render: <span id="render-mode">CSS</span>
</div>
<script>
// June's Quick and Dirty Implementation
let dropletCount = 0;
let raining = false;
let rainInterval = null;
function createDroplet(x, y, size = 'medium') {
const droplet = document.createElement('div');
droplet.className = `droplet ${size}`;
droplet.innerHTML = '<div class="droplet-inner"></div>';
// Position it
droplet.style.left = x + 'px';
droplet.style.top = y + 'px';
// Add to container
document.getElementById('droplets').appendChild(droplet);
dropletCount++;
updateDebug();
return droplet;
}
function spawnDroplet(x = null, y = null) {
// Random position if not specified
if (x === null) x = Math.random() * window.innerWidth;
if (y === null) y = -50;
// Random size
const sizes = ['small', 'medium', 'large'];
const size = sizes[Math.floor(Math.random() * sizes.length)];
const droplet = createDroplet(x, y, size);
// Make it fall
droplet.classList.add('falling');
droplet.style.setProperty('--duration', (3 + Math.random() * 3) + 's');
droplet.style.setProperty('--delay', Math.random() + 's');
// Remove after animation
setTimeout(() => {
droplet.remove();
dropletCount--;
updateDebug();
}, 7000);
}
function startRain() {
if (raining) return;
raining = true;
// Spawn droplets periodically
rainInterval = setInterval(() => {
spawnDroplet();
}, 200);
// Initial burst
for (let i = 0; i < 10; i++) {
setTimeout(() => spawnDroplet(), i * 100);
}
}
function stopRain() {
raining = false;
if (rainInterval) {
clearInterval(rainInterval);
rainInterval = null;
}
}
function clearAll() {
stopRain();
document.getElementById('droplets').innerHTML = '';
dropletCount = 0;
updateDebug();
}
function updateDebug() {
document.getElementById('droplet-count').textContent = dropletCount;
}
// Click to spawn droplet
document.addEventListener('click', (e) => {
if (e.target.closest('.controls') || e.target.closest('.debug-info')) return;
const rect = document.querySelector('.rain-effect').getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
// Create static droplet at click position
const droplet = createDroplet(x - 25, y - 30, 'large');
// June's physics hack - make it slide down slowly
let posY = y - 30;
let velocity = 0;
function slide() {
velocity += 0.15; // gravity
velocity *= 0.98; // friction
posY += velocity;
droplet.style.top = posY + 'px';
if (posY < window.innerHeight) {
requestAnimationFrame(slide);
} else {
droplet.remove();
dropletCount--;
updateDebug();
}
}
setTimeout(slide, 100);
});
// Jay's FPS counter
let lastTime = performance.now();
let frames = 0;
function updateFPS() {
frames++;
const currentTime = performance.now();
if (currentTime >= lastTime + 1000) {
const fps = Math.round((frames * 1000) / (currentTime - lastTime));
document.getElementById('fps').textContent = fps;
frames = 0;
lastTime = currentTime;
}
requestAnimationFrame(updateFPS);
}
updateFPS();
</script>
</body>
</html>