let lines = []; let numLines; function setup() { createCanvas(windowWidth, windowHeight); colorMode(HSB, 360, 100, 100, 100); background(0); randomSeed(window.location.pathname.split('/')[2]); generateLines(); } function draw() { background(0); for (let line of lines) { line.display(); line.update(); } } function generateLines() { lines = []; numLines = int(random(1, 550)); // Random number of lines between 1 and 550 for (let i = 0; i < numLines; i++) { lines.push(new VibrantLine(i + 1)); } } class VibrantLine { constructor(harmonicIndex) { this.x = random(width); this.thickness = random(1, 6); this.color = color(random(360), 100, 100); this.hasGlow = random(1) > 0.7; this.glowAlpha = random(20, 50); this.glowPulsateSpeed = random(0.01, 0.05); this.glowPhase = random(TWO_PI); this.fadeSpeed = random(0.0005, 0.002); // Slower fade speed this.fadePhase = random(TWO_PI); this.previousAlpha = 0; } display() { let currentAlpha = 150 * (sin(this.fadePhase) * 0.5 + 0.5); this.previousAlpha = currentAlpha; strokeWeight(this.thickness); stroke(hue(this.color), saturation(this.color), brightness(this.color), currentAlpha); line(this.x, 0, this.x, height); if (this.hasGlow) { noFill(); let glowAlpha = this.glowAlpha * (sin(this.glowPhase) * 0.5 + 0.5); stroke(hue(this.color), saturation(this.color), brightness(this.color), glowAlpha); strokeWeight(this.thickness * 4); // Increase the glow size line(this.x, 0, this.x, height); } } update() { if (this.hasGlow) { this.glowPhase += this.glowPulsateSpeed; } this.fadePhase += this.fadeSpeed; } }