File size: 1,376 Bytes
c6767cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | document.addEventListener('DOMContentLoaded', function() {
// Initialize wave simulation canvas
const canvas = document.getElementById('waveCanvas');
const ctx = canvas.getContext('2d');
// Set canvas dimensions
function resizeCanvas() {
const container = canvas.parentElement;
canvas.width = container.clientWidth;
canvas.height = container.clientHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// Simple wave simulation
function simulateWave() {
if (!canvas.width || !canvas.height) return;
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw a simple wave for demonstration
ctx.strokeStyle = '#8b5cf6';
ctx.lineWidth = 2;
ctx.beginPath();
const amplitude = canvas.height / 4;
const frequency = 0.02;
const phase = Date.now() * 0.001;
for (let x = 0; x < canvas.width; x++) {
const y = canvas.height / 2 + amplitude * Math.sin(x * frequency + phase);
if (x === 0) {
ctx.moveTo(x, y);
} else {
ctx.lineTo(x, y);
}
}
ctx.stroke();
requestAnimationFrame(simulateWave);
}
// Start simulation
simulateWave();
}); |