-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
681 lines (579 loc) · 28.7 KB
/
index.html
File metadata and controls
681 lines (579 loc) · 28.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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MSA | Market Stock Analyzer</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;500;700;900&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<script>
tailwind.config = {
darkMode: 'class', // We will force this class
theme: {
extend: {
colors: {
bull: '#00ffaa', // Neon Green
bear: '#ff0044', // Neon Red
dark: '#030305',
glass: 'rgba(255, 255, 255, 0.05)'
},
fontFamily: {
sans: ['Outfit', 'sans-serif'],
mono: ['JetBrains Mono', 'monospace'],
},
boxShadow: {
'neon-green': '0 0 20px rgba(0, 255, 170, 0.5)',
'neon-red': '0 0 20px rgba(255, 0, 68, 0.5)',
}
}
}
}
</script>
<style>
body {
margin: 0; overflow-x: hidden;
background-color: #030305;
color: white;
cursor: crosshair;
}
button, a, .glass-panel, input {
cursor: pointer;
}
/* 1. The Canvas (Untouched) */
#market-wave {
position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
z-index: 0; pointer-events: none;
}
/* 2. Glass Panels */
.glass-panel {
background: rgba(15, 15, 20, 0.7);
backdrop-filter: blur(24px);
-webkit-backdrop-filter: blur(24px);
border: 1px solid rgba(255, 255, 255, 0.08);
border-top: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 20px 40px rgba(0,0,0,0.4);
transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s;
}
.glass-panel:hover {
transform: translateY(-5px) scale(1.01);
border-color: rgba(255, 255, 255, 0.3);
}
/* 3. Gradients */
.text-gradient-main {
background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
/* 4. Ticker */
.ticker-wrap {
width: 100%; overflow: hidden; background: rgba(0,0,0,0.3);
border-bottom: 1px solid rgba(255,255,255,0.05);
backdrop-filter: blur(5px);
}
.ticker { display: inline-block; white-space: nowrap; animation: ticker 40s linear infinite; }
.ticker-item { display: inline-block; padding: 0 2rem; font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; color: #888; }
@keyframes ticker { 0% { transform: translate3d(0, 0, 0); } 100% { transform: translate3d(-50%, 0, 0); } }
/* 5. Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #030305; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
.z-content { position: relative; z-index: 10; }
/* Neon Button */
.btn-neon {
background: #00ffaa; color: black;
box-shadow: 0 0 20px rgba(0, 255, 170, 0.3);
transition: all 0.3s ease;
}
.btn-neon:hover {
box-shadow: 0 0 40px rgba(0, 255, 170, 0.6);
transform: scale(1.05);
}
/* Hero candlestick background */
#hero-chart-canvas {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
z-index: -1; opacity: 0.8; pointer-events: none;
mix-blend-mode: screen;
}
#chart-labels-container {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
z-index: -1; pointer-events: none; overflow: hidden;
}
.animate-float-up-label {
position: absolute; font-family: 'JetBrains Mono', monospace;
font-size: 10px; font-weight: bold; pointer-events: none;
white-space: nowrap;
}
</style>
</head>
<body class="bg-dark text-white font-sans selection:bg-bull selection:text-black">
<canvas id="market-wave"></canvas>
<nav class="fixed top-0 w-full z-50 border-b border-white/5 bg-dark/50 backdrop-blur-xl transition-all duration-300">
<div class="max-w-7xl mx-auto px-6 h-20 flex justify-between items-center">
<div class="flex items-center gap-3 group cursor-pointer">
<div class="relative w-8 h-8 flex items-center justify-center">
<div class="absolute inset-0 bg-bull/20 rounded-lg blur-lg group-hover:bg-bull/40 transition"></div>
<div class="relative w-full h-full border border-white/20 rounded-lg flex items-center justify-center bg-black/20">
<div class="w-3 h-3 bg-bull rounded-sm animate-pulse"></div>
</div>
</div>
<div class="flex flex-col">
<span class="text-xl font-black tracking-tighter leading-none">MSA</span>
<span class="text-[0.6rem] text-gray-400 uppercase tracking-widest">Intelligence</span>
</div>
</div>
<div class="flex items-center gap-6">
<div class="hidden md:flex items-center gap-3">
<a href="compare.html" class="border border-white/20 text-white px-5 py-2.5 rounded-full font-bold text-sm hover:border-warn hover:text-warn hover:scale-105 transition uppercase tracking-wider">
Compare
</a>
<a href="dashboard.html" class="bg-white text-black px-6 py-2.5 rounded-full font-bold text-sm hover:bg-bull hover:scale-105 transition shadow-lg shadow-white/10 uppercase tracking-wider">
Terminal
</a>
</div>
</div>
</div>
</nav>
<div class="fixed bottom-0 z-40 w-full ticker-wrap pointer-events-none">
<div class="ticker" id="ticker-belt">
<div class="ticker-item text-gray-600">Connecting to live feed...</div>
</div>
</div>
<main class="z-content">
<section class="min-h-screen flex flex-col justify-center items-center text-center px-4 pt-20 relative overflow-hidden">
<canvas id="hero-chart-canvas"></canvas>
<div id="chart-labels-container"></div>
<h1 class="text-7xl md:text-[9rem] font-black leading-[0.9] tracking-tight mb-8 text-gradient-main">
MARKET<br>PULSE
</h1>
<p class="text-lg md:text-2xl text-gray-400 max-w-3xl mb-12 leading-relaxed font-light">
We visualized millions of trades into a <span class="text-bull font-bold">visual wave</span>.
Green means institutional buying, Red reveals critical risk.
</p>
<form id="hero-search" class="flex flex-col sm:flex-row gap-4 w-full max-w-xl justify-center items-center">
<input
type="text"
id="hero-ticker"
placeholder="Enter ticker (e.g. AAPL)"
maxlength="10"
class="w-full sm:w-auto flex-1 bg-white/5 border border-white/10 rounded-full px-8 py-5 text-lg font-mono text-white placeholder-gray-600 focus:outline-none focus:border-bull/50 focus:shadow-neon-green transition text-center"
>
<button type="submit" class="btn-neon px-12 py-5 rounded-full font-black text-lg tracking-widest uppercase">
Launch Terminal
</button>
</form>
</section>
<section class="py-20 border-y border-white/5 bg-black/20 backdrop-blur-sm">
<div class="max-w-7xl mx-auto px-6 grid grid-cols-2 md:grid-cols-4 gap-12 text-center">
<div>
<div class="text-4xl font-black mb-2" id="api-stat-status">
<span class="text-gray-500">--</span>
</div>
<div class="text-xs text-gray-500 uppercase tracking-widest font-mono">API Status</div>
</div>
<div>
<div class="text-4xl font-black mb-2" id="api-stat-latency">
<span class="text-gray-500">--</span>
</div>
<div class="text-xs text-gray-500 uppercase tracking-widest font-mono">Response Time</div>
</div>
<div>
<div class="text-4xl font-black text-bull mb-2">8,000+</div>
<div class="text-xs text-gray-500 uppercase tracking-widest font-mono">Tickers</div>
</div>
<div>
<div class="text-4xl font-black text-bear mb-2">0%</div>
<div class="text-xs text-gray-500 uppercase tracking-widest font-mono">Emotion</div>
</div>
</div>
</section>
<section class="py-32 px-6 max-w-7xl mx-auto space-y-40">
<div class="flex flex-col md:flex-row items-center gap-20 feature-trigger">
<div class="md:w-1/2 relative">
<div class="absolute -inset-4 bg-bull/20 blur-3xl rounded-full opacity-20"></div>
<div class="relative glass-panel p-10 rounded-3xl border-l-4 border-bull">
<div class="text-bull/20 text-8xl font-black mb-6 absolute -top-10 -right-4 select-none">01</div>
<h2 class="text-4xl font-bold mb-6 text-white">Liquidity Flow</h2>
<p class="text-gray-400 text-lg leading-relaxed">
Watch the Smart Money. When the wave spikes <span class="text-bull">Neon Green</span>, it signals massive institutional accumulation before the price jumps.
</p>
</div>
</div>
<div class="md:w-1/2">
<div class="glass-panel p-6 rounded-2xl border border-bull/10 inline-block">
<pre class="font-mono text-xs text-bull/40 leading-relaxed"><code>$ msa --mode live
> source: yfinance
> sma_50: ██████████ 184.32
> sma_200: ██████░░░░ 171.08
> signal: GOLDEN_CROSS
> status: <span class="text-bull">BUY_PRESSURE_DETECTED</span></code></pre>
</div>
</div>
</div>
<div class="flex flex-col md:flex-row-reverse items-center gap-20 feature-trigger">
<div class="md:w-1/2 relative">
<div class="absolute -inset-4 bg-bear/20 blur-3xl rounded-full opacity-20"></div>
<div class="relative glass-panel p-10 rounded-3xl border-r-4 border-bear">
<div class="text-bear/20 text-8xl font-black mb-6 absolute -top-10 -left-4 select-none">02</div>
<h2 class="text-4xl font-bold mb-6 text-white">Risk Detection</h2>
<p class="text-gray-400 text-lg leading-relaxed">
Red isn't just a color; it's an alarm. Our algorithms detect sell-offs and distribution patterns, turning the wave <span class="text-bear">Neon Red</span> to warn you instantly.
</p>
</div>
</div>
<div class="md:w-1/2">
<div class="glass-panel p-6 rounded-2xl border border-bear/10 inline-block float-right">
<pre class="font-mono text-xs text-bear/40 leading-relaxed"><code>$ msa --scan risk
> fear_greed: 22 (EXTREME_FEAR)
> volume: ▼▼▼ distribution
> sma_50: ░░░░░░████ 141.50
> sma_200: ██████████ 168.72
> signal: DEATH_CROSS
> status: <span class="text-bear">DUMP_DETECTED</span></code></pre>
</div>
</div>
</div>
</section>
<footer class="border-t border-white/10 bg-black/40 backdrop-blur-lg pt-20 pb-10">
<div class="max-w-7xl mx-auto px-6 flex flex-col md:flex-row justify-between items-center gap-10">
<div class="text-center md:text-left">
<h2 class="text-2xl font-black mb-2 tracking-tighter">MSA.</h2>
<p class="text-gray-500 text-sm font-mono">© 2026 Market Stock Analyzer. All rights reserved.</p>
</div>
<div class="flex gap-8 text-sm font-bold text-gray-400">
<a href="#" class="hover:text-bull transition">Privacy</a>
<a href="#" class="hover:text-bull transition">Terms</a>
<a href="#" class="hover:text-bull transition">API</a>
</div>
</div>
</footer>
</main>
<script>
// --- WebSocket live feed ---
const WS_URL = 'wss://fisi-production.up.railway.app';
const STOCK_SYMBOLS = ['NVDA', 'PLTR', 'META', 'AAPL', 'TSLA', 'MSFT'];
const CRYPTO_SYMBOLS = ['bitcoin', 'ethereum', 'solana'];
const DISPLAY_NAMES = {
'NVDA': 'NVDA', 'PLTR': 'PLTR', 'META': 'META',
'AAPL': 'AAPL', 'TSLA': 'TSLA', 'MSFT': 'MSFT',
'bitcoin': 'BTC', 'ethereum': 'ETH', 'solana': 'SOL'
};
let ws = null;
let wsMessages = 0;
let wsLastTime = null;
let wsConnectedAt = null;
let tickerData = {};
let reconnectDelay = 1000;
function connectWS() {
if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) {
return;
}
ws = new WebSocket(WS_URL);
ws.onopen = () => {
wsConnectedAt = Date.now();
reconnectDelay = 1000;
ws.send(JSON.stringify({
type: 'subscribe',
payload: { channel: 'stock', symbols: STOCK_SYMBOLS }
}));
ws.send(JSON.stringify({
type: 'subscribe',
payload: { channel: 'crypto', symbols: CRYPTO_SYMBOLS }
}));
};
ws.onmessage = (event) => {
wsLastTime = Date.now();
wsMessages++;
try {
const msg = JSON.parse(event.data);
handleWSMessage(msg);
} catch (e) {}
};
ws.onclose = () => {
document.getElementById('nav-status').innerHTML = '<span class="w-2 h-2 rounded-full bg-red-500"></span> RECONNECTING';
ws = null;
setTimeout(connectWS, reconnectDelay);
reconnectDelay = Math.min(reconnectDelay * 2, 30000);
};
ws.onerror = () => {
document.getElementById('nav-status').innerHTML = '<span class="w-2 h-2 rounded-full bg-yellow-500"></span> WS ERROR';
};
}
function handleWSMessage(msg) {
if (msg.type !== 'update') return;
const channel = msg.channel;
const symbol = msg.symbol;
const data = msg.data;
if (!symbol || !data) return;
let price = null;
let changePct = null;
if (channel === 'stock') {
price = parseFloat(data.c);
changePct = data.dp != null ? parseFloat(data.dp) : null;
} else if (channel === 'crypto') {
price = parseFloat(data.price);
changePct = data.change_percent != null ? parseFloat(data.change_percent) : null;
}
if (!price || isNaN(price)) return;
const prev = tickerData[symbol];
let direction = 0;
if (prev) {
direction = price > prev.price ? 1 : price < prev.price ? -1 : prev.direction || 0;
}
if (changePct != null) {
direction = changePct >= 0 ? 1 : -1;
}
tickerData[symbol] = { price, changePct, direction, channel, updated: Date.now() };
renderTickerBelt();
}
function renderTickerBelt() {
const belt = document.getElementById('ticker-belt');
const symbols = Object.keys(tickerData);
if (symbols.length === 0) return;
let html = '';
symbols.forEach(sym => {
const d = tickerData[sym];
const label = DISPLAY_NAMES[sym] || sym.toUpperCase();
const priceStr = d.price >= 1
? d.price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
: d.price.toFixed(4);
const up = d.direction >= 0;
const arrow = d.direction > 0 ? '▲' : d.direction < 0 ? '▼' : '●';
const colorClass = d.direction > 0 ? 'text-bull' : d.direction < 0 ? 'text-bear' : 'text-gray-400';
const changeStr = d.changePct != null ? ` ${d.changePct >= 0 ? '+' : ''}${d.changePct.toFixed(2)}%` : '';
html += `<div class="ticker-item">${label} <span class="${colorClass}">${arrow} $${priceStr}${changeStr}</span></div>`;
});
belt.innerHTML = html + html;
}
connectWS();
const API_URL = 'https://vd2mi-msa.hf.space';
async function pingAPI() {
const statusEl = document.getElementById('api-stat-status');
const latencyEl = document.getElementById('api-stat-latency');
const t0 = performance.now();
try {
const resp = await fetch(`${API_URL}/health`);
const ms = Math.round(performance.now() - t0);
if (!resp.ok) throw new Error(resp.status);
const data = await resp.json();
statusEl.innerHTML = '<span class="text-bull">ONLINE</span>';
latencyEl.innerHTML = `<span class="${ms < 500 ? 'text-bull' : ms < 1500 ? 'text-white' : 'text-warn'}">${ms}ms</span>`;
} catch (e) {
statusEl.innerHTML = '<span class="text-bear">DOWN</span>';
latencyEl.innerHTML = '<span class="text-bear">ERR</span>';
}
}
pingAPI();
setInterval(pingAPI, 15000);
// --- Hero candlestick background ---
const heroCanvas = document.getElementById('hero-chart-canvas');
const labelsContainer = document.getElementById('chart-labels-container');
const heroCtx = heroCanvas.getContext('2d');
let heroWidth, heroHeight;
let heroCandles = [];
const candleWidth = 12;
const candleSpacing = 25;
const UP_WORDS = ["BREAKOUT", "ACCUMULATION", "MOMENTUM", "BUY", "RALLY", "LONG"];
const DOWN_WORDS = ["DUMP", "DISTRIBUTION", "CRASH", "SELL", "RESISTANCE", "SHORT"];
function resizeHero() {
heroWidth = heroCanvas.width = heroCanvas.parentElement.offsetWidth;
heroHeight = heroCanvas.height = heroCanvas.parentElement.offsetHeight;
initHeroCandles();
}
function initHeroCandles() {
heroCandles = [];
let x = 0;
let currentClose = heroHeight * 0.6;
while (x < heroWidth + 100) {
heroCandles.push(generateCandle(x, currentClose));
currentClose = heroCandles[heroCandles.length - 1].close;
x += candleSpacing;
}
}
function generateCandle(x, prevClose) {
let change = (Math.random() - 0.5) * 80;
let open = prevClose;
let close = open + change;
if (close < heroHeight * 0.2) close += 50;
if (close > heroHeight * 0.8) close -= 50;
let high = Math.min(open, close) - Math.random() * 30;
let low = Math.max(open, close) + Math.random() * 30;
return { x, open, close, high, low };
}
function spawnCandleLabel(x, y, isUp) {
const el = document.createElement('div');
const words = isUp ? UP_WORDS : DOWN_WORDS;
el.innerText = words[Math.floor(Math.random() * words.length)];
el.className = `animate-float-up-label ${isUp ? 'text-bull' : 'text-bear'}`;
el.style.left = x + 'px';
el.style.top = (y - 20) + 'px';
labelsContainer.appendChild(el);
el.animate([
{ opacity: 1, transform: 'translateY(0) scale(1)' },
{ opacity: 0, transform: 'translateY(-30px) scale(0.8)' }
], { duration: 1500, easing: 'ease-out', fill: 'forwards' }).onfinish = () => el.remove();
}
function animateHero() {
for (let c of heroCandles) c.x -= 0.5;
if (heroCandles.length > 0 && heroCandles[0].x < -50) heroCandles.shift();
let last = heroCandles[heroCandles.length - 1];
if (last && last.x < heroWidth + 50) {
heroCandles.push(generateCandle(last.x + candleSpacing, last.close));
}
if (Math.random() < 0.04 && heroCandles.length > 5) {
const idx = Math.floor(Math.random() * heroCandles.length);
const c = heroCandles[idx];
if (c.x > 0 && c.x < heroWidth) spawnCandleLabel(c.x, c.high, c.close < c.open);
}
heroCtx.clearRect(0, 0, heroWidth, heroHeight);
for (let c of heroCandles) {
const isUp = c.close < c.open;
heroCtx.fillStyle = heroCtx.strokeStyle = isUp ? '#00ffaa' : '#ff0044';
heroCtx.globalAlpha = 0.8;
heroCtx.beginPath();
heroCtx.moveTo(c.x, c.high);
heroCtx.lineTo(c.x, c.low);
heroCtx.lineWidth = 1;
heroCtx.stroke();
const bodyTop = Math.min(c.open, c.close);
heroCtx.fillRect(c.x - candleWidth / 2, bodyTop, candleWidth, Math.max(Math.abs(c.close - c.open), 2));
}
heroCtx.globalAlpha = 1.0;
requestAnimationFrame(animateHero);
}
resizeHero();
animateHero();
// --- Three.js engine ---
let scene, camera, renderer, particles;
let count = 0;
let mouseX = 0, mouseY = 0;
function createGlowSprite() {
const canvas = document.createElement('canvas');
canvas.width = 32; canvas.height = 32;
const context = canvas.getContext('2d');
const gradient = context.createRadialGradient(16, 16, 0, 16, 16, 16);
gradient.addColorStop(0, 'rgba(255,255,255,1)');
gradient.addColorStop(0.2, 'rgba(255,255,255,0.8)');
gradient.addColorStop(0.5, 'rgba(255,255,255,0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
context.fillStyle = gradient;
context.fillRect(0,0,32,32);
const texture = new THREE.Texture(canvas);
texture.needsUpdate = true;
return texture;
}
function initMarketWave() {
const container = document.getElementById('market-wave');
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.y = 500;
camera.position.z = 1000;
camera.lookAt(0,0,0);
renderer = new THREE.WebGLRenderer({ canvas: container, alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
// Particle Setup
const particleCount = 40000;
const geometry = new THREE.BufferGeometry();
const positions = new Float32Array(particleCount * 3);
const colors = new Float32Array(particleCount * 3);
const scales = new Float32Array(particleCount);
let i = 0, j = 0;
const separation = 35;
const amountX = 250;
const amountY = 160;
for (let ix = 0; ix < amountX; ix++) {
for (let iy = 0; iy < amountY; iy++) {
positions[i] = ix * separation - ((amountX * separation) / 2); // x
positions[i + 1] = 0; // y
positions[i + 2] = iy * separation - ((amountY * separation) / 2); // z
colors[i] = 1; colors[i+1] = 1; colors[i+2] = 1;
scales[j] = 1;
i += 3; j++;
}
}
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
geometry.setAttribute('scale', new THREE.BufferAttribute(scales, 1));
const material = new THREE.PointsMaterial({
size: 10,
map: createGlowSprite(),
vertexColors: true,
transparent: true,
opacity: 0.9,
depthWrite: false,
blending: THREE.AdditiveBlending
});
particles = new THREE.Points(geometry, material);
scene.add(particles);
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX - window.innerWidth / 2;
mouseY = e.clientY - window.innerHeight / 2;
});
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
resizeHero();
});
animate();
}
function animate() {
requestAnimationFrame(animate);
camera.position.x += (mouseX - camera.position.x) * 0.05;
camera.position.y += (-mouseY + 500 - camera.position.y) * 0.05;
camera.lookAt(scene.position);
const positions = particles.geometry.attributes.position.array;
const cols = particles.geometry.attributes.color.array;
let i = 0;
let c = 0;
// Hardcoded to Dark Mode logic as requested
const isDark = true;
for (let ix = 0; ix < 250; ix++) {
for (let iy = 0; iy < 160; iy++) {
const value = (Math.sin((ix + count) * 0.3) * 70) +
(Math.sin((iy + count) * 0.5) * 70);
positions[i + 1] = value;
// STRICT NEON HARD CORE
if (value > 0) {
// Neon Green
cols[c] = 0.0;
cols[c+1] = 1.0;
cols[c+2] = 0.6;
} else {
// Neon Red
cols[c] = 1.0;
cols[c+1] = 0.0;
cols[c+2] = 0.3;
}
i += 3; c += 3;
}
}
particles.geometry.attributes.position.needsUpdate = true;
particles.geometry.attributes.color.needsUpdate = true;
count += 0.06;
renderer.render(scene, camera);
}
initMarketWave();
gsap.registerPlugin(ScrollTrigger);
gsap.utils.toArray('.glass-panel').forEach(panel => {
gsap.from(panel, {
scrollTrigger: { trigger: panel, start: "top 90%" },
y: 30, opacity: 0, duration: 0.8, ease: "power2.out"
});
});
document.getElementById('hero-search').addEventListener('submit', function(e) {
e.preventDefault();
const ticker = document.getElementById('hero-ticker').value.trim().toUpperCase();
if (ticker) {
window.location.href = `dashboard.html?ticker=${encodeURIComponent(ticker)}`;
} else {
window.location.href = 'dashboard.html';
}
});
</script>
</body>
</html>