Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const canvas = document.getElementById('flow-canvas');
+ const ctx = canvas.getContext('2d');
+
+ // Set canvas size
+ function resizeCanvas() {
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight;
+ }
+
+ window.addEventListener('resize', resizeCanvas);
+ resizeCanvas();
+
+ // Particle system
+ class Particle {
+ constructor() {
+ this.reset();
+ }
+
+ reset() {
+ this.x = Math.random() * canvas.width;
+ this.y = Math.random() * canvas.height;
+ this.size = Math.random() * 2 + 1;
+ this.speedX = Math.random() * 3 - 1.5;
+ this.speedY = Math.random() * 3 - 1.5;
+ this.life = 1;
+ }
+
+ update() {
+ this.x += this.speedX;
+ this.y += this.speedY;
+ this.life -= 0.003;
+
+ if (this.x < 0 || this.x > canvas.width ||
+ this.y < 0 || this.y > canvas.height ||
+ this.life <= 0) {
+ this.reset();
+ }
+ }
+
+ draw() {
+ ctx.fillStyle = `rgba(100, 255, 218, ${this.life})`;
+ ctx.beginPath();
+ ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
+ ctx.fill();
+ }
+ }
+
+ // Create particle system
+ const particles = Array(100).fill().map(() => new Particle());
+
+ // Animation loop
+ function animate() {
+ ctx.fillStyle = 'rgba(10, 25, 47, 0.1)';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ particles.forEach(particle => {
+ particle.update();
+ particle.draw();
+ });
+
+ requestAnimationFrame(animate);
+ }
+
+ animate();
+
+ // Interactive ripple effect
+ document.addEventListener('mousemove', (e) => {
+ createRipple(e.clientX, e.clientY);
+ });
+
+ function createRipple(x, y) {
+ const ripple = document.createElement('div');
+ ripple.className = 'ripple';
+ ripple.style.left = x + 'px';
+ ripple.style.top = y + 'px';
+ document.querySelector('.ripple-container').appendChild(ripple);
+
+ setTimeout(() => {
+ ripple.remove();
+ }, 1000);
+ }
+ });