chansung commited on
Commit
f458870
·
verified ·
1 Parent(s): 50c6cea

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +737 -19
index.html CHANGED
@@ -1,19 +1,737 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Hello World - Interactive Experience</title>
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ :root {
16
+ --primary-color: #667eea;
17
+ --secondary-color: #764ba2;
18
+ --text-color: #ffffff;
19
+ --bg-color: #0f0f23;
20
+ --card-bg: rgba(255, 255, 255, 0.05);
21
+ --border-color: rgba(255, 255, 255, 0.1);
22
+ --shadow-color: rgba(102, 126, 234, 0.5);
23
+ }
24
+
25
+ [data-theme="light"] {
26
+ --primary-color: #667eea;
27
+ --secondary-color: #764ba2;
28
+ --text-color: #1a202c;
29
+ --bg-color: #f7fafc;
30
+ --card-bg: rgba(255, 255, 255, 0.8);
31
+ --border-color: rgba(0, 0, 0, 0.1);
32
+ --shadow-color: rgba(102, 126, 234, 0.3);
33
+ }
34
+
35
+ body {
36
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
37
+ background: var(--bg-color);
38
+ color: var(--text-color);
39
+ min-height: 100vh;
40
+ overflow-x: hidden;
41
+ transition: all 0.3s ease;
42
+ }
43
+
44
+ /* Animated Background */
45
+ .bg-animation {
46
+ position: fixed;
47
+ width: 100%;
48
+ height: 100%;
49
+ top: 0;
50
+ left: 0;
51
+ z-index: 0;
52
+ background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
53
+ opacity: 0.1;
54
+ }
55
+
56
+ .bg-animation::before {
57
+ content: '';
58
+ position: absolute;
59
+ top: -50%;
60
+ left: -50%;
61
+ width: 200%;
62
+ height: 200%;
63
+ background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
64
+ animation: rotate 20s linear infinite;
65
+ }
66
+
67
+ @keyframes rotate {
68
+ 0% {
69
+ transform: rotate(0deg);
70
+ }
71
+
72
+ 100% {
73
+ transform: rotate(360deg);
74
+ }
75
+ }
76
+
77
+ /* Header */
78
+ header {
79
+ position: relative;
80
+ z-index: 100;
81
+ padding: 20px;
82
+ background: var(--card-bg);
83
+ backdrop-filter: blur(10px);
84
+ border-bottom: 1px solid var(--border-color);
85
+ display: flex;
86
+ justify-content: space-between;
87
+ align-items: center;
88
+ flex-wrap: wrap;
89
+ gap: 15px;
90
+ }
91
+
92
+ .logo {
93
+ font-size: 1.5rem;
94
+ font-weight: bold;
95
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
96
+ -webkit-background-clip: text;
97
+ -webkit-text-fill-color: transparent;
98
+ background-clip: text;
99
+ }
100
+
101
+ .header-controls {
102
+ display: flex;
103
+ gap: 15px;
104
+ align-items: center;
105
+ }
106
+
107
+ .theme-toggle {
108
+ width: 50px;
109
+ height: 25px;
110
+ background: var(--border-color);
111
+ border-radius: 25px;
112
+ position: relative;
113
+ cursor: pointer;
114
+ transition: all 0.3s ease;
115
+ }
116
+
117
+ .theme-toggle::after {
118
+ content: '🌙';
119
+ position: absolute;
120
+ width: 21px;
121
+ height: 21px;
122
+ background: white;
123
+ border-radius: 50%;
124
+ top: 2px;
125
+ left: 2px;
126
+ display: flex;
127
+ align-items: center;
128
+ justify-content: center;
129
+ font-size: 12px;
130
+ transition: all 0.3s ease;
131
+ }
132
+
133
+ [data-theme="light"] .theme-toggle::after {
134
+ content: '☀️';
135
+ left: calc(100% - 23px);
136
+ }
137
+
138
+ .language-selector {
139
+ padding: 8px 15px;
140
+ background: var(--card-bg);
141
+ border: 1px solid var(--border-color);
142
+ border-radius: 20px;
143
+ color: var(--text-color);
144
+ cursor: pointer;
145
+ transition: all 0.3s ease;
146
+ }
147
+
148
+ .language-selector:hover {
149
+ transform: translateY(-2px);
150
+ box-shadow: 0 5px 15px var(--shadow-color);
151
+ }
152
+
153
+ /* Main Content */
154
+ .container {
155
+ position: relative;
156
+ z-index: 10;
157
+ max-width: 1200px;
158
+ margin: 0 auto;
159
+ padding: 40px 20px;
160
+ display: flex;
161
+ flex-direction: column;
162
+ align-items: center;
163
+ min-height: calc(100vh - 85px);
164
+ justify-content: center;
165
+ }
166
+
167
+ .hello-world {
168
+ font-size: clamp(3rem, 10vw, 8rem);
169
+ font-weight: 900;
170
+ text-align: center;
171
+ margin-bottom: 30px;
172
+ position: relative;
173
+ letter-spacing: -2px;
174
+ animation: fadeInUp 1s ease-out;
175
+ }
176
+
177
+ @keyframes fadeInUp {
178
+ from {
179
+ opacity: 0;
180
+ transform: translateY(30px);
181
+ }
182
+
183
+ to {
184
+ opacity: 1;
185
+ transform: translateY(0);
186
+ }
187
+ }
188
+
189
+ .gradient-text {
190
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), #f093fb, #f5576c);
191
+ background-size: 300% 300%;
192
+ -webkit-background-clip: text;
193
+ -webkit-text-fill-color: transparent;
194
+ background-clip: text;
195
+ animation: gradientShift 5s ease infinite;
196
+ }
197
+
198
+ @keyframes gradientShift {
199
+
200
+ 0%,
201
+ 100% {
202
+ background-position: 0% 50%;
203
+ }
204
+
205
+ 50% {
206
+ background-position: 100% 50%;
207
+ }
208
+ }
209
+
210
+ .subtitle {
211
+ font-size: 1.5rem;
212
+ opacity: 0.8;
213
+ margin-bottom: 40px;
214
+ animation: fadeInUp 1s ease-out 0.2s both;
215
+ }
216
+
217
+ /* Interactive Cards */
218
+ .cards-container {
219
+ display: grid;
220
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
221
+ gap: 25px;
222
+ width: 100%;
223
+ max-width: 900px;
224
+ margin-bottom: 40px;
225
+ }
226
+
227
+ .card {
228
+ background: var(--card-bg);
229
+ backdrop-filter: blur(10px);
230
+ border: 1px solid var(--border-color);
231
+ border-radius: 20px;
232
+ padding: 30px;
233
+ text-align: center;
234
+ transition: all 0.3s ease;
235
+ cursor: pointer;
236
+ animation: fadeInUp 1s ease-out calc(0.4s + var(--index)) both;
237
+ }
238
+
239
+ .card:hover {
240
+ transform: translateY(-10px) scale(1.05);
241
+ box-shadow: 0 20px 40px var(--shadow-color);
242
+ border-color: var(--primary-color);
243
+ }
244
+
245
+ .card-icon {
246
+ font-size: 3rem;
247
+ margin-bottom: 15px;
248
+ }
249
+
250
+ .card-title {
251
+ font-size: 1.3rem;
252
+ font-weight: 600;
253
+ margin-bottom: 10px;
254
+ color: var(--primary-color);
255
+ }
256
+
257
+ .card-description {
258
+ opacity: 0.7;
259
+ line-height: 1.6;
260
+ }
261
+
262
+ /* Interactive Button */
263
+ .cta-button {
264
+ padding: 18px 50px;
265
+ font-size: 1.2rem;
266
+ font-weight: 600;
267
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
268
+ color: white;
269
+ border: none;
270
+ border-radius: 50px;
271
+ cursor: pointer;
272
+ transition: all 0.3s ease;
273
+ position: relative;
274
+ overflow: hidden;
275
+ animation: fadeInUp 1s ease-out 0.6s both;
276
+ }
277
+
278
+ .cta-button::before {
279
+ content: '';
280
+ position: absolute;
281
+ top: 50%;
282
+ left: 50%;
283
+ width: 0;
284
+ height: 0;
285
+ border-radius: 50%;
286
+ background: rgba(255, 255, 255, 0.3);
287
+ transform: translate(-50%, -50%);
288
+ transition: width 0.6s, height 0.6s;
289
+ }
290
+
291
+ .cta-button:hover::before {
292
+ width: 300px;
293
+ height: 300px;
294
+ }
295
+
296
+ .cta-button:hover {
297
+ transform: translateY(-3px);
298
+ box-shadow: 0 15px 30px var(--shadow-color);
299
+ }
300
+
301
+ /* Particle Canvas */
302
+ #particleCanvas {
303
+ position: fixed;
304
+ top: 0;
305
+ left: 0;
306
+ width: 100%;
307
+ height: 100%;
308
+ z-index: 1;
309
+ pointer-events: none;
310
+ }
311
+
312
+ /* Floating Animation */
313
+ .floating {
314
+ animation: floating 3s ease-in-out infinite;
315
+ }
316
+
317
+ @keyframes floating {
318
+
319
+ 0%,
320
+ 100% {
321
+ transform: translateY(0px);
322
+ }
323
+
324
+ 50% {
325
+ transform: translateY(-20px);
326
+ }
327
+ }
328
+
329
+ /* Typing Animation */
330
+ .typing-container {
331
+ min-height: 40px;
332
+ margin-bottom: 30px;
333
+ font-size: 1.2rem;
334
+ font-family: 'Courier New', monospace;
335
+ }
336
+
337
+ .typing-text {
338
+ border-right: 3px solid var(--primary-color);
339
+ animation: blink 0.7s infinite;
340
+ }
341
+
342
+ @keyframes blink {
343
+
344
+ 0%,
345
+ 50% {
346
+ border-color: var(--primary-color);
347
+ }
348
+
349
+ 51%,
350
+ 100% {
351
+ border-color: transparent;
352
+ }
353
+ }
354
+
355
+ /* Footer */
356
+ footer {
357
+ position: relative;
358
+ z-index: 100;
359
+ padding: 20px;
360
+ text-align: center;
361
+ background: var(--card-bg);
362
+ backdrop-filter: blur(10px);
363
+ border-top: 1px solid var(--border-color);
364
+ margin-top: auto;
365
+ }
366
+
367
+ .footer-link {
368
+ color: var(--primary-color);
369
+ text-decoration: none;
370
+ font-weight: 600;
371
+ transition: all 0.3s ease;
372
+ }
373
+
374
+ .footer-link:hover {
375
+ text-decoration: underline;
376
+ transform: scale(1.05);
377
+ display: inline-block;
378
+ }
379
+
380
+ /* Responsive Design */
381
+ @media (max-width: 768px) {
382
+ .hello-world {
383
+ font-size: clamp(2.5rem, 12vw, 5rem);
384
+ }
385
+
386
+ .subtitle {
387
+ font-size: 1.2rem;
388
+ }
389
+
390
+ .cards-container {
391
+ grid-template-columns: 1fr;
392
+ max-width: 400px;
393
+ }
394
+ }
395
+
396
+ /* Toast Notification */
397
+ .toast {
398
+ position: fixed;
399
+ bottom: 30px;
400
+ right: 30px;
401
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
402
+ color: white;
403
+ padding: 15px 25px;
404
+ border-radius: 10px;
405
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
406
+ transform: translateX(400px);
407
+ transition: transform 0.3s ease;
408
+ z-index: 1000;
409
+ }
410
+
411
+ .toast.show {
412
+ transform: translateX(0);
413
+ }
414
+ </style>
415
+ </head>
416
+
417
+ <body data-theme="dark">
418
+ <div class="bg-animation"></div>
419
+ <canvas id="particleCanvas"></canvas>
420
+
421
+ <header>
422
+ <div class="logo">Hello World</div>
423
+ <div class="header-controls">
424
+ <select class="language-selector" id="languageSelector">
425
+ <option value="en">English</option>
426
+ <option value="es">Español</option>
427
+ <option value="fr">Français</option>
428
+ <option value="de">Deutsch</option>
429
+ <option value="ja">日本語</option>
430
+ <option value="zh">中文</option>
431
+ </select>
432
+ <div class="theme-toggle" id="themeToggle"></div>
433
+ </div>
434
+ </header>
435
+
436
+ <main class="container">
437
+ <div class="typing-container">
438
+ <span class="typing-text" id="typingText"></span>
439
+ </div>
440
+
441
+ <h1 class="hello-world gradient-text floating">
442
+ <span id="helloText">Hello</span> <span id="worldText">World</span>
443
+ </h1>
444
+
445
+ <p class="subtitle" id="subtitle">Welcome to the future of web experiences</p>
446
+
447
+ <div class="cards-container">
448
+ <div class="card" style="--index: 0s" onclick="handleCardClick('design')">
449
+ <div class="card-icon">🎨</div>
450
+ <h3 class="card-title">Modern Design</h3>
451
+ <p class="card-description">Beautiful gradients and animations that captivate</p>
452
+ </div>
453
+
454
+ <div class="card" style="--index: 0.1s" onclick="handleCardClick('interactive')">
455
+ <div class="card-icon">⚡</div>
456
+ <h3 class="card-title">Interactive</h3>
457
+ <p class="card-description">Click, hover, and explore dynamic elements</p>
458
+ </div>
459
+
460
+ <div class="card" style="--index: 0.2s" onclick="handleCardClick('responsive')">
461
+ <div class="card-icon">📱</div>
462
+ <h3 class="card-title">Responsive</h3>
463
+ <p class="card-description">Perfectly adapted for every screen size</p>
464
+ </div>
465
+ </div>
466
+
467
+ <button class="cta-button" onclick="handleCTAClick()">
468
+ Experience More
469
+ </button>
470
+ </main>
471
+
472
+ <footer>
473
+ <p>Created with ❤️ | <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank"
474
+ class="footer-link">Built with anycoder</a></p>
475
+ </footer>
476
+
477
+ <div class="toast" id="toast"></div>
478
+
479
+ <script>
480
+ // Translations
481
+ const translations = {
482
+ en: { hello: 'Hello', world: 'World', subtitle: 'Welcome to the future of web experiences' },
483
+ es: { hello: 'Hola', world: 'Mundo', subtitle: 'Bienvenido al futuro de las experiencias web' },
484
+ fr: { hello: 'Bonjour', world: 'Monde', subtitle: 'Bienvenue dans le futur des expériences web' },
485
+ de: { hello: 'Hallo', world: 'Welt', subtitle: 'Willkommen in der Zukunft des Web-Erlebnisses' },
486
+ ja: { hello: 'こんにちは', world: '世界', subtitle: 'ウェブ体験の未来へようこそ' },
487
+ zh: { hello: '你好', world: '世界', subtitle: '欢迎来到网络体验的未来' }
488
+ };
489
+
490
+ // Theme Toggle
491
+ const themeToggle = document.getElementById('themeToggle');
492
+ const body = document.body;
493
+
494
+ themeToggle.addEventListener('click', () => {
495
+ const currentTheme = body.getAttribute('data-theme');
496
+ const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
497
+ body.setAttribute('data-theme', newTheme);
498
+ localStorage.setItem('theme', newTheme);
499
+ });
500
+
501
+ // Load saved theme
502
+ const savedTheme = localStorage.getItem('theme') || 'dark';
503
+ body.setAttribute('data-theme', savedTheme);
504
+
505
+ // Language Selector
506
+ const languageSelector = document.getElementById('languageSelector');
507
+ const helloText = document.getElementById('helloText');
508
+ const worldText = document.getElementById('worldText');
509
+ const subtitle = document.getElementById('subtitle');
510
+
511
+ languageSelector.addEventListener('change', (e) => {
512
+ const lang = e.target.value;
513
+ const translation = translations[lang];
514
+ helloText.textContent = translation.hello;
515
+ worldText.textContent = translation.world;
516
+ subtitle.textContent = translation.subtitle;
517
+ showToast(`Language changed to ${e.target.options[e.target.selectedIndex].text}`);
518
+ });
519
+
520
+ // Typing Animation
521
+ const messages = [
522
+ 'Initializing experience...',
523
+ 'Loading modern UI...',
524
+ 'Preparing interactions...',
525
+ 'Welcome aboard!'
526
+ ];
527
+ let messageIndex = 0;
528
+ let charIndex = 0;
529
+ let isDeleting = false;
530
+
531
+ function typeMessage() {
532
+ const typingText = document.getElementById('typingText');
533
+ const currentMessage = messages[messageIndex];
534
+
535
+ if (isDeleting) {
536
+ typingText.textContent = currentMessage.substring(0, charIndex - 1);
537
+ charIndex--;
538
+ } else {
539
+ typingText.textContent = currentMessage.substring(0, charIndex + 1);
540
+ charIndex++;
541
+ }
542
+
543
+ let typeSpeed = isDeleting ? 50 : 100;
544
+
545
+ if (!isDeleting && charIndex === currentMessage.length) {
546
+ typeSpeed = 2000;
547
+ isDeleting = true;
548
+ } else if (isDeleting && charIndex === 0) {
549
+ isDeleting = false;
550
+ messageIndex = (messageIndex + 1) % messages.length;
551
+ typeSpeed = 500;
552
+ }
553
+
554
+ setTimeout(typeMessage, typeSpeed);
555
+ }
556
+
557
+ typeMessage();
558
+
559
+ // Particle Animation
560
+ const canvas = document.getElementById('particleCanvas');
561
+ const ctx = canvas.getContext('2d');
562
+ let particles = [];
563
+
564
+ function resizeCanvas() {
565
+ canvas.width = window.innerWidth;
566
+ canvas.height = window.innerHeight;
567
+ }
568
+
569
+ class Particle {
570
+ constructor() {
571
+ this.x = Math.random() * canvas.width;
572
+ this.y = Math.random() * canvas.height;
573
+ this.size = Math.random() * 3 + 1;
574
+ this.speedX = Math.random() * 2 - 1;
575
+ this.speedY = Math.random() * 2 - 1;
576
+ this.opacity = Math.random() * 0.5 + 0.2;
577
+ }
578
+
579
+ update() {
580
+ this.x += this.speedX;
581
+ this.y += this.speedY;
582
+
583
+ if (this.x > canvas.width) this.x = 0;
584
+ if (this.x < 0) this.x = canvas.width;
585
+ if (this.y > canvas.height) this.y = 0;
586
+ if (this.y < 0) this.y = canvas.height;
587
+ }
588
+
589
+ draw() {
590
+ ctx.fillStyle = `rgba(102, 126, 234, ${this.opacity})`;
591
+ ctx.beginPath();
592
+ ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
593
+ ctx.fill();
594
+ }
595
+ }
596
+
597
+ function initParticles() {
598
+ particles = [];
599
+ for (let i = 0; i < 50; i++) {
600
+ particles.push(new Particle());
601
+ }
602
+ }
603
+
604
+ function animateParticles() {
605
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
606
+
607
+ particles.forEach(particle => {
608
+ particle.update();
609
+ particle.draw();
610
+ });
611
+
612
+ // Draw connections
613
+ particles.forEach((particle, index) => {
614
+ for (let j = index + 1; j < particles.length; j++) {
615
+ const dx = particles[j].x - particle.x;
616
+ const dy = particles[j].y - particle.y;
617
+ const distance = Math.sqrt(dx * dx + dy * dy);
618
+
619
+ if (distance < 150) {
620
+ ctx.strokeStyle = `rgba(102, 126, 234, ${0.1 * (1 - distance / 150)})`;
621
+ ctx.lineWidth = 1;
622
+ ctx.beginPath();
623
+ ctx.moveTo(particle.x, particle.y);
624
+ ctx.lineTo(particles[j].x, particles[j].y);
625
+ ctx.stroke();
626
+ }
627
+ }
628
+ });
629
+
630
+ requestAnimationFrame(animateParticles);
631
+ }
632
+
633
+ window.addEventListener('resize', () => {
634
+ resizeCanvas();
635
+ initParticles();
636
+ });
637
+
638
+ resizeCanvas();
639
+ initParticles();
640
+ animateParticles();
641
+
642
+ // Card Click Handler
643
+ function handleCardClick(type) {
644
+ const messages = {
645
+ design: 'Design is not just what it looks like. Design is how it works!',
646
+ interactive: 'Interactivity makes the web come alive!',
647
+ responsive: 'Responsive design ensures everyone gets a great experience!'
648
+ };
649
+ showToast(messages[type]);
650
+ }
651
+
652
+ // CTA Button Handler
653
+ function handleCTAClick() {
654
+ const helloWorld = document.querySelector('.hello-world');
655
+ helloWorld.style.transform = 'scale(1.2) rotate(5deg)';
656
+
657
+ setTimeout(() => {
658
+ helloWorld.style.transform = 'scale(1) rotate(0deg)';
659
+ }, 300);
660
+
661
+ showToast('Amazing! You discovered the secret animation! 🎉');
662
+
663
+ // Create confetti effect
664
+ createConfetti();
665
+ }
666
+
667
+ // Toast Notification
668
+ function showToast(message) {
669
+ const toast = document.getElementById('toast');
670
+ toast.textContent = message;
671
+ toast.classList.add('show');
672
+
673
+ setTimeout(() => {
674
+ toast.classList.remove('show');
675
+ }, 3000);
676
+ }
677
+
678
+ // Confetti Effect
679
+ function createConfetti() {
680
+ const colors = ['#667eea', '#764ba2', '#f093fb', '#f5576c'];
681
+ const confettiCount = 50;
682
+
683
+ for (let i = 0; i < confettiCount; i++) {
684
+ const confetti = document.createElement('div');
685
+ confetti.style.position = 'fixed';
686
+ confetti.style.width = '10px';
687
+ confetti.style.height = '10px';
688
+ confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
689
+ confetti.style.left = Math.random() * 100 + '%';
690
+ confetti.style.top = '-10px';
691
+ confetti.style.opacity = '1';
692
+ confetti.style.transform = `rotate(${Math.random() * 360}deg)`;
693
+ confetti.style.transition = 'all 2s ease-out';
694
+ confetti.style.zIndex = '9999';
695
+ confetti.style.pointerEvents = 'none';
696
+
697
+ document.body.appendChild(confetti);
698
+
699
+ setTimeout(() => {
700
+ confetti.style.top = '100%';
701
+ confetti.style.opacity = '0';
702
+ confetti.style.transform = `rotate(${Math.random() * 720}deg)`;
703
+ }, 10);
704
+
705
+ setTimeout(() => {
706
+ confetti.remove();
707
+ }, 2000);
708
+ }
709
+ }
710
+
711
+ // Mouse interaction with particles
712
+ canvas.style.pointerEvents = 'auto';
713
+ canvas.addEventListener('mousemove', (e) => {
714
+ const mouseX = e.clientX;
715
+ const mouseY = e.clientY;
716
+
717
+ particles.forEach(particle => {
718
+ const dx = mouseX - particle.x;
719
+ const dy = mouseY - particle.y;
720
+ const distance = Math.sqrt(dx * dx + dy * dy);
721
+
722
+ if (distance < 100) {
723
+ const force = (100 - distance) / 100;
724
+ particle.x -= (dx / distance) * force * 2;
725
+ particle.y -= (dy / distance) * force * 2;
726
+ }
727
+ });
728
+ });
729
+
730
+ // Initial welcome message
731
+ setTimeout(() => {
732
+ showToast('Welcome! Explore the interactive features! 👋');
733
+ }, 2000);
734
+ </script>
735
+ </body>
736
+
737
+ </html>