Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Smooth scrolling for navigation
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+
+ // Interactive canvas
+ const canvas = document.getElementById('interactive-canvas');
+ let dots = [];
+
+ function createDot(x, y) {
+ return {
+ x,
+ y,
+ size: Math.random() * 3 + 1,
+ speedX: (Math.random() - 0.5) * 2,
+ speedY: (Math.random() - 0.5) * 2
+ };
+ }
+
+ function initCanvas() {
+ const rect = canvas.getBoundingClientRect();
+ for (let i = 0; i < 111; i++) {
+ dots.push(createDot(
+ Math.random() * rect.width,
+ Math.random() * rect.height
+ ));
+ }
+ }
+
+ canvas.addEventListener('mousemove', (e) => {
+ const rect = canvas.getBoundingClientRect();
+ const x = e.clientX - rect.left;
+ const y = e.clientY - rect.top;
+ dots.push(createDot(x, y));
+ if (dots.length > 111) dots.shift();
+ });
+
+ function animate() {
+ const rect = canvas.getBoundingClientRect();
+ dots.forEach(dot => {
+ dot.x += dot.speedX;
+ dot.y += dot.speedY;
+
+ if (dot.x < 0 || dot.x > rect.width) dot.speedX *= -1;
+ if (dot.y < 0 || dot.y > rect.height) dot.speedY *= -1;
+ });
+
+ requestAnimationFrame(animate);
+ }
+
+ initCanvas();
+ animate();
+ });