diff --git a/index.php b/index.php index dac3d1f..2ad250d 100644 --- a/index.php +++ b/index.php @@ -353,6 +353,8 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; justify-content: center; overflow: hidden; border-bottom: 1px solid rgba(255, 255, 255, 0.1); + background: radial-gradient(circle at center, rgba(56, 189, 248, 0.1) 0%, transparent 70%); + position: relative; } #visualizer { @@ -770,6 +772,7 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; let analyzer; let source; let animationId; + let bars = []; function initVisualizer() { if (audioCtx) return; @@ -784,10 +787,70 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; const bufferLength = analyzer.frequencyBinCount; const dataArray = new Uint8Array(bufferLength); + // Create color bars + for(let i = 0; i < 40; i++) { + bars.push(new ColorBar()); + } + function resizeCanvas() { canvas.width = canvas.offsetWidth * window.devicePixelRatio; canvas.height = canvas.offsetHeight * window.devicePixelRatio; ctx.scale(window.devicePixelRatio, window.devicePixelRatio); + bars.forEach(p => p.reset()); + } + reset() { + this.x = Math.random() * canvas.width; + this.y = Math.random() * canvas.height; + this.width = Math.random() * 3 + 1; + this.height = Math.random() * 15 + 5; + this.speedX = Math.random() * 1 - 0.5; + this.speedY = Math.random() * 2 + 0.5; // Falling effect + this.opacity = Math.random() * 0.4 + 0.1; + this.hue = Math.random() * 360; + } + update(intensity) { + this.y += this.speedY * (1 + intensity * 0.05); + this.x += this.speedX; + this.height = (intensity / 5) * Math.random() + 5; + + if (this.y > canvas.height) { + this.y = -20; + this.x = Math.random() * canvas.width; + } + if (this.x < 0) this.x = canvas.width; + if (this.x > canvas.width) this.x = 0; + } + draw(ctx, intensity) { + ctx.fillStyle = `hsla(${(this.hue + intensity) % 360}, 100%, 70%, ${this.opacity})`; + ctx.beginPath(); + ctx.roundRect(this.x / window.devicePixelRatio, this.y / window.devicePixelRatio, this.width, this.height, 2); + ctx.fill(); + } + } + + function initVisualizer() { + if (audioCtx) return; + + audioCtx = new (window.AudioContext || window.webkitAudioContext)(); + analyzer = audioCtx.createAnalyser(); + source = audioCtx.createMediaElementSource(audio); + source.connect(analyzer); + analyzer.connect(audioCtx.destination); + + analyzer.fftSize = 256; + const bufferLength = analyzer.frequencyBinCount; + const dataArray = new Uint8Array(bufferLength); + + // Create particles + for(let i = 0; i < 50; i++) { + particles.push(new Particle()); + } + + function resizeCanvas() { + canvas.width = canvas.offsetWidth * window.devicePixelRatio; + canvas.height = canvas.offsetHeight * window.devicePixelRatio; + ctx.scale(window.devicePixelRatio, window.devicePixelRatio); + particles.forEach(p => p.reset()); } resizeCanvas(); window.addEventListener('resize', resizeCanvas); @@ -805,6 +868,16 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; ctx.clearRect(0, 0, canvas.width, canvas.height); + let sum = 0; + for(let i=0; i { + b.update(average); + b.draw(ctx, average); + }); + const barCount = bufferLength / 1.5; const logicalWidth = canvas.width / window.devicePixelRatio; const logicalHeight = canvas.height / window.devicePixelRatio; @@ -812,34 +885,43 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; let x = logicalWidth / 2; let xLeft = logicalWidth / 2; - let sum = 0; - for(let i=0; i