I went poking around the p5js reference library and found a really intriguing example in the randomGaussian() object so I decided to run with that and see what I could do with that. mouseX controls the properties of the yellow burst, and mouseY the blue. Click to randomize the burst lines, and click and drag to shade the background along greyscale.
sketchDownload
// Bridget Doherty, bpdohert, 104 Section C
// Click to randomize burst density
// mouse X position changes yellow burst
// mouse Y position changes blue burst
// Clicking & dragging changes background color along greyscale
// Base code for bursts from p5js reference >> randomGaussian() object
let distribution = new Array(360);
var Burst1 = 200;
var Burst2 = 200;
let bkgColor = 0;
function setup() {
createCanvas(600, 450);
for (let i = 0; i < distribution.length; i++) {
distribution[i] = floor(randomGaussian(0, Burst1));
}
for (let i2 = 0; i2 < distribution.length; i2++) {
distribution[i2] = floor(randomGaussian(0, Burst2));
}
}
function draw() {
background(bkgColor);
translate(width / 2, height / 2);
for (let i = 0; i < distribution.length; i++) {
rotate(TWO_PI / distribution.length);
strokeWeight(1.5);
stroke(color(243, 197, 101));
let dist = abs(distribution[i]);
line(0+mouseX, 0, dist, 0);
}
for (let i2 = 0; i2 < distribution.length; i2++) {
rotate(TWO_PI / distribution.length);
stroke(color(158, 182, 187));
let dist = abs(distribution[i2]);
line(0, 0+mouseY, dist, 0);
}
}
function mousePressed(){
let Burst1 = mouseX;
let Burst2 = mouseY;
print (Burst1 +", " + Burst2);
for (let i = 0; i < distribution.length; i++) {
distribution[i] = floor(randomGaussian(0, Burst1));
}
for (let i2 = 0; i2 < distribution.length; i2++) {
distribution[i2] = floor(randomGaussian(0, Burst2));
}
}
function mouseDragged() {
bkgColor = bkgColor - 0.7;
if (bkgColor<=0) {
bkgColor = 255;
}
}