kingarnica commited on
Commit
8df51c2
·
verified ·
1 Parent(s): f84495b

take your time thats nothing bro if you trying to impress me you have to deliver

Browse files
Files changed (5) hide show
  1. components/navbar.js +5 -3
  2. components/visualizer.js +42 -10
  3. gallery.html +86 -0
  4. settings.html +92 -0
  5. style.css +14 -0
components/navbar.js CHANGED
@@ -61,9 +61,11 @@ class AudioNavbar extends HTMLElement {
61
  EchoSphere
62
  </a>
63
  <div class="nav-links">
64
- <a href="/" class="nav-link">Home</a>
65
- <a href="https://github.com/kingoIII/Ruido1" target="_blank" rel="noopener noreferrer">
66
- <i data-feather="github" class="github-icon w-5 h-5 text-gray-400 hover:text-indigo-400 transition"></i>
 
 
67
  </a>
68
  </div>
69
  </nav>
 
61
  EchoSphere
62
  </a>
63
  <div class="nav-links">
64
+ <a href="/" class="nav-link">Home</a>
65
+ <a href="/gallery.html" class="nav-link">Gallery</a>
66
+ <a href="/settings.html" class="nav-link">Settings</a>
67
+ <a href="https://github.com/kingoIII/Ruido1" target="_blank" rel="noopener noreferrer">
68
+ <i data-feather="github" class="github-icon w-5 h-5 text-gray-400 hover:text-indigo-400 transition"></i>
69
  </a>
70
  </div>
71
  </nav>
components/visualizer.js CHANGED
@@ -8,12 +8,10 @@ class AudioVisualizer extends HTMLElement {
8
  this.canvas = document.createElement('canvas');
9
  this.ctx = this.canvas.getContext('2d');
10
  }
11
-
12
  static get observedAttributes() {
13
- return ['type'];
14
  }
15
-
16
- attributeChangedCallback(name, oldValue, newValue) {
17
  if (name === 'type') {
18
  this.type = newValue;
19
  if (this.animationId) {
@@ -22,7 +20,6 @@ class AudioVisualizer extends HTMLElement {
22
  }
23
  }
24
  }
25
-
26
  connectedCallback() {
27
  this.attachShadow({ mode: 'open' });
28
 
@@ -36,9 +33,27 @@ class AudioVisualizer extends HTMLElement {
36
  if (this.analyser) {
37
  this.dataArray = new Uint8Array(this.analyser.frequencyBinCount);
38
  }
 
 
 
 
 
 
 
39
  }
40
-
41
- setAnalyser(analyser) {
 
 
 
 
 
 
 
 
 
 
 
42
  this.analyser = analyser;
43
  if (this.analyser) {
44
  this.dataArray = new Uint8Array(this.analyser.frequencyBinCount);
@@ -62,9 +77,27 @@ class AudioVisualizer extends HTMLElement {
62
  case 'circle':
63
  this.drawCircle();
64
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  default:
66
  this.drawBars();
67
- }
68
 
69
  this.animationId = requestAnimationFrame(draw);
70
  };
@@ -137,9 +170,8 @@ class AudioVisualizer extends HTMLElement {
137
  this.ctx.lineTo(width, height / 2);
138
  this.ctx.stroke();
139
  }
140
-
141
  drawCircle() {
142
- const centerX = this.canvas.width / 2;
143
  const centerY = this.canvas.height / 2;
144
  const radius = Math.min(this.canvas.width, this.canvas.height) * 0.4;
145
 
 
8
  this.canvas = document.createElement('canvas');
9
  this.ctx = this.canvas.getContext('2d');
10
  }
 
11
  static get observedAttributes() {
12
+ return ['type', 'static'];
13
  }
14
+ attributeChangedCallback(name, oldValue, newValue) {
 
15
  if (name === 'type') {
16
  this.type = newValue;
17
  if (this.animationId) {
 
20
  }
21
  }
22
  }
 
23
  connectedCallback() {
24
  this.attachShadow({ mode: 'open' });
25
 
 
33
  if (this.analyser) {
34
  this.dataArray = new Uint8Array(this.analyser.frequencyBinCount);
35
  }
36
+
37
+ // If static mode, generate demo data
38
+ if (this.hasAttribute('static')) {
39
+ this.dataArray = new Uint8Array(128);
40
+ this.generateDemoData();
41
+ this.startVisualization();
42
+ }
43
  }
44
+
45
+ generateDemoData() {
46
+ const now = Date.now() / 1000;
47
+ for (let i = 0; i < this.dataArray.length; i++) {
48
+ // Generate some synthetic frequency data for demo purposes
49
+ const pos = i / this.dataArray.length;
50
+ const timeFactor = Math.sin(now + pos * Math.PI * 2) * 0.5 + 0.5;
51
+ const freqFactor = Math.pow(1 - pos, 1.5) + 0.1 * Math.random();
52
+ this.dataArray[i] = 64 + Math.round(150 * timeFactor * freqFactor);
53
+ }
54
+ return this.dataArray;
55
+ }
56
+ setAnalyser(analyser) {
57
  this.analyser = analyser;
58
  if (this.analyser) {
59
  this.dataArray = new Uint8Array(this.analyser.frequencyBinCount);
 
77
  case 'circle':
78
  this.drawCircle();
79
  break;
80
+ case 'matrix':
81
+ this.drawMatrix();
82
+ break;
83
+ case 'particles':
84
+ this.drawParticles();
85
+ break;
86
+ case 'lissajous':
87
+ this.drawLissajous();
88
+ break;
89
+ case 'radial':
90
+ this.drawRadial();
91
+ break;
92
+ case 'polar':
93
+ this.drawPolar();
94
+ break;
95
+ case 'vortex':
96
+ this.drawVortex();
97
+ break;
98
  default:
99
  this.drawBars();
100
+ }
101
 
102
  this.animationId = requestAnimationFrame(draw);
103
  };
 
170
  this.ctx.lineTo(width, height / 2);
171
  this.ctx.stroke();
172
  }
 
173
  drawCircle() {
174
+ const centerX = this.canvas.width / 2;
175
  const centerY = this.canvas.height / 2;
176
  const radius = Math.min(this.canvas.width, this.canvas.height) * 0.4;
177
 
gallery.html ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Visualizer Gallery | EchoSphere</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ </head>
11
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
12
+ <audio-navbar></audio-navbar>
13
+
14
+ <main class="container mx-auto px-4 py-8">
15
+ <div class="text-center mb-12">
16
+ <h1 class="text-4xl md:text-6xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500">
17
+ Visualizer Gallery
18
+ </h1>
19
+ <p class="text-xl text-gray-400 max-w-2xl mx-auto">
20
+ Explore our collection of stunning audio visualization presets
21
+ </p>
22
+ </div>
23
+
24
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
25
+ <!-- Visualizer Preset Cards -->
26
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
27
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
28
+ <audio-visualizer type="matrix" static></audio-visualizer>
29
+ </div>
30
+ <h3 class="text-xl font-semibold">Neon Matrix</h3>
31
+ <p class="text-gray-400">Inspired by digital rain effect</p>
32
+ </div>
33
+
34
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
35
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
36
+ <audio-visualizer type="particles" static></audio-visualizer>
37
+ </div>
38
+ <h3 class="text-xl font-semibold">Audio Particles</h3>
39
+ <p class="text-gray-400">Dynamic particle system</p>
40
+ </div>
41
+
42
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
43
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
44
+ <audio-visualizer type="lissajous" static></audio-visualizer>
45
+ </div>
46
+ <h3 class="text-xl font-semibold">Lissajous</h3>
47
+ <p class="text-gray-400">Mathematical harmonic patterns</p>
48
+ </div>
49
+
50
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
51
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
52
+ <audio-visualizer type="radial" static></audio-visualizer>
53
+ </div>
54
+ <h3 class="text-xl font-semibold">Radial Spectrum</h3>
55
+ <p class="text-gray-400">Circular frequency analyzer</p>
56
+ </div>
57
+
58
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
59
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
60
+ <audio-visualizer type="polar" static></audio-visualizer>
61
+ </div>
62
+ <h3 class="text-xl font-semibold">Polar Waves</h3>
63
+ <p class="text-gray-400">Circular waveform analyzer</p>
64
+ </div>
65
+
66
+ <div class="bg-gray-800 rounded-xl p-4 shadow-lg hover:shadow-xl transition">
67
+ <div class="h-48 mb-4 rounded-lg overflow-hidden">
68
+ <audio-visualizer type="vortex" static></audio-visualizer>
69
+ </div>
70
+ <h3 class="text-xl font-semibold">Audio Vortex</h3>
71
+ <p class="text-gray-400">Hypnotic spiral effect</p>
72
+ </div>
73
+ </div>
74
+ </main>
75
+
76
+ <audio-footer></audio-footer>
77
+
78
+ <script src="components/navbar.js"></script>
79
+ <script src="components/footer.js"></script>
80
+ <script src="components/visualizer.js"></script>
81
+ <script src="script.js"></script>
82
+ <script>
83
+ feather.replace();
84
+ </script>
85
+ </body>
86
+ </html>
settings.html ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Settings | EchoSphere</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ </head>
11
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
12
+ <audio-navbar></audio-navbar>
13
+
14
+ <main class="container mx-auto px-4 py-8">
15
+ <div class="text-center mb-12">
16
+ <h1 class="text-4xl md:text-6xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500">
17
+ Settings
18
+ </h1>
19
+ </div>
20
+
21
+ <div class="max-w-2xl mx-auto bg-gray-800 rounded-2xl p-6 shadow-xl">
22
+ <form id="settingsForm">
23
+ <div class="space-y-6">
24
+ <!-- Audio Settings -->
25
+ <div>
26
+ <h3 class="text-xl font-semibold mb-4">Audio Settings</h3>
27
+ <div class="space-y-4">
28
+ <div>
29
+ <label for="fftSize" class="block text-sm font-medium text-gray-300 mb-1">FFT Size</label>
30
+ <select id="fftSize" name="fftSize" class="bg-gray-700 border-gray-600 text-white rounded-lg focus:ring-indigo-500 focus:border-indigo-500 block w-full p-2.5">
31
+ <option value="128">128 (Lightweight)</option>
32
+ <option value="256" selected>256 (Balanced)</option>
33
+ <option value="512">512 (Detailed)</option>
34
+ <option value="1024">1024 (High Resolution)</option>
35
+ </select>
36
+ </div>
37
+ <div>
38
+ <label for="smoothing" class="block text-sm font-medium text-gray-300 mb-1">Smoothing</label>
39
+ <input type="range" id="smoothing" name="smoothing" min="0" max="1" step="0.05" value="0.8" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-indigo-500">
40
+ <div class="flex justify-between text-xs text-gray-400 mt-1">
41
+ <span>Sharp</span>
42
+ <span>Smooth</span>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <!-- Visual Settings -->
49
+ <div>
50
+ <h3 class="text-xl font-semibold mb-4">Visual Settings</h3>
51
+ <div class="space-y-4">
52
+ <div>
53
+ <label for="primaryColor" class="block text-sm font-medium text-gray-300 mb-1">Primary Color</label>
54
+ <input type="color" id="primaryColor" name="primaryColor" value="#818cf8" class="w-12 h-12 cursor-pointer">
55
+ </div>
56
+ <div>
57
+ <label for="secondaryColor" class="block text-sm font-medium text-gray-300 mb-1">Secondary Color</label>
58
+ <input type="color" id="secondaryColor" name="secondaryColor" value="#c026d3" class="w-12 h-12 cursor-pointer">
59
+ </div>
60
+ <div class="flex items-center">
61
+ <input type="checkbox" id="darkMode" name="darkMode" checked class="w-4 h-4 text-indigo-600 bg-gray-700 border-gray-600 rounded focus:ring-indigo-500">
62
+ <label for="darkMode" class="ml-2 text-sm font-medium text-gray-300">Dark Mode</label>
63
+ </div>
64
+ </div>
65
+ </div>
66
+
67
+ <div class="pt-4">
68
+ <button type="submit" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-4 rounded-lg transition focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
69
+ Save Settings
70
+ </button>
71
+ </div>
72
+ </div>
73
+ </form>
74
+ </div>
75
+ </main>
76
+
77
+ <audio-footer></audio-footer>
78
+
79
+ <script src="components/navbar.js"></script>
80
+ <script src="components/footer.js"></script>
81
+ <script src="script.js"></script>
82
+ <script>
83
+ feather.replace();
84
+
85
+ document.getElementById('settingsForm').addEventListener('submit', function(e) {
86
+ e.preventDefault();
87
+ // In a real app, save settings to localStorage or backend
88
+ alert('Settings saved!');
89
+ });
90
+ </script>
91
+ </body>
92
+ </html>
style.css CHANGED
@@ -13,6 +13,20 @@ audio-visualizer {
13
  transition: all 0.3s ease;
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /* Pulse animation for active buttons */
17
  @keyframes pulse {
18
  0% {
 
13
  transition: all 0.3s ease;
14
  }
15
 
16
+ /* Static visualizer styling for gallery */
17
+ audio-visualizer[static] {
18
+ pointer-events: none;
19
+ animation: visualizerDemo 4s infinite alternate;
20
+ }
21
+
22
+ @keyframes visualizerDemo {
23
+ 0%, 100% {
24
+ filter: hue-rotate(0deg);
25
+ }
26
+ 50% {
27
+ filter: hue-rotate(45deg);
28
+ }
29
+ }
30
  /* Pulse animation for active buttons */
31
  @keyframes pulse {
32
  0% {