var osc, env;
function setup() {
createCanvas(windowWidth, windowHeight);
noCursor();
env = new p5.Env();
env.setADSR(0.01, 0, 1, 0.2);
env.setExp(true);
osc = new p5.Oscillator();
osc.setType('sine');
osc.amp(env);
osc.freq(250);
osc.start();
background(0);
}
function draw() {
noStroke();
fill(0, 100)
rect(0, 0, width, height);
if(random(1) < map(sqrt(sq(mouseX - pmouseX) + sq(mouseY - pmouseY)), 0, 200, 0.05, 0.5)) {
var r = random(1);
var h = random(height);
stroke(255, map(random(1), 0, 1, 100, 255));
line(0, h, width, h);
osc.freq(map(random(1), 0, 1, 100, 2000));
env.play();
}
}